Subarray

SKASubarray

A SubArray handling device. It allows the assigning/releasing of resources into/from Subarray, configuring capabilities, and exposes the related information like assigned resources, configured capabilities, etc.

Device Class

class ska_tango_base.SKASubarray(*args: Any, **kwargs: Any)[source]

Implements the SKA SubArray device

class InitCommand(target, state_model, logger=None)[source]

A class for the SKASubarray’s init_device() “command”.

Create a new InitCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (DeviceStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do()[source]

Stateless hook for device initialisation.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class AssignResourcesCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s AssignResources() command.

Constructor for AssignResourcesCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do(argin)[source]

Stateless hook for AssignResources() command functionality.

Parameters

argin (list of str) – The resources to be assigned

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class ReleaseResourcesCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s ReleaseResources() command.

Constructor for OnCommand()

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do(argin)[source]

Stateless hook for ReleaseResources() command functionality.

Parameters

argin (list of str) – The resources to be released

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class ReleaseAllResourcesCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s ReleaseAllResources() command.

Constructor for OnCommand()

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do()[source]

Stateless hook for ReleaseAllResources() command functionality.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class ConfigureCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s Configure() command.

Constructor for ConfigureCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do(argin)[source]

Stateless hook for Configure() command functionality.

Parameters

argin (str) – The configuration as JSON

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class ScanCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s Scan() command.

Constructor for ScanCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do(argin)[source]

Stateless hook for Scan() command functionality.

Parameters

argin (str) – Scan info

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class EndScanCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s EndScan() command.

Constructor for EndScanCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do()[source]

Stateless hook for EndScan() command functionality.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class EndCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s End() command.

Constructor for EndCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do()[source]

Stateless hook for End() command functionality.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class AbortCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s Abort() command.

Constructor for AbortCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do()[source]

Stateless hook for Abort() command functionality.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class ObsResetCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s ObsReset() command.

Constructor for ObsResetCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do()[source]

Stateless hook for ObsReset() command functionality.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

class RestartCommand(target, state_model, logger=None)[source]

A class for SKASubarray’s Restart() command.

Constructor for RestartCommand

Parameters
  • target (object) – the object that this command acts upon; for example, the SKASubarray device for which this class implements the command

  • state_model (SKASubarrayStateModel) – the state model that this command uses to check that it is allowed to run, and that it drives with actions.

  • logger (a logger that implements the standard library logger interface) – the logger to be used by this Command. If not provided, then a default module logger will be used.

do()[source]

Stateless hook for Restart() command functionality.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

init_command_objects()[source]

Sets up the command objects

CapabilityTypes = tango.server.device_property(dtype=('str',))
SubID = tango.server.device_property(dtype=str)
activationTime = tango.server.attribute(dtype=double, unit=s, standard_unit=s, display_unit=s, doc=Time of activation in seconds since Unix epoch.)

Device attribute.

assignedResources = tango.server.attribute(dtype=('str',), max_dim_x=100, doc=The list of resources assigned to the subarray.)

Device attribute.

configuredCapabilities = tango.server.attribute(dtype=('str',), max_dim_x=10, doc=A list of capability types with no. of instances in use on this subarray; e.g. Correlators:512, PssBeams:4, PstBeams:4, VlbiBeams:0.)

Device attribute.

always_executed_hook()[source]

Method that is always executed before any device command gets executed.

delete_device()[source]

Method to cleanup when device is stopped.

read_activationTime()[source]

Reads the time since device is activated.

Returns

Time of activation in seconds since Unix epoch.

read_assignedResources()[source]

Reads the resources assigned to the device.

Returns

Resources assigned to the device.

read_configuredCapabilities()[source]

Reads capabilities configured in the Subarray.

Returns

A list of capability types with no. of instances used in the Subarray

is_AssignResources_allowed()[source]

Check if command AssignResources is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

AssignResources(argin)[source]

Assign resources to this subarray

To modify behaviour for this command, modify the do() method of the command class.

Parameters

argin (list of str) – the resources to be assigned

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_ReleaseResources_allowed()[source]

Check if command ReleaseResources is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

ReleaseResources(argin)[source]

Delta removal of assigned resources.

To modify behaviour for this command, modify the do() method of the command class.

Parameters

argin (list of str) – the resources to be released

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_ReleaseAllResources_allowed()[source]

Check if command ReleaseAllResources is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

ReleaseAllResources()[source]

Remove all resources to tear down to an empty subarray.

To modify behaviour for this command, modify the do() method of the command class.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_Configure_allowed()[source]

Check if command Configure is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

Configure(argin)[source]

Configures the capabilities of this subarray

To modify behaviour for this command, modify the do() method of the command class.

Parameters

argin (string) – configuration specification

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_Scan_allowed()[source]

Check if command Scan is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

Scan(argin)[source]

Start scanning

To modify behaviour for this command, modify the do() method of the command class.

Parameters

argin (Array of str) – Information about the scan

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_EndScan_allowed()[source]

Check if command EndScan is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

EndScan()[source]

End the scan

To modify behaviour for this command, modify the do() method of the command class.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_End_allowed()[source]

Check if command End is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

End()[source]

End the scan block.

To modify behaviour for this command, modify the do() method of the command class.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_Abort_allowed()[source]

Check if command Abort is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

Abort()[source]

Abort any long-running command such as Configure() or Scan().

To modify behaviour for this command, modify the do() method of the command class.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_ObsReset_allowed()[source]

Check if command ObsReset is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

ObsReset()[source]

Reset the current observation process.

To modify behaviour for this command, modify the do() method of the command class.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

is_Restart_allowed()[source]

Check if command Restart is allowed in the current device state.

Raises

tango.DevFailed – if the command is not allowed

Returns

True if the command is allowed

Return type

boolean

Restart()[source]

Restart the subarray. That is, deconfigure and release all resources.

To modify behaviour for this command, modify the do() method of the command class.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

Device State Model

class ska_tango_base.SKASubarrayStateModel(logger, op_state_callback=None, admin_mode_callback=None, obs_state_callback=None)[source]

Implements the state model for the SKASubarray

Initialises the model. Note that this does not imply moving to INIT state. The INIT state is managed by the model itself.

Parameters
  • logger (a logger that implements the standard library logger interface) – the logger to be used by this state model.

  • op_state_callback (callable) – A callback to be called when a transition implies a change to op state

  • admin_mode_callback (callable) – A callback to be called when a transition causes a change to device admin_mode

  • obs_state_callback (callable) – A callback to be called when a transition causes a change to device obs_state

Resource Manager

class ska_tango_base.SKASubarrayResourceManager[source]

A simple class for managing subarray resources

Constructor for SKASubarrayResourceManager

assign(resources)[source]

Assign some resources

Todo

Currently implemented for testing purposes to take a JSON string encoding a dictionary with key ‘example’. In future this will take a collection of resources.

Parameters

resources (JSON string) – JSON-encoding of a dictionary, with resources to assign under key ‘example’

release(resources)[source]

Release some resources

Todo

Currently implemented for testing purposes to take a JSON string encoding a dictionary with key ‘example’. In future this will take a collection of resources.

Parameters

resources (JSON string) – JSON-encoding of a dictionary, with resources to assign under key ‘example’

release_all()[source]

Release all resources

get()[source]

Get current resources

Returns

a set of current resources.

Return type

set of string