fixes on 2023-11-27
- ls372 autorange: wait one sec. more for switching - keep only one channel, even after target is reached - intermediate target only when T is raise, but not when lowered
This commit is contained in:
parent
c80b4ac5fb
commit
5b0da3ba98
@ -24,6 +24,7 @@ Mod('ts_low',
|
|||||||
minrange=13,
|
minrange=13,
|
||||||
range=22,
|
range=22,
|
||||||
tolerance = 0.1,
|
tolerance = 0.1,
|
||||||
|
vexc = 3,
|
||||||
htrrng=4,
|
htrrng=4,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,7 +33,8 @@ Mod('ts_high',
|
|||||||
'sample Cernox',
|
'sample Cernox',
|
||||||
channel = 1,
|
channel = 1,
|
||||||
switcher = 'lsc_channel',
|
switcher = 'lsc_channel',
|
||||||
minrange=9,
|
minrange=11,
|
||||||
|
vexc = 5,
|
||||||
range=22,
|
range=22,
|
||||||
tolerance = 0.1,
|
tolerance = 0.1,
|
||||||
htrrng=5,
|
htrrng=5,
|
||||||
@ -45,7 +47,9 @@ Mod('ts',
|
|||||||
value=Param(unit='K'),
|
value=Param(unit='K'),
|
||||||
low='ts_low',
|
low='ts_low',
|
||||||
high='ts_high',
|
high='ts_high',
|
||||||
min_high=0.6035,
|
#min_high=0.6035,
|
||||||
max_low=1.6965,
|
#max_low=1.6965,
|
||||||
|
min_high=0.6,
|
||||||
|
max_low=1.7,
|
||||||
tolerance=0.1,
|
tolerance=0.1,
|
||||||
)
|
)
|
||||||
|
@ -231,7 +231,7 @@ class ResChannel(Channel):
|
|||||||
def _read_value(self):
|
def _read_value(self):
|
||||||
"""read value, without update"""
|
"""read value, without update"""
|
||||||
now = time.monotonic()
|
now = time.monotonic()
|
||||||
if now + 0.5 < max(self._last_range_change, self.switcher._start_switch) + self.pause:
|
if now - 0.5 < max(self._last_range_change, self.switcher._start_switch) + self.pause:
|
||||||
return None
|
return None
|
||||||
result = float(self.communicate('RDGR?%d' % self.channel))
|
result = float(self.communicate('RDGR?%d' % self.channel))
|
||||||
if result == 0:
|
if result == 0:
|
||||||
@ -241,7 +241,7 @@ class ResChannel(Channel):
|
|||||||
return None
|
return None
|
||||||
if self.autorange:
|
if self.autorange:
|
||||||
self.fix_autorange()
|
self.fix_autorange()
|
||||||
if now + 0.5 > self._last_range_change + self.pause:
|
if now - 0.5 > self._last_range_change + self.pause:
|
||||||
rng = int(max(self.minrange, self.range)) # convert from enum to int
|
rng = int(max(self.minrange, self.range)) # convert from enum to int
|
||||||
if self.status[0] < self.Status.ERROR:
|
if self.status[0] < self.Status.ERROR:
|
||||||
if abs(result) > self.RES_SCALE[rng]:
|
if abs(result) > self.RES_SCALE[rng]:
|
||||||
@ -386,6 +386,10 @@ class TemperatureLoop(HasConvergence, TemperatureChannel, Drivable):
|
|||||||
htrrng = Parameter('', EnumType(HTRRNG), readonly=False)
|
htrrng = Parameter('', EnumType(HTRRNG), readonly=False)
|
||||||
_control_active = False
|
_control_active = False
|
||||||
|
|
||||||
|
def doPoll(self):
|
||||||
|
super().doPoll()
|
||||||
|
self.set_htrrng()
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
def control_off(self):
|
def control_off(self):
|
||||||
"""switch control off"""
|
"""switch control off"""
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"""modules to access parameters"""
|
"""modules to access parameters"""
|
||||||
|
|
||||||
from frappy.core import Drivable, EnumType, IDLE, Attached, StringType, Property, \
|
from frappy.core import Drivable, EnumType, IDLE, Attached, StringType, Property, \
|
||||||
Parameter, FloatRange, Readable, ERROR
|
Parameter, FloatRange, BoolType, Readable, ERROR
|
||||||
from frappy.errors import ConfigError
|
from frappy.errors import ConfigError
|
||||||
from frappy_psi.convergence import HasConvergence
|
from frappy_psi.convergence import HasConvergence
|
||||||
from frappy_psi.mixins import HasRamp
|
from frappy_psi.mixins import HasRamp
|
||||||
@ -148,6 +148,7 @@ class SwitchDriv(HasConvergence, Drivable):
|
|||||||
max_low = Parameter('maximum low target', FloatRange(unit='$'), readonly=False)
|
max_low = Parameter('maximum low target', FloatRange(unit='$'), readonly=False)
|
||||||
# disable_other = Parameter('whether to disable unused channel', BoolType(), readonly=False)
|
# disable_other = Parameter('whether to disable unused channel', BoolType(), readonly=False)
|
||||||
selected = Parameter('selected module', EnumType(low=LOW, high=HIGH), readonly=False, default=0)
|
selected = Parameter('selected module', EnumType(low=LOW, high=HIGH), readonly=False, default=0)
|
||||||
|
autoswitch = Parameter('switch sensor automatically', BoolType(), readonly=False, default=True)
|
||||||
_switch_target = None # if not None, switch to selection mhen mid range is reached
|
_switch_target = None # if not None, switch to selection mhen mid range is reached
|
||||||
|
|
||||||
# TODO: copy units from attached module
|
# TODO: copy units from attached module
|
||||||
@ -165,13 +166,13 @@ class SwitchDriv(HasConvergence, Drivable):
|
|||||||
self.write_target(self.target)
|
self.write_target(self.target)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
high = get_value(self.high, mid) # return mid then high is invalid
|
high = get_value(self.high, mid) # return mid when high is invalid
|
||||||
if high < mid:
|
if high < mid:
|
||||||
self.value = self.high.value
|
self.value = self.high.value
|
||||||
self._switch_target = None
|
self._switch_target = None
|
||||||
self.write_target(self.target)
|
self.write_target(self.target)
|
||||||
return
|
return
|
||||||
if not self.isBusy():
|
if not self.isBusy() and self.autoswitch:
|
||||||
low = get_value(self.low, self.max_low)
|
low = get_value(self.low, self.max_low)
|
||||||
high = get_value(self.high, self.min_high)
|
high = get_value(self.high, self.min_high)
|
||||||
low_valid = low < self.max_low
|
low_valid = low < self.max_low
|
||||||
@ -184,8 +185,9 @@ class SwitchDriv(HasConvergence, Drivable):
|
|||||||
if not high_valid and not self.high.control_active:
|
if not high_valid and not self.high.control_active:
|
||||||
set_enabled(self.high, False)
|
set_enabled(self.high, False)
|
||||||
return
|
return
|
||||||
set_enabled(self.low, True)
|
# keep only one channel on
|
||||||
set_enabled(self.high, True)
|
#set_enabled(self.low, True)
|
||||||
|
#set_enabled(self.high, True)
|
||||||
|
|
||||||
def get_selected(self):
|
def get_selected(self):
|
||||||
low = get_value(self.low, self.max_low)
|
low = get_value(self.low, self.max_low)
|
||||||
@ -219,13 +221,13 @@ class SwitchDriv(HasConvergence, Drivable):
|
|||||||
this, other = other, this
|
this, other = other, this
|
||||||
selected = HIGH
|
selected = HIGH
|
||||||
elif target < self.min_high * 0.75 + self.max_low * 0.25:
|
elif target < self.min_high * 0.75 + self.max_low * 0.25:
|
||||||
if self.value > self.max_low:
|
#if self.value > self.max_low:
|
||||||
target1 = max(self.min_high, target)
|
# target1 = max(self.min_high, target)
|
||||||
self._switch_target = LOW
|
# self._switch_target = LOW
|
||||||
this, other = other, this
|
# this, other = other, this
|
||||||
selected = HIGH
|
# selected = HIGH
|
||||||
else:
|
#else:
|
||||||
selected = LOW
|
selected = LOW
|
||||||
elif self.selected == HIGH:
|
elif self.selected == HIGH:
|
||||||
this, other = other, this
|
this, other = other, this
|
||||||
if hasattr(other, 'control_off'):
|
if hasattr(other, 'control_off'):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user