hitl_tester.test_cases.bms.test_bms_temp
A simple test case to check temperature faults. Work in progress.
1""" 2A simple test case to check temperature faults. 3Work in progress. 4""" 5 6import pytest 7 8from hitl_tester.modules.bms.bms_hw import BMSHardware 9 10bms_hardware = BMSHardware(pytest.flags) # type: ignore[arg-type] 11bms_hardware.init() 12 13 14def power_on_test(): 15 """Power on the system.""" 16 # Default power up settings 17 bms_hardware.plateset.ce_switch = False # BMS configured as off the charger 18 bms_hardware.plateset.thermistor1 = 25 # set THERM1 to degrees C 19 bms_hardware.plateset.thermistor2 = 25 # set THERM2 to degrees C 20 bms_hardware.load.disable() # load relay off 21 bms_hardware.charger.disable() # charger relay off 22 23 bms_hardware.delay(2) # Delay before BMS powers on 24 25 v = 3.7 # start test with cell voltages at 3.7 26 27 bms_hardware.cells[1].volts = v # sets cell1 voltage 28 bms_hardware.cells[2].volts = v # sets cell2 voltage 29 bms_hardware.cells[3].volts = v # sets cell3 voltage 30 bms_hardware.cells[4].volts = v # sets cell4 voltage 31 32 bms_hardware.delay(5) # Let cells settle and allow for boot time 33 34 35def test_overtemp_1(): 36 """In this simple test case we are going to cause an overtemp fault.""" 37 38 # Conditions for a transition from any state into SlowSample 39 bms_hardware.load.disable() # disable load 40 bms_hardware.delay(2) # wait for load to disable and isolate 41 bms_hardware.plateset.ce_switch = True # Enable charging 42 bms_hardware.charger.enable() # Turn on charger relay 43 bms_hardware.charger.set_profile(16.8, 0.035) 44 bms_hardware.delay(2) 45 bms_hardware.plateset.thermistor1 = 94 # set THERM1 to degrees C 46 bms_hardware.plateset.thermistor2 = 94 # set THERM2 to degrees C 47 48 # ... and check that the value was set correctly 49 assert bms_hardware.plateset.ce_switch is False
bms_hardware =
<hitl_tester.modules.bms.bms_hw.BMSHardware object>
def
power_on_test():
15def power_on_test(): 16 """Power on the system.""" 17 # Default power up settings 18 bms_hardware.plateset.ce_switch = False # BMS configured as off the charger 19 bms_hardware.plateset.thermistor1 = 25 # set THERM1 to degrees C 20 bms_hardware.plateset.thermistor2 = 25 # set THERM2 to degrees C 21 bms_hardware.load.disable() # load relay off 22 bms_hardware.charger.disable() # charger relay off 23 24 bms_hardware.delay(2) # Delay before BMS powers on 25 26 v = 3.7 # start test with cell voltages at 3.7 27 28 bms_hardware.cells[1].volts = v # sets cell1 voltage 29 bms_hardware.cells[2].volts = v # sets cell2 voltage 30 bms_hardware.cells[3].volts = v # sets cell3 voltage 31 bms_hardware.cells[4].volts = v # sets cell4 voltage 32 33 bms_hardware.delay(5) # Let cells settle and allow for boot time
Power on the system.
def
test_overtemp_1():
36def test_overtemp_1(): 37 """In this simple test case we are going to cause an overtemp fault.""" 38 39 # Conditions for a transition from any state into SlowSample 40 bms_hardware.load.disable() # disable load 41 bms_hardware.delay(2) # wait for load to disable and isolate 42 bms_hardware.plateset.ce_switch = True # Enable charging 43 bms_hardware.charger.enable() # Turn on charger relay 44 bms_hardware.charger.set_profile(16.8, 0.035) 45 bms_hardware.delay(2) 46 bms_hardware.plateset.thermistor1 = 94 # set THERM1 to degrees C 47 bms_hardware.plateset.thermistor2 = 94 # set THERM2 to degrees C 48 49 # ... and check that the value was set correctly 50 assert bms_hardware.plateset.ce_switch is False
In this simple test case we are going to cause an overtemp fault.