Subrack device to hardware

The subrack Tango device controls a subrack management board (SMB), which in turn monitors and controls a SPS subrack. This turns on and off individual TPM boards, monitors TPM supply voltages, currents and temperatures, and manages cooling fans.

The SMB is controlled by a ARM microcontroller and a standalone program. The subrack Tango device operates in the MCCS cluster, and communicates with the microcontroller to execute Tango functions.

The subrack has 8 bays, numbered from 1 to 8, which host up to 8 TMB. All attributes related to bays (TMB) return a tuple of 8 elements, with element 0 corresponding to bay 1. Use of 1-based indexes for bays has been chosen to be more understandable by a human operator.

Remote hardware web interface

The subrack device communicates with the actual hardware using a web based interface. The interface is implemented by the WebHardwareClient, with the protocol implemented by the HardwareClient class.

This class interfaces with a remote hardware. It has 4 main methods: * connect() checks the connection status or reopens it. It returns True if the connection can be established. * get_attribute(attributeName) retrieves the current value of a hardware attribute * set_attribute(attributeName, value) sets the current value of a hardware attribute * execute_command(commandName, parameters) executes a command on the hardware, with the provided optional parameters

The attribute and command methods return a dictionary, with the return value and status.

Attributes are retrieved instantly (in less than 1 second) and are synchronous. Commands may be synchronous (short execution time) or asynchronous, if they require a longer time to execute. Each command is defined to be always synchronous or asynchronous. Asynchronous commands block the hardware until completion, i.e. all further requests are denied. Special commands are used to check for command completion or to abort it.

Attribute query example

participant "Initiator" as Initiator
participant "Subrack\nDevice" as Subrack_dv
participant "Subrack\nDriver" as Subrack_drv
participant "Hardware\nServer" as Hw_server
participant "Subrack\nServer" as Subrack

Initiator -> Subrack_dv: get_attribute("TpmCurrents")
Subrack_dv -> Subrack_drv: tpm_currents()
Subrack_drv -> Hw_server: read_attribute("tpm_currents")
Hw_server -> Subrack: '...?type=getattribute&param=tpm_currents'
Subrack -> Hw_server: '{...attribute:"tpm_currents",value=[1.0...]}'
Hw_server -> Subrack_drv: {...attribute:"tpm_currents",value=[1.0...]}
Subrack_drv -> Subrack_dv: [1.0, ...]
Subrack_dv -> Initiator: (1.0, ..)

An attribute read operation translates to a specific method in the SubrackDriver object, which queries the WebHardwareClient object. It sends a html query to the subrack management board, which replies with a json formatted dictionary. The dictionary contains the returned value (scalar or list) which is translated to the required attribute value by the Tango device.

Power on a TPM

participant "Tile" as Tile
participant "Initiator" as Initiator
participant "Subrack\nDevice" as Subrack_dv
participant "Subrack\nDriver" as Subrack_drv
participant "Hardware\nServer" as Hw_server
participant "Subrack\nServer" as Subrack

Tile -> Subrack_dv: subscribe_event()
Initiator -> Subrack_dv: command_inout("TurnOnTpm",1)
Subrack_dv -> Subrack_drv: turn_on_tpm(1)
Subrack_drv -> Hw_server: execute_command("turn_on_tpm",1)
Hw_server -> Subrack: '...?type=command&param=turn_on_tpm&value=1'
Subrack -> Hw_server: '{...command:"turn_on_tpm",status=STARTED}'
Hw_server -> Subrack_drv: {...command:"turn_on_tpm",status=STARTED]}
Subrack_drv -> Hw_server: execute_command("command_completed")
Hw_server -> Subrack: '...?type=command&param=command_completed'
Subrack -> Hw_server: '{...command:"command_completed",retvalue=true}'
Hw_server -> Subrack_drv: {...command:"command_completed",retvalue=True}
Subrack_drv -> Subrack_dv: True
Subrack_dv -> Subrack_drv: are_tpms_on()
Subrack_drv -> Hw_server: read_attribute("are_tpms_on")
Hw_server -> Subrack: '...?type=getattribute&param=are_tpms_on'
Subrack -> Hw_server: '{...attribute:"are_tpms_on",value=[true, ...]}'
Hw_server -> Subrack_drv: {...attribute:"tpm_currents",value=[True, ...]}
Subrack_drv -> Subrack_dv: [True, ...]
Subrack_drv -> Tile: _subrack_power_changed()
Subrack_dv -> Initiator: True

A command to power on a TPM is more complex. The command is not completed instantaneously, so the driver polls every second whether the command has completed. When this happens, the Tango device queries the TPM On status, and if a change is detected, generates an event. The Tile devices subscribe to this event, in order to change their status accordingly.