make return value 'Done' unneccessary

'Done' was introduced in order to suppress unneccessary
duplicate updates. However, since super calls on access methods are
allowed, it is not nice when such a method returns Done, as this
is not automagically replaced by the current parameter value.
As a consequence:

- using Done is discouraged, but not (yet) removed in all code
- the 'omit_unchanged_within' property is moved from Module to an
  internal Parameter property 'update_unchanged'
- its default is moved from a SEC node property to generalConfig
- the 'update_unchanged' parameter property may be set to
  'never' for parameters where duplicate updates make no sense
- this property might be set to 'always', for measurements, where
  even unchanged values taken from HW should be transmitted

Change-Id: I2847c983ca09c2c4098e402edd08d0c96c3913f4
Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/30672
Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2023-03-13 17:16:07 +01:00
parent 9cab6670b9
commit 0d265b9752
22 changed files with 188 additions and 119 deletions

View File

@ -40,7 +40,7 @@ from frappy.datatypes import BoolType, EnumType, \
from frappy.errors import HardwareError
from frappy.lib import clamp
from frappy.lib.enum import Enum
from frappy.modules import Communicator, Done, \
from frappy.modules import Communicator, \
Drivable, Parameter, Property, Readable
from frappy.io import HasIO
from frappy.rwhandler import CommonReadHandler, CommonWriteHandler
@ -478,16 +478,14 @@ class Temp(PpmsDrivable):
def write_approachmode(self, value):
if self.isDriving():
self._write_params(self.setpoint, self.ramp, value)
return Done
self.approachmode = value
return Done # do not execute TEMP command, as this would trigger an unnecessary T change
return self.approachmode
return value # do not execute TEMP command, as this would trigger an unnecessary T change
def write_ramp(self, value):
if self.isDriving():
self._write_params(self.setpoint, value, self.approachmode)
return Done
self.ramp = value
return Done # do not execute TEMP command, as this would trigger an unnecessary T change
return self.ramp
return value # do not execute TEMP command, as this would trigger an unnecessary T change
def calc_expected(self, target, ramp):
self._expected_target_time = time.time() + abs(target - self.value) * 60.0 / max(0.1, ramp)
@ -606,7 +604,7 @@ class Field(PpmsDrivable):
self._last_change = time.time()
self.status = (self.Status.BUSY, 'changed target')
self._write_params(target, self.ramp, self.approachmode, self.persistentmode)
return Done
return self.target
def write_persistentmode(self, mode):
if abs(self.target - self.value) <= 2e-5 and mode == self.persistentmode:
@ -617,20 +615,18 @@ class Field(PpmsDrivable):
self._stopped = False
self.status = (self.Status.BUSY, 'changed persistent mode')
self._write_params(self.target, self.ramp, self.approachmode, mode)
return Done
return self.persistentmode
def write_ramp(self, value):
self.ramp = value
if self.isDriving():
self._write_params(self.target, value, self.approachmode, self.persistentmode)
return Done
return None # do not execute FIELD command, as this would trigger a ramp up of leads current
return self.ramp
return value # do not execute FIELD command, as this would trigger a ramp up of leads current
def write_approachmode(self, value):
if self.isDriving():
self._write_params(self.target, self.ramp, value, self.persistentmode)
return Done
return None # do not execute FIELD command, as this would trigger a ramp up of leads current
# do not execute FIELD command, as this would trigger a ramp up of leads current
def stop(self):
if not self.isDriving():
@ -728,14 +724,13 @@ class Position(PpmsDrivable):
self._status_before_change = self.status
self.status = (self.Status.BUSY, 'changed target')
self._write_params(target, self.speed)
return Done
return self.target
def write_speed(self, value):
if self.isDriving():
self._write_params(self.target, value)
return Done
self.speed = value
return None # do not execute MOVE command, as this would trigger an unnecessary move
return self.speed
return value # do not execute MOVE command, as this would trigger an unnecessary move
def stop(self):
if not self.isDriving():