Skip to content
Snippets Groups Projects
Commit 456b9a5c authored by Stefano Di Frischia's avatar Stefano Di Frischia
Browse files

L2SS-1173: add attributes

parent e5cd4efa
No related branches found
No related tags found
1 merge request!739Resolve L2SS-1173 "Add ec2 device"
......@@ -85,16 +85,6 @@
}
}
},
"EC2": {
"STAT": {
"EC2": {
"STAT/EC2/1": {
"properties": {
}
}
}
}
},
"ObservationControl": {
"STAT": {
"ObservationControl": {
......
......@@ -115,6 +115,16 @@
}
}
},
"EC2": {
"STAT": {
"EC2": {
"STAT/EC2/1": {
"properties": {
}
}
}
}
},
"APSPU": {
"STAT": {
"APSPU": {
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment