diff --git a/csaxs_bec/device_configs/simulated_omny/__init__.py b/csaxs_bec/device_configs/simulated_omny/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csaxs_bec/device_configs/simulated_omny/simulated_bl_endstation.yaml b/csaxs_bec/device_configs/simulated_omny/simulated_bl_endstation.yaml new file mode 100644 index 0000000..4c77216 --- /dev/null +++ b/csaxs_bec/device_configs/simulated_omny/simulated_bl_endstation.yaml @@ -0,0 +1,18 @@ +ddg1: + description: Main delay Generator for triggering + deviceClass: csaxs_bec.devices.sim.simulated_beamline_devices.SimulatedDDG1 + enabled: true + deviceConfig: + prefix: 'X12SA-CPCL-DDG1:' + onFailure: raise + readOnly: false + readoutPriority: baseline + softwareTrigger: true +fsh: + description: Fast shutter manual control and readback + deviceClass: csaxs_bec.devices.sim.simulated_beamline_devices.cSAXSSimulatedFastShutter + deviceConfig: + prefix: 'X12SA-ES1-TTL:' + onFailure: raise + enabled: true + readoutPriority: monitored \ No newline at end of file diff --git a/csaxs_bec/devices/sim/__init__.py b/csaxs_bec/devices/sim/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/csaxs_bec/devices/sim/simulated_beamline_devices.py b/csaxs_bec/devices/sim/simulated_beamline_devices.py new file mode 100644 index 0000000..0e5e479 --- /dev/null +++ b/csaxs_bec/devices/sim/simulated_beamline_devices.py @@ -0,0 +1,50 @@ +"""This module contains simulated versions of beamline devices relevant for running simulated experiments.""" + +from __future__ import annotations + +from ophyd import Device +from ophyd_devices import StatusBase +from ophyd_devices.tests.utils import patched_device + +from csaxs_bec.devices.epics.delay_generator_csaxs.ddg_1 import DDG1 +from csaxs_bec.devices.epics.fast_shutter import cSAXSFastEpicsShutter + + +class cSAXSSimulatedFastShutter(Device): + """ + Simulated version of the cSAXS Fast Shutter. + + To set up initial signal to specific values, please use the example below: + fsh.shutter._read_pv.mock_data = 1 # + -> with 'shutter' being a signal of the shutter device + + """ + + def __new__(cls, *args, **kwargs): + with patched_device(cSAXSFastEpicsShutter, *args, **kwargs) as fsh: + # fsh.shutter._read_pv.mock_data = 1 # Set mock data if needed + return fsh + + +class DDG1WithPatchedStage(DDG1): + """ + Simulated version of the DDG1 with patched stage method. + We inherit here to be able to overwrite the on_stage method if needed, without compromising the rest of the device's functionality. + """ + + def on_trigger(self): + """ + We overwrite and patch the on_trigger method. This resolves immediately now and + sets the status to finished, instead of waiting for the trigger logic to complete. + """ + # Change logic if needed + status = StatusBase(obj=self) + status.set_finished() + return status + + +class SimulatedDDG1(Device): + + def __new__(cls, *args, **kwargs): + with patched_device(DDG1, *args, **kwargs) as ddg1: + return ddg1