Skip to content
Snippets Groups Projects
Commit d0ff184b authored by Jan David Mol's avatar Jan David Mol
Browse files

Extracted PCC node lookup to separate function

parent 6502cf07
No related branches found
No related tags found
No related merge requests found
...@@ -191,6 +191,50 @@ class RCUSCC(Device): ...@@ -191,6 +191,50 @@ class RCUSCC(Device):
self.obj_node = self.client.get_objects_node() self.obj_node = self.client.get_objects_node()
self.pcc_node = self.obj_node.get_child(["{}:PCC".format(self.name_space_index)]) self.pcc_node = self.obj_node.get_child(["{}:PCC".format(self.name_space_index)])
def _extract_pcc_nodes(self):
self.debug_stream("Mapping OPC-UA MP/CP to attributes...")
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Attenuator_R"] = (self.get_pcc_node("RCUs_Attenuator1_R"), self.get_pcc_node("RCUs_Attenuator2_R"), self.get_pcc_node("RCUs_Attenuator3_R"))
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Attenuator_RW"] = (self.get_pcc_node("RCUs_Attenuator1_RW"), self.get_pcc_node("RCUs_Attenuator2_RW"), self.get_pcc_node("RCUs_Attenuator3_RW"))
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Band_R"] = (self.get_pcc_node("RCUs_Band1_R"), self.get_pcc_node("RCUs_Band2_R"), self.get_pcc_node("RCUs_Band3_R"))
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Band_RW"] = (self.get_pcc_node("RCUs_Band1_RW"), self.get_pcc_node("RCUs_Band2_RW"), self.get_pcc_node("RCUs_Band3_RW"))
self.attribute_mapping["CLK_PLL_locked_R"] = self.get_pcc_node("CLK_PLL_locked_R")
# self.attribute_mapping["Dither_Frequency_R"] = self.get_pcc_node("RCUs_Dither_Frequency_R")
# self.attribute_mapping["Dither_Frequency_RW"] = self.get_pcc_node("RCUs_Dither_Frequency_RW")
self.attribute_mapping["LED_R"] = self.get_pcc_node("RCUs_LED0_R")
self.attribute_mapping["LED_RW"] = self.get_pcc_node("RCUs_LED0_RW")
self.attribute_mapping["Pwr_dig_R"] = self.get_pcc_node("RCUs_Pwr_dig_R")
self.attribute_mapping["Temperature_R"] = self.get_pcc_node("RCUs_Temperature_R")
# self.attribute_mapping["RCU_off"] = self.get_pcc_node("RCUs_RCU_off")
# self.attribute_mapping["RCU_on"] = self.get_pcc_node("RCUs_RCU_on")
self.debug_stream("Mapping OPC-UA MP/CP to attributes done.")
def init_device(self): def init_device(self):
"""Initialises the attributes and properties of the RCUSCC.""" """Initialises the attributes and properties of the RCUSCC."""
...@@ -241,49 +285,8 @@ class RCUSCC(Device): ...@@ -241,49 +285,8 @@ class RCUSCC(Device):
try: try:
self._connect() self._connect()
self._extract_pcc_nodes()
self.debug_stream("Mapping OPC-UA MP/CP to attributes...")
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Attenuator_R"] = (self.get_pcc_node("RCUs_Attenuator1_R"), self.get_pcc_node("RCUs_Attenuator2_R"), self.get_pcc_node("RCUs_Attenuator3_R"))
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Attenuator_RW"] = (self.get_pcc_node("RCUs_Attenuator1_RW"), self.get_pcc_node("RCUs_Attenuator2_RW"), self.get_pcc_node("RCUs_Attenuator3_RW"))
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Band_R"] = (self.get_pcc_node("RCUs_Band1_R"), self.get_pcc_node("RCUs_Band2_R"), self.get_pcc_node("RCUs_Band3_R"))
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Band_RW"] = (self.get_pcc_node("RCUs_Band1_RW"), self.get_pcc_node("RCUs_Band2_RW"), self.get_pcc_node("RCUs_Band3_RW"))
self.attribute_mapping["CLK_PLL_locked_R"] = self.get_pcc_node("CLK_PLL_locked_R")
# self.attribute_mapping["Dither_Frequency_R"] = self.get_pcc_node("RCUs_Dither_Frequency_R")
# self.attribute_mapping["Dither_Frequency_RW"] = self.get_pcc_node("RCUs_Dither_Frequency_RW")
self.attribute_mapping["LED_R"] = self.get_pcc_node("RCUs_LED0_R")
self.attribute_mapping["LED_RW"] = self.get_pcc_node("RCUs_LED0_RW")
self.attribute_mapping["Pwr_dig_R"] = self.get_pcc_node("RCUs_Pwr_dig_R")
self.attribute_mapping["Temperature_R"] = self.get_pcc_node("RCUs_Temperature_R")
# self.attribute_mapping["RCU_off"] = self.get_pcc_node("RCUs_RCU_off")
# self.attribute_mapping["RCU_on"] = self.get_pcc_node("RCUs_RCU_on")
self.debug_stream("Mapping OPC-UA MP/CP to attributes done.")
self.set_state(DevState.ON) self.set_state(DevState.ON)
except Exception as e: except Exception as e:
self.set_state(DevState.FAULT) self.set_state(DevState.FAULT)
......
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