Coverage for C:\Users\hjanssen\HOME\pyCharmProjects\ethz_hvl\hvl_ccb\hvl_ccb\dev\supercube\typ_a.py : 0%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Copyright (c) 2019-2020 ETH Zurich, SIS ID and HVL D-ITET
2#
3"""
4Supercube Typ A module.
5"""
7from time import sleep
9from hvl_ccb.configuration import configdataclass
10from . import constants
11from .base import (
12 SupercubeBase,
13 SupercubeOpcUaCommunication,
14 SupercubeOpcUaCommunicationConfig,
15)
18@configdataclass
19class SupercubeAOpcUaConfiguration(SupercubeOpcUaCommunicationConfig):
20 endpoint_name: str = constants.SupercubeOpcEndpoint.A.value # type: ignore
23class SupercubeAOpcUaCommunication(SupercubeOpcUaCommunication):
24 @staticmethod
25 def config_cls():
26 return SupercubeAOpcUaConfiguration
29class SupercubeWithFU(SupercubeBase):
30 """
31 Variant A of the Supercube with frequency converter.
32 """
34 @staticmethod
35 def default_com_cls():
36 return SupercubeAOpcUaCommunication
38 def set_target_voltage(self, volt_v: float) -> None:
39 """
40 **TODO: test set_target_voltage with device**
42 Set the output voltage to a defined value in V.
44 :param volt_v: the desired voltage in V
45 """
47 self.write(constants.Power.voltage_target, volt_v)
49 def get_target_voltage(self) -> float:
50 """
51 **TODO: test get_target_voltage with device**
53 Gets the current setpoint of the output voltage value in V. This is not a
54 measured value but is the corresponding function to :meth:`set_target_voltage`.
56 :return: the setpoint voltage in V.
57 """
59 return float(self.read(constants.Power.voltage_target))
61 def get_max_voltage(self) -> float:
62 """
63 **TODO: test get_max_voltage with device**
65 Reads the maximum voltage of the setup and returns in V.
67 :return: the maximum voltage of the setup in V.
68 """
70 return float(self.read(constants.Power.voltage_max))
72 def set_slope(self, slope: float) -> None:
73 """
74 **TODO: test set_slope with device**
76 Sets the dV/dt slope of the Supercube frequency converter to a new value in
77 V/s.
79 :param slope: voltage slope in V/s (0..15)
80 """
82 self.write(constants.Power.voltage_slope, slope)
84 def get_primary_voltage(self) -> float:
85 """
86 **TODO: test get_primary_voltage with device**
88 Read the current primary voltage at the output of the frequency converter (
89 before transformer).
91 :return: primary voltage in V
92 """
94 return float(self.read(constants.Power.voltage_primary))
96 def get_primary_current(self) -> float:
97 """
98 **TODO: get_primary_current with device**
100 Read the current primary current at the output of the frequency converter (
101 before transformer).
103 :return: primary current in A
104 """
106 return float(self.read(constants.Power.current_primary))
108 def get_frequency(self) -> float:
109 """
110 **TODO: test get_frequency with device**
112 Read the electrical frequency of the current Supercube setup.
114 :return: the frequency in Hz
115 """
117 return float(self.read(constants.Power.frequency))
119 def get_power_setup(self) -> constants.PowerSetup:
120 """
121 **TODO: test get_power_setup with device**
123 Return the power setup selected in the Supercube's settings.
125 :return: the power setup
126 """
128 return constants.PowerSetup(self.read(constants.Power.setup))
130 def get_fso_active(self) -> bool:
131 """
132 **TODO: test get_fso_active with device**
134 Get the state of the fast switch off functionality. Returns True if it is
135 enabled, False otherwise.
137 :return: state of the FSO functionality
138 """
140 return self.read(constants.BreakdownDetection.activated)
142 def fso_reset(self) -> None:
143 """
144 **TODO: test fso_reset with device**
146 Reset the fast switch off circuitry to go back into normal state and allow to
147 re-enable operate mode.
148 """
150 self.write(constants.BreakdownDetection.reset, True)
151 sleep(0.1)
152 self.write(constants.BreakdownDetection.reset, False)