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

@ -20,7 +20,7 @@
# *****************************************************************************
"""Andeen Hagerling capacitance bridge"""
from frappy.core import Done, FloatRange, HasIO, Parameter, Readable, StringIO, nopoll
from frappy.core import FloatRange, HasIO, Parameter, Readable, StringIO, nopoll
class Ah2700IO(StringIO):
@ -43,7 +43,7 @@ class Capacitance(HasIO, Readable):
reply = self.communicate('SI')
if not reply.startswith('F='): # this is probably an error message like "LOSS TOO HIGH"
self.status = [self.Status.ERROR, reply]
return
return self.value
self.status = [self.Status.IDLE, '']
# examples of replies:
# 'F= 1000.0 HZ C= 0.000001 PF L> 0.0 DS V= 15.0 V'
@ -55,7 +55,6 @@ class Capacitance(HasIO, Readable):
_, freq, _, _, cap, _, _, loss, lossunit, _, volt = reply[:11]
self.freq = freq
self.voltage = volt
self.value = cap
if lossunit == 'DS':
self.loss = loss
else: # the unit was wrong, we want DS = tan(delta), not NS = nanoSiemens
@ -64,30 +63,30 @@ class Capacitance(HasIO, Readable):
self.loss = reply[7]
except IndexError:
pass # don't worry, loss will be updated next time
return cap
def read_value(self):
self.parse_reply(self.communicate('SI')) # SI = single trigger
return Done
return self.parse_reply(self.communicate('SI')) # SI = single trigger
@nopoll
def read_freq(self):
self.read_value()
return Done
return self.freq
@nopoll
def read_loss(self):
self.read_value()
return Done
return self.loss
@nopoll
def read_voltage(self):
self.read_value()
return Done
return self.voltage
def write_freq(self, value):
self.parse_reply(self.communicate('FR %g;SI' % value))
return Done
self.value = self.parse_reply(self.communicate('FR %g;SI' % value))
return self.freq
def write_voltage(self, value):
self.parse_reply(self.communicate('V %g;SI' % value))
return Done
self.value = self.parse_reply(self.communicate('V %g;SI' % value))
return self.voltage