add muwaba multiple water bath
This commit is contained in:
97
cfg/muwaba_cfg.py
Normal file
97
cfg/muwaba_cfg.py
Normal file
@@ -0,0 +1,97 @@
|
||||
Node('thermofischer.psi.ch',
|
||||
'thermofischer_waterbath',
|
||||
'tcp://5000',
|
||||
)
|
||||
|
||||
Mod('wio_1',
|
||||
'frappy_psi.thermofisher.ThermFishIO',
|
||||
'connection for water bath',
|
||||
uri='serial:///dev/ttyUSB0?baudrate=19200', # 3001 = Port 1, 3002 = Port 2 ...
|
||||
)
|
||||
|
||||
Mod('wio_2',
|
||||
'frappy_psi.thermofisher.ThermFishIO',
|
||||
'connection for water bath',
|
||||
uri='serial:///dev/ttyUSB1?baudrate=19200', # 3001 = Port 1, 3002 = Port 2 ...
|
||||
)
|
||||
|
||||
Mod('wio_3',
|
||||
'frappy_psi.thermofisher.ThermFishIO',
|
||||
'connection for water bath',
|
||||
uri='serial:///dev/ttyUSB2?baudrate=19200', # 3001 = Port 1, 3002 = Port 2 ...
|
||||
)
|
||||
|
||||
Mod('Tbath_1',
|
||||
'frappy_psi.thermofisher.TemperatureLoopA10',
|
||||
'water_bath_1',
|
||||
io='wio_1',
|
||||
control_active=0,
|
||||
target=25,
|
||||
tolerance=0.1,
|
||||
settling_time=20,
|
||||
)
|
||||
|
||||
Mod('Tbath_2',
|
||||
'frappy_psi.thermofisher.TemperatureLoopA10',
|
||||
'water_bath_2',
|
||||
io='wio_2',
|
||||
control_active=0,
|
||||
target=25,
|
||||
tolerance=0.1,
|
||||
settling_time=20,
|
||||
)
|
||||
|
||||
Mod('Tbath_3',
|
||||
'frappy_psi.thermofisher.TemperatureLoopA10',
|
||||
'water_bath_3',
|
||||
io='wio_3',
|
||||
control_active=0,
|
||||
target=25,
|
||||
tolerance=0.1,
|
||||
settling_time=20,
|
||||
)
|
||||
|
||||
Mod('valve_1',
|
||||
'frappy_psi.ionopimax.DigitalOutput',
|
||||
'valve_for_fast_water_temperature_changing',
|
||||
addr = 'o1',
|
||||
target = 0,
|
||||
)
|
||||
|
||||
Mod('valve_2',
|
||||
'frappy_psi.ionopimax.DigitalOutput',
|
||||
'valve_for_fast_water_temperature_changing',
|
||||
addr = 'o2',
|
||||
target = 0,
|
||||
)
|
||||
|
||||
Mod('valve_3',
|
||||
'frappy_psi.ionopimax.DigitalOutput',
|
||||
'valve_for_fast_water_temperature_changing',
|
||||
addr = 'o3',
|
||||
target = 0,
|
||||
)
|
||||
|
||||
Mod('temp_sensor_tc',
|
||||
'frappy_psi.ionopimax.SimpleVoltageInput',
|
||||
'temperatur_sensor_sample',
|
||||
rawrange = (0.0, 10.0),
|
||||
valuerange = (5.0, 90.0),
|
||||
addr = 'ai1_mv',
|
||||
)
|
||||
|
||||
Mod('temp_sensor_pt1000',
|
||||
'frappy_psi.ionopimax.SimpleVoltageInput',
|
||||
'temperatur_sensor_sample',
|
||||
rawrange = (0.0, 10.0),
|
||||
valuerange = (5.0, 90.0),
|
||||
addr = 'ai2_mv',
|
||||
)
|
||||
|
||||
Mod('switcher',
|
||||
'frappy_psi.muwaba.Switcher',
|
||||
'waterbath switcher',
|
||||
valve1 = 'valve_1',
|
||||
valve2 = 'valve_2',
|
||||
valve3 = 'valve_3',
|
||||
)
|
||||
61
frappy_psi/muwaba.py
Normal file
61
frappy_psi/muwaba.py
Normal file
@@ -0,0 +1,61 @@
|
||||
# *****************************************************************************
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 2 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Module authors:
|
||||
# Marcel Fuchs <marcel.fuchs@psi.ch>
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
"""
|
||||
Multiple waterbath switching
|
||||
"""
|
||||
|
||||
from frappy.core import Readable, Writable, Parameter, Property, IntRange, Attached,ERROR, IDLE, WARN
|
||||
|
||||
class Switcher(Writable):
|
||||
value = Parameter("Switcher state", IntRange(0,3))
|
||||
target = Parameter("Switcher target", IntRange(0,3), default=0)
|
||||
valve1 = Attached(Writable)
|
||||
valve2 = Attached(Writable)
|
||||
valve3 = Attached(Writable)
|
||||
_count = 0
|
||||
_idle_status = IDLE, ''
|
||||
|
||||
def initModule(self):
|
||||
super().initModule()
|
||||
self.valves = {1:self.valve1, 2:self.valve2, 3:self.valve3}
|
||||
|
||||
def write_target(self, target):
|
||||
for nr, valve in self.valves.items():
|
||||
if nr != target:
|
||||
valve.write_target(False)
|
||||
if target != 0:
|
||||
self.valves[target].write_target(True)
|
||||
self._idle_status = IDLE, ''
|
||||
|
||||
def read_value(self):
|
||||
opened = [nr for nr, valve in self.valves.items() if valve.read_value()]
|
||||
self._count = len(opened)
|
||||
if self._count == 0:
|
||||
return 0
|
||||
if self._count == 1:
|
||||
return opened[0]
|
||||
self.write_target(self.target)
|
||||
self._idle_status = WARN, 'superfluous valves closed'
|
||||
return self.target
|
||||
|
||||
def read_status(self):
|
||||
return self._idle_status
|
||||
|
||||
Reference in New Issue
Block a user