3.1.4. waf_tools.battery_cell_config_validate
Validate battery cell configuration files.
This module validates the battery_cell_cfg.json configuration file used
by the foxBMS build system. It parses the JSON structure into typed dataclasses
representing the battery cell’s electrical and thermal operating limits and
ensures all required defines are present and have the declared type.
- The following configuration sections are validated:
Temperature limits (charge/discharge) - MSL, RSL, MOL thresholds in deci-degrees Celsius.
Voltage limits - Maximum, nominal, and minimum cell voltages in mV.
Current limits (charge/discharge) - MSL, RSL, MOL thresholds in mA.
Capacity - Cell capacity (mAh) and energy (Wh).
Lookup tables - File references for SOC and SOE estimation tables.
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.4.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_cell_cfg.json"),
validator=battery_cell_config_validate.validate_battery_cell_configuration,
target=f"{cp}battery_cell_cfg",
)
It can also be called directly:
cfg = validate_battery_cell_configuration(bld, battery_cell_json_node)
3.1.4.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 cell configuration. |
|
|
Validate the battery cell configuration JSON file. |
Classes
Complete validated battery cell configuration. |
|
|
Battery cell capacity and energy rating. |
|
Operating current limits for a battery cell in one direction. |
|
File references for SOC and SOE lookup tables. |
|
Operating temperature limits for a battery cell. |
|
Operating voltage limits for a battery cell. |
Exceptions
Raised for an invalid battery cell configuration. |