Operating State

class ska_control_model.OpStateModel(logger, callback=None, state_machine_factory=None)

This class implements the state model for operational state (“opState”).

The model supports the following states, represented as values of the tango.DevState enum.

  • INIT: the control system is initialising.

  • DISABLE: the control system has been told not to monitor the system under control.

  • UNKNOWN: the control system is monitoring (or at least trying to monitor) the system under control, but is unable to determine its state.

  • OFF: the control system is monitoring the system under control, which is powered off.

  • STANDBY: the control system is monitoring the system under control, which is in low-power standby mode.

  • ON: the control system is monitoring the system under control, which is turned on.

  • FAULT: the control system is monitoring the system under control, which has failed or is in an inconsistent state.

The actions supported are:

  • init_invoked: the control system has started initialising.

  • init_completed: the control system has finished initialising.

  • component_disconnected: the control system his disconnected from the system under control (for example because admin mode was set to OFFLINE). Note, this action indicates a deliberate, control-system-initiated, disconnect; a lost connection would be indicated by a “component_unknown” action.

  • component_unknown: the control system is unable to determine the state of the system under control.

  • component_off: the system under control has been switched off

  • component_standby: the system under control has switched to low-power standby mode

  • component_on: the system under control has been switched on.

  • component_fault: the system under control has experienced a fault.

  • component_no_fault: the system under control has stopped experiencing a fault.

A diagram of the operational state model, as implemented, is shown below.

INIT: The Tango device is initialising.
UNKNOWN: The Tango device cannot determine\nthe state of its telescope component.
DISABLE: The Tango device is not monitoring\nits telescope component.
OFF: The telescope component is turned off
STANDBY: The telescope component is standing by
ON: The telescope component is turned on
FAULT: The telescope component has faulted

INIT --down--> DISABLE
INIT --down--> UNKNOWN
INIT --down--> OFF
INIT --down--> STANDBY
INIT --down--> ON
INIT --down--> FAULT
DISABLE -> UNKNOWN
DISABLE -> OFF
DISABLE -> STANDBY
DISABLE -> ON
DISABLE -> FAULT

UNKNOWN -> DISABLE
UNKNOWN -> OFF
UNKNOWN -> STANDBY
UNKNOWN -> ON
UNKNOWN -> FAULT

OFF -> DISABLE
OFF -> UNKNOWN
OFF -> STANDBY
OFF -> ON
OFF -> FAULT

STANDBY -> DISABLE
STANDBY -> UNKNOWN
STANDBY -> OFF
STANDBY -> ON
STANDBY -> FAULT

ON -> DISABLE
ON -> UNKNOWN
ON -> OFF
ON -> STANDBY
ON -> FAULT

FAULT -> DISABLE
FAULT -> UNKNOWN
FAULT -> OFF
FAULT -> STANDBY
FAULT -> ON

Diagram of the operational state model

The following hierarchical diagram is more explanatory; however note that the implementation does not use a hierarchical state machine.

INIT: The Tango device is initialising.
UNKNOWN: The Tango device cannot determine\nthe state of its telescope component.
DISABLE: The Tango device is not monitoring\nits telescope component.

INIT -right-> DISABLE
INIT -right-> MONITORING
INIT -right-> UNKNOWN
DISABLE -down-> UNKNOWN
DISABLE -down-> MONITORING
UNKNOWN -up-> DISABLE
UNKNOWN -down-> MONITORING
MONITORING -up-> DISABLE
MONITORING -up-> UNKNOWN

state "[monitoring]" as MONITORING {
  MONITORING: The Tango device is monitoring the telescope component.

  OFF: The telescope component is turned off
  STANDBY: The telescope component is standing by
  ON: The telescope component is turned on
  FAULT: The telescope component has faulted

OFF -right-> STANDBY
OFF -right-> FAULT
OFF -right-> ON
STANDBY -left-> OFF
STANDBY -down-> ON
STANDBY -down-> FAULT
ON -left-> OFF
ON -up-> STANDBY
ON -down-> FAULT
FAULT -left-> OFF
FAULT -up-> STANDBY
FAULT -up-> ON
}

Diagram of the operational state model

__init__(logger, callback=None, state_machine_factory=None)

Initialise the operational state model.

Parameters:
  • logger (Logger) – the logger to be used by this state model.

  • callback (Optional[Callable[[Optional[DevState]], None]]) – A callback to be called when the state machine for op_state reports a change of state

  • state_machine_factory (Optional[Callable[..., LockedMachine]]) – a callable that returns a state machine for this model to use

__weakref__

list of weak references to the object (if defined)

is_action_allowed(action, raise_if_disallowed=False)

Return whether a given action is allowed in the current state.

Parameters:
  • action (str) – an action, as given in the transitions table

  • raise_if_disallowed (bool) – whether to raise an exception if the action is disallowed, or merely return False (optional, defaults to False)

Raises:

StateModelError – if the action is unknown to the state machine

Return type:

bool

Returns:

whether the action is allowed in the current state

property op_state: tango.DevState

Return the op state.

Returns:

the op state of this state model

perform_action(action)

Perform an action on the state model.

Parameters:

action (str) – an action, as given in the transitions table

Return type:

None