[WIP] further fixes for linse-fi

This commit is contained in:
zolliker 2025-04-14 17:26:26 +02:00
parent 5768f096a5
commit 8cea974f49
2 changed files with 55 additions and 47 deletions

View File

@ -3,30 +3,10 @@ Node('fi.psi.ch',
'tcp://5000', 'tcp://5000',
) )
Mod('htr_io',
'frappy_psi.tdkpower.IO',
'powersupply communicator',
uri='serial:///dev/ttyUSB0?baudrate=9600',
)
Mod('htr_power',
'frappy_psi.tdkpower.Power',
'heater power',
io='htr_io',
)
Mod('htr',
'frappy_psi.furnace.TdkOutput',
'heater output',
io='htr_io',
maxvolt=8,
maxcurrent=200,
)
Mod('T_main', Mod('T_main',
'frappy_psi.ionopimax.CurrentInput', 'frappy_psi.ionopimax.CurrentInput',
'sample temperature', 'sample temperature',
addr='ai4', addr='ai1',
valuerange=(0, 1372), valuerange=(0, 1372),
value=Param(unit='degC'), value=Param(unit='degC'),
) )
@ -34,7 +14,7 @@ Mod('T_main',
Mod('T_extra', Mod('T_extra',
'frappy_psi.ionopimax.CurrentInput', 'frappy_psi.ionopimax.CurrentInput',
'extra temperature', 'extra temperature',
addr='ai3', addr='ai2',
valuerange=(0, 1372), valuerange=(0, 1372),
value=Param(unit='degC'), value=Param(unit='degC'),
) )
@ -58,6 +38,33 @@ Mod('T',
i=0.01, i=0.01,
) )
Mod('htr_io',
'frappy_psi.tdkpower.IO',
'powersupply communicator',
uri='serial:///dev/ttyUSB0?baudrate=9600',
)
Mod('htr_power',
'frappy_psi.tdkpower.Power',
'heater power',
io='htr_io',
)
Mod('htr',
'frappy_psi.furnace.TdkOutput',
'heater output',
io='htr_io',
maxvolt=8,
maxcurrent=200,
)
Mod('flowswitch',
'frappy_psi.ionopimax.DigitalInput',
'flow switch',
addr='dt2',
true_level='low',
)
# Mod('interlocks', # Mod('interlocks',
# 'frappy_psi.furnace.Interlocks', # 'frappy_psi.furnace.Interlocks',
# 'interlock parameters', # 'interlock parameters',
@ -69,24 +76,18 @@ Mod('T',
# vacuum_limit=0.1, # vacuum_limit=0.1,
# ) # )
# Mod('p', Mod('p',
# 'frappy_psi.ionopimax.VoltageInput', 'frappy_psi.ionopimax.LogVoltageInput',
# 'pressure', 'pressure reading',
# addr='av?', addr = 'av1',
# rawrange=(0, 1.5), rawrange = (1.82, 8.6),
# valuerange=(0, 150), valuerange = (5e-9, 1000),
# value=Param(unit='degC'), value = Param(unit='mbar'),
# ) )
Mod('vso',
# Mod('p_io', 'frappy_psi.ionopimax.VoltagePower',
# 'frappy_psi.pfeiffer.IO', 'voltage power output',
# 'pressure io', target = 24,
# uri='serial:///dev/ttyUSBlower', export = False,
# ) )
#
# Mod('p',
# 'frappy_psi.pfeiffer.Pressure',
# 'pressure reading',
# io='p_io',
# )

View File

@ -21,7 +21,7 @@
import os import os
from glob import glob from glob import glob
from frappy.core import Readable, Writable, Parameter, BoolType, StringType,\ from frappy.core import Readable, Writable, Parameter, BoolType, StringType,\
FloatRange, Property, TupleOf, ERROR, IDLE EnumType, FloatRange, Property, TupleOf, ERROR, IDLE
from frappy.errors import ConfigError, OutOfRangeError from frappy.errors import ConfigError, OutOfRangeError
from math import log from math import log
@ -41,7 +41,7 @@ class Base:
for basepath in basepaths: for basepath in basepaths:
for devclass in ([self.devclass] if isinstance(self.devclass, str) else self.devclass): for devclass in ([self.devclass] if isinstance(self.devclass, str) else self.devclass):
devpath = f'{basepath}/{devclass}' devpath = f'{basepath}/{devclass}'
if os.path.exists(devpath): if os.path.exists(f'{devpath}/{self.addr}'):
self._devpath = devpath self._devpath = devpath
return return
else: else:
@ -64,10 +64,17 @@ class Base:
class DigitalInput(Base, Readable): class DigitalInput(Base, Readable):
value = Parameter('input state', BoolType()) value = Parameter('input state', BoolType())
devclass = 'digital_in' true_level = Property('level representig True', EnumType(low=0, high=1), default=1)
devclass = 'digital_in', 'digital_io'
def initModule(self):
super().initModule()
self.log.info('devpath %r', self._devpath)
if self.addr.startswith('dt'):
self.write(f'{self.addr}_mode','inp')
def read_value(self): def read_value(self):
return self.read(self.addr, 1) return self.read(self.addr, 1) == self.true_level
class DigitalOutput(DigitalInput, Writable): class DigitalOutput(DigitalInput, Writable):
@ -75,7 +82,7 @@ class DigitalOutput(DigitalInput, Writable):
devclass = 'digital_out', 'relay' devclass = 'digital_out', 'relay'
def write_target(self, value): def write_target(self, value):
self.write(self.addr, value, 1) self.write(self.addr, value == self.true_level, 1)
class AnalogInput(Base, Readable): class AnalogInput(Base, Readable):