From dbedda9b6d9ecb4b539dad536ccc24ac0e032ca3 Mon Sep 17 00:00:00 2001 From: Thomas Juerges <4-jurges@users.noreply.git.astron.nl> Date: Mon, 1 Feb 2021 11:34:23 +0100 Subject: [PATCH] Rename get_sdp_node to a more generic get_node This function should be moved to the base class. On error it prints out the LOFAR device type, i.e. "SDP"m which is set in the first lines of the class. --- SDP/SDP/SDP.py | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/SDP/SDP/SDP.py b/SDP/SDP/SDP.py index b98336472..00568ca42 100644 --- a/SDP/SDP/SDP.py +++ b/SDP/SDP/SDP.py @@ -61,6 +61,7 @@ class SDP(Device): The user triggers their transitions by the commands reflecting the target state (Initialise(), On(), Fault()). """ + device = "SDP" client = 0 name_space_index = 0 obj = 0 @@ -87,29 +88,42 @@ class SDP(Device): # ---------- # Attributes # ---------- + fpga_weights_R = attribute( + dtype = ('DevBoolean',), + max_dim_x = 16 * 192 * 488, + #access=AttrWriteType.READ_WRITE, + ) + + fpga_mask_R = attribute( + dtype = ('DevBoolean',), + max_dim_x = 16, + #access=AttrWriteType.READ_WRITE, + ) - SDP_mask_RW = attribute( + fpga_status_R = attribute( dtype = ('DevBoolean',), - max_dim_x = 32, - access=AttrWriteType.READ_WRITE, + max_dim_x = 16, ) fpga_temp_R = attribute( dtype = ('DevDouble',), - max_dim_x = 4, + max_dim_x = 16, ) + fpga_version_R = attribute( + dtype = ('DevString',), + max_dim_x = 16, + ) # --------------- # General methods # --------------- - - def get_sdp_node(self, node): + def get_node(self, node): try: - return self.sdp_node.get_child(["{}:{}".format(self.name_space_index, node)]) + return self.lofar_device_node.get_child(["{}:{}".format(self.name_space_index, node)]) except opcua.ua.uaerrors._auto.BadNoMatch: - self.error_stream("Could not find SDP node %s", node) + self.error_stream("Could not find LOFAR device %s node %s", self.device, node) # Contract with hardware is broken --- cannot recover raise @@ -122,7 +136,11 @@ class SDP(Device): self.name_space_index = 2 self.obj_node = self.client.get_objects_node() - self.sdp_node = self.obj_node.get_child(["{}:SDP".format(self.name_space_index)]) + # TODO + # The server does not implement the correct namespace yet. + # Instead it is directly using the Objects node. + #self.lofar_device_node = self.obj_node.get_child(["{}:SDP".format(self.name_space_index)]) + self.lofar_device_node = self.obj_node self.debug_stream("Mapping OPC-UA MP/CP to attributes...") -- GitLab