56 #ifndef FOXBMS__DATABASE_CFG_H_
57 #define FOXBMS__DATABASE_CFG_H_
Configuration of the battery system (e.g., number of battery modules, battery cells,...
#define BS_NR_OF_VOLTAGES_FROM_CURRENT_SENSOR
number of high voltage inputs measured by current sensors (like IVT-MOD)
#define BS_NR_OF_CELLS_PER_MODULE
number of battery cells per battery module (parallel cells are counted as one)
#define BS_NR_OF_MODULES
number of modules in battery pack
#define BS_NR_OF_GPIOS_PER_MODULE
Number of GPIOs on the LTC IC.
#define BS_NR_OF_TEMP_SENSORS_PER_STRING
#define BS_NR_OF_BAT_CELLS
struct DATA_BLOCK_ADC_VOLTAGE DATA_BLOCK_ADC_VOLTAGE_s
struct DATA_BLOCK_INSULATION_MONITORING DATA_BLOCK_INSULATION_MONITORING_s
struct DATA_BLOCK_DUMMY_FOR_SELF_TEST DATA_BLOCK_DUMMY_FOR_SELF_TEST_s
struct DATA_BLOCK_STATEREQUEST DATA_BLOCK_STATEREQUEST_s
struct DATA_BLOCK_SOX DATA_BLOCK_SOX_s
struct DATA_BLOCK_INTERLOCK_FEEDBACK DATA_BLOCK_INTERLOCK_FEEDBACK_s
struct DATA_BLOCK_CONTFEEDBACK DATA_BLOCK_CONTACTOR_FEEDBACK_s
struct DATA_BLOCKHEADER DATA_BLOCK_HEADER_s
struct DATA_BLOCK_CURRENT_SENSOR DATA_BLOCK_CURRENT_SENSOR_s
struct DATA_BLOCK_SLAVE_CONTROL DATA_BLOCK_SLAVE_CONTROL_s
struct DATA_BLOCK_BALANCING_FEEDBACK DATA_BLOCK_BALANCING_FEEDBACK_s
struct DATA_BLOCK_USER_MUX DATA_BLOCK_USER_MUX_s
struct DATA_BLOCK_CELL_TEMPERATURE DATA_BLOCK_CELL_TEMPERATURE_s
struct DATA_BLOCK_CELL_VOLTAGE DATA_BLOCK_CELL_VOLTAGE_s
DATA_BASE_s data_database[DATA_BLOCK_ID_MAX]
channel configuration of database (data blocks)
struct DATA_BLOCK_RSL_FLAG DATA_BLOCK_RSL_FLAG_s
struct DATA_BLOCK_OPENWIRE DATA_BLOCK_OPEN_WIRE_s
struct DATA_BLOCK_PACK_VALUES DATA_BLOCK_PACK_VALUES_s
enum DATA_BLOCK_ID DATA_BLOCK_ID_e
struct DATA_BLOCK_ALL_GPIO_VOLTAGES DATA_BLOCK_ALL_GPIO_VOLTAGES_s
struct DATA_BLOCK_MSL_FLAG DATA_BLOCK_MSL_FLAG_s
struct DATA_BLOCK_SOF DATA_BLOCK_SOF_s
struct DATA_BLOCK_BALANCING_CONTROL DATA_BLOCK_BALANCING_CONTROL_s
struct DATA_BLOCK_MOL_FLAG DATA_BLOCK_MOL_FLAG_s
struct DATA_BASE DATA_BASE_s
struct DATA_BLOCK_HTSEN DATA_BLOCK_HTSEN_s
@ DATA_BLOCK_ID_CELL_VOLTAGE_REDUNDANCY0
@ DATA_BLOCK_ID_OPEN_WIRE_REDUNDANCY0
@ DATA_BLOCK_ID_INTERLOCK_FEEDBACK
@ DATA_BLOCK_ID_BALANCING_CONTROL
@ DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_REDUNDANCY0
@ DATA_BLOCK_ID_DUMMY_FOR_SELF_TEST
@ DATA_BLOCK_ID_INSULATION_MONITORING
@ DATA_BLOCK_ID_CELL_VOLTAGE
@ DATA_BLOCK_ID_MOVING_AVERAGE
@ DATA_BLOCK_ID_CELL_TEMPERATURE_REDUNDANCY0
@ DATA_BLOCK_ID_CELL_TEMPERATURE_BASE
@ DATA_BLOCK_ID_CURRENT_SENSOR
@ DATA_BLOCK_ID_SYSTEMSTATE
@ DATA_BLOCK_ID_OPEN_WIRE_BASE
@ DATA_BLOCK_ID_SLAVE_CONTROL
@ DATA_BLOCK_ID_CONTACTOR_FEEDBACK
@ DATA_BLOCK_ID_ADC_VOLTAGE
@ DATA_BLOCK_ID_CELL_VOLTAGE_BASE
@ DATA_BLOCK_ID_ERRORSTATE
@ DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE
@ DATA_BLOCK_ID_PACK_VALUES
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_REDUNDANCY0
@ DATA_BLOCK_ID_CELL_TEMPERATURE
@ DATA_BLOCK_ID_STATEREQUEST
struct DATA_BLOCK_ERRORSTATE DATA_BLOCK_ERRORSTATE_s
struct DATA_BLOCK_MIN_MAX DATA_BLOCK_MIN_MAX_s
General macros and definitions for the whole platform.
#define ADC_ADC1_MAX_NR_CHANNELS
maximum number of channels measured by the ADC1
float adc1ConvertedVoltages_mV[ADC_ADC1_MAX_NR_CHANNELS]
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint16_t gpioVoltages_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *BS_NR_OF_GPIOS_PER_MODULE]
uint16_t invalidGpioVoltages[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
uint16_t nrBalancedCells[BS_NR_OF_STRINGS]
uint32_t deltaCharge_mAs[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint16_t value[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
int16_t cellTemperature_ddegC[BS_NR_OF_STRINGS][BS_NR_OF_TEMP_SENSORS_PER_STRING]
DATA_BLOCK_HEADER_s header
uint16_t invalidCellTemperature[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
uint16_t nrValidTemperatures[BS_NR_OF_STRINGS]
uint16_t nrValidCellVoltages[BS_NR_OF_STRINGS]
uint32_t moduleVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
uint64_t invalidCellVoltage[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
bool validModuleVoltage[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
DATA_BLOCK_HEADER_s header
int32_t packVoltage_mV[BS_NR_OF_STRINGS]
uint32_t contactorFeedback
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint8_t invalidCurrentMeasurement[BS_NR_OF_STRINGS]
uint32_t timestampCurrent[BS_NR_OF_STRINGS]
uint32_t previousTimestampCurrentCounting[BS_NR_OF_STRINGS]
uint32_t timestampPower[BS_NR_OF_STRINGS]
int32_t power_W[BS_NR_OF_STRINGS]
uint8_t invalidSensorTemperatureMeasurement[BS_NR_OF_STRINGS]
uint8_t invalidHighVoltageMeasurement[BS_NR_OF_STRINGS][BS_NR_OF_VOLTAGES_FROM_CURRENT_SENSOR]
uint32_t previousTimestampPower[BS_NR_OF_STRINGS]
int32_t current_mA[BS_NR_OF_STRINGS]
uint8_t invalidCurrentCountingMeasurement[BS_NR_OF_STRINGS]
uint32_t timestampHighVoltage[BS_NR_OF_STRINGS][BS_NR_OF_VOLTAGES_FROM_CURRENT_SENSOR]
uint8_t invalidPowerMeasurement[BS_NR_OF_STRINGS]
uint32_t previousTimestampHighVoltage[BS_NR_OF_STRINGS][BS_NR_OF_VOLTAGES_FROM_CURRENT_SENSOR]
int32_t sensorTemperature_ddegC[BS_NR_OF_STRINGS]
uint32_t timestampEnergyCounting[BS_NR_OF_STRINGS]
int32_t currentCounter_As[BS_NR_OF_STRINGS]
int32_t highVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_VOLTAGES_FROM_CURRENT_SENSOR]
uint8_t invalidEnergyCountingMeasurement[BS_NR_OF_STRINGS]
uint32_t previousTimestampEnergyCounting[BS_NR_OF_STRINGS]
int32_t energyCounter_Wh[BS_NR_OF_STRINGS]
uint32_t timestampCurrentCounting[BS_NR_OF_STRINGS]
uint32_t previousTimestampCurrent[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t baseCellVoltageMeasurementTimeout
uint8_t currentSensorTimeoutV3[BS_NR_OF_STRINGS]
uint8_t plausibilityCheckCelltemperature[BS_NR_OF_STRINGS]
uint8_t powerMeasurementError[BS_NR_OF_STRINGS]
uint8_t afeConfigurationError[BS_NR_OF_STRINGS]
uint8_t currentMeasurementTimeout[BS_NR_OF_STRINGS]
uint8_t deepDischargeDetected[BS_NR_OF_STRINGS]
uint8_t crcError[BS_NR_OF_STRINGS]
uint8_t canTimingEc[BS_NR_OF_STRINGS]
uint8_t prechargeContactor[BS_NR_OF_STRINGS]
uint8_t plausibilityCheckPackvoltage[BS_NR_OF_STRINGS]
uint8_t currentMeasurementError[BS_NR_OF_STRINGS]
uint8_t muxError[BS_NR_OF_STRINGS]
uint8_t plausibilityCheckCellvoltageSpread[BS_NR_OF_STRINGS]
uint8_t currentSensorTimeoutV1[BS_NR_OF_STRINGS]
uint8_t currentSensorPowerTimeout[BS_NR_OF_STRINGS]
uint8_t spiError[BS_NR_OF_STRINGS]
uint8_t open_wire[BS_NR_OF_STRINGS]
uint8_t redundancy0CellTemperatureMeasurementTimeout
uint8_t fuseStateNormal[BS_NR_OF_STRINGS]
uint8_t mcuDieTemperature
uint8_t afeCellTemperatureError[BS_NR_OF_STRINGS]
uint8_t fuseStateCharge[BS_NR_OF_STRINGS]
uint8_t afeCellvoltageError[BS_NR_OF_STRINGS]
uint8_t redundancy0CellVoltageMeasurementTimeout
uint8_t plausibilityCheckCelltemperatureSpread[BS_NR_OF_STRINGS]
uint8_t plausibilityCheckCellvoltage[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t currentSensor[BS_NR_OF_STRINGS]
uint8_t currentOnOpenString[BS_NR_OF_STRINGS]
uint8_t baseCellTemperatureMeasurementTimeout
uint8_t canTimingCc[BS_NR_OF_STRINGS]
uint8_t stringContactor[BS_NR_OF_STRINGS]
int16_t temperature_ddegC
DATA_BLOCK_HEADER_s header
uint8_t outdatedInsulationResistanceValue
uint8_t insulationMeasurements
uint8_t testImcParameterConfiguration
uint8_t calibrationRunning
uint8_t insulationWarning
uint8_t aliveStatusDetection
uint32_t insulationResistance_kOhm
DATA_BLOCK_HEADER_s header
float interlockVoltageFeedback_IL_LS_VS_mV
float interlockVoltageFeedback_IL_HS_VS_mV
uint8_t interlockFeedback_IL_STATE
float interlockCurrentFeedback_IL_LS_CS_mA
float interlockCurrentFeedback_IL_HS_CS_mA
DATA_BLOCK_HEADER_s header
uint16_t nrCellMinimumCellVoltage[BS_NR_OF_STRINGS]
uint16_t validMeasuredCellTemperatures[BS_NR_OF_STRINGS]
uint16_t nrSensorMinimumTemperature[BS_NR_OF_STRINGS]
int16_t maximumTemperature_ddegC[BS_NR_OF_STRINGS]
int16_t minimumTemperature_ddegC[BS_NR_OF_STRINGS]
float averageTemperature_ddegC[BS_NR_OF_STRINGS]
uint16_t nrModuleMaximumCellVoltage[BS_NR_OF_STRINGS]
uint16_t nrCellMaximumCellVoltage[BS_NR_OF_STRINGS]
uint16_t nrSensorMaximumTemperature[BS_NR_OF_STRINGS]
uint16_t validMeasuredCellVoltages[BS_NR_OF_STRINGS]
int16_t maximumCellVoltage_mV[BS_NR_OF_STRINGS]
int16_t previousMinimumCellVoltage_mV[BS_NR_OF_STRINGS]
uint16_t nrModuleMinimumCellVoltage[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint16_t nrModuleMaximumTemperature[BS_NR_OF_STRINGS]
int16_t averageCellVoltage_mV[BS_NR_OF_STRINGS]
uint16_t nrModuleMinimumTemperature[BS_NR_OF_STRINGS]
int16_t previousMaximumCellVoltage_mV[BS_NR_OF_STRINGS]
int16_t minimumCellVoltage_mV[BS_NR_OF_STRINGS]
uint8_t pcbOvertemperature[BS_NR_OF_STRINGS]
uint8_t stringDischargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t overtemperatureDischarge[BS_NR_OF_STRINGS]
uint8_t cellDischargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t underVoltage[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t undertemperatureDischarge[BS_NR_OF_STRINGS]
uint8_t overtemperatureCharge[BS_NR_OF_STRINGS]
uint8_t stringChargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t undertemperatureCharge[BS_NR_OF_STRINGS]
uint8_t pcbUndertemperature[BS_NR_OF_STRINGS]
uint8_t cellChargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t overVoltage[BS_NR_OF_STRINGS]
float movingAveragePower1sInterval_mA
float movingAveragePower10sInterval_mA
float movingAveragePower60sInterval_mA
float movingAveragePower30sInterval_mA
DATA_BLOCK_HEADER_s header
float movingAverageCurrentConfigurableInterval_mA
float movingAverageCurrent10sInterval_mA
float movingAverageCurrent1sInterval_mA
float movingAverageCurrent5sInterval_mA
float movingAverageCurrent30sInterval_mA
float movingAverageCurrent60sInterval_mA
float movingAveragePower5sInterval_mA
float movingAveragePowerConfigurableInterval_mA
uint8_t packDischargeOvercurrent
uint8_t cellChargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t overtemperatureDischarge[BS_NR_OF_STRINGS]
uint8_t undertemperatureCharge[BS_NR_OF_STRINGS]
uint8_t stringDischargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t underVoltage[BS_NR_OF_STRINGS]
uint8_t stringChargeOvercurrent[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t packChargeOvercurrent
uint8_t cellDischargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t overtemperatureCharge[BS_NR_OF_STRINGS]
uint8_t pcbOvertemperature[BS_NR_OF_STRINGS]
uint8_t pcbUndertemperature[BS_NR_OF_STRINGS]
uint8_t undertemperatureDischarge[BS_NR_OF_STRINGS]
uint8_t overVoltage[BS_NR_OF_STRINGS]
uint16_t nrOpenWires[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t openwire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *(BS_NR_OF_CELLS_PER_MODULE+1u)]
uint8_t invalidHvBusVoltage
int32_t stringCurrent_mA[BS_NR_OF_STRINGS]
uint8_t invalidBatteryVoltage
int32_t stringPower_W[BS_NR_OF_STRINGS]
int32_t highVoltageBusVoltage_mV
uint8_t invalidPackCurrent
uint8_t invalidStringCurrent[BS_NR_OF_STRINGS]
int32_t stringVoltage_mV[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t invalidStringPower[BS_NR_OF_STRINGS]
uint8_t invalidStringVoltage[BS_NR_OF_STRINGS]
int32_t batteryVoltage_mV
uint8_t overtemperatureDischarge[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint8_t pcbUndertemperature[BS_NR_OF_STRINGS]
uint8_t cellDischargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t overVoltage[BS_NR_OF_STRINGS]
uint8_t stringChargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t overtemperatureCharge[BS_NR_OF_STRINGS]
uint8_t pcbOvertemperature[BS_NR_OF_STRINGS]
uint8_t undertemperatureCharge[BS_NR_OF_STRINGS]
uint8_t stringDischargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t undertemperatureDischarge[BS_NR_OF_STRINGS]
uint8_t cellChargeOvercurrent[BS_NR_OF_STRINGS]
uint8_t underVoltage[BS_NR_OF_STRINGS]
uint8_t ioValueIn[BS_NR_OF_MODULES]
uint8_t eepromValueWrite[BS_NR_OF_MODULES]
uint32_t eepromWriteAddressLastUsed
uint32_t eepromReadAddressLastUsed
uint32_t eepromReadAddressToUse
DATA_BLOCK_HEADER_s header
uint8_t ioValueOut[BS_NR_OF_MODULES]
uint8_t eepromValueRead[BS_NR_OF_MODULES]
uint32_t eepromWriteAddressToUse
uint8_t externalTemperatureSensor[BS_NR_OF_MODULES]
float peakMslChargeCurrent_mA[BS_NR_OF_STRINGS]
float peakRslChargeCurrent_mA[BS_NR_OF_STRINGS]
float recommendedContinuousPackDischargeCurrent_mA
float peakMolChargeCurrent_mA[BS_NR_OF_STRINGS]
float recommendedPeakDischargeCurrent_mA[BS_NR_OF_STRINGS]
float recommendedContinuousChargeCurrent_mA[BS_NR_OF_STRINGS]
float peakMolDischargeCurrent_mA[BS_NR_OF_STRINGS]
float recommendedPeakPackDischargeCurrent_mA
float peakRslDischargeCurrent_mA[BS_NR_OF_STRINGS]
float continuousRslChargeCurrent_mA[BS_NR_OF_STRINGS]
float peakMslDischargeCurrent_mA[BS_NR_OF_STRINGS]
float recommendedContinuousPackChargeCurrent_mA
float continuousMslDischargeCurrent_mA[BS_NR_OF_STRINGS]
float continuousRslDischargeCurrent_mA[BS_NR_OF_STRINGS]
float continuousMolChargeCurrent_mA[BS_NR_OF_STRINGS]
float continuousMolDischargeCurrent_mA[BS_NR_OF_STRINGS]
float continuousMslChargeCurrent_mA[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
float recommendedContinuousDischargeCurrent_mA[BS_NR_OF_STRINGS]
float recommendedPeakChargeCurrent_mA[BS_NR_OF_STRINGS]
float recommendedPeakPackChargeCurrent_mA
float maximumSoe_perc[BS_NR_OF_STRINGS]
uint32_t averageSoe_Wh[BS_NR_OF_STRINGS]
uint32_t maximumSoe_Wh[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
float minimumSoe_perc[BS_NR_OF_STRINGS]
float minimumSoc_perc[BS_NR_OF_STRINGS]
float averageSoc_perc[BS_NR_OF_STRINGS]
float maximumSoc_perc[BS_NR_OF_STRINGS]
uint32_t minimumSoe_Wh[BS_NR_OF_STRINGS]
float averageSoe_perc[BS_NR_OF_STRINGS]
uint8_t stateRequestViaCan
uint8_t previousStateRequestViaCan
DATA_BLOCK_HEADER_s header
uint8_t stateRequestViaCanPending
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
uint16_t value[BS_NR_OF_STRINGS][8u *2u *BS_NR_OF_MODULES]