Subrack subpackage
This subpackage implements subrack functionality for the MCCS.
- class FanMode(value)
Python enumerated type for
FanMode
attribute.- MANUAL = 0
Tango Device accepts commands from all clients.
- 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.
- PowerDownTpms()
Power down all TPMs.
- PowerOffTpm(argin)
Power down a TPM.
- PowerOnTpm(argin)
Power up a TPM.
- PowerUpTpms()
Power up all TPMs.
- 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:
- 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:
- 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:
- 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.
- 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.
- boardCurrent()
Handle a Tango attribute read of subrack management board current.
Total current provided by the two power supplies.
- boardTemperatures()
Handle a Tango attribute read of the subrack board temperature.
Two values are returned.
- create_component_manager()
Create and return a component manager for this device.
- Return type:
- Returns:
a component manager for this device.
- healthModelParams(argin)
Set the params for health transition rules.
- init_device()
Initialise the device.
This is overridden here to change the Tango serialisation model.
- Return type:
- powerSupplyCurrents()
Handle a Tango attribute read of the power supply currents.
- powerSupplyFanSpeeds()
Handle a Tango attribute read of the power supply fan speeds.
Values expressed in percent of maximum.
- powerSupplyPowers()
Handle a Tango attribute read of the power supply powers.
- powerSupplyVoltages()
Handle a Tango attribute read of the power supply voltages.
- subrackFanModes()
Handle a Tango attribute read of the subrack fan modes.
- subrackFanSpeeds()
Handle a Tango attribute read of the subrack fan speeds, in RPM.
- 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.
- tpm1PowerState()
Handle a Tango attribute read of the power state of TPM 1.
- Return type:
- Returns:
the power state of TPM 1.
- tpm2PowerState()
Handle a Tango attribute read of the power state of TPM 2.
- Return type:
- Returns:
the power state of TPM 2.
- tpm3PowerState()
Handle a Tango attribute read of the power state of TPM 3.
- Return type:
- Returns:
the power state of TPM 3.
- tpm4PowerState()
Handle a Tango attribute read of the power state of TPM 4.
- Return type:
- Returns:
the power state of TPM 4.
- tpm5PowerState()
Handle a Tango attribute read of the power state of TPM 5.
- Return type:
- Returns:
the power state of TPM 5.
- tpm6PowerState()
Handle a Tango attribute read of the power state of TPM 6.
- Return type:
- Returns:
the power state of TPM 6.
- tpm7PowerState()
Handle a Tango attribute read of the power state of TPM 7.
- Return type:
- Returns:
the power state of TPM 7.
- tpm8PowerState()
Handle a Tango attribute read of the power state of TPM 8.
- Return type:
- Returns:
the power state of TPM 8.
- tpmCount()
Handle a Tango attribute read of TPM count.
- Return type:
- 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.
- tpmPowers()
Handle a Tango attribute read of the TPM powers.
- tpmPresent()
Handle a Tango attribute read of which TPMs are present in the subrack.
- class SubrackComponentManager(subrack_ip, subrack_port, logger, communication_state_changed_callback, component_state_changed_callback, update_rate=5.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, communication_state_changed_callback, component_state_changed_callback, update_rate=5.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 subracksubrack_port (
int
) – the subrack portlogger (
Logger
) – a logger for this object to usecommunication_state_changed_callback (
Callable
[[CommunicationStatus
],None
]) – callback to be called when the status of the communications channel between the component manager and its component changescomponent_state_changed_callback (
Callable
[...
,None
]) – callback to be called when the component state changesupdate_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)._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.
- set_power_supply_fan_speed(fan_number, speed, task_callback=None)
Set the target speed of a power supply fan.
- Parameters:
- Return type:
- 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:
- Return type:
- 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:
- Return type:
- Returns:
the task status and a human-readable status message
- turn_off_tpm(tpm_number, task_callback=None)
Turn a TPM off.
- turn_off_tpms(task_callback=None)
Turn all TPMs off.
- turn_on_tpm(tpm_number, task_callback=None)
Turn a TPM on.
- class SubrackData
This class contain data/facts about a subrack that are needed by multiple classes.
For example, the fact that a subrack contains 8 TPM bays is something that a subrack driver may need to know, a subrack Tango device may need to know, and a subrack simulator certainly needs to know. So rather than store this fact in three separate places, we store it here.
- MAX_SUBRACK_FAN_SPEED = 8000.0
The maximum fan speed for the subrack.
- TPM_BAY_COUNT = 8
The number of TPM bays (some bays may be empty)
- class SubrackDriver(host, port, logger, communication_state_callback, component_state_callback, update_rate=5.0)
A component manager for the PSI-Low subrack.
- __init__(host, port, logger, communication_state_callback, component_state_callback, update_rate=5.0)
Initialise a new instance.
- Parameters:
host (
str
) – the host name or IP address of the subrack management board.port (
int
) – the port of the subrack management board.logger (
Logger
) – a logger for this component manager to use for loggingcommunication_state_callback (
Callable
) – callback to be called when the status of communications between the component manager and its component changes.component_state_callback (
Callable
) – callback to be called when the state of the component 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).
- get_request()
Return the reads, writes and commands to be executed in the next poll.
- Return type:
- Returns:
reads, writes and commands to be executed in the next poll.
- off(task_callback=None)
Turn the component off.
- Parameters:
task_callback (
Optional
[Callable
]) – callback to be called when the status of the command changes- Raises:
NotImplementedError – because this command is not yet implemented
- Return type:
- on(task_callback=None)
Turn the component on.
- Parameters:
task_callback (
Optional
[Callable
]) – callback to be called when the status of the command changes- Raises:
NotImplementedError – because this command is not yet implemented
- Return type:
- poll(poll_request)
Poll the hardware.
Connect to the hardware, write any values that are to be written, and then read all values.
- Parameters:
poll_request (
HttpPollRequest
) – specification of the reads and writes to be performed in this poll.- Raises:
ConnectionError – if an error is raised from the lower layer
- Return type:
- Returns:
responses to queries in this poll
- poll_succeeded(poll_response)
Handle the receipt of new polling values.
This is a hook called by the poller when values have been read during a poll.
- Parameters:
poll_response (
HttpPollResponse
) – response to the pool, including any values read.- Return type:
- polling_stopped()
Respond to polling having stopped.
This is a hook called by the poller when it stops polling.
- Return type:
- reset(task_callback=None)
Reset the component (from fault state).
- Parameters:
task_callback (
Optional
[Callable
]) – callback to be called when the status of the command changes- Raises:
NotImplementedError – because this command is not yet implemented
- Return type:
- set_power_supply_fan_speed(fan_number, speed, task_callback=None)
Set the target speed of a power supply fan.
- Parameters:
- Return type:
- 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:
- Return type:
- 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:
- Return type:
- Returns:
the task status and a human-readable status message
- standby(task_callback=None)
Put the component into low-power standby mode.
- Parameters:
task_callback (
Optional
[Callable
]) – callback to be called when the status of the command changes- Raises:
NotImplementedError – because this command is not yet implemented
- Return type:
- turn_off_tpm(tpm_number, task_callback=None)
Turn a TPM off.
- turn_off_tpms(task_callback=None)
Turn all TPMs off.
- turn_on_tpm(tpm_number, task_callback=None)
Turn a TPM on.
- turn_on_tpms(task_callback=None)
Turn all TPMs on.
- write_attribute(**kwargs)
Update subrack attribute value(s).
This doesn’t actually immediately write to the subrack. It only stores the details of the requested write where it will be picked up by the next iteration of the polling loop.
- class SubrackHealthModel(component_state_changed_callback, thresholds=None)
A health model for a subrack.
- __init__(component_state_changed_callback, thresholds=None)
Initialise a new instance.
- Parameters:
component_state_changed_callback (
HealthChangedCallbackProtocol
) – callback to be called whenever there is a change to this this health model’s evaluated health state.thresholds (
Optional
[dict
[str
,Any
]]) – Thresholds for the subrack device.
- evaluate_health()
Compute overall health of the subrack.
The overall health is based on the fault and communication status of the subrack overall, together with the health of the tpms that it manages.
This implementation simply sets the health of the subrack to the health of its least healthy component.
- Return type:
- Returns:
an overall health of the subrack
- class SubrackSimulator(**kwargs)
A simple simulator of a subrack management board web server.
- class AttributeMetadataType
Type for attribute metadata dictionary.
- __init__(**kwargs)
Initialise a new instance.
- Parameters:
kwargs (
Any
) – initial values, different from the defaults, that the simulator should take.- Raises:
AttributeError – if kwargs refer to an non-existent attribute.
- execute_command(name, argument)
Execute a command on the subrack hardware/simulator.
It works by checking for a method named f”_{name}”; that is, if the command name is “turn_on_tpms”, then it checks for a method named “_turn_on_tpms”. If it finds such a method, it calls it with the provided argument, and returns the return value.
Otherwise, it checks for a method named f”_async_{name}; for example, “_async_turn_on_tpms”. If it finds such a method, it simulates a long running command by returning “STARTED”, then letting a little time pass, then invoking the method.
- Parameters:
- Return type:
- Returns:
the return value. For synchronous commands, this is the returned value of the fully executed command. For asynchronous commands, this is the string “STARTED” or “FAILED”.
- Raises:
AttributeError – if the command method does not exist in the simulator.
- get_attribute(name)
Return the value of a simulator attribute.
- set_attribute(name, value)
Set the value of a simulator attribute.
- HTTP stack
- Subrack API
- Subrack component manager
SubrackComponentManager
SubrackComponentManager.__init__()
SubrackComponentManager.set_power_supply_fan_speed()
SubrackComponentManager.set_subrack_fan_mode()
SubrackComponentManager.set_subrack_fan_speed()
SubrackComponentManager.turn_off_tpm()
SubrackComponentManager.turn_off_tpms()
SubrackComponentManager.turn_on_tpm()
SubrackComponentManager.turn_on_tpms()
- Subrack data
- Subrack device
MccsSubrack
MccsSubrack.InitCommand
MccsSubrack.PowerDownTpms()
MccsSubrack.PowerOffTpm()
MccsSubrack.PowerOnTpm()
MccsSubrack.PowerUpTpms()
MccsSubrack.SetPowerSupplyFanSpeed()
MccsSubrack.SetSubrackFanMode()
MccsSubrack.SetSubrackFanSpeed()
MccsSubrack.__init__()
MccsSubrack.backplaneTemperatures()
MccsSubrack.boardCurrent()
MccsSubrack.boardTemperatures()
MccsSubrack.create_component_manager()
MccsSubrack.healthModelParams()
MccsSubrack.init_command_objects()
MccsSubrack.init_device()
MccsSubrack.powerSupplyCurrents()
MccsSubrack.powerSupplyFanSpeeds()
MccsSubrack.powerSupplyPowers()
MccsSubrack.powerSupplyVoltages()
MccsSubrack.subrackFanModes()
MccsSubrack.subrackFanSpeeds()
MccsSubrack.subrackFanSpeedsPercent()
MccsSubrack.tpm1PowerState()
MccsSubrack.tpm2PowerState()
MccsSubrack.tpm3PowerState()
MccsSubrack.tpm4PowerState()
MccsSubrack.tpm5PowerState()
MccsSubrack.tpm6PowerState()
MccsSubrack.tpm7PowerState()
MccsSubrack.tpm8PowerState()
MccsSubrack.tpmCount()
MccsSubrack.tpmCurrents()
MccsSubrack.tpmPowers()
MccsSubrack.tpmPresent()
MccsSubrack.tpmVoltages()
SetPowerSupplyFanSpeedCommand
SetSubrackFanModeCommand
SetSubrackFanSpeedCommand
main()
- Subrack driver
SubrackDriver
SubrackDriver.__init__()
SubrackDriver.get_request()
SubrackDriver.off()
SubrackDriver.on()
SubrackDriver.poll()
SubrackDriver.poll_succeeded()
SubrackDriver.polling_stopped()
SubrackDriver.reset()
SubrackDriver.set_power_supply_fan_speed()
SubrackDriver.set_subrack_fan_mode()
SubrackDriver.set_subrack_fan_speed()
SubrackDriver.standby()
SubrackDriver.turn_off_tpm()
SubrackDriver.turn_off_tpms()
SubrackDriver.turn_on_tpm()
SubrackDriver.turn_on_tpms()
SubrackDriver.write_attribute()
- Subrack health model
- Subrack health rules
- Subrack simulator server
- Subrack simulator