Helper_Subarray_Device

This module implements the Helper devices for subarray nodes for testing an integrated TMC

class ska_tmc_simulators.helper_subarray_device.HelperSubArrayDevice(*args: Any, **kwargs: Any)

Bases: SKASubarray

A generic subarray device for triggering state changes with a command. It can be used as helper device for element subarray node

InitCommand = None
init_device()
healthInfo(value: dict) None

Writes the healthInfo attribute value.

Args:

value (dict): healthInfo attribute value.

SetDirectHealthInfo(argin: str) None

Sets the health info of the dish.

read_isAdminModeEnabled()

Raise an AttributeError indicating ‘isAdminModeEnabled’ is unavailable.

Raises:

AttributeError – Always raised to block access to the attribute.

write_isAdminModeEnabled(value: bool)

Raise an AttributeError indicating that ‘isAdminModeEnabled’ cannot be modified.

Parameters:

value – The value attempted to set for isAdminModeEnabled.

Raises:

AttributeError – Always raised to access to the attribute..

read_delay() float

Read the delay value.

Returns:

delay value

Return type:

float

write_delay(value: float) None

Write the delay value.

Parameters:

value (float) – The delay value to set

read_adminMode() int

This method reads the adminMode value of the device.

Returns:

admin_mode value

Return type:

AdminMode

write_adminMode(mode: int) None

This method writes the adminMode value of the device.

assignedResources() str
read_scanId() int

This method is used to read the attribute value for scanId.

Returns:

scan_id

read_obsStateTransitionDuration()

Read transition

Returns:

state duration info

read_isSubsystemAvailable() bool

Returns availability status for the leaf nodes devices

Returns:

availability status for the leaf nodes devices

Return type:

bool

SetSubsystemAvailable(value: bool) None

Sets Availability of the device

Return type:

bool

AddTransition(state_duration_info: str) None

This command will set duration for obs state such that when respective command for obs state is triggered then it change obs state after provided duration

ResetTransitions() None

This command will reset ObsState duration which is set

read_commandCallInfo()

This method is used to read the attribute value for commandCallInfo.

Returns:

attribute value for commandCallInfo

read_commandDelayInfo()

This method is used to read the attribute value for delay.

Returns:

attribute value for delay

read_commandInProgress() str

This method is used to read, which command is in progress

Returns:

command in progress

Return type:

str

read_defective() str

This method is used to read the value of the attribute defective

Returns:

attribute value defective

Return type:

str

read_receiveAddresses() str

This method is used to read receiveAddresses attribute

Returns:

attribute receiveAddresses

Return type:

str

push_obs_state_event(obs_state: int) None

This Method pushes change event for subarray observation state

Args:

obs_state (ObsState): Observation state of subarray

push_command_result(result_code: ska_tango_base.commands.ResultCode, command_name: str, message: str = 'Command Completed', command_id: str = '') None

Push long running command result event for given command.

Parameters:
  • result_code (ResultCode) – The result code to be pushed as an event

  • command_name (str) – The command name for which event is being pushed

  • message (str) – The message associated with the command result

  • command_id (str) – The unique command id

update_device_obsstate(value: int, command_name: str = '') None

Updates the given data after a delay.

update_command_info(command_name: str = '', command_input: str = '') None

This method updates the commandCallInfo attribute, with the respective command information.

Args:
  • command_name (str): command name

  • command_input (str): Input argin for command

create_component_manager() EmptySubArrayComponentManager

This method is used to create an instance of EmptySubarrayComponentManager

Returns:

component manager

Return type:

EmptySubArrayComponentManager

SetDelayInfo(command_delay_info: str) None

Update delay value

ResetDelayInfo() None

Reset Delay to its default values

ClearCommandCallInfo() None

Clears commandCallInfo to empty list

SetDirectObsState(argin: int) None

Trigger a ObsState change

SetDirectState(argin: tango.DevState) None

Trigger a DevState change

:param tango.DevState

SetDirectHealthState(argin: <Mock id='132366630214800'>) None

Trigger a HealthState change

SetDirectCommandInProgress(argin: str) None

Trigger a CommandInProgress change

SetDirectassignedResources(argin: tuple) None

Triggers an assignedResources attribute change.

is_On_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

execute_On() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes On command on Subarray Device

Returns:

ResultCode

Return type:

Tuple

is_Off_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

execute_Off() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes Off command on Subarray Device

Returns:

ResultCode and message

Return type:

Tuple

induce_fault(command_name: str, command_id: str) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

Induces a fault into the device based on the given parameters.

Parameters:
  • command_name (str) – The name of the command for which a fault is being induced.

  • command_id (str) – The command id over which the LRCR event is to be pushed.

Returns:

ResultCode and Unique_ID

Return type:

Tuple[List[ResultCode], List[str]]

Example:

defective_params = json.dumps({“enabled”: False,”fault_type”: FaultType.FAILED_RESULT,”error_message”: “Default exception.”, “result”: ResultCode.FAILED,}) proxy.SetDefective(defective_params)

Explanation: This method induces various types of faults into a device to test its robustness and error-handling capabilities.

  • FAILED_RESULT:

    A fault type that triggers a failed result code for the command. The device will return a result code of ‘FAILED’ along with a unique_id indicating that the command execution has failed.

  • LONG_RUNNING_EXCEPTION:

    A fault type where a failed result will be sent over the LongRunningCommandResult attribute in ‘delay’ amount of time.

  • STUCK_IN_INTERMEDIATE_STATE:

    This fault type makes it such that the device is stuck in the given Observation state.

  • COMMAND_NOT_ALLOWED_AFTER_QUEUING:

    This fault type sends a ResultCode.NOT_ALLOWED event through the LongRunningCommandResult attribute.

  • COMMAND_NOT_ALLOWED_EXCEPTION_AFTER_QUEUING:

    This fault type sends a ResultCode.REJECTED event through the LongRunningCommandResult attribute.

  • STUCK_IN_OBS_STATE:

    This fault type sets the device to given obsState and sends out an event on the LongRunningCommandResult attribute.

SetDefective(values: str) None

Trigger defective change

Param:

values

Type:

str

is_Standby_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

execute_Standby() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes Standby command on subarray devices

Returns:

ResultCode, message

Return type:

tuple

is_AssignResources_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

AssignResources(argin: str) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes AssignResources command on subarray devices

Returns:

ResultCode and message

is_ReleaseResources_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

ReleaseResources(argin) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes ReleaseResources command on subarray device

Returns:

ResultCode and message

is_ReleaseAllResources_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

ReleaseAllResources() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes ReleaseAllResources command on subarray device

Returns:

ResultCode, message

Return type:

tuple

is_Configure_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

Configure(argin: str) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes Configure command on subarray devices

Returns:

ResultCode, message

Return type:

tuple

is_Scan_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

Scan(argin: str) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes Scan command on subarray devices.

Returns:

ResultCode, message

Return type:

tuple

is_EndScan_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

EndScan() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes EndScan command on subarray devices.

Returns:

ResultCode, message

Return type:

tuple

is_End_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

End() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes End command on subarray devices.

Returns:

ResultCode, message

Return type:

tuple

is_ObsReset_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

ObsReset() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

ObsReset Command

Returns:

ResultCode and message

is_Abort_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

Abort() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes Abort command on subarray devices.

Returns:

ResultCode, message

Return type:

tuple

is_SetAdminMode_allowed() bool

This method checks if SetAdminMode command is allowed in the current device state.

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

SetAdminMode(argin) Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This is the method to invoke SetAdminMode command.

Returns:

ResultCode, message

Return type:

tuple

is_Restart_allowed() bool

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

Returns:

True if the command is allowed

Return type:

bool

Raises:

CommandNotAllowed – command is not allowed

Restart() Tuple[List[ska_tango_base.commands.ResultCode], List[str]]

This method invokes Restart command on subarray devices

Returns:

ResultCode, message

Return type:

tuple