Helper_SDP_Subarray
Helper device for SdpSubarray device
- class ska_tmc_simulators.helper_sdp_subarray.HelperSdpSubarray(*args: Any, **kwargs: Any)
Bases:
HelperSubArrayDeviceA helper SdpSubarray device for triggering state changes with a command. It can be used to mock SdpSubarray’s bahavior to test error propagation from SdpSubarray to SdpSubarrayLeafNode in case of command failure
- InitCommand = None
- init_device()
- lrcProtocolVersions() tuple[int, int]
Return supported protocol versions.
- Returns:
A tuple containing the lower and upper bounds of supported long running command protocol versions.
- read_delay() int
This method is used to read the attribute value for delay.
- Returns:
delay
- SetDirectreceiveAddresses(argin: str) None
Set the receivedAddresses
- read_receiveAddresses()
Returns receive addresses.
- Returns:
receiveAddresses
- read_defective() str
Returns defective status of devices
- Returns:
defective parameters
- Return type:
str
- check_and_raise_defective_error(command_name: str, initial_obstate: int) None
Checks if the device is set to defective and raises an error accordingly.
If the device is defective, it updates the observation state based on the fault type and raises a Tango exception with the configured error message.
- Args:
command_name (str): The name of the command being executed. initial_obstate (ObsState): The initial observation state before the command execution.
- Raises:
DevFailed: If the device is marked defective.
- execute_On()
This method simulates On command on SDP Subarray
- execute_Off()
This method simulates OFF command on SDP Subarray
- AssignResources(argin)
This method simulates AssignResources command on SdpSubarray device.
- Raises:
throw_exception – when input json is wrong
- update_receive_addresses(assign_resources: dict, receive_addresses: dict) dict
Update the receive addresses with scan types from AssignResources command input.
- Parameters:
assign_resources – The AssignResources command input as a dict.
receive_addresses – The receive addresses as a dict.
- Raises:
ValueError – if receive_addresses is empty
- Returns:
The updated receive addresses as a dict.
- ReleaseResources()
This method invokes ReleaseResources command on SdpSubarray device.
- ReleaseAllResources()
This method invokes ReleaseAllResources command on SdpSubarray device.
- Configure(argin)
This method invokes Configure command on SdpSubarray device.
- Raises:
throw_exception – when input json is wrong
- Scan(argin)
This method invokes Scan command on SdpSubarray device.
- Raises:
throw_exception – when input json is wrong
- EndScan()
This method invokes EndScan command on SdpSubarray device.
- End()
This method invokes End command on SdpSubarray device.
- Abort()
This method invokes Abort command on SdpSubarray device.
- Restart()
This method invokes Restart command on SdpSubarray device.
- induce_fault()
Induces a fault into the device based on the given parameters.
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 where an exception will be raised when command invoked with induce fault.
- Raises:
throw_exception – Raises error to mimic the real device behavior.