diff --git a/CDB/stations/common.json b/CDB/stations/common.json index 11cd0e71547640e887c679d30cad6fcc858c6190..45768cf244203c86e94ca786550ae669aaf30e96 100644 --- a/CDB/stations/common.json +++ b/CDB/stations/common.json @@ -85,16 +85,6 @@ } } }, - "EC2": { - "STAT": { - "EC2": { - "STAT/EC2/1": { - "properties": { - } - } - } - } - }, "ObservationControl": { "STAT": { "ObservationControl": { diff --git a/CDB/stations/testenv_cs001.json b/CDB/stations/testenv_cs001.json index 6bf8d12a9634b50792f34d68180fe7bd6e038647..a0ea3d301eab1ac2570f67c8f3d107d1b375cb4b 100644 --- a/CDB/stations/testenv_cs001.json +++ b/CDB/stations/testenv_cs001.json @@ -115,6 +115,16 @@ } } }, + "EC2": { + "STAT": { + "EC2": { + "STAT/EC2/1": { + "properties": { + } + } + } + } + }, "APSPU": { "STAT": { "APSPU": { diff --git a/tangostationcontrol/tangostationcontrol/devices/ec2.py b/tangostationcontrol/tangostationcontrol/devices/ec2.py index 70b3a979762635af4961db4ff8d279ce5898ce54..d4a46bfa50e9eb53d694f36434686a94790139b4 100644 --- a/tangostationcontrol/tangostationcontrol/devices/ec2.py +++ b/tangostationcontrol/tangostationcontrol/devices/ec2.py @@ -5,11 +5,14 @@ """ import logging +import numpy + +from tango.server import attribute, AttrWriteType # PyTango imports from tangostationcontrol.common.entrypoint import entry from tangostationcontrol.common.lofar_logging import device_logging_to_python -from tangostationcontrol.devices.base_device_classes.opcua_device import OPCUADevice +from tangostationcontrol.devices.base_device_classes.opcua_device import LOFARDevice # Additional import @@ -19,7 +22,7 @@ __all__ = ["EC2", "main"] @device_logging_to_python() -class EC2(OPCUADevice): +class EC2(LOFARDevice): """EC Device Server 2.0 for LOFAR2.0""" # ----------------- @@ -30,6 +33,40 @@ class EC2(OPCUADevice): # Attributes # ---------- + @attribute( + dtype=numpy.float32, + ) + def subrack_cabinet_temperature_R(self): + return self._subrack_cabinet_temperature + + subrack_cabinet_temperature_RW = attribute( + dtype=numpy.float32, + access=AttrWriteType.READ_WRITE, + ) + + def read_subrack_cabinet_temperature_RW(self): + return self._subrack_cabinet_temperature + + def write_subrack_cabinet_temperature_RW(self, temp: float): + self._subrack_cabinet_temperature = temp + + @attribute(dtype=bool, fisallowed="is_attribute_access_allowed") + def subrack_cabinet_bimetal_tripped_R(self): + return self._subrack_cabinet_bimetal_tripped + + subrack_cabinet_bimetal_tripped_RW = attribute( + doc="it indicates whether the bimetal was tripped, cutting power to the subrack", + dtype=bool, + access=AttrWriteType.READ_WRITE, + fisallowed="is_attribute_access_allowed", + ) + + def read_subrack_cabinet_bimetal_tripped_RW(self): + return self._subrack_cabinet_bimetal_tripped + + def write_subrack_cabinet_bimetal_tripped_RW(self, value: bool): + self._subrack_cabinet_bimetal_tripped = value + # ---------- # Summarising Attributes # ---------- @@ -37,6 +74,12 @@ class EC2(OPCUADevice): # -------- # overloaded functions # -------- + def configure_for_initialise(self): + super().configure_for_initialise() + + # Setup a fake initial cabinet temperature + self._subrack_cabinet_temperature = 20.0 + self._subrack_cabinet_bimetal_tripped = False # -------- # Commands