|
foxBMS-UnitTests
1.0.0
The foxBMS Unit Tests API Documentation
|
Go to the documentation of this file.
76 uint32_t previousTimestamp
142 float soeMinimumValue_perc,
143 float soeMaximumValue_perc,
144 float soeAverageValue_perc,
145 uint8_t stringNumber);
158 float stringSoe_perc = 0.0f;
160 stringSoe_perc = 100.0f;
164 return stringSoe_perc;
168 float energy_Wh = 0.0f;
169 if (stringSoe_perc >= 100.0f) {
171 }
else if (stringSoe_perc <= 0.0f) {
176 return (uint32_t)energy_Wh;
184 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
196 float soe_perc = 50.0f;
198 uint16_t between_high = 0;
199 uint16_t between_low = 0;
204 between_low = i + 1u;
210 if (!(((0u == between_high) && (0u == between_low)) ||
229 float soeMinimumValue_perc,
230 float soeMaximumValue_perc,
231 float soeAverageValue_perc,
232 uint8_t stringNumber) {
254 #if POSITIVE_DISCHARGE_CURRENT == false
292 extern void SOE_Init(
bool ec_present, uint8_t stringNumber) {
310 if (
true == ec_present) {
318 #if POSITIVE_DISCHARGE_CURRENT == false
332 bool continueFunction =
true;
335 continueFunction =
false;
338 if (
true == continueFunction) {
346 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
354 float timestep_s = (((float)timestamp - (
float)previous_timestamp)) / 1000.0f;
355 if (timestep_s > 0.0f) {
364 #if POSITIVE_DISCHARGE_CURRENT == false
366 deltaSOE_Wh *= (-1.0f);
389 float deltaSoe_perc =
393 #if POSITIVE_DISCHARGE_CURRENT == false
395 deltaSoe_perc *= (-1.0f);
Header for SOE configuration.
uint16_t bc_stateOfEnergyLookupTableLength
static DATA_BLOCK_CURRENT_SENSOR_s soe_tableCurrentSensor
void SOE_Calculation(void)
calculates state-of-energy (SOE)
DATA_BLOCK_HEADER_s header
uint32_t previousTimestamp[BS_NR_OF_STRINGS]
void SOE_Init(bool ec_present, uint8_t stringNumber)
initializes startup state-of-energy (SOE) related values
#define DATA_WRITE_DATA(...)
float ecScalingMaximum[BS_NR_OF_STRINGS]
static uint32_t SOE_GetStringEnergyFromSoePercentage(float stringSoe_perc)
calculates string energy in Wh from passed SOE in percentage
float maximumSoe_perc[BS_NR_OF_STRINGS]
Configuration of the battery system (e.g., number of battery modules, battery cells,...
static float SOE_GetFromVoltage(int16_t voltage_mV)
look-up table for SOE initialization
int16_t averageCellVoltage_mV[BS_NR_OF_STRINGS]
float ecScalingAverage[BS_NR_OF_STRINGS]
static float SOE_GetStringSoePercentageFromEnergy(uint32_t energy_Wh)
calculates string SOE in percentage from passed string energy in Wh
const BC_LUT_s bc_stateOfEnergyLookupTable[]
int32_t energyCounter_Wh[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
uint32_t averageSoe_Wh[BS_NR_OF_STRINGS]
int32_t current_mA[BS_NR_OF_STRINGS]
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
float ecScalingMinimum[BS_NR_OF_STRINGS]
float maximumSoe_perc[BS_NR_OF_STRINGS]
uint32_t timestampEnergyCounting[BS_NR_OF_STRINGS]
static DATA_BLOCK_SOX_s soe_tableSoeValues
math library for often used math functions
uint32_t maximumSoe_Wh[BS_NR_OF_STRINGS]
float minimumSoe_perc[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
#define SOE_STRING_ENERGY_Wh
BMS_CURRENT_FLOW_STATE_e BMS_GetBatterySystemState(void)
Returns current battery system state (charging/discharging, resting or in relaxation phase)
Configuration of the battery cell (e.g., minimum and maximum cell voltage)
uint32_t timestampCurrent[BS_NR_OF_STRINGS]
int16_t maximumCellVoltage_mV[BS_NR_OF_STRINGS]
bool sensor_ec_used[BS_NR_OF_STRINGS]
STD_RETURN_TYPE_e FRAM_Write(FRAM_BLOCK_ID_e blockId)
Writes a variable to the FRAM.
static SOE_STATE_s soe_state
float MATH_linearInterpolation(float x1, float y1, float x2, float y2, float x_interpolate)
Linear inter-/extrapolates a third point according to two given points.
#define DATA_READ_DATA(...)
uint32_t previousTimestampCurrent[BS_NR_OF_STRINGS]
int32_t highVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_VOLTAGES_FROM_CURRENT_SENSOR]
#define NULL_PTR
Null pointer.
Header for SOE module, responsible for calculation of SOE.
STD_RETURN_TYPE_e FRAM_Read(FRAM_BLOCK_ID_e blockId)
Reads a variable from the FRAM.
float averageSoe_perc[BS_NR_OF_STRINGS]
static void SOE_CheckDatabaseSoePercentageLimits(DATA_BLOCK_SOX_s *pTableSoe, uint8_t stringNumber)
Check if all database SOE percentage values are within [0.0, 100.0] Limits SOE values to limit values...
uint32_t minimumSoe_Wh[BS_NR_OF_STRINGS]
int16_t minimumCellVoltage_mV[BS_NR_OF_STRINGS]
@ DATA_BLOCK_ID_CURRENT_SENSOR
static void SOE_RecalibrateViaLookupTable(void)
initializes database and FRAM SOE values via lookup table (average, min and max).
float averageSoe_perc[BS_NR_OF_STRINGS]
static void SOE_SetValue(float soeMinimumValue_perc, float soeMaximumValue_perc, float soeAverageValue_perc, uint8_t stringNumber)
sets SOE value with a parameter between 0.0 and 100.0.
float minimumSoe_perc[BS_NR_OF_STRINGS]
Header for the driver for the FRAM module.