Operational State Model
- class ska_csp_lmc_common.model.OpStateModel(op_state_init: tango.DevState, op_state_changed_callback: Callable[[tango.DevState], None], logger: Logger | None = None)
Bases:
object
A simple operational state model.
DevState.DISABLE – when communication with the component is not established.
DevState.FAULT – when the component has faulted
- __init__(op_state_init: tango.DevState, op_state_changed_callback: Callable[[tango.DevState], None], logger: Logger | None = None) None
Initialise a new instance.
- Parameters:
op_state_init – the initial state of the component under control.
op_state_changed_callback – callback to be called whenever there is a change to evaluated operational state.
logger – a logger for this instance
- property faulty
Return whether the componend is experiencing a faulty condition or not.
- Returns:
whether the component is in fault.
- property disabled: bool
Return whether the component is disabled or not.
- Returns:
whether the component is disabled.
- property op_state: tango.DevState
Return the component operational state.
- Returns:
the operational state.
- update_op_state() None
Update operational state.
This method calls the :py:meth:
evaluate_op_state
method to figure out what the new operational state should be, and then updates thestate
attribute, calling the callback if required.
- evaluate_op_state() tango.DevState
Re-evaluate the operational state.
This method contains the logic for evaluating the state.
This method should be extended by subclasses in order to define how state is evaluated by their particular device.
If the CSP device opState is in FAULT for an internal error (i.e not depending from the opStates of the CSP sub-systems) this state has to be maintained. The only way to exit from this state is to Reset/Reinit the CSP device. In this case the faulty flag is reset to False.
- Returns:
the new state state.
- component_fault(faulty: bool) None
Handle a component experiencing or recovering from a fault.
This method is called when the component goes into or out of FAULT state.
- Parameters:
faulty – whether the component has faulted or not
- is_disabled(disabled: bool) None
Handle disabling the monitoring functionalities of a TANGO device.
This method is called when the communication between the TANGO device and the component under controller is disabled/enabled via the setting of the adimnistrative mode.
- Parameters:
disabled – whether the communication between the component and the controlling TANGO device is disabled.
Health State Model
- class ska_csp_lmc_common.model.HealthStateModel(init_state: ska_control_model.HealthState, health_changed_callback: Callable[[ska_control_model.HealthState], None], logger: Logger | None = None)
Bases:
object
A simple health model the supports.
HealthState.OK – when the component is fully operative.
HealthState.DEGRADED – when the component is partially operative.
HealthState.UNKNOWN – when communication with the component is not established.
HealthState.FAILED – when the component has faulted
- __init__(init_state: ska_control_model.HealthState, health_changed_callback: Callable[[ska_control_model.HealthState], None], logger: Logger | None = None) None
Initialise a new instance.
- Parameters:
init_state – The health state of the component under control at initialization.
health_changed_callback – callback to be called whenever there is a change to this this health model’s evaluated health state.
logger (an instance of :py:class`logging.Logger`, or an object that implements the same interface) – a logger for this instance
- property faulty
Return whether the componend is experiencing a faulty condition or not.
- Returns:
whether the component is in fault.
- property disabled
Return whether the component is disabled or not.
- Returns:
whether the component is disabled
- property health_state: ska_control_model.HealthState
Return the health state of the component under control.
- Returns:
the health state.
- update_health() None
Update health state.
This method calls the :py:meth:
evaluate_health
method to figure out what the new health state should be, and then updates thehealth_state
attribute, calling the callback if required.
- evaluate_health() ska_control_model.HealthState
Re-evaluate the health state.
This method contains the logic for evaluating the health.
This method should be extended by subclasses in order to define how health is evaluated by their particular device.
- Returns:
the new health state.
Observing State Model
- class ska_csp_lmc_common.model.ObsStateModel(obs_state_init: ska_control_model.ObsState, obs_state_changed_callback: Callable[[ska_control_model.ObsState], None], logger: Logger | None = None)
Bases:
object
A simple observing state model for observing devices.
- __init__(obs_state_init: ska_control_model.ObsState, obs_state_changed_callback: Callable[[ska_control_model.ObsState], None], logger: Logger | None = None) None
Initialise a new instance.
- Parameters:
obs_state_int – the observing state of the component under control at initialization.
obs_state_changed_callback – callback to be called whenever the observing state of the component under control (as evaluated by this model) changes.
logger – a logger for this instance
- property faulty
Return whether the component is experiencing a faulty condition or not.
- Returns:
whether the component is aborted.
- property aborted
Return whether the component is experiencing a aborted condition or not.
- Returns:
whether the component is in fault.
- property action_driven
Return whether the updating of the component observing State is driven by actions or events (default).
- Returns:
whether the component obseving state update is driven by actions or events.
- property obs_state: ska_control_model.ObsState
The observing state of the component under control of the CSP Subarray TANGO Device.
- Getter:
the current observing state
- Setter:
set the component observing state to the updated value and the device callback is invoked, if defined.
- _update_obs_state(obs_state) None
Helper method to handle the update of the observing state of a component and the device that controls it.
# pylint: disable-next=fixme TODO: lock the TANGO Device AutoTangoMonitor otherwise there race conditions can happen.
- update_obs_state() None
Update the component observing state.
This method calls the :py:meth:
evaluate_obs_state
method to figure out what the new obsstate state should be, and then updates theobs_state
attribute, calling the callback if required.
- evaluate_obs_state() ska_control_model.ObsState
Re-evaluate the component observing state.
This method contains the basic logic for evaluating the observing state.
This method should be extended by subclasses in order to define how observing state is evaluated by their particular device.
- Returns:
the new observing state.
- component_fault(faulty: bool) None
Handle a component experiencing or recovering from a fault.
This method is called when the component goes into or out of FAULT state.
- Parameters:
faulty – whether the component has faulted or not.
- component_aborted(aborted: bool) None
Handle a component experiencing or recovering from an abort.
This method is called when the component goes into or out of ABORTED state.
- Parameters:
aborted – whether the component has faulted or not.
- component_disabled(disabled: bool) None
Handle the monitoring functionalities of a TANGO Device.
This method is called when the communication between the TANGO device and the component under controller is disabled/enabled via the setting of the administrative mode.
- Parameters:
disabled – whether the communication between the component and the controlling device is disabled.