Subrack Device

@startuml

class MccsSubrack {
  +SubrackIp
  +SubrackPort
  +TileFQDNs
  -_are_tpms_on
  -_health_state
  +hardware_manager
  +IsTpmOn()
  +PowerDownTpms()
  +PowerOffTpm()
  +PowerOnTpm()
  +PowerUpTpms()
  +SetPowerSupplyFanSpeed()
  +SetSubrackFanMode()
  +SetSubrackFanSpeed()
  -_update_health_state()
  +always_executed_hook()
  +areTpmsOn()
  +are_tpms_on_changed()
  +backplaneTemperatures()
  +boardCurrent()
  +boardTemperatures()
  +delete_device()
  +health_changed()
  +init_command_objects()
  +init_device()
  +is_IsTpmOn_allowed()
  +is_PowerDownTpms_allowed()
  +is_PowerOffTpm_allowed()
  +is_PowerOnTpm_allowed()
  +is_PowerUpTpms_allowed()
  +powerSupplyCurrents()
  +powerSupplyFanSpeeds()
  +powerSupplyPowers()
  +powerSupplyVoltages()
  +simulationMode()
  +subrackFanMode()
  +subrackFanSpeeds()
  +subrackFanSpeedsPercent()
  +tpmCount()
  +tpmCurrents()
  +tpmPowers()
  +tpmPresent()
  +tpmSupplyFault()
  +tpmTemperatures()
  +tpmVoltages()
}

class SKABaseDevice {


}

class SubrackHardwareManager {
  -_are_tpms_on
  -_are_tpms_on_change_callback
  +backplane_temperatures
  +bay_count
  +board_current
  +board_temperatures
  +power_supply_currents
  +power_supply_fan_speeds
  +power_supply_powers
  +power_supply_voltages
  +subrack_fan_modes
  +subrack_fan_speeds
  +subrack_fan_speeds_percent
  +tpm_count
  +tpm_currents
  +tpm_powers
  +tpm_present
  +tpm_supply_fault
  +tpm_temperatures
  +tpm_voltages
  +__init__()
  -_connect()
  -_update_are_tpms_on()
  +are_tpms_on()
  +connect()
  +is_tpm_on()
  +poll()
  +set_power_supply_fan_speed()
  +set_subrack_fan_modes()
  +set_subrack_fan_speed()
  +turn_off_tpm()
  +turn_off_tpms()
  +turn_on_tpm()
  +turn_on_tpms()
}

class SimulableHardwareManager {


}

class OnOffHardwareManager {


}

class SubrackHardwareFactory {
  -_logger
  -_subrack_ip
  -_subrack_port
  -_tpm_count
  +__init__()
  -_create_driver()
  -_create_static_simulator()
}

class SimulableHardwareFactory {


}
SKABaseDevice <|-- MccsSubrack
SimulableHardwareManager <|-- SubrackHardwareManager
OnOffHardwareManager <|-- SubrackHardwareManager
SimulableHardwareFactory <|-- SubrackHardwareFactory

@enduml

This module provides a Tango device for a PSI-Low subrack.

class MccsSubrack(*args, **kwargs)

A Tango device for monitor and control of the PSI-Low subrack.

class InitCommand(*args, **kwargs)

Initialisation command class for this base device.

do(*args, **kwargs)

Initialise the attributes of this MccsSubrack.

Parameters:
  • args (Any) – additional positional arguments; unused here

  • kwargs (Any) – additional keyword arguments; unused here

Return type:

tuple[ResultCode, str]

Returns:

a resultcode, message tuple

PowerDownTpms()

Power down all TPMs.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

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

PowerOffTpm(argin)

Power down a TPM.

Parameters:

argin (int) – the logical id of the TPM to power down

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

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

PowerOnTpm(argin)

Power up a TPM.

Parameters:

argin (int) – the logical id of the TPM to power up

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

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

PowerUpTpms()

Power up all TPMs.

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

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

SetPowerSupplyFanSpeed(argin)

Set the selected power supply fan speed.

Parameters:

argin (str) –

json dictionary with mandatory keywords

  • power_supply_id (int) power supply id from 1 to 2

  • speed_percent - (float) fan speed in percent

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

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

SetSubrackFanMode(argin)

Set the selected subrack backplane fan mode.

Parameters:

argin (str) –

json dictionary with mandatory keywords

  • fan_id (int) fan id from 1 to 4

  • mode - (int) mode: 1=MANUAL, 2=AUTO

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

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

SetSubrackFanSpeed(argin)

Set the selected subrack backplane fan speed.

Parameters:

argin (str) –

json dictionary with mandatory keywords

  • subrack_fan_id (int) fan id from 1 to 4

  • speed_percent - (float) fan speed in percent

Return type:

tuple[list[ResultCode], list[Optional[str]]]

Returns:

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

__init__(*args, **kwargs)

Initialise this device object.

Parameters:
  • args (Any) – positional args to the init

  • kwargs (Any) – keyword args to the init

backplaneTemperatures()

Handle a Tango attribute read of the subrack backplane temperature.

Two values are returned, respectively for the first (bays 1-4) and second (bays 5-8) halves of the backplane.

Return type:

list[float]

Returns:

the backplane temperatures. When communication with the subrack is not established, this returns an empty list.

boardCurrent()

Handle a Tango attribute read of subrack management board current.

Total current provided by the two power supplies.

Return type:

list[float]

Returns:

total board current, in a list of length 1. When communication with the subrack is not established, this returns an empty list.

boardTemperatures()

Handle a Tango attribute read of the subrack board temperature.

Two values are returned.

Return type:

list[float]

Returns:

the board temperatures. When communication with the subrack is not established, this returns an empty list.

create_component_manager()

Create and return a component manager for this device.

Return type:

SubrackComponentManager

Returns:

a component manager for this device.

healthModelParams(argin)

Set the params for health transition rules.

Parameters:

argin (str) – JSON-string of dictionary of health states

Return type:

None

init_command_objects()

Initialise the command handlers for this device.

Return type:

None

init_device()

Initialise the device.

This is overridden here to change the Tango serialisation model.

Return type:

None

powerSupplyCurrents()

Handle a Tango attribute read of the power supply currents.

Return type:

list[float]

Returns:

the power supply currents. When communication with the subrack is not established, this returns an empty list.

powerSupplyFanSpeeds()

Handle a Tango attribute read of the power supply fan speeds.

Values expressed in percent of maximum.

Return type:

list[float]

Returns:

the power supply fan speeds. When communication with the subrack is not established, this returns an empty list.

powerSupplyPowers()

Handle a Tango attribute read of the power supply powers.

Return type:

list[float]

Returns:

the power supply powers. When communication with the subrack is not established, this returns an empty list.

powerSupplyVoltages()

Handle a Tango attribute read of the power supply voltages.

Return type:

list[float]

Returns:

the power supply voltages. When communication with the subrack is not established, this returns an empty list.

subrackFanModes()

Handle a Tango attribute read of the subrack fan modes.

Return type:

list[int]

Returns:

the subrack fan modes. When communication with the subrack is not established, this returns an empty list.

subrackFanSpeeds()

Handle a Tango attribute read of the subrack fan speeds, in RPM.

Return type:

list[float]

Returns:

the subrack fan speeds. When communication with the subrack is not established, this returns an empty list.

subrackFanSpeedsPercent()

Handle a Tango attribute read of the subrack fan speeds, in percent.

This is the commanded setpoint; the relation between this level and the actual RPMs is not linear. Subrack speed is managed automatically by the controller, by default (see subrack_fan_mode).

Commanded speed is the same for fans 1-2 and 3-4.

Return type:

list[float]

Returns:

the subrack fan speed setpoints in percent. When communication with the subrack is not established, this returns an empty list.

tpm1PowerState()

Handle a Tango attribute read of the power state of TPM 1.

Return type:

PowerState

Returns:

the power state of TPM 1.

tpm2PowerState()

Handle a Tango attribute read of the power state of TPM 2.

Return type:

PowerState

Returns:

the power state of TPM 2.

tpm3PowerState()

Handle a Tango attribute read of the power state of TPM 3.

Return type:

PowerState

Returns:

the power state of TPM 3.

tpm4PowerState()

Handle a Tango attribute read of the power state of TPM 4.

Return type:

PowerState

Returns:

the power state of TPM 4.

tpm5PowerState()

Handle a Tango attribute read of the power state of TPM 5.

Return type:

PowerState

Returns:

the power state of TPM 5.

tpm6PowerState()

Handle a Tango attribute read of the power state of TPM 6.

Return type:

PowerState

Returns:

the power state of TPM 6.

tpm7PowerState()

Handle a Tango attribute read of the power state of TPM 7.

Return type:

PowerState

Returns:

the power state of TPM 7.

tpm8PowerState()

Handle a Tango attribute read of the power state of TPM 8.

Return type:

PowerState

Returns:

the power state of TPM 8.

tpmCount()

Handle a Tango attribute read of TPM count.

Return type:

int

Returns:

the number of TPMs present in the subrack. When communication with the subrack is not established, this returns 0.

tpmCurrents()

Handle a Tango attribute read of the TPM currents.

Return type:

list[float]

Returns:

the TPM currents. When communication with the subrack is not established, this returns an empty list.

tpmPowers()

Handle a Tango attribute read of the TPM powers.

Return type:

list[float]

Returns:

the TPM powers. When communication with the subrack is not established, this returns an empty list.

tpmPresent()

Handle a Tango attribute read of which TPMs are present in the subrack.

Return type:

list[bool]

Returns:

whether a TPM is present in each bay. When communication with the subrack is not established, this returns an empty list.

tpmVoltages()

Handle a Tango attribute read of the TPM voltages.

Return type:

list[float]

Returns:

the TPM voltages

class SetPowerSupplyFanSpeedCommand(command_tracker, component_manager, logger=None)

Class for handling the SetPowerSupplyFanSpeed command.

This command set the selected power supply fan speed.

This command takes as input a JSON string that conforms to the following schema:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsSubrack_SetPowerSupplyFanSpeed.json",
    "title": "MccsSubrack SetPowerSupplyFanSpeed schema",
    "description": "Schema for MccsSubrack's SetPowerSupplyFanSpeed command",
    "type": "object",
    "properties": {
        "power_supply_fan_id": {
            "description": "ID of the power supply fan",
            "type": "integer",
            "minimum": 1,
            "maximum": 2
        },
        "speed_percent": {
            "description": "Fan speed in percent",
            "type": "number",
            "minimum": 0.0,
            "maximum": 100.0
        }
    },
    "required": ["power_supply_fan_id", "speed_percent"]
}
__init__(command_tracker, component_manager, logger=None)

Initialise a new instance.

Parameters:
  • command_tracker (CommandTrackerProtocol) – the device’s command tracker

  • component_manager (BaseComponentManager) – the component manager on which this command acts.

  • logger (Optional[Logger]) – a logger for this command to use.

do(*args, power_supply_fan_id, speed_percent, **kwargs)

Implement MccsSubrack.SetPowerSupplyFanSpeed() command.

Parameters:
  • args (Any) – unspecified positional arguments. This should be empty and is provided for typehinting purposes only.

  • power_supply_fan_id (int) – id of the power supply (1 or 2).

  • speed_percent (float) – fan speed in percent

  • kwargs (Any) – unspecified keyword arguments. This should be empty and is provided for typehinting purposes only.

Return type:

tuple[ResultCode, str]

Returns:

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

class SetSubrackFanModeCommand(command_tracker, component_manager, logger=None)

Class for handling the SetSubrackFanMode command.

This command set the selected subrack fan mode.

This command takes as input a JSON string that conforms to the following schema:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsSubrack_SetSubrackFanMode.json",
    "title": "MccsSubrack SetSubrackFanMode schema",
    "description": "Schema for MccsSubrack's SetSubrackFanMode command",
    "type": "object",
    "properties": {
        "fan_id": {
            "description": "ID of the subrack fan",
            "type": "integer",
            "minimum": 1,
            "maximum": 4
        },
        "mode": {
            "description": "Fan mode: 0 means MANUAL, 1 means AUTO",
            "type": "integer",
            "minimum": 0,
            "maximum": 1
        }
    },
    "required": ["fan_id", "mode"]
}
__init__(command_tracker, component_manager, logger=None)

Initialise a new instance.

Parameters:
  • command_tracker (CommandTrackerProtocol) – the device’s command tracker

  • component_manager (BaseComponentManager) – the component manager on which this command acts.

  • logger (Optional[Logger]) – a logger for this command to use.

do(*args, fan_id, mode, **kwargs)

Implement MccsSubrack.SetSubrackFanMode() command.

Parameters:
  • args (Any) – unspecified positional arguments. This should be empty and is provided for typehinting purposes only.

  • fan_id (int) – id of the subrack (1-4).

  • mode (int) – fan mode

  • kwargs (Any) – unspecified keyword arguments. This should be empty and is provided for typehinting purposes only.

Return type:

tuple[ResultCode, str]

Returns:

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

class SetSubrackFanSpeedCommand(command_tracker, component_manager, fan_speed_set, logger=None)

Class for handling the SetSubrackFanSpeed command.

This command sets the selected subrack fan speed.

This command takes as input a JSON string that conforms to the following schema:

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsSubrack_SetSubrackFanSpeed.json",
    "title": "MccsSubrack SetSubrackFanSpeed schema",
    "description": "Schema for MccsSubrack's SetSubrackFanSpeed command",
    "type": "object",
    "properties": {
        "subrack_fan_id": {
            "description": "ID of the subrack fan",
            "type": "integer",
            "minimum": 1,
            "maximum": 4
        },
        "speed_percent": {
            "description": "Fan speed in percent",
            "type": "number",
            "minimum": 0.0,
            "maximum": 100.0
        }
    },
    "required": ["subrack_fan_id", "speed_percent"]
}
__init__(command_tracker, component_manager, fan_speed_set, logger=None)

Initialise a new instance.

Parameters:
  • command_tracker (CommandTrackerProtocol) – the device’s command tracker

  • component_manager (BaseComponentManager) – the component manager on which this command acts.

  • fan_speed_set (Callable) – callback to be called when fan speed is set.

  • logger (Optional[Logger]) – a logger for this command to use.

do(*args, subrack_fan_id, speed_percent, **kwargs)

Implement MccsSubrack.SetSubrackFanSpeed() command.

Parameters:
  • args (Any) – unspecified positional arguments. This should be empty and is provided for typehinting purposes only.

  • subrack_fan_id (int) – id of the subrack (1-4).

  • speed_percent (float) – fan speed in percent

  • kwargs (Any) – unspecified keyword arguments. This should be empty and is provided for typehinting purposes only.

Return type:

tuple[ResultCode, str]

Returns:

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

main(*args, **kwargs)

Launch an MccsSubrack Tango device server instance.

Parameters:
  • args (str) – positional arguments, passed to the Tango device

  • kwargs (str) – keyword arguments, passed to the sever

Return type:

int

Returns:

the Tango server exit code