more demo test cases

- added them to cfg/dummy_cfg.py
+ treat enum correctly in SecopClient.setParameterFromString

Change-Id: Ia5b2d8d3a21c3215cb93d90975086eb9995b1543
This commit is contained in:
zolliker 2025-04-25 15:38:16 +02:00
parent 0230641b1d
commit 58549065fb
4 changed files with 23 additions and 3 deletions

View File

@ -96,3 +96,15 @@ Mod('cryo',
pollinterval = Param(export=False),
value = Param(unit = 'K', test = 'customized value'),
)
Mod('heatswitch',
'frappy_demo.modules.Switch',
'Heatswitch for `mf` device',
switch_on_time = 5,
switch_off_time = 10,
)
Mod('bool',
'frappy_demo.modules.BoolWritable',
'boolean writable test',
)

View File

@ -734,7 +734,7 @@ class SecopClient(ProxyClient):
"""
self.connect() # make sure we are connected
datatype = self.modules[module]['parameters'][parameter]['datatype']
value = datatype.from_string(formatted)
value = datatype.export_value(datatype.from_string(formatted))
self.request(WRITEREQUEST, self.identifier[module, parameter], value)
return self.cache[module, parameter]

View File

@ -161,7 +161,7 @@ class Cryostat(CryoBase):
by setting the current setpoint as new target"""
# XXX: discussion: take setpoint or current value ???
self.write_target(self.setpoint)
self.write_target(self.setpoint if self.mode == 'ramp' else self.value)
#
# calculation helpers

View File

@ -28,7 +28,7 @@ import time
from frappy.datatypes import ArrayOf, BoolType, EnumType, \
FloatRange, IntRange, StringType, StructOf, TupleOf
from frappy.lib.enum import Enum
from frappy.modules import Drivable, Readable, Attached
from frappy.modules import Drivable, Readable, Writable, Attached
from frappy.modules import Parameter as SECoP_Parameter
from frappy.properties import Property
@ -99,6 +99,14 @@ class Switch(Drivable):
self.log.info(info)
class BoolWritable(Writable):
value = Parameter('boolean', BoolType())
target = Parameter('boolean', BoolType())
def write_target(self, value):
self.value = value
class MagneticField(Drivable):
"""a liquid magnet
"""