Consider sim_init dictionary during init of simulated devices
Description
This MR fixes a bug that sim_init dictionary was not considered upon initiated the simulated devices
Related Issues
closes #75 (closed)
Type of Change
One may add additional fields to the deviceConfig in BEC to allow devices to start with specific simulation models and params.
Example :
bpm4i:
deviceClass: ophyd_devices.SimMonitor
deviceConfig:
sim_init:
model: GaussianModel
params:
amplitude: 200
center: 2
sigma: 3
deviceTags:
- beamline
enabled: true
readOnly: false
readoutPriority: monitored
Note, the parameter will be checked, but at the moment they would not raise a warning to the client in case a syntax error is in the deviceConfig. They would start without finish setting the parameter. This can be handled more gracefully, but I would postpone this to a later point in time.
In order to dump the current parameters of a simulation model, one would have to do the following for the moment:
cfg = dev.bpm4s.get_device_config()
cfg.update({"sim_init" : {"model" : "GaussianModel", "params" : dev.bpm4s.sim.sim_params}})
dev.bpm4s.set_device_config(cfg)
bec.config.save_current_session("./test.yaml")
Potential side effects
None
Definition of Done
-
Documentation is up-to-date. -> will be complemented soon in BEC.