Skip to content
Snippets Groups Projects
Commit 30c79c53 authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

Added output current check

parent 525bccc6
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,10 @@ VOUT_POLS = {"CTR_LBA" : 8.0,
"CTR_RCU2_A" : 5.60009765625,
"CTR_RCU2_D" : 3.2998046875}
IOUT_POLS = {"CTR_LBA" : 0.45,
"CTR_RCU2_A" : 0.7,
"CTR_RCU2_D" : 0.36}
LP_VIN = 0x88 #
LP_VOUT_MODE = 0x20
LP_VOUT = 0x8B #
......
......@@ -86,8 +86,13 @@ class ApspuClass:
print("APSPU OK")
else:
print(">>> APSPU NOT OK <<<")
return check_ok
def apspu_on_off(self, on):
if on:
print(f">> Switch APSPU ON")
else:
print(">> Switch APSPU OFF")
for pol in self.pols:
pol.on_off(on)
return True
......@@ -310,7 +315,7 @@ class PolClass:
#
if self.status:
ret_ack, raw_value = self.pol_dev.read_bytes(0x39,2)
ret_ack, raw_value = self.pol_dev.read_bytes(LP_IOUT, 3)
ret_ack, raw_value = self.pol_dev.read_bytes(LP_IOUT, 2)
ret_value = []
ret_value.append(int(raw_value[:2], 16))
ret_value.append(int(raw_value[2:], 16))
......@@ -349,21 +354,28 @@ class PolClass:
check_ok = True
else:
check_ok = False
print(f"Vout not OK, expected {expected_vout} V, measured {self.vout} V")
print(f"POL {self.name:10} Vout not OK, expected {expected_vout} V, measured {self.vout} V")
vin_low = 45
vin_high = 50
if vin_low < self.vin < vin_high:
check_ok = True
else:
check_ok = False
print(f"Vin not OK, expected {vin_low} V, measured {self.vout} V < {vin_high} V")
print(f"POL {self.name:10} Vin not OK, expected {vin_low} V - {vin_high} V, measured {self.vout} V ")
temp_low = 20
temp_high = 50
if (temp_low < self.temp < temp_high) & check_ok:
check_ok = True
else:
check_ok = False
print(f"TEMP not OK, expected {temp_low} C < measured {self.temp} C < {temp_high} C")
print(f"POL {self.name:10} TEMP not OK, expected {temp_low} C - {temp_high} C, measured {self.temp} C ")
i_low = 0.8*IOUT_POLS[self.name]
i_high = 1.2*IOUT_POLS[self.name]
if (i_low < self.iout < i_high) & check_ok:
check_ok = True
else:
check_ok = False
print(f"POL {self.name:10} Iout not OK, expected {i_low:4.2f} A - {i_high:4.2f} A, measured {self.iout:4.2f} A ")
return check_ok
......
......@@ -38,12 +38,12 @@ apspu = ApspuClass()
#sleep(10)
apspu.read_all()
apspu.print_status()
#apspu.check_apspu()
#apspu.apspu_on_off(False)
#sleep(10)
#apspu.read_all()
#apspu.print_status()
#apspu.apspu_on_off(True)
if apspu.check_apspu():
apspu.apspu_on_off(False)
sleep(10)
apspu.read_all()
apspu.print_status()
apspu.apspu_on_off(True)
id = "APSPU-" + sys.argv[1]
serial = sys.argv[2]
apspu.eeprom.wr_rd_eeprom(id, address=0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment