entangle.AnalogOutput: fix window mechanism
fix 2 problems: - in case the window is smaller than the pollinterval, isAtTarget might be False for up to the timeout delay - in case the history is shorter than the window, and the ramp is fast enough to miss any points during ramp, isAtTarget is True before the window time is reached. This happens because the history is reset on write_target + do not wait when target is not changed (by more than precision) tested! Change-Id: Ia4ff4378fe91fa93be50168b2883a20b49ebfb6a Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/27159 Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
This commit is contained in:
parent
c91d726f9d
commit
b29b1e1b36
@ -492,8 +492,11 @@ class AnalogOutput(PyTangoDevice, Drivable):
|
||||
hist = self._history[:]
|
||||
window_start = currenttime() - self.window
|
||||
hist_in_window = [v for (t, v) in hist if t >= window_start]
|
||||
if len(hist) == len(hist_in_window):
|
||||
return False # no data point before window
|
||||
if not hist_in_window:
|
||||
return False # no relevant history -> no knowledge
|
||||
# window is too small -> use last point only
|
||||
hist_in_window = [self.value]
|
||||
|
||||
max_in_hist = max(hist_in_window)
|
||||
min_in_hist = min(hist_in_window)
|
||||
@ -574,7 +577,9 @@ class AnalogOutput(PyTangoDevice, Drivable):
|
||||
if not self.timeout:
|
||||
self._timeout = None
|
||||
self._moving = True
|
||||
self._history = [] # clear history
|
||||
# do not clear the history here:
|
||||
# - if the target is not changed by more than precision, there is no need to wait
|
||||
# self._history = []
|
||||
self.read_status() # poll our status to keep it updated
|
||||
return self.read_target()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user