hitl_tester.test_cases.bms.test_bms_imbalance

A simple test case to set a high cell voltage. Work in progress.

 1"""
 2A simple test case to set a high cell voltage.
 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_imbalance():
36    """In this simple test case we are going to test cell voltage imbalance."""
37    # Conditions for a transition from any state into SlowSample
38    bms_hardware.load.disable()  # disable load
39    bms_hardware.delay(2)  # wait for load to disable and isolate
40    bms_hardware.plateset.ce_switch = True  # Enable charging
41    bms_hardware.charger.enable()  # Turn on charger relay
42    bms_hardware.charger.set_profile(16.8, 0.035)
43    bms_hardware.delay(2)
44    bms_hardware.cells[1].volts = 4
45    bms_hardware.cells[2].volts = 3
46    bms_hardware.delay(1)
47    # ... and check that the value was set correctly
48    assert bms_hardware.plateset.ce_switch is False
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_imbalance():
36def test_imbalance():
37    """In this simple test case we are going to test cell voltage imbalance."""
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.cells[1].volts = 4
46    bms_hardware.cells[2].volts = 3
47    bms_hardware.delay(1)
48    # ... and check that the value was set correctly
49    assert bms_hardware.plateset.ce_switch is False

In this simple test case we are going to test cell voltage imbalance.