From 03c239ca7c8544af0d5b12a80d46e79ed5a33bdc Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Tue, 12 Oct 2021 14:54:32 +0200 Subject: [PATCH] L2SS-358: Move clock initialisation to APSCT, updated method stubs. --- devices/clients/opcua_client.py | 2 ++ devices/devices/apsct.py | 50 +++++++++++++++++++++++++++++++++ devices/devices/recv.py | 50 +++------------------------------ 3 files changed, 56 insertions(+), 46 deletions(-) diff --git a/devices/clients/opcua_client.py b/devices/clients/opcua_client.py index d5e96d5d9..ea91becc4 100644 --- a/devices/clients/opcua_client.py +++ b/devices/clients/opcua_client.py @@ -166,6 +166,8 @@ class OPCUAConnection(AsyncCommClient): def call_method(self, method_path, *args): + method_path = self.get_node_path(method_path) + raise NotImplementedError diff --git a/devices/devices/apsct.py b/devices/devices/apsct.py index 6b65c1a66..debc132d4 100644 --- a/devices/devices/apsct.py +++ b/devices/devices/apsct.py @@ -71,11 +71,61 @@ class APSCT(opcua_device): # overloaded functions # -------- + def _initialise_hardware(self): + """ Initialise the APSCT hardware. """ + + # method calls don't work yet, so don't use them to allow the boot + # device to initialise us without errors + logger.error("OPC-UA methods not supported yet, not initialising APSCT hardware!") + return + + # Cycle clock + self.CLK_off() + self.wait_attribute("APSCTTR_translator_busy_R", False, 10) + self.CLK_on() + self.wait_attribute("APSCTTR_translator_busy_R", False, 10) + + if not self.APSCT_PLL_200MHz_locked_R: + if self.APSCT_I2C_error_R: + raise Exception("I2C is not working. Maybe power cycle subrack to restart CLK board and translator?") + else: + raise Exception("200MHz signal is not locked. The subrack probably do not receive clock input or the CLK PCB is broken?") + # -------- # Commands # -------- + @command() + @DebugIt() + @only_when_on() + def CLK_off(self): + """ + + :return:None + """ + self.opcua_connection.call_method(["CLK_off"]) + + @command() + @DebugIt() + @only_when_on() + def CLK_on(self): + """ + + :return:None + """ + self.opcua_connection.call_method(["CLK_on"]) + + @command() + @DebugIt() + @only_when_on() + def CLK_PLL_setup(self): + """ + + :return:None + """ + self.opcua_connection.call_method(["CLK_PLL_setup"]) + # ---------- # Run server # ---------- diff --git a/devices/devices/recv.py b/devices/devices/recv.py index 4d86bda4b..f2f15255c 100644 --- a/devices/devices/recv.py +++ b/devices/devices/recv.py @@ -117,7 +117,7 @@ class RECV(opcua_device): :return:None """ - self.opcua_connection.call_method(["2:PCC","2:RCU_off"]) + self.opcua_connection.call_method(["RCU_off"]) @command() @DebugIt() @@ -127,7 +127,7 @@ class RECV(opcua_device): :return:None """ - self.opcua_connection.call_method(["2:PCC","2:RCU_on"]) + self.opcua_connection.call_method(["RCU_on"]) @command() @DebugIt() @@ -137,7 +137,7 @@ class RECV(opcua_device): :return:None """ - self.opcua_connection.call_method(["2:PCC","2:ADC_on"]) + self.opcua_connection.call_method(["ADC_on"]) @command() @DebugIt() @@ -147,37 +147,7 @@ class RECV(opcua_device): :return:None """ - self.opcua_connection.call_method(["2:PCC","2:RCU_update"]) - - @command() - @DebugIt() - @only_when_on() - def CLK_off(self): - """ - - :return:None - """ - self.opcua_connection.call_method(["2:PCC","2:CLK_off"]) - - @command() - @DebugIt() - @only_when_on() - def CLK_on(self): - """ - - :return:None - """ - self.opcua_connection.call_method(["2:PCC","2:CLK_on"]) - - @command() - @DebugIt() - @only_when_on() - def CLK_PLL_setup(self): - """ - - :return:None - """ - self.opcua_connection.call_method(["2:PCC","2:CLK_PLL_setup"]) + self.opcua_connection.call_method(["RCU_update"]) def _initialise_hardware(self): """ Initialise the RCU hardware. """ @@ -187,18 +157,6 @@ class RECV(opcua_device): logger.error("OPC-UA methods not supported yet, not initialising RCU hardware!") return - # Cycle clock - self.CLK_off() - self.wait_attribute("CLK_translator_busy_R", False, 10) - self.CLK_on() - self.wait_attribute("CLK_translator_busy_R", False, 10) - - if not self.CLK_PLL_locked_R: - if self.CLK_I2C_STATUS_R > 0: - raise Exception("CLK I2C is not working. Maybe power cycle subrack to restart CLK board and translator?") - else: - raise Exception("CLK signal is not locked. The subrack probably do not receive clock input or the CLK PCB is broken?") - # Cycle RCUs self.RCU_off() self.wait_attribute("RECVTR_translator_busy_R", False, 5) -- GitLab