From f8a97a24b0a9481fdf06a3ce2f9d6e4e678adcfa Mon Sep 17 00:00:00 2001 From: Diego Gassmann Date: Fri, 4 Sep 2026 09:55:25 +0200 Subject: [PATCH] state as of 20260904 --- cfg/dilprep_cfg.py | 90 +++++++++++++++++++++++++++++++++++ frappy_psi/blueforssim.py | 20 +++++++- frappy_psi/channelswitcher.py | 2 +- frappy_psi/lakeshore.py | 1 - frappy_psi/lakeshore370.py | 13 ++--- 5 files changed, 117 insertions(+), 9 deletions(-) create mode 100644 cfg/dilprep_cfg.py diff --git a/cfg/dilprep_cfg.py b/cfg/dilprep_cfg.py new file mode 100644 index 00000000..c17302f4 --- /dev/null +++ b/cfg/dilprep_cfg.py @@ -0,0 +1,90 @@ +Node( + 'dilprep.psi.ch', + 'dilprep test', + interface='tcp://5000', +) + +IO( + 'io', + uri = 'linse-6837-ts:3001', # with ssh tunnel +) + +Mod('dev', + 'frappy_psi.lakeshore370.Device', + 'monitoring lakeshore 370', + curve_handling = True, + io = 'io', + ) + +Mod('switcher', + 'frappy_psi.lakeshore370.Switcher', + 'scan switcher', + device = 'dev', + io = 'io', + ) + +Mod('samplehtr', #TODO:ecitatiom + 'frappy_psi.lakeshore370.Sensor', + 'sensor sample heater', + io = 'io', + channel = 1, + switcher = 'switcher', + calcurve = 'rx198', + enabled = True, ## disable when used as heater + vexc = '200mV', +) + +Mod('sample', #TODO:ecitatiom + 'frappy_psi.lakeshore370.Sensor', + 'sensor sample', + io = 'io', + channel = 3, + switcher = 'switcher', + calcurve = 'cx198', + enabled = True, ## disable when used as heater + vexc = '200mV', +) + +Mod('mix', #TODO:ecitatiom + 'frappy_psi.lakeshore370.Sensor', + 'sensor mix', + io = 'io', + channel = 4, + switcher = 'switcher', + calcurve = 'ruoxm0', + enabled = True, ## disable when used as heater + vexc = '200mV', +) + +Mod('stillt', #TODO: channel, calcurve, excitatiom + 'frappy_psi.lakeshore370.Sensor', + 'sensor stillt', + io = 'io', + channel = 10, + switcher = 'switcher', + calcurve = 'ruoxm0', + enabled = True, ## disable when used as heater + vexc = '200mV', +) + +Mod('onek', #TODO: channel, calcurve, excitatiom + 'frappy_psi.lakeshore370.Sensor', + 'sensor onek', + io = 'io', + channel = 11, + switcher = 'switcher', + calcurve = 'ruoxm0', + enabled = True, ## disable when used as heater + vexc = '200mV', +) + +Mod('sorb', #TODO: channel, calcurve, excitatiom + 'frappy_psi.lakeshore370.Sensor', + 'sensor sorb', + io = 'io', + channel = 12, + switcher = 'switcher', + calcurve = 'c270', + enabled = True, ## disable when used as heater + vexc = '200mV', +) \ No newline at end of file diff --git a/frappy_psi/blueforssim.py b/frappy_psi/blueforssim.py index d2451379..37ece89c 100644 --- a/frappy_psi/blueforssim.py +++ b/frappy_psi/blueforssim.py @@ -54,6 +54,16 @@ class Blueforssim(Communicator): ] Hex_l = ['a', 'b', 'c', 'd'] + DILHTR_COMMANDS = [ + ('pr', 'pr=60000000'), + ('r', 'r=1'), + ('i', 'i=30000'), + ('v', 'v=4000'), + ('k', 'k=1'), + ('h', 'h=1'), + ('p', '1'), + ] + def earlyInit(self): super().earlyInit() @@ -67,6 +77,7 @@ class Blueforssim(Communicator): for com, value in self.BRIDGE_COMMANDS: for adr in self.Hex_l: self._data[com % adr] = value + self._data.update(dict(self.DILHTR_COMMANDS)) @@ -92,7 +103,14 @@ class Blueforssim(Communicator): command = (f'{comm_base}?{port}') #TODO: port mussnoch rein self._data[command] = commands[-1] else: #commands nicht von bridge - if command == 'status': + com_s = set(command) + if not 't' in com_s or 'o' in com_s: #comands von dilhtr + com_l = command.split('=') + if len(com_l) > 1: + self._data[com_l[0]] = str(com_l[1]) + else: + reply = self._data[com_l[0]] + elif command == 'status': #ab jetzt commandds von flow oder pressure self.log.info('X %r', self._data['status']) reply = 'xxxxx' + ','.join(f'{key}={value}' for key, value in self._data['status'].items()) elif command == 'fmstatus': diff --git a/frappy_psi/channelswitcher.py b/frappy_psi/channelswitcher.py index f371737f..4ef1cdfb 100644 --- a/frappy_psi/channelswitcher.py +++ b/frappy_psi/channelswitcher.py @@ -144,7 +144,7 @@ class ChannelSwitcher(Drivable): self._last_measure = next_measure if not self.autoscan or now + self._time_tol < self._start_measure + self.measure_delay: #schaut, ob kanal gewechselt werden muss return self.status - print('next active') + #print('next active') next_channel = self.next_channel(self.value) #setzt neuen kanal if next_channel == self.value: return 'IDLE', 'single channel' diff --git a/frappy_psi/lakeshore.py b/frappy_psi/lakeshore.py index 1c76b35b..78a172a4 100644 --- a/frappy_psi/lakeshore.py +++ b/frappy_psi/lakeshore.py @@ -659,7 +659,6 @@ class SensorBase(Base, Readable): value_error = None if self.enabled: rdgst, raw, value = self.get_internal_data() - print('info diego!!') print(self.channel) # self.log.info('rdgst %r, raw %r', rdgst, raw) rdgst &= 0xfd # suppress old reading diff --git a/frappy_psi/lakeshore370.py b/frappy_psi/lakeshore370.py index 51ae0268..a8ec1f6a 100644 --- a/frappy_psi/lakeshore370.py +++ b/frappy_psi/lakeshore370.py @@ -142,7 +142,6 @@ class Switcher(ls.HasLscIO, ChannelSwitcher): super().doPoll() channelno, autoscan = self.query('SCAN?', int, int) remote_mode = self.device.read_remote_mode() - print('dopoll1', channelno) if autoscan and remote_mode == 'remote': # pressed autoscan button: switch off hardware autoscan and toggle software autoscan self.command('SCAN', self.value, 0) @@ -197,12 +196,14 @@ class Switcher(ls.HasLscIO, ChannelSwitcher): def set_active_channel(self, chan): self.command('SCAN', chan.channel, 0) - for a in range(10): - if self.query('SCAN?', int, int)[0] == chan.channel: - break - self.log.info('wait for scaner') + counter = 0 + with self.io._lock: #schliesst diese funktion fur andere kanale + for a in range(5): + if self.query('SCAN?', int, int)[0] == chan.channel: + break + self.log.info('wait for scaner') + counter = counter + 1 self.value = chan.channel - print(chan.channel, 'active channel') if self.device.remote_mode == 'remote': self.set_delays(chan)