fix(sim): moved SimWaveform and SimMonitor to new async update structure

This commit is contained in:
wakonig_k 2025-03-03 18:51:00 +01:00
parent 75f32800f8
commit 63eff57ec4
2 changed files with 15 additions and 2 deletions

View File

@ -176,7 +176,14 @@ class SimMonitorAsync(PSIDeviceBase, SimMonitorAsyncControl):
def _send_data_to_bec(self) -> None:
"""Sends bundled data to BEC"""
metadata = {"async_update": self.async_update.get()}
async_update = self.async_update.get()
if async_update not in ["extend", "append"]:
raise ValueError(f"Invalid async_update value for device {self.name}: {async_update}")
if async_update == "extend":
metadata = {"async_update": {"type": "add", "max_shape": [None]}}
elif async_update == "append":
metadata = {"async_update": {"type": "add", "max_shape": [None, None]}}
msg = messages.DeviceMessage(
signals={self.readback.name: self.data_buffer}, metadata=metadata

View File

@ -133,7 +133,13 @@ class SimWaveform(Device):
async_update_type = self.async_update.get()
if async_update_type not in ["extend", "append"]:
raise ValueError(f"Invalid async_update type: {async_update_type}")
metadata = {"async_update": async_update_type}
waveform_shape = self.waveform_shape.get()
if async_update_type == "append":
metadata = {"async_update": {"type": "add", "max_shape": [None, waveform_shape]}}
else:
metadata = {"async_update": {"type": "add", "max_shape": [None]}}
msg = messages.DeviceMessage(
signals={self.waveform.name: {"value": self.waveform.get(), "timestamp": time.time()}},
metadata=metadata,