3.1.9. waf_tools.bms_config_model

Data model and parser for the foxBMS BMS configuration (bms.json).

This module defines the typed dataclass hierarchy that represents the complete foxBMS battery management system configuration. Validation is performed by pydantic: field types and Literal choices are checked when the model is validated.

The dataclass hierarchy mirrors the JSON structure:

The validators raise ValueError. Pydantic collects them into a single ValidationError, which parse_config_to_system() converts into one InvalidConfigurationError listing all invalid entries.

3.1.9.1. Usage

Parse a configuration dictionary (typically read from bms.json):

from bms_config_model import parse_config_to_system

system = parse_config_to_system(config_dict)

The returned System instance is then consumed by waf_tools.bms_config_generate to set environment variables and generate configuration headers.

3.1.9.2. Dependencies

Functions

parse_config_to_system(config)

Parse a JSON configuration into a validated system configuration.

Classes

AerosolSensor(manufacturer, model, type)

Aerosol sensor hardware configuration.

Algorithm(state_estimation)

Algorithm configuration container.

AnalogFrontEnd(ic, manufacturer)

Analog front-end IC configuration.

Application(algorithm, current_sensor, ...)

Application-level configuration, including sensors and algorithms.

BMSSlave(analog_front_end, temperature_sensor)

BMS-Slave board configuration.

CurrentSensor(manufacturer, model, type)

Current sensor hardware configuration.

Debug(interfaces, ...)

Debug interface configuration.

InsulationMonitoringDevice(manufacturer, ...)

Insulation monitoring device configuration.

MCU([use_cache])

MCU configuration.

RTOS(name, ...)

Real-Time Operating System configuration.

StateEstimation(soc, soe, sof, soh)

State-of-X estimation method selection for battery management.

System(application, rtos, bms_slave, mcu, debug)

Root configuration object representing the complete BMS system.

TemperatureSensor(manufacturer, method, model)

Temperature sensor configuration for the BMS-Slave board.

Exceptions

InvalidConfigurationError

Raised when the BMS configuration contains invalid or unsupported values.