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

Adjust for the latest MP names

parent aa406b0f
No related branches found
No related tags found
No related merge requests found
...@@ -144,8 +144,11 @@ class SDP(Device): ...@@ -144,8 +144,11 @@ class SDP(Device):
self.debug_stream("Mapping OPC-UA MP/CP to attributes...") self.debug_stream("Mapping OPC-UA MP/CP to attributes...")
self.attribute_mapping["SDP_mask_RW"] = self.get_pcc_node("SDP_mask_RW") self.attribute_mapping["fpga_weights_R"] = self.get_node("weights")
self.attribute_mapping["fpga_temp_R"] = self.get_pcc_node("fpga_temp_R") self.attribute_mapping["fpga_mask_R"] = self.get_node("fpga_mask_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_version_R"] = self.get_node("fpga_version_R")
self.debug_stream("Mapping OPC-UA MP/CP to attributes done.") self.debug_stream("Mapping OPC-UA MP/CP to attributes done.")
...@@ -167,10 +170,16 @@ class SDP(Device): ...@@ -167,10 +170,16 @@ class SDP(Device):
# Set default values in the RW/R attributes and add them to # Set default values in the RW/R attributes and add them to
# the mapping. # the mapping.
self._SDP_mask_RW = numpy.full(32, False) self._fpga_weights_R = numpy.full(16 * 192 * 488, 0.0)
self.attribute_mapping["SDP_mask_RW"] = {} self.attribute_mapping["fpga_weights_R"] = {}
self._fpga_temp_R = numpy.full(4, False) self._fpga_mask_R = numpy.full(16, False)
self.attribute_mapping["fpga_mask_R"] = {}
self._fpga_status_R = numpy.full(16, False)
self.attribute_mapping["fpga_status_R"] = {}
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.attribute_mapping["fpga_version_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 = {}
...@@ -206,7 +215,7 @@ class SDP(Device): ...@@ -206,7 +215,7 @@ class SDP(Device):
# #
# TODO # TODO
# Read default masks from config DB # Read default masks from config DB
#self.write_SDP_mask_RW(self._SDP_mask_R) #self.write_fpga_mask_RW(self._fpga_mask_R)
# Everything went ok -- go standby. # Everything went ok -- go standby.
self.set_state(DevState.STANDBY) self.set_state(DevState.STANDBY)
...@@ -230,28 +239,43 @@ class SDP(Device): ...@@ -230,28 +239,43 @@ class SDP(Device):
# ------------------ # ------------------
# Attributes methods # Attributes methods
# ------------------ # ------------------
@only_when_on
@fault_on_error
def read_fpga_weights_R(self):
"""Return the fpga_weights_R attribute."""
value = numpy.array(self.attribute_mapping["fpga_weights_R"].get_value())
fpgas = numpy.array(numpy.split(value, indices_or_sections = 16))
self._fpga_weights_R = numpy.array(numpy.split(fpgas, indices_or_sections = 192))
return self._fpga_weights_R
@only_when_on @only_when_on
@fault_on_error @fault_on_error
def read_SDP_mask_RW(self): def read_fpga_mask_R(self):
"""Return the SDP_mask_RW attribute.""" """Return the fpga_mask_R attribute."""
return self._SDP_mask_RW self._fpga_mask_R = numpy.array(self.attribute_mapping["fpga_mask_R"].get_value())
return self._fpga_mask_R
@only_when_on @only_when_on
@fault_on_error @fault_on_error
def write_SDP_mask_RW(self, value): def read_fpga_status_R(self):
"""Set the SDP_mask_RW attribute.""" """Return the fpga_status_R attribute."""
self.attribute_mapping["SDP_mask_RW"].set_value(value.tolist()) self._fpga_status_R = numpy.array(self.attribute_mapping["fpga_status_R"].get_value())
self._SDP_mask_RW = value return self._fpga_status_R
@only_when_on @only_when_on
@fault_on_error @fault_on_error
def read_fpga_temp_R(self): def read_fpga_temp_R(self):
"""Return the fpga_temp_R attribute.""" """Return the fpga_temp_R attribute."""
value = numpy.array(self.attribute_mapping["fpga_temp_R"].get_value()) self._fpga_temp_R = numpy.array(self.attribute_mapping["fpga_temp_R"].get_value())
self._fpga_temp_R = numpy.array(numpy.split(value, indices_or_sections = 4))
return self._fpga_temp_R return self._fpga_temp_R
@only_when_on
@fault_on_error
def read_fpga_version_R(self):
"""Return the fpga_version_R attribute."""
self._fpga_version_R = numpy.array(self.attribute_mapping["fpga_version_R"].get_value())
return self._fpga_version_R
# -------- # --------
# Commands # Commands
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment