virtac.pv
#
Contains the PV subclasses which wrap softioc records and provide the link between the softioc records and the simulation.
Members
Stores the attributes and methods which allow the VIRTAC to control an EPICS PV. |
|
Used to collate values from a list of PVs into an array, with the result set to this PVs _record. |
|
Used to invert records containing a boolean or array of booleans, ie swap true to false and false to true and then save the result in its own waveform _record. |
|
This type of PV monitors one or more PVs using channal access and does a callback when one of the camonitors returns |
|
This PV is used to read a value from the simulation using the pytac lattice and then set it to a softioc record. |
|
This PV is used to write a value to the simulation from a softioc record using the pytac lattice. |
|
Class for holding information required to create a softioc record |
|
Currently supported EPICS sofioc record types |
|
This PV monitors another PV and when it updates, we set our _record to the returned value and then force a third PV to update (refresh). |
|
Used to sum values from a list of PVs, with the result set to this PVs _record. |
- class virtac.pv.RecordData(record_type: str, lower: str | None = None, upper: str | None = None, precision: str | None = None, drive_high: str | None = None, drive_low: str | None = None, zrvl: str | None = None, zrst: str | None = None, scan: str = 'I/O Intr', pini: str = 'YES', always_update: bool = False, initial_value: int | float | ndarray = 0)[source]#
Class for holding information required to create a softioc record
- class virtac.pv.BasePV(name: str, record_data: RecordData | None)[source]#
Stores the attributes and methods which allow the VIRTAC to control an EPICS PV.
- self.__record#
This softioc record is the heart of the PV class, the main purpose of PV objects is to manage the setting and getting of these records.
- Type:
softioc.pythonSoftIoc.RecordWrapper
- Parameters:
name – Used to identify this PV and its softioc record.
record_data – Dataclass used to create this PVs softioc record.
- set_record_field(field: str, value: int | float | ndarray) None [source]#
Set a field on this PVs softioc record.
- Parameters:
field – The EPICS field to set on the softioc record
value – The value to set to the EPICS field
- create_softioc_record(record_data: RecordData) None [source]#
Create this PVs softioc record.
- Parameters:
record_data – Dataclass used to create this PVs softioc record.
- get_record() RecordWrapper [source]#
Return this PVs softioc record, care should be taken when manipulating the returned record.
- Returns:
The softioc record object.
- class virtac.pv.ReadSimPV(name: str, record_data: RecordData, pytac_items: list[EpicsLattice | Element], field: str)[source]#
This PV is used to read a value from the simulation using the pytac lattice and then set it to a softioc record.
- Parameters:
name – Used to identify this PV and its softioc record.
record_data – Dataclass used to create this PVs softioc record.
pytac_items – A list of pytac elements or the pytac lattice itself which should be linked to this PV.
pytac_field – The field on the pytac item(s) to set/get.
- class virtac.pv.ReadWriteSimPV(name: str, record_data: RecordData, read_pv: ReadSimPV, pytac_items: list[EpicsLattice | Element], pytac_field: str, offset_pv: BasePV | None = None)[source]#
This PV is used to write a value to the simulation from a softioc record using the pytac lattice.
These PVs always have an associated readback PV, we do not simulate how the hardware would ramp up this readback PV, instead we simply set it equal to the value set to this PV.
- Parameters:
name – Used to identify this PV and its softioc record.
record_data – Dataclass used to create this PVs softioc record.
read_pv – The readback PV linked to this PV which reads from the lattice.
pytac_items – A list of pytac elements or the pytac lattice itself which should be linked to this PV.
pytac_field – The field on the pytac item(s) to set/get.
offset_pv – An optional PV which can be used to get an offset value which is appended to this pvs pytac item(s) when writing.
- set_value(value: int | float | ndarray, offset: int | float | ndarray | None = None) None [source]#
- Set a value to this PVs softioc record, update its pytac element(s)
with the same value and then set the value to its read pv.
- Parameters:
value – The value to set to the softioc record.
offset – An optional offset value to add to this PVs pytac element but NOT to its softioc record.
- class virtac.pv.MonitorPV(name: str, record_data: RecordData | None, monitored_pv_names: list[str], callbacks: list[Callable[[int | float | ndarray, int | None], None]] | None = None)[source]#
This type of PV monitors one or more PVs using channal access and does a callback when one of the camonitors returns
- _monitor_data#
Used to keep track of which PVs we are monitoring and which functions the camonitor calls when they change value.
- Type:
(list[tuple[list[str], list[CallbackType]]])
- _camonitor_handles#
Used to close camonitors if a command is sent to pause monitoring.
- Type:
list[_Subscription]
- Parameters:
name – Used to set self.name
record_data – Dataclass used to create this PVs softioc record.
monitored_pvs – A list of PV names used to setup camonitoring.
callbacks – A list of functions to be called when the monitored PVs return. If none, then this PVs set function is called as the callback.
- class virtac.pv.RefreshPV(name: str, monitored_pv_name: str, record_to_refresh: BasePV, pv_to_cannibalise: BasePV)[source]#
This PV monitors another PV and when it updates, we set our _record to the returned value and then force a third PV to update (refresh).
Note
In the current implementation of VIRTAC, this PV is used to monitor an external PV in the tune feedbacks IOC. We store the value from the monitored PV in our _record, we then force a third PV (OffsetPV) to update. When this third PV updates, it reads the value from our _record and uses it as an offset which it adds to its own value before setting the result to itself and the pytac lattice.
- TODO: This PV does a lot of work at the moment, possible candidate for refactoring
or removal. Removal would also allow us to guarentee that _record is not None.
- _record_to_refresh#
The PV to refresh.
- Type:
PV
- Parameters:
name – Used to set self.name
monitored_pv_name – A PV to monitor and trigger refreshing.
record_to_refresh – The PV to pass to _record_to_refresh
pv_to_cannibalise – We take relevant variables from this PV, after which it should be discarded.
- TODO: It would be better if we didnt have to.
cannibalise an existing PV and could just create a new one.
- class virtac.pv.InversionPV(name: str, record_data: RecordData, invert_pvs: list[BasePV])[source]#
Used to invert records containing a boolean or array of booleans, ie swap true to false and false to true and then save the result in its own waveform _record.
Note
This class can either invert a single waveform record or a list of ai records. If invert_pvs contains more than 1 PV, then we assume the latter.
Note
In the current implementation of VIRTAC, this PV is being used to invert a list of SR01C-DI-EBPM-01:CF:ENABLED_S PVs, each containing a boolean value into a single waveform.
- Parameters:
name – Used to set self.name
record_data – Dataclass used to create this PVs softioc record.
invert_pvs – A list of PVs to monitor and then invert when they change value.
- class virtac.pv.SummationPV(name: str, record_data: RecordData, summate_pvs: list[BasePV])[source]#
Used to sum values from a list of PVs, with the result set to this PVs _record.
- Parameters:
name – Used to set self.name
record_data – Dataclass used to create this PVs softioc record.
summate_pvs – A list of PVs to monitor and then sum when they change value.
- class virtac.pv.CollationPV(name: str, record_data: RecordData, collate_pvs: list[BasePV])[source]#
Used to collate values from a list of PVs into an array, with the result set to this PVs _record.
- Parameters:
name – Used to set self.name
record_data – Dataclass used to create this PVs softioc record.
collate_pv – A list of PVs to monitor and then collate when they change value.