106 int16_t minimumCellVoltage_mV,
107 int16_t maximumCellVoltage_mV,
122 int16_t minimumCellTemperature_ddegC,
123 int16_t maximumCellTemperature_ddegC,
190 int16_t minimumCellVoltage_mV,
191 int16_t maximumCellVoltage_mV,
200 if (minimumCellVoltage_mV <= pConfigLimitValues->limitLowerCellVoltage_mV) {
204 if (minimumCellVoltage_mV <= pConfigLimitValues->cutoffLowerCellVoltage_mV) {
233 int16_t minimumCellTemperature_ddegC,
234 int16_t maximumCellTemperature_ddegC,
244 if (minimumCellTemperature_ddegC <= pConfigLimitValues->limitLowTemperatureDischarge_ddegC) {
248 if (minimumCellTemperature_ddegC <= pConfigLimitValues->cutoffLowTemperatureDischarge_ddegC) {
261 if (minimumCellTemperature_ddegC <= pConfigLimitValues->limitLowTemperatureCharge_ddegC) {
265 if (minimumCellTemperature_ddegC <= pConfigLimitValues->cutoffLowTemperatureCharge_ddegC) {
346 #if BMS_CHECK_SOF_CURRENT_LIMITS == true
369 uint8_t nrClosedStrings = 0;
370 float minDischarge_mA = FLT_MAX;
371 float minCharge_mA = FLT_MAX;
373 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
387 &temperatureBasedSof,
414 #if BMS_CHECK_SOF_CURRENT_LIMITS == true
425 &temperatureBasedSof,
445 &temperatureBasedSof,
465 &temperatureBasedSof,
509 #ifdef UNITY_UNIT_TEST
510 extern void TEST_SOF_CalculateCurves(
const SOF_CONFIG_s *pConfigurationValues,
SOF_CURVE_s *pCalculatedSofCurveValues) {
513 extern void TEST_SOF_CalculateVoltageBasedCurrentLimit(
514 int16_t minimumCellVoltage_mV,
515 int16_t maximumCellVoltage_mV,
520 minimumCellVoltage_mV,
521 maximumCellVoltage_mV,
522 pAllowedVoltageBasedCurrent,
524 pCalculatedSofCurves);
526 extern void TEST_SOF_CalculateTemperatureBasedCurrentLimit(
527 int16_t minimumCellTemperature_ddegC,
528 int16_t maximumCellTemperature_ddegC,
533 minimumCellTemperature_ddegC,
534 maximumCellTemperature_ddegC,
535 pAllowedTemperatureBasedCurrent,
537 pCalculatedSofCurves);
Configuration of the battery cell (e.g., minimum and maximum cell voltage)
#define BC_CURRENT_MAX_CHARGE_RSL_mA
Maximum charge current limit.
#define BC_CURRENT_MAX_DISCHARGE_MOL_mA
Maximum discharge current limit.
#define BC_CURRENT_MAX_DISCHARGE_MSL_mA
Maximum discharge current limit.
#define BC_CURRENT_MAX_DISCHARGE_RSL_mA
Maximum discharge current limit.
#define BC_CURRENT_MAX_CHARGE_MSL_mA
Maximum charge current limit.
#define BC_CURRENT_MAX_CHARGE_MOL_mA
Maximum charge current limit.
Configuration of the battery system (e.g., number of battery modules, battery cells,...
#define BS_MAXIMUM_STRING_CURRENT_mA
Maximum string current limit in mA that is used in the SOA module to check for string overcurrent.
bool BMS_IsStringClosed(uint8_t stringNumber)
Returns string state (closed or open)
#define DATA_READ_DATA(...)
#define DATA_WRITE_DATA(...)
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
float MATH_MinimumOfTwoFloats(const float value1, const float value2)
Returns the minimum of the passed float values.
math library for often used math functions
#define NULL_PTR
Null pointer.
static SOF_CURVE_s sof_curveMol
static void SOF_CalculateTemperatureBasedCurrentLimit(int16_t minimumCellTemperature_ddegC, int16_t maximumCellTemperature_ddegC, SOF_CURRENT_LIMITS_s *pAllowedTemperatureBasedCurrent, const SOF_CONFIG_s *pConfigLimitValues, SOF_CURVE_s *pCalculatedSofCurves)
calculates the SoF from temperature data (i.e., minimum and maximum temperature of cells)
void SOF_Calculation(void)
triggers SOF calculation
static DATA_BLOCK_SOF_s sof_tableSofValues
static SOF_CURVE_s sof_curveRsl
static DATA_BLOCK_MIN_MAX_s sof_tableMinimumMaximumValues
static void SOF_CalculateVoltageBasedCurrentLimit(int16_t minimumCellVoltage_mV, int16_t maximumCellVoltage_mV, SOF_CURRENT_LIMITS_s *pAllowedVoltageBasedCurrent, const SOF_CONFIG_s *pConfigLimitValues, SOF_CURVE_s *pCalculatedSofCurves)
calculates the SoF from voltage data (i.e., minimum and maximum voltage)
static void SOF_CalculateCurves(const SOF_CONFIG_s *pConfigurationValues, SOF_CURVE_s *pCalculatedSofCurveValues)
calculate SOF curve depending on configured configuration values
static SOF_CURVE_s sof_curveMsl
static SOF_CURRENT_LIMITS_s SOF_MinimumOfTwoSofValues(SOF_CURRENT_LIMITS_s voltageBasedLimits, SOF_CURRENT_LIMITS_s temperatureBasedLimits)
get the minimum current values of all variants of SoF calculation
static SOF_CURVE_s sof_curveRecommendedOperatingCurrent
void SOF_Init(void)
initializes the area for SOF (where derating starts and is fully active).
Header for SOX module, responsible for current derating calculation.
const SOF_CONFIG_s sof_recommendedCurrent
const SOF_CONFIG_s sof_recommendedSafetyLimit
const SOF_CONFIG_s sof_configMaximumSafetyLimit
const SOF_CONFIG_s sof_maximumOperatingLimit
int16_t maximumTemperature_ddegC[BS_NR_OF_STRINGS]
int16_t minimumTemperature_ddegC[BS_NR_OF_STRINGS]
int16_t maximumCellVoltage_mV[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
int16_t minimumCellVoltage_mV[BS_NR_OF_STRINGS]
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
int16_t limitUpperCellVoltage_mV
int16_t cutoffUpperCellVoltage_mV
int16_t limitHighTemperatureDischarge_ddegC
float maximumDischargeCurrent_mA
int16_t limitLowerCellVoltage_mV
int16_t cutoffLowTemperatureCharge_ddegC
int16_t limitLowTemperatureDischarge_ddegC
int16_t limitLowTemperatureCharge_ddegC
int16_t cutoffHighTemperatureDischarge_ddegC
float maximumChargeCurrent_mA
int16_t cutoffLowerCellVoltage_mV
int16_t limitHighTemperatureCharge_ddegC
int16_t cutoffLowTemperatureDischarge_ddegC
int16_t cutoffHighTemperatureCharge_ddegC
float peakDischargeCurrent_mA
float peakChargeCurrent_mA
float continuousDischargeCurrent_mA
float continuousChargeCurrent_mA
float slopeHighTemperatureDischarge
float offsetLowerCellVoltage
float offsetLowTemperatureCharge
float offsetHighTemperatureDischarge
float slopeUpperCellVoltage
float slopeLowerCellVoltage
float offsetUpperCellVoltage
float slopeLowTemperatureCharge
float slopeLowTemperatureDischarge
float slopeHighTemperatureCharge
float offsetLowTemperatureDischarge
float offsetHighTemperatureCharge