pytac.device
#
The device class used to represent a particular function of an accelerator element.
A physical element in an accelerator may have multiple devices: an example at DLS is a sextupole magnet that contains also horizontal and vertical corrector magnets and a skew quadrupole.
Members
A representation of a property of an element associated with a field. |
|
An EPICS-aware device. |
|
A PvEnabler class to check whether a device is enabled. |
|
A basic implementation of the device class. |
- class pytac.device.Device[source]#
A representation of a property of an element associated with a field.
Typically a control system will be used to set and get values on a device.
Methods:
- class pytac.device.SimpleDevice(value: float | list[float], enabled: bool = True, readonly: bool = True)[source]#
A basic implementation of the device class.
This device does not have a PV associated with it, nor does it interact with a simulator. In short this device acts as simple storage for data that rarely changes, as it is not affected by changes to other aspects of the accelerator.
- Parameters:
value – can be a number or a list of numbers.
enabled – whether the device is enabled. May be a PvEnabler object.
readonly – whether the value may be changed.
- is_enabled()[source]#
Whether the device is enabled.
- Returns:
whether the device is enabled.
- Return type:
- class pytac.device.EpicsDevice(name, cs, enabled=True, rb_pv=None, sp_pv=None)[source]#
An EPICS-aware device.
Contains a control system, readback and setpoint PVs. A readback or setpoint PV is required when creating an epics device otherwise a DataSourceException is raised. The device is enabled by default.
Attributes:
- Parameters:
- Raises:
DataSourceException – if no PVs are provided.
Methods:
- is_enabled()[source]#
Whether the device is enabled.
- Returns:
whether the device is enabled.
- Return type:
- get_value(handle, throw=True)[source]#
Read the value of a readback or setpoint PV.
- Parameters:
- Returns:
The value of the PV.
- Return type:
- Raises:
HandleException – if the requested PV doesn’t exist.
- set_value(value, throw=True)[source]#
Set the device value.
- Parameters:
- Raises:
HandleException – if no setpoint PV exists.
- get_pv_name(handle)[source]#
Get the PV name for the specified handle.
- Parameters:
handle (str) – The readback or setpoint handle to be returned.
- Returns:
A readback or setpoint PV.
- Return type:
- Raises:
HandleException – if the PV doesn’t exist.