3.1.6. waf_tools.battery_system_config_validate
Validate battery system configuration files.
This module validates the battery_system_cfg.json configuration file used
by the foxBMS build system. It parses the JSON structure into typed dataclasses
representing the battery system’s topology, timing, current thresholds,
operational flags, and hardware configuration.
- The following configuration sections are validated:
Topology - Number of strings, modules, cell blocks, parallel cells, temperature sensors, and contactors.
Timeouts - Response timeouts for current, coulomb counting, and energy counting measurements in ms.
Currents - Maximum string current, rest current, no-current threshold, and contactor break current in mA.
Flags - Boolean operational switches (e.g. interlock feedback, CAN timing checks, balancing defaults, fuse placement checks).
Fuse - Trigger duration and maximum voltage drop configuration.
Relaxation - Relaxation period configuration.
The validation is performed during the waf build phase. Any raised error is
reported by waf_tools.config_codegen_task.CreateCfgFile, which then
fails the task and thereby the build.
3.1.6.1. Usage
The validator is typically passed as a callback to the codegen_config
feature in a waf build script:
bld(
features="codegen_config",
json=bld.srcnode.find_node("conf/bms/battery_system_cfg.json"),
validator=battery_system_config_validate.validate_battery_system_configuration,
target=f"{cp}battery_system_cfg",
)
It can also be called directly:
cfg = validate_battery_system_configuration(bld, battery_system_json_node)
3.1.6.2. Dependencies
waf_tools.battery_config_validate_utils- Shared extraction and parsing helpers.waf_tools.config_validate_utils- JSON file reading utilities.
Functions
Parse a raw JSON dictionary into a validated battery system configuration. |
|
|
Validate the battery system configuration JSON file. |
Classes
|
Complete validated battery system configuration. |
|
Battery system current thresholds. |
|
Battery system boolean operational flags. |
|
Battery system fuse configuration. |
|
Battery system relaxation configuration. |
|
Battery system timeout configuration. |
|
Battery system topology configuration. |
Exceptions
Raised for an invalid battery system configuration. |