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
Branches
Tags
No related merge requests found
......@@ -144,8 +144,11 @@ class SDP(Device):
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_temp_R"] = self.get_pcc_node("fpga_temp_R")
self.attribute_mapping["fpga_weights_R"] = self.get_node("weights")
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.")
......@@ -167,10 +170,16 @@ class SDP(Device):
# Set default values in the RW/R attributes and add them to
# the mapping.
self._SDP_mask_RW = numpy.full(32, False)
self.attribute_mapping["SDP_mask_RW"] = {}
self._fpga_temp_R = numpy.full(4, False)
self._fpga_weights_R = numpy.full(16 * 192 * 488, 0.0)
self.attribute_mapping["fpga_weights_R"] = {}
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._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.
self.function_mapping = {}
......@@ -206,7 +215,7 @@ class SDP(Device):
#
# TODO
# 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.
self.set_state(DevState.STANDBY)
......@@ -230,28 +239,43 @@ class SDP(Device):
# ------------------
# 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
@fault_on_error
def read_SDP_mask_RW(self):
"""Return the SDP_mask_RW attribute."""
return self._SDP_mask_RW
def read_fpga_mask_R(self):
"""Return the fpga_mask_R attribute."""
self._fpga_mask_R = numpy.array(self.attribute_mapping["fpga_mask_R"].get_value())
return self._fpga_mask_R
@only_when_on
@fault_on_error
def write_SDP_mask_RW(self, value):
"""Set the SDP_mask_RW attribute."""
self.attribute_mapping["SDP_mask_RW"].set_value(value.tolist())
self._SDP_mask_RW = value
def read_fpga_status_R(self):
"""Return the fpga_status_R attribute."""
self._fpga_status_R = numpy.array(self.attribute_mapping["fpga_status_R"].get_value())
return self._fpga_status_R
@only_when_on
@fault_on_error
def read_fpga_temp_R(self):
"""Return the fpga_temp_R attribute."""
value = numpy.array(self.attribute_mapping["fpga_temp_R"].get_value())
self._fpga_temp_R = numpy.array(numpy.split(value, indices_or_sections = 4))
self._fpga_temp_R = numpy.array(self.attribute_mapping["fpga_temp_R"].get_value())
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment