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

Abstracted pcc_node.get_child to avoid repetition

parent d36e1393
No related branches found
No related tags found
No related merge requests found
......@@ -159,6 +159,9 @@ class RCUSCC(Device):
# General methods
# ---------------
def get_pcc_node(self, node):
return self.pcc_node.get_child(["{}:{}".format(self.name_space_index, node)])
def init_device(self):
"""Initialises the attributes and properties of the RCUSCC."""
......@@ -228,40 +231,40 @@ class RCUSCC(Device):
# 2020-11-27, thomas
# TODO
# Modify as soon as we have a real multi-dimensional array
self.attribute_mapping["Attenuator_R"] = (self.pcc_node.get_child(["{}:RCUs_Attenuator1_R".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Attenuator2_R".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Attenuator3_R".format(self.name_space_index)]))
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.pcc_node.get_child(["{}:RCUs_Attenuator1_RW".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Attenuator2_RW".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Attenuator3_RW".format(self.name_space_index)]))
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.pcc_node.get_child(["{}:RCUs_Band1_R".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Band2_R".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Band3_R".format(self.name_space_index)]))
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.pcc_node.get_child(["{}:RCUs_Band1_RW".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Band2_RW".format(self.name_space_index)]), self.pcc_node.get_child(["{}:RCUs_Band3_RW".format(self.name_space_index)]))
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.pcc_node.get_child(["{}:CLK_PLL_locked_R".format(self.name_space_index)])
self.attribute_mapping["CLK_PLL_locked_R"] = self.get_pcc_node("CLK_PLL_locked_R")
# self.attribute_mapping["Dither_Frequency_R"] = self.pcc_node.get_child(["{}:RCUs_Dither_Frequency_R".format(self.name_space_index)])
# self.attribute_mapping["Dither_Frequency_R"] = self.get_pcc_node("RCUs_Dither_Frequency_R")
# self.attribute_mapping["Dither_Frequency_RW"] = self.pcc_node.get_child(["{}:RCUs_Dither_Frequency_RW".format(self.name_space_index)])
# self.attribute_mapping["Dither_Frequency_RW"] = self.get_pcc_node("RCUs_Dither_Frequency_RW")
self.attribute_mapping["LED_R"] = self.pcc_node.get_child(["{}:RCUs_LED0_R".format(self.name_space_index)])
self.attribute_mapping["LED_R"] = self.get_pcc_node("RCUs_LED0_R")
self.attribute_mapping["LED_RW"] = self.pcc_node.get_child(["{}:RCUs_LED0_RW".format(self.name_space_index)])
self.attribute_mapping["LED_RW"] = self.get_pcc_node("RCUs_LED0_RW")
self.attribute_mapping["Pwr_dig_R"] = self.pcc_node.get_child(["{}:RCUs_Pwr_dig_R".format(self.name_space_index)])
self.attribute_mapping["Pwr_dig_R"] = self.get_pcc_node("RCUs_Pwr_dig_R")
self.attribute_mapping["Temperature_R"] = self.pcc_node.get_child(["{}:RCUs_Temperature_R".format(self.name_space_index)])
self.attribute_mapping["Temperature_R"] = self.get_pcc_node("RCUs_Temperature_R")
# self.attribute_mapping["RCU_off"] = self.pcc_node.get_child(["{}:RCUs_RCU_off".format(self.name_space_index)])
# self.attribute_mapping["RCU_off"] = self.get_pcc_node("RCUs_RCU_off")
# self.attribute_mapping["RCU_on"] = self.pcc_node.get_child(["{}:RCUs_RCU_on".format(self.name_space_index)])
# self.attribute_mapping["RCU_on"] = self.get_pcc_node("RCUs_RCU_on")
self.debug_stream("Mapping OPC-UA MP/CP to attributes done.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment