From a9d090203922a973df7b66cbfbb42323d9bed867 Mon Sep 17 00:00:00 2001 From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl> Date: Mon, 1 Feb 2021 11:52:31 +0100 Subject: [PATCH] Adjust for the latest MP names --- SDP/SDP/SDP.py | 54 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/SDP/SDP/SDP.py b/SDP/SDP/SDP.py index 93729b9fe..c61e2ea7b 100644 --- a/SDP/SDP/SDP.py +++ b/SDP/SDP/SDP.py @@ -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 -- GitLab