hitl_tester.test_cases.bms.test_cell_threads

Activate and use the cell simulators to confirm the hardware is working.

Used in these test plans:

  • cell_simulators ⠀⠀⠀(bms/cell_simulators.plan)

Example Command (warning: test plan may run other test cases):

  • ./hitl_tester.py cell_simulators
 1"""
 2Activate and use the cell simulators to confirm the hardware is working.
 3"""
 4
 5from time import sleep
 6
 7import pytest
 8
 9from hitl_tester.modules.bms.bms_hw import BMSHardware
10from hitl_tester.modules.logger import logger
11
12bms_hardware = BMSHardware(pytest.flags)  # type: ignore[arg-type]
13bms_hardware.init()
14
15
16def test_cell_sim():
17    """Activate and measure cell properties."""
18    for cell in bms_hardware.cells.values():
19        cell.volts = 3.8002
20    bms_hardware.charger.set_profile(4.2 * len(bms_hardware.cells), 2.0)
21    bms_hardware.charger.enable()
22    while True:
23        for i, cell in bms_hardware.cells.items():
24            logger.write_info_to_report(f"Cell {i}: {cell.ohms}, {cell.volts}, {cell.amps}")
25        sleep(0.5)
def test_cell_sim():
17def test_cell_sim():
18    """Activate and measure cell properties."""
19    for cell in bms_hardware.cells.values():
20        cell.volts = 3.8002
21    bms_hardware.charger.set_profile(4.2 * len(bms_hardware.cells), 2.0)
22    bms_hardware.charger.enable()
23    while True:
24        for i, cell in bms_hardware.cells.items():
25            logger.write_info_to_report(f"Cell {i}: {cell.ohms}, {cell.volts}, {cell.amps}")
26        sleep(0.5)

Activate and measure cell properties.