Subrack Component Manager

This module implements component management for subracks.

class SubrackComponentManager(subrack_ip, subrack_port, logger, pdu_trl, pdu_ports, power_marshaller_trl, simulated_pdu, communication_state_changed_callback, component_state_changed_callback, update_rate=5.0, command_update_rate=20.0, _driver=None, _initial_power_state=ska_control_model.PowerState.ON, _initial_fail=False)

A component manager for an subrack (simulator or driver) and its power supply.

__init__(subrack_ip, subrack_port, logger, pdu_trl, pdu_ports, power_marshaller_trl, simulated_pdu, communication_state_changed_callback, component_state_changed_callback, update_rate=5.0, command_update_rate=20.0, _driver=None, _initial_power_state=ska_control_model.PowerState.ON, _initial_fail=False)

Initialise a new instance.

Parameters:
  • subrack_ip (str) – the IP address of the subrack

  • subrack_port (int) – the subrack port

  • logger (Logger) – a logger for this object to use

  • pdu_trl (str) – trl for the pdu device

  • pdu_ports (list[int]) – the ports of the pdu that this subrack is plugged into

  • power_marshaller_trl (str) – trl for the power marshaller device

  • simulated_pdu (bool) – if we are using a simulated pdu or not

  • communication_state_changed_callback (Callable[[CommunicationStatus], None]) – callback to be called when the status of the communications channel between the component manager and its component changes

  • component_state_changed_callback (Callable[..., None]) – callback to be called when the component state changes

  • update_rate (float) – how often updates to attribute values should be provided. This is not necessarily the same as the rate at which the instrument is polled. For example, the instrument may be polled every 0.1 seconds, thus ensuring that any invoked commands or writes will be executed promptly. However, if the update_rate is 5.0, then routine reads of instrument values will only occur every 50th poll (i.e. every 5 seconds).

  • command_update_rate (float) – similar to update_rate but for polled commands such as get_health_status.

  • _driver (Optional[SubrackDriver]) – for testing only, we can inject a driver rather then letting the component manager create its own. If provided, this overrides driver-specific arguments such as the IP and port.

  • _initial_power_state (PowerState) – for testing only, we can set the initial power state of the simulated subrack power supply. If not provided, the default is ON, since all our current facilities with a real hardware subrack do not yet allow it to be powered on and off.

  • _initial_fail (bool) – for testing only, we can set the simulated subrack power supply to fail.

get_health_status(task_callback=None)

Read all the monitoring points available in health status.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

pdu_health_state()

Get PDU health.

Return type:

Optional[str]

Returns:

pdu health.

pdu_model()

Get PDU model type.

Return type:

Optional[str]

Returns:

pdu model type.

pdu_number_of_ports()

Get number of pdu ports .

Return type:

Optional[int]

Returns:

number of pdu ports

pdu_port_currents()

Get the currents for a pdu port.

Return type:

Optional[list[float]]

Returns:

pdu port currents.

pdu_port_states()

Get the states for a pdu port.

Return type:

Optional[list[int]]

Returns:

pdu port statuses.

pdu_port_voltages()

Get the voltages for a pdu port.

Return type:

Optional[list[float]]

Returns:

pdu port voltages.

power_pdu_port_off(port_number, task_callback=None, task_abort_event=None)

Turn a pdu port off.

Parameters:
  • port_number (int) – (one-based) number of the port to turn off.

  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

power_pdu_port_on(port_number, task_callback=None, task_abort_event=None)

Turn a pdu port on.

Parameters:
  • port_number (int) – (one-based) number of the port to turn on.

  • task_callback (Optional[Callable]) – Update task state, defaults to None

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

read_health_status()

Read all the monitoring points available in health status.

Return type:

dict

Returns:

monitoring points available in health status.

schedule_off(task_callback=None, task_abort_event=None)

Turn self off.

Parameters:
  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

schedule_on(task_callback=None, task_abort_event=None)

Schedule self on.

Parameters:
  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

  • task_abort_event (Optional[Event]) – Check for abort, defaults to None

Return type:

None

set_power_supply_fan_speed(fan_number, speed, task_callback=None)

Set the target speed of a power supply fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • speed (float) – speed setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

set_subrack_fan_mode(fan_number, mode, task_callback=None)

Set the target speed mode of a subrack fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • mode (FanMode) – speed mode setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

set_subrack_fan_speed(fan_number, speed, task_callback=None)

Set the target speed of a subrack fan.

Parameters:
  • fan_number (int) – one-based number of the fan to be set.

  • speed (float) – speed setting for the fan.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

start_communicating()

Establish communication with the subrack components.

Return type:

None

stop_communicating()

Break off communication with the subrack components.

Return type:

None

turn_off_tpm(tpm_number, task_callback=None)

Turn a TPM off.

Parameters:
  • tpm_number (int) – (one-based) number of the TPM to turn off.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_off_tpms(task_callback=None)

Turn all TPMs off.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_on_tpm(tpm_number, task_callback=None)

Turn a TPM on.

Parameters:
  • tpm_number (int) – (one-based) number of the TPM to turn on.

  • task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message

turn_on_tpms(task_callback=None)

Turn all TPMs on.

Parameters:

task_callback (Optional[Callable]) – callback to be called when the status of the command changes

Return type:

tuple[TaskStatus, str]

Returns:

the task status and a human-readable status message