Skip to content
Snippets Groups Projects
Commit 1aca240a authored by Thomas Juerges's avatar Thomas Juerges
Browse files

Add new MPs/CPs

Worth mentioning:  added weights, 2 * 488 * 12 * 16 int16_t.
parent e6b3ce1a
Branches
Tags
No related merge requests found
...@@ -94,15 +94,15 @@ class SDP(Device): ...@@ -94,15 +94,15 @@ class SDP(Device):
access=AttrWriteType.READ_WRITE, access=AttrWriteType.READ_WRITE,
) )
fpga_scrap_RW = attribute( fpga_scrap_R = attribute(
dtype = ('DevLong',), dtype = ('DevLong',),
max_dim_x = 2048, max_dim_x = 2048,
access=AttrWriteType.READ_WRITE,
) )
fpga_scrap_R = attribute( fpga_scrap_RW = attribute(
dtype = ('DevLong',), dtype = ('DevLong',),
max_dim_x = 2048, max_dim_x = 2048,
access=AttrWriteType.READ_WRITE,
) )
fpga_status_R = attribute( fpga_status_R = attribute(
...@@ -120,6 +120,33 @@ class SDP(Device): ...@@ -120,6 +120,33 @@ class SDP(Device):
max_dim_x = 16, max_dim_x = 16,
) )
fpga_weights_R = attribute(
dtype = (('DevShort',),),
max_dim_x = 12 * 488 * 2, max_dim_y = 16,
)
fpga_weights_RW = attribute(
dtype = (('DevShort',),),
max_dim_x = 12 * 488 * 2, max_dim_y = 16,
access=AttrWriteType.READ_WRITE,
)
sdp_info_R = attribute(
dtype = ('DevString',),
)
tod_R = attribute(
dtype = ('DevString',),
)
translator_network_R = attribute(
dtype = ('DevString',),
)
translator_timing_R = attribute(
dtype = ('DevString',),
)
# --------------- # ---------------
# General methods # General methods
...@@ -150,11 +177,17 @@ class SDP(Device): ...@@ -150,11 +177,17 @@ class SDP(Device):
self.info_stream("Mapping OPC-UA MP/CP to attributes...") self.info_stream("Mapping OPC-UA MP/CP to attributes...")
self.attribute_mapping["fpga_mask_RW"] = self.get_node("fpga_mask_RW") self.attribute_mapping["fpga_mask_RW"] = self.get_node("fpga_mask_RW")
self.attribute_mapping["fpga_scrap_RW"] = self.get_node("fpga_scrap_RW")
self.attribute_mapping["fpga_scrap_R"] = self.get_node("fpga_scrap_R") self.attribute_mapping["fpga_scrap_R"] = self.get_node("fpga_scrap_R")
self.attribute_mapping["fpga_scrap_RW"] = self.get_node("fpga_scrap_RW")
self.attribute_mapping["fpga_status_R"] = self.get_node("fpga_status_R") self.attribute_mapping["fpga_status_R"] = self.get_node("fpga_status_R")
self.attribute_mapping["fpga_temp_R"] = self.get_node("fpga_temp_R") self.attribute_mapping["fpga_temp_R"] = self.get_node("fpga_temp_R")
self.attribute_mapping["fpga_version_R"] = self.get_node("fpga_version_R") self.attribute_mapping["fpga_version_R"] = self.get_node("fpga_version_R")
self.attribute_mapping["fpga_weights_R"] = self.get_node("fpga_weights_R")
self.attribute_mapping["fpga_weights_RW"] = self.get_node("fpga_weights_RW")
self.attribute_mapping["sdp_info_R"] = self.get_node("sdp_info")
self.attribute_mapping["tod_R"] = self.get_node("tod")
self.attribute_mapping["translator_network_R"] = self.get_node("translator_network")
self.attribute_mapping["translator_timing_R"] = self.get_node("translator_timing")
self.info_stream("Mapping OPC-UA MP/CP to attributes done.") self.info_stream("Mapping OPC-UA MP/CP to attributes done.")
...@@ -178,16 +211,28 @@ class SDP(Device): ...@@ -178,16 +211,28 @@ class SDP(Device):
# the mapping. # the mapping.
self._fpga_mask_RW = numpy.full(16, False) self._fpga_mask_RW = numpy.full(16, False)
self.attribute_mapping["fpga_mask_RW"] = {} self.attribute_mapping["fpga_mask_RW"] = {}
self._fpga_scrap_RW = numpy.full(2048, False)
self.attribute_mapping["fpga_scrap_RW"] = {}
self._fpga_scrap_R = numpy.full(2048, False) self._fpga_scrap_R = numpy.full(2048, False)
self.attribute_mapping["fpga_scrap_R"] = {} self.attribute_mapping["fpga_scrap_R"] = {}
self._fpga_scrap_RW = numpy.full(2048, False)
self.attribute_mapping["fpga_scrap_RW"] = {}
self._fpga_status_R = numpy.full(16, False) self._fpga_status_R = numpy.full(16, False)
self.attribute_mapping["fpga_status_R"] = {} self.attribute_mapping["fpga_status_R"] = {}
self._fpga_temp_R = numpy.full(16, 0.0) self._fpga_temp_R = numpy.full(16, 0.0)
self.attribute_mapping["fpga_temp_R"] = {} self.attribute_mapping["fpga_temp_R"] = {}
self._fpga_version_R = numpy.full(16, "NO_VERSION_INFO_YET") self._fpga_version_R = numpy.full(16, "NO_VERSION_INFO_YET")
self.attribute_mapping["fpga_version_R"] = {} self.attribute_mapping["fpga_version_R"] = {}
self._fpga_weights_R = numpy.full((16, 2 * 488 * 12), 0)
self.attribute_mapping["fpga_weights_R"] = {}
self._fpga_weights_RW = numpy.full((16, 2 * 488 * 12), 0)
self.attribute_mapping["fpga_weights_RW"] = {}
self._sdp_info_R = "NOT_INITIALISED"
self.attribute_mapping["sdp_info_R"] = {}
self._tod_R = "NOT_INITIALISED"
self.attribute_mapping["tod_R"] = {}
self._translator_network_R = "NOT_INITIALISED"
self.attribute_mapping["translator_network_R"] = {}
self._translator_timing_R = "NOT_INITIALISED"
self.attribute_mapping["translator_timing_R"] = {}
# Init the dict that contains function to OPC-UA function mappings. # Init the dict that contains function to OPC-UA function mappings.
self.function_mapping = {} self.function_mapping = {}
...@@ -265,9 +310,7 @@ class SDP(Device): ...@@ -265,9 +310,7 @@ class SDP(Device):
@fault_on_error @fault_on_error
def read_fpga_scrap_R(self): def read_fpga_scrap_R(self):
"""Return the fpga_scrap_R attribute.""" """Return the fpga_scrap_R attribute."""
value = numpy.array(numpy.split(self.attribute_mapping["fpga_scrap_R"].get_data_value().Value.Value, indices_or_sections = 16)) self._fpga_scrap_R = numpy.array(numpy.split(self.attribute_mapping["fpga_scrap_R"].get_data_value().Value.Value, indices_or_sections = 16))
value_tuples = numpy.array(numpy.split(value, indices_or_sections = 2))
self._fpga_scrap_R = value_tuples
return self._fpga_scrap_R return self._fpga_scrap_R
@only_when_on @only_when_on
...@@ -304,6 +347,55 @@ class SDP(Device): ...@@ -304,6 +347,55 @@ class SDP(Device):
self._fpga_version_R = numpy.array(self.attribute_mapping["fpga_version_R"].get_value()) self._fpga_version_R = numpy.array(self.attribute_mapping["fpga_version_R"].get_value())
return self._fpga_version_R return self._fpga_version_R
@only_when_on
@fault_on_error
def read_fpga_weights_R(self):
"""Return the fpga_weights_R attribute."""
value = numpy.array(numpy.split(self.attribute_mapping["fpga_weights_R"].get_value(), indices_or_sections = 16))
self._fpga_weights_R = value
return self._fpga_weights_R
@only_when_on
@fault_on_error
def read_fpga_weights_RW(self):
"""Return the fpga_weights_RW attribute."""
return self._fpga_weights_RW
@only_when_on
@fault_on_error
def write_fpga_weights_RW(self, value):
"""Return the fpga_weights_RW attribute."""
self.attribute_mapping["fpga_weights_RW"].set_data_value(opcua.ua.uatypes.Variant(value = value.tolist(), varianttype=opcua.ua.VariantType.Int16))
_fpga_weights_RW = value
@only_when_on
@fault_on_error
def read_sdp_info_R(self):
"""Return the sdp_info_R attribute."""
self._sdp_info_R = self.attribute_mapping["sdp_info_R"].get_value()
return self._sdp_info_R
@only_when_on
@fault_on_error
def read_sdp_tod_R(self):
"""Return the sdp_tod_R attribute."""
self._sdp_tod_R = self.attribute_mapping["sdp_tod_R"].get_value()
return self._sdp_tod_R
@only_when_on
@fault_on_error
def read_translator_network_R(self):
"""Return the _translator_network_R attribute."""
self._translator_network_R = self.attribute_mapping["translator_network_R"].get_value()
return self._translator_network_R
@only_when_on
@fault_on_error
def read_translator_timing_R(self):
"""Return the _translator_timing_R attribute."""
self._translator_timing_R = self.attribute_mapping["translator_timing_R"].get_value()
return self._translator_timing_R
# -------- # --------
# Commands # Commands
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment