diff --git a/APSPU_I2C.py b/APSPU_I2C.py index 7d93c8c28e50a9c0fd042273e55cf2d311ca51c9..491dc58ed01ce34fad9ac1a7ea54a2a5b260f8b0 100644 --- a/APSPU_I2C.py +++ b/APSPU_I2C.py @@ -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 # diff --git a/apspu_lib.py b/apspu_lib.py index 3bc4afa3ed6fe6d641ea589538535296785693de..b0f731174cd805a42dc91efd4ac762ca8453e604 100644 --- a/apspu_lib.py +++ b/apspu_lib.py @@ -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 diff --git a/production_apspu.py b/production_apspu.py index 0d23249856e9090d50e633f8a7b43a26b50ce742..5f312f409294b62be47b984414b0d5d305a02eb1 100644 --- a/production_apspu.py +++ b/production_apspu.py @@ -38,13 +38,13 @@ 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) -id = "APSPU-" + sys.argv[1] -serial = sys.argv[2] -apspu.eeprom.wr_rd_eeprom(id, address=0) -apspu.eeprom.wr_rd_eeprom(serial, address=0x20) +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) + apspu.eeprom.wr_rd_eeprom(serial, address=0x20)