Future Powered Interface
Base interfaces for SKA Tango devices.
- class ska_tango_base.future._powered_interface.PoweredOpStateEmitMixin[source]
Bases:
_BaseOpStateEmitMixinA mixin class for a SKA powered device or its component manager.
It provides helper methods for managing the Operational State of the device.
- class ska_tango_base.future._powered_interface.PoweredInterface[source]
Bases:
PoweredOpStateEmitMixin,BaseInterfaceProvides the Tango interface for an SKA device that controls a powered component.
This class extends
BaseInterfacewith support for power state transitions (ON, OFF, STANDBY) driven by the component under control. It is up to subclasses to override various abstract methods to provide the appropriate behaviour and set the Operational State as appropriate, except for the initial state that is set ininit_device().The Operational State of an SKA Tango device is exposed as the built-in Tango device state via
set_state(). Subclasses are not expected to callset_state()themselves. Instead, the state is driven automatically by calling_update_op_state()with apowerkeyword argument (aPowerStatevalue), which will additionally ensure that change and archive events are sent.The Operational State of the
PoweredInterfaceonly supports a subset of theDevStateenumeration, with the following interpretations:INIT: The device is initialising. Mandatory initial state for all devices.
ON: The system under control is powered on. Mandatory default state if the device is operational.
OFF: The system under control is powered off. Optional.
STANDBY: The system under control is in low-power standby mode. Optional.
FAULT: The system under control is in fault. Optional.
PoweredInterfacealso provides the signals_admin_mode,_commanded_stateand_health_stateas well as the corresponding Tango attributesadminMode,commandedStateandhealthState, as well ashealthInfo.The
adminModeTango attribute is writable and should not be set by subclasses of this interface.The
commandedStateshould be set by subclasses as appropriate, using the corresponding signal.The
healthStateandhealthInforead-only attributes should be set by subclasses by callingreport_health().This interface also provides optional state transition commands
Off(),Standby(),On()as well as implementations of theis_Off_allowed(),is_Standby_allowed()andis_On_allowed()methods which respect the Operational State machine.Subclasses can provide an implementation for these commands by overriding the
execute_Off(),execute_Standby()andexecute_On()methods.- _commanded_state: CommandedStateSignal
Signal for the commanded Operational State of the device.
Write to this signal whenever a command is executed which will result in a state transition.
- commandedState: attribute_from_signal
Attribute for the last commanded Operating State of the device.
This should be set by subclasses of this interface by writing to
_commanded_state.
- init_device() None[source]
Initialise the tango device after startup.
Subclasses overriding
init_device()must callinit_completed()once initialisation has finished.Example
class MyDevice(PoweredInterface): def init_device(self) -> None: super().init_device() ... self.init_completed()
- is_commandedState_allowed(request_type: AttReqType) bool[source]
Check if the commandedState can be read currently.
This can be overridden by subclasses to restrict when clients can access the attribute.
- read_commandedState() str | tuple[str, float, AttrQuality][source]
Read the commanded state of the device.
Subclasses can override this to change the behaviour of the
commandedStateattribute.
- is_Standby_allowed(request_type: LRCReqType | None = None) bool[source]
Return whether the
Standby()command may be called currently.This method can be overridden by subclasses to change when this command is allowed.
- Returns:
whether the command may be called in the current device state
- execute_Standby() tuple[list[ResultCode], list[str]][source]
Execute the standard Standby command.
This method must be overridden by a subclass to enable the Tango command, otherwise the command will not be part of the device interface. The
submit_lrc_task()decorator can be used to make Standby a long running command.If implemented, this command should put the device in standby mode and result in the operational state transitioning to
STANDBY. The command should not return until the transition has occurred.- Returns:
A tuple containing a return code and a string message indicating status or a command ID. The message is for information purpose only.
- is_Off_allowed(request_type: LRCReqType | None = None) bool[source]
Return whether the
Off()command may be called currently.This method can be overridden by subclasses to change when this command is allowed.
- Returns:
whether the command may be called in the current device state
- execute_Off() tuple[list[ResultCode], list[str]][source]
Execute the standard Off command.
This method must be overridden by a subclass to enable the Tango command, otherwise the command will not be part of the device interface. The
submit_lrc_task()decorator can be used to make Off a long running command.If implemented, this command should turn the device off and result in the operational state transitioning to
OFF. The command should not return until the transition has occurred.- Returns:
A tuple containing a return code and a string message indicating status or a command ID. The message is for information purpose only.
- is_On_allowed(request_type: LRCReqType | None = None) bool[source]
Return whether the
On()command may be called currently.This method can be overridden by subclasses to change when this command is allowed.
- Returns:
whether the command may be called in the current device state
- execute_On() tuple[list[ResultCode], list[str]][source]
Execute the standard On command.
This method must be overridden by a subclass to enable the Tango command, otherwise the command will not be part of the device interface. The
submit_lrc_task()decorator can be used to make On a long running command.If implemented, this command should turn the device on and result in the operational state transitioning to
ON. The command should not return until the transition has occurred.- Returns:
A tuple containing a return code and a string message indicating status or a command ID. The message is for information purpose only.
- On() tuple[list[ResultCode], list[str]][source]
Turn the device on.
Subclasses should override the
execute_On()method to change the behaviour of this command.- Returns:
A tuple containing a return code and a string message indicating status or a command ID. The message is for information purpose only.
- Standby() tuple[list[ResultCode], list[str]][source]
Put the device into standby mode.
Subclasses should override the
execute_Standby()method to change the behaviour of this command.- Returns:
A tuple containing a return code and a string message indicating status or a command ID. The message is for information purpose only.
- Off() tuple[list[ResultCode], list[str]][source]
Turn the device off.
Subclasses should override the
execute_Off()method to change the behaviour of this command.- Returns:
A tuple containing a return code and a string message indicating status or a command ID. The message is for information purpose only.