hitl_tester.test_cases.bms.test_20s_charge
The test should sample current via the DMM at some desired rate and output a CSV with timestamp & current.
Add a rigol DMM in series with the positive terminal of the pack and collect AC current data while charging
Wrike: https://www.wrike.com/open.htm?id=1327092188 git: https://github.com/turnaroundfactor/HITL/issues/234
Used in these test plans:
- 20s_charge ⠀⠀⠀(bms/20s_charge.plan)
Example Command (warning: test plan may run other test cases):
./hitl_tester.py 20s_charge -DSAMPLE_RATE=1
1""" 2The test should sample current via the DMM at some desired rate and output a CSV with timestamp & current. 3 4Add a rigol DMM in series with the positive terminal of the pack and collect AC current data while charging 5 6Wrike: https://www.wrike.com/open.htm?id=1327092188 7git: https://github.com/turnaroundfactor/HITL/issues/234 8""" 9 10import time 11 12import pytest 13 14from hitl_tester.modules.bms.bms_hw import BMSHardware 15from hitl_tester.modules.bms.plateset import Plateset 16from hitl_tester.modules.logger import logger 17 18SAMPLE_RATE = 1 19 20bms_hardware = BMSHardware(pytest.flags) # type: ignore[arg-type] 21bms_hardware.init() 22plateset = Plateset() 23 24 25def test_record_current(): 26 """Record AC current data until killed.""" 27 start_time = time.perf_counter() 28 while True: 29 bms_hardware.csv.dmm_ac.record( 30 elapsed_time := time.perf_counter() - start_time, current := bms_hardware.dmm.amps_ac 31 ) 32 logger.write_info_to_report(f"Elapsed Time(s): {elapsed_time:.3f}, AC Current(A): {current}") 33 time.sleep(SAMPLE_RATE)
SAMPLE_RATE =
1
bms_hardware =
<hitl_tester.modules.bms.bms_hw.BMSHardware object>
plateset =
<hitl_tester.modules.bms.plateset.Plateset object>
def
test_record_current():
26def test_record_current(): 27 """Record AC current data until killed.""" 28 start_time = time.perf_counter() 29 while True: 30 bms_hardware.csv.dmm_ac.record( 31 elapsed_time := time.perf_counter() - start_time, current := bms_hardware.dmm.amps_ac 32 ) 33 logger.write_info_to_report(f"Elapsed Time(s): {elapsed_time:.3f}, AC Current(A): {current}") 34 time.sleep(SAMPLE_RATE)
Record AC current data until killed.