ska_oso_scripting.functions.devicecontrol

The ska_oso_scripting.functions.devicecontrol module contains code that controls SKA Tango devices, translating from the Tango-free ‘science domain’ objects to the Tango-required control system domain.

ska_oso_scripting.functions.devicecontrol.assign_resources_from_file(subarray_id: int, request_path: str, with_processing: bool = True, timeout: float | None = None)

Allocate resources to a sub-array using a JSON file.

Parameters:
  • subarray_id – the ID of the sub-array to control

  • request_path – JSON file path

  • with_processing – False if JSON should be passed through to CentralNode directly without any validation or processing

  • timeout – custom timeout provided while execution of assign resource command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

ska_oso_scripting.functions.devicecontrol.assign_resources_from_cdm(subarray_id: int, request: ska_tmc_cdm.messages.central_node.assign_resources.AssignResourcesRequest, timeout: float | None = None)

Allocate resources to a sub-array using a CDM object.

Parameters:
  • subarray_id – the id of the sub-array to allocate the resources

  • request – the CDM AssignResourcesRequest object

  • timeout – custom timeout provided while execution of assign resource command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

ska_oso_scripting.functions.devicecontrol.assign_resources_from_json(subarray_id: int, request: str, with_processing: bool = True, timeout: float | None = None)

Allocate resources to a sub-array using a JSON string representation of AssignResources request. Validity of given JSON string will be checked by default unless with_processing is explicitly set to False. In this case the string will be passed directly to central node without any processing.

This function will block until the sub-array with the given ID has been allocated the resources and has transitioned to obsState IDLE.

Parameters:
  • subarray_id – the id of the sub-array to allocate the resources

  • request – the JSON string to AssignResources with

  • with_processing – False if JSON should be passed through to CentralNode directly without any validation or processing

  • timeout – custom timeout provided while execution of assign resource command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

ska_oso_scripting.functions.devicecontrol.release_all_resources(subarray_id: int, timeout: float | None = None)

Release resources on the sub-array with the given ID. If release_all is set to False, ReleaseResourcesRequest CDM object specified in request parameter will be sent to the sub-array. If release_all is set to True, the request will not be used.

This function blocks until resources have been released on the given sub-array and its obsState has transitioned to EMPTY.

Parameters:
  • subarray_id – the sub-array to control

  • timeout – custom timeout provided while execution of release resorce command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

ska_oso_scripting.functions.devicecontrol.release_resources(subarray_id: int, request: ska_tmc_cdm.messages.central_node.release_resources.ReleaseResourcesRequest, timeout: float | None = None)

Release resources on the sub-array with the given ID. If release_all is set to False, ReleaseResourcesRequest CDM object specified in request parameter will be sent to the sub-array. If release_all is set to True, the request will not be used.

This function blocks until resources have been released on the given sub-array and its obsState has transitioned to EMPTY.

Parameters:
  • subarray_id – the sub-array to control

  • request – CDM ReleaseResourcesRequest object specifying resources to release. Only required if release_all is False

  • timeout – custom timeout provided while execution of release resource command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

ska_oso_scripting.functions.devicecontrol.configure_from_file(subarray_id: int, request_path: str, with_processing: bool = True, timeout: float | None = None)

Load a CDM ConfigureRequest from disk and use it to perform sub-array configuration.

This function blocks until the sub-array is configured and has an obsState of READY.

JSON processing is disabled when with_processing is set to False.

Parameters:
  • subarray_id – the ID of the sub-array to configure

  • request_path – path to CDM file

  • with_processing – False if JSON should be passed through to SubArrayNode directly without any validation or processing

  • timeout – custom timeout provided while execution of scan command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

ska_oso_scripting.functions.devicecontrol.configure_from_cdm(subarray_id: int, request: ska_tmc_cdm.messages.subarray_node.configure.ConfigureRequest, timeout: float | None = None)

Configure a sub-array using the supplied CDM configuration.

This method does not make any changes to the configuration. It is the responsibility of the caller to ensure that all IDs, etc. are consistent.

Parameters:
  • subarray_id – the ID of the sub-array to configure

  • request – the CDM configuration to set custom timeout provided while execution of assign resource command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

ska_oso_scripting.functions.devicecontrol.scan(subarray_id: int, timeout: float | None = None)

Execute a scan.

Parameters:
  • subarray_id – the sub-array to control

  • timeout – custom timeout provided while execution of scan command if systems do not respond within reasonable timescales then method raised EventTimeoutError.

Returns:

the response from sending the command to configure sub-array

ska_oso_scripting.functions.devicecontrol.end(subarray_id: int)

Send the ‘end’ command to the SubArrayNode, marking the end of the current observation.

Parameters:

subarray_id – the subarray to command

Returns:

ska_oso_scripting.functions.devicecontrol.telescope_on()

Start up the telescope.

This command powers up Dishes that are currently in standby.

Returns:

ska_oso_scripting.functions.devicecontrol.telescope_off(final_state: tango.DevState = tango.DevState.STANDBY)

Instruct telescope devices to switch to STANDBY mode.

If expect_standby is True (default) then this function will wait for the telescope to reach STANDBY state. Otherwise, this function will wait for the OFF state to be reached.

Background: At the time of writing (PI15), CentralNode has new behaviour where it reports the aggregated state of the systems it controls. Hence. it is not yet clear which state CentralNode will reach when commanded to turn the telescope off, as this state could change dependning on what subsystems are connected to TMC. For instance, if CSP reports STANDBY, CentralNode will report STANDBY. If CSP was not present, CentralNode might report OFF.

Parameters:

final_state – Final Tango state to expect (default=STANDBY)

Returns:

ska_oso_scripting.functions.devicecontrol.abort(subarray_id: int)

Send the ‘abort’ command to the SubArrayNode, halt the subarray activity.

Parameters:

subarray_id – the subarray to command

Returns:

ska_oso_scripting.functions.devicecontrol.obsreset(subarray_id: int)

Send the ‘ObsReset’ command to the SubArrayNode, which resets the SubArrayNode state to IDLE.

Parameters:

subarray_id – the subarray to command

Returns:

ska_oso_scripting.functions.devicecontrol.restart(subarray_id: int)

Send the ‘restart’ command to the SubArrayNode which sets the SubArrayNode from ABORTED or FAULT state to EMPTY.

Parameters:

subarray_id – the subarray to command

Returns: