fix: update timestamp upon reading of non computed readback signal

This commit is contained in:
appel_c 2024-06-28 16:57:28 +02:00
parent f818ff0234
commit 17e8cd9234
2 changed files with 13 additions and 0 deletions

View File

@ -294,6 +294,7 @@ class SimulatedPositioner(SimulatedDataBase):
The position is updated by the parent device, and readback/setpoint values The position is updated by the parent device, and readback/setpoint values
have a jitter/tolerance introduced directly in the parent class (SimPositioner). have a jitter/tolerance introduced directly in the parent class (SimPositioner).
""" """
self.sim_state[signal_name].update({"timestamp": ttime.time()})
if compute_readback: if compute_readback:
method = None method = None
value = self.execute_simulation_method(method=method, signal_name=signal_name) value = self.execute_simulation_method(method=method, signal_name=signal_name)

View File

@ -433,3 +433,15 @@ def test_async_mon_send_data_to_bec(async_monitor):
] ]
assert mock_xadd.mock_calls == call assert mock_xadd.mock_calls == call
assert async_monitor.data_buffer["value"] == [] assert async_monitor.data_buffer["value"] == []
def test_positioner_updated_timestamp(positioner):
"""Test the updated_timestamp method of SimPositioner."""
positioner.sim.sim_state[positioner.name]["value"] = 1
readback = positioner.read()[positioner.name]
timestamp = readback["timestamp"]
assert readback["value"] == 1
positioner.sim.sim_state[positioner.name]["value"] = 5
readback = positioner.read()[positioner.name]
assert readback["value"] == 5
assert readback["timestamp"] > timestamp