PaSD bus device

This module implements the MCCS PaSD bus device.

class MccsPasdBus(*args, **kwargs)

An implementation of a PaSD bus Tango device for MCCS.

GetPasdDeviceSubscriptions(device_id)

Get subscriptions for a particular pasd device.

Parameters:

device_id (int) – the id of the device we want to get subscriptions for.

Return type:

list[str]

Returns:

The subscriptions for this device.

InitializeFndh()

Initialize an FNDH.

Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

InitializeSmartbox(smartbox_id)

Initialize a smartbox.

Parameters:

smartbox_id (int) – id of the smartbox being addressed.

Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

ResetFnccStatus()

Reset the FNCC status register.

Return type:

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

Returns:

A tuple containing a result code and a unique id to identify the command in the queue.

ResetFndhAlarms()

Reset the FNDH alarms register.

Return type:

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

Returns:

A tuple containing a result code and a unique id to identify the command in the queue.

ResetFndhWarnings()

Reset the FNDH warnings register.

Return type:

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

Returns:

A tuple containing a result code and a unique id to identify the command in the queue.

ResetSmartboxAlarms(smartbox_number)

Reset a Smartbox alarms register.

Parameters:

smartbox_number (int) – number of the smartbox to be addressed.

Return type:

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

Returns:

A tuple containing a result code and a unique id to identify the command in the queue.

ResetSmartboxPortBreaker(smartbox_number, port_number)

Reset a Smartbox’s port’s breaker.

Parameters:
  • smartbox_number (int) – number of the smartbox to be addressed.

  • port_number (int) – the number of the port whose breaker is

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsPasdBus_ResetSmartboxPortBreaker.json",
    "title": "MccsPasdBus ResetSmartboxPortBreaker schema",
    "description": "Schema for MccsPasdBus's ResetSmartboxPortBreaker command",
    "type": "object",
    "properties": {
        "smartbox_number": {
            "description": "Number of the smartbox being addressed",
            "type": "integer",
            "minimum": 1,
            "maximum": 24
        },
        "port_number": {
            "description": "Number of the port whose breaker is to be reset",
            "type": "integer",
            "minimum": 1,
            "maximum": 12
        }
    },
    "required": ["smartbox_number", "port_number"]
}
Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

ResetSmartboxWarnings(smartbox_number)

Reset a Smartbox warnings register.

Parameters:

smartbox_number (int) – number of the smartbox to be addressed

Return type:

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

Returns:

A tuple containing a result code and a unique id to identify the command in the queue.

SetFndhLedPattern(pattern)

Set the FNDH service LED pattern.

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsPasdBus_SetFndhLedPattern.json",
    "title": "MccsPasdBus SetFndhLedPattern schema",
    "description": "Schema for MccsPasdBus's SetFndhLedPattern command",
    "type": "object",
    "properties": {
        "pattern": {
            "description": "Name of the service LED pattern",
            "type": "string",
            "enum": [
                "OFF",
                "ON",
                "VFAST",
                "FAST",
                "SLOW",
                "VSLOW"
            ]
        }
    },
    "required": [
        "pattern"
    ]
}
Parameters:

pattern (str) – Name of the service LED pattern.

Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

SetFndhLowPassFilters(cutoff, extra_sensors=False)

Set the FNDH’s sensors’ low pass filter constants.

Parameters:
  • cutoff (int) – frequency of LPF to set.

  • extra_sensors (bool) – write the constant to the extra sensors’ registers after the LED status register.

The given cut-off frequency is stored as the LowPassFilterCutoff property in the tango database. It is automatically written to all sensor registers of the FNDH and smartboxes after MccsPasdBus is initialised and set ONLINE, and after any of them are powered on or reset later.

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsPasdBus_SetFndhLowPassFilters.json",
    "title": "MccsPasdBus SetFndhLowPassFilters schema",
    "description": "Schema for MccsPasdBus's SetFndhLowPassFilters command",
    "type": "object",
    "properties": {
        "cutoff": {
            "description": "Cut-off frequency to set for the low-pass filtering",
            "type": "number",
            "minimum": 0.1,
            "maximum": 1000.0
        },
        "extra_sensors": {
            "description": "Write the filter constant to the extra sensors' registers after the LED status register",
            "type": "boolean"
        }
    },
    "required": [
        "cutoff"
    ]
}
Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

SetFndhPortPowers(port_powers, stay_on_when_offline)

Set FNDH port powers.

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/MccsPasdBus_SetFndhPortPowers.json",
    "title": "MccsPasdBus SetFndhPortPowers schema",
    "description": "Schema for MccsPasdBus's SetFndhPortPowers command",
    "type": "object",
    "properties": {
        "port_powers": {
            "description": "The desired power of each port",
            "type": "array",
            "minItems": 28,
            "maxItems": 28,
            "items": {
                "type": [
                    "boolean",
                    "null"
                ]
            }
        },
        "stay_on_when_offline": {
            "description": "Whether to stay on when M&C is offline",
            "type": "boolean"
        }
    },
    "required": [
        "port_powers",
        "stay_on_when_offline"
    ]
}
Parameters:
  • port_powers (list[bool]) – The desired power of each port. False means off, True means on, None means no desired change.

  • stay_on_when_offline (bool) – whether any ports being turned on should remain on if communication with the MCCS is lost.

Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

SetSmartboxLedPattern(smartbox_number, pattern)

Set a Smartbox’s service LED pattern.

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsPasdBus_SetSmartboxLedPattern.json",
    "title": "MccsPasdBus SetSmartboxLedPattern schema",
    "description": "Schema for MccsPasdBus's SetSmartboxLedPattern command",
    "type": "object",
    "properties": {
        "smartbox_number": {
            "description": "Number of the smartbox being addressed",
            "type": "integer",
            "minimum": 1,
            "maximum": 24
        },
        "pattern": {
            "description": "Name of the service LED pattern",
            "type": "string",
            "enum": [
                "OFF",
                "ON",
                "VFAST",
                "FAST",
                "SLOW",
                "VSLOW"
            ]
        }
    },
    "required": [
        "smartbox_number",
        "pattern"
    ]
}
Parameters:
  • smartbox_number (int) – id of the smartbox being addressed

  • pattern (str) – name of the pattern for the service LED

Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

SetSmartboxLowPassFilters(smartbox_number, cutoff, extra_sensors=False)

Set a Smartbox’s sensors’ low pass filter constants.

The given cut-off frequency is stored as the LowPassFilterCutoff property in the tango database. It is automatically written to all sensor registers of the FNDH and smartboxes after MccsPasdBus is initialised and set ONLINE, and after any of them are powered on or reset later.

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://skao.int/MccsPasdBus_SetSmartboxLowPassFilters.json",
    "title": "MccsPasdBus SetSmartboxLowPassFilters schema",
    "description": "Schema for MccsPasdBus's SetSmartboxLowPassFilters command",
    "type": "object",
    "properties": {
        "smartbox_number": {
            "description": "Number of the smartbox being addressed",
            "type": "integer",
            "minimum": 1,
            "maximum": 24
        },
        "cutoff": {
            "description": "Cut-off frequency to set for the low-pass filtering",
            "type": "number",
            "minimum": 0.1,
            "maximum": 1000.0
        },
        "extra_sensors": {
            "description": "Write the filter constant to the extra sensors' registers after the LED status register.",
            "type": "boolean"
        }
    },
    "required": [
        "smartbox_number",
        "cutoff"
    ]
}
Parameters:
  • smartbox_number (int) – number of the smartbox to be addressed.

  • cutoff (int) – frequency of LPF to set.

  • extra_sensors (bool) – write the constant to the extra sensors’ registers after the LED status register.

Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

SetSmartboxPortPowers(smartbox_number, port_powers, stay_on_when_offline)

Set a Smartbox’s port powers.

Parameters:
  • smartbox_number (int) – number of the smartbox to be addressed.

  • port_powers (list[Optional[bool]]) – the desired power for each port. True means powered on, False means off, None means no desired change

  • stay_on_when_offline (bool) – whether any ports being turned on should remain on if communication with the MCCS is lost.

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/MccsPasdBus_SetSmartboxPortPowers.json",
    "title": "MccsPasdBus SetSmartboxPortPowers schema",
    "description": "Schema for MccsPasdBus's SetSmartboxPortPowers command",
    "type": "object",
    "properties": {
        "smartbox_number": {
            "description": "Number of the smartbox being addressed",
            "type": "integer",
            "minimum": 1,
            "maximum": 24
        },
        "port_powers": {
            "description": "The desired power of each port",
            "type": "array",
            "minItems": 12,
            "maxItems": 12,
            "items": {
                "type": [
                    "boolean",
                    "null"
                ]
            }
        },
        "stay_on_when_offline": {
            "description": "Whether to stay on when M&C is offline",
            "type": "boolean"
        }
    },
    "required": [
        "smartbox_number",
        "port_powers",
        "stay_on_when_offline"
    ]
}
Return type:

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

Returns:

A tuple containing a result code and a human-readable status message.

create_component_manager()

Create and return a component manager for this device.

Return type:

PasdBusComponentManager

Returns:

a component manager for this device.

delete_device()

Prepare to delete the device.

Make sure the component manager doesn’t have a socket open. (The socket should be closed when it is deleted, but it is good practice to close it explicitly anyhow.)

Return type:

None

init_device()

Initialise the device.

This is overridden here to change the Tango serialisation model.

Return type:

None

set_logging_level(value)

Update logging level and explicitly set pymodbus logging level.

Parameters:

value (LoggingLevel) – Logging level for logger

Return type:

None