Observing State

class ska_control_model.ObsState(value)

Python enumerated type for observing state.

ABORTED = 7

The subarray is in an aborted state.

ABORTING = 6

The subarray has been interrupted and is aborting what it was doing.

CONFIGURING = 3

The subarray is being configured for an observation.

This is a transient state; the subarray will automatically transition to READY when configuring completes normally.

EMPTY = 0

The sub-array has no resources allocated and is unconfigured.

FAULT = 9

The subarray has detected an error in its observing state.

IDLE = 2

The subarray has resources allocated but is unconfigured.

READY = 4

The subarray is fully prepared to scan, but is not scanning.

It may be tracked, but it is not moving in the observed coordinate system, nor is it taking data.

RESETTING = 8

The subarray device is resetting to a base (EMPTY or IDLE) state.

RESOURCING = 1

Resources are being allocated to, or deallocated from, the subarray.

In normal science operations these will be the resources required for the upcoming SBI execution.

This may be a complete de/allocation, or it may be incremental. In both cases it is a transient state; when the resourcing operation completes, the subarray will automatically transition to EMPTY or IDLE, according to whether the subarray ended up having resources or not.

For some subsystems this may be a very brief state if resourcing is a quick activity.

RESTARTING = 10

The subarray device is restarting.

After restarting, the subarray will return to EMPTY state, with no allocated resources and no configuration defined.

SCANNING = 5

The subarray is scanning.

It is taking data and, if needed, all components are synchronously moving in the observed coordinate system.

Any changes to the sub-systems are happening automatically (this allows for a scan to cover the case where the phase centre is moved in a pre-defined pattern).

__new__(value)
class ska_control_model.ObsStateModel(logger, callback=None, state_machine_factory=<class 'ska_control_model.obs_state._ObsStateMachine'>)

Implements the observation state model for subarray.

The model supports all of the states of the ObsState enum:

  • EMPTY: the subarray is unresourced

  • RESOURCING: the subarray is performing a resourcing operation

  • IDLE: the subarray is resourced but unconfigured

  • CONFIGURING: the subarray is performing a configuring operation

  • READY: the subarray is resourced and configured

  • SCANNING: the subarray is scanning

  • ABORTING: the subarray is aborting

  • ABORTED: the subarray has aborted

  • RESETTING: the subarray is resetting from an ABORTED or FAULT state back to IDLE

  • RESTARTING: the subarray is restarting from an ABORTED or FAULT state back to EMPTY

  • FAULT: the subarray has encountered a observation fault.

A diagram of the subarray observation state model is shown below. This model is non-deterministic as diagrammed, but the underlying state machines has extra states and transitions that render it deterministic. This class simply maps those extra classes onto valid ObsState values.

EMPTY: The subarray has no resources
RESOURCING: The subarray is performing a resourcing operation
IDLE: The subarray is unconfigured
CONFIGURING: The subarray is performing a configuring operation
READY: The subarray is configured
SCANNING: The subarray is scanning
ABORTING: The subarray is aborting
ABORTED: The subarray has aborted
RESETTING: The subarray is resetting to IDLE\nfrom FAULT or ABORTED state
RESTARTING: The subarray is restarting to EMPTY\nfrom FAULT or ABORTED state
FAULT: The subarray has faulted

EMPTY -down-> RESOURCING: assign_invoked
EMPTY -left-> RESTARTING: restart_invoked
RESOURCING -up-> EMPTY: assign_completed
RESOURCING -up-> EMPTY: release_completed
RESOURCING -down-> IDLE: assign_completed
RESOURCING -down-> IDLE: release_completed
IDLE -up-> RESOURCING: assign_invoked
IDLE -up-> RESOURCING: release_invoked
IDLE -down-> CONFIGURING: configure_invoked
IDLE -left-> ABORTING: abort_invoked
CONFIGURING -up-> IDLE: configure_completed
CONFIGURING -left-> ABORTING: abort_invoked
CONFIGURING -down-> READY: configure_completed
CONFIGURING -left-> ABORTING: abort_invoked
READY -up-> CONFIGURING: configure_invoked
READY -up-> IDLE: component_unconfigured
READY -down-> SCANNING: component_scanning
READY -left-> ABORTING: abort_invoked
SCANNING -up-> READY: component_not_scanning
SCANNING -left-> ABORTING: abort_invoked
ABORTING -up-> ABORTED: abort_completed
ABORTED -up-> RESETTING: obsreset_invoked
ABORTED -up-> RESTARTING: restart_invoked
RESETTING -down-> ABORTING: abort_invoked
RESETTING -right-> IDLE: obsreset_completed
RESTARTING -right-> EMPTY: restart_completed
[*] -up-> FAULT: component_obsfault\n(from any state)
FAULT -up-> RESETTING: obsreset_invoked
FAULT -up-> RESTARTING: restart_invoked

Diagram of the subarray observation state model

__init__(logger, callback=None, state_machine_factory=<class 'ska_control_model.obs_state._ObsStateMachine'>)

Initialise the model.

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

  • callback (Optional[Callable[[ObsState], None]]) – A callback to be called when a transition causes a change to device obs_state

  • state_machine_factory (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 obs_state: ObsState | None

Return the obs_state.

Returns:

obs_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