82 .errorRequestCounter = 0,
86 .balancingAllowed =
true,
87 .balancingGlobalAllowed =
false,
123 float cellBalancingCurrent = 0.0f;
124 uint32_t difference = 0;
129 uint16_t nrBalancedCells = 0u;
213 bool activateBalancing =
true;
236 activateBalancing =
false;
246 if (activateBalancing ==
true) {
267 uint16_t voltageMin = 0;
268 uint16_t minVoltageIndex = 0;
294 if (c != minVoltageIndex) {
373 #ifdef UNITY_UNIT_TEST
380 #ifdef UNITY_UNIT_TEST
STD_RETURN_TYPE_e BAL_Init(DATA_BLOCK_BALANCING_CONTROL_s *pControl)
Generic initialization function for the balancing module.
void BAL_SaveLastStates(BAL_STATE_s *pBalancingState)
Saves the last state and the last substate.
void BAL_ProcessStateInitialization(BAL_STATE_s *currentState)
State machine subfunction to initialize the balancing state machine.
void BAL_ProcessStateUninitalized(BAL_STATE_s *pCurrentState, BAL_STATE_REQUEST_e stateRequest)
Substate handling function for BAL_Trigger()
BAL_STATE_REQUEST_e BAL_TransferStateRequest(BAL_STATE_s *currentState)
transfers the current state request to the state machine.
void BAL_ProcessStateInitialized(BAL_STATE_s *currentState)
State machine subfunction to transfer from an initalized state to "running" states of th state machin...
uint8_t BAL_CheckReEntrance(BAL_STATE_s *currentState)
re-entrance check of BAL state machine trigger function
BAL_RETURN_TYPE_e BAL_CheckStateRequest(BAL_STATE_s *pCurrentState, BAL_STATE_REQUEST_e stateRequest)
checks the state requests that are made.
@ BAL_STATEMACH_UNINITIALIZED
@ BAL_STATEMACH_INITIALIZATION
@ BAL_STATEMACH_INITIALIZED
@ BAL_STATEMACH_CHECK_BALANCING
int32_t BAL_GetBalancingThreshold_mV(void)
get balancing threshold
#define BAL_LOWER_VOLTAGE_LIMIT_mV
#define BAL_STATEMACH_SHORTTIME_100ms
#define BAL_DEFAULT_THRESHOLD_mV
#define BAL_UPPER_TEMPERATURE_LIMIT_ddegC
#define BAL_STATEMACH_BALANCINGTIME_100ms
#define BAL_HYSTERESIS_mV
DATA_BLOCK_BALANCING_CONTROL_s * TEST_BAL_GetBalancingControl(void)
STD_RETURN_TYPE_e BAL_GetInitializationState(void)
gets the initialization state.
static void BAL_ActivateBalancing(void)
static BAL_STATE_s bal_state
BAL_STATEMACH_e BAL_GetState(void)
static void BAL_ProcessStateBalancing(void)
BAL_RETURN_TYPE_e BAL_SetStateRequest(BAL_STATE_REQUEST_e stateRequest)
sets the current state request of the state variable bal_state.
static bool BAL_CheckImbalances(void)
static DATA_BLOCK_BALANCING_CONTROL_s bal_balancing
static void BAL_Deactivate(void)
Deactivates history based balancing.
void BAL_Trigger(void)
trigger function for the BAL driver state machine.
static DATA_BLOCK_CELL_VOLTAGE_s bal_cellVoltage
static void BAL_ComputeImbalances(void)
BAL_STATE_s * TEST_BAL_GetBalancingState(void)
static void BAL_ProcessStateCheckBalancing(void)
State machine subfunction to check if balancing is allowed.
Header for the history-based balancing strategy module.
Configuration of the battery cell (e.g., minimum and maximum cell voltage)
#define BC_CAPACITY_mAh
Cell capacity used for SOC calculation.
#define BS_BALANCING_RESISTANCE_ohm
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define BS_NR_OF_CELL_BLOCKS_PER_STRING
BMS_CURRENT_FLOW_STATE_e BMS_GetBatterySystemState(void)
Returns current battery system state (charging/discharging, resting or in relaxation phase)
#define DATA_READ_DATA(...)
#define DATA_WRITE_DATA(...)
@ DATA_BLOCK_ID_BALANCING_CONTROL
@ DATA_BLOCK_ID_CELL_VOLTAGE
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
float SE_GetStateOfChargeFromVoltage(int16_t voltage_mV)
look-up table for SOC initialization
Declaration of the OS wrapper interface.
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
Header for state-estimation module responsible for the estimation of state-of-charge (SOC),...
int32_t balancingThreshold
BAL_STATE_REQUEST_e stateRequest
STD_RETURN_TYPE_e initializationFinished
bool balancingGlobalAllowed
BAL_STATEMACH_SUB_e substate
uint32_t deltaCharge_mAs[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
DATA_BLOCK_HEADER_s header
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
uint16_t nrBalancedCells[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_CELL_BLOCKS_PER_STRING]
int16_t maximumTemperature_ddegC[BS_NR_OF_STRINGS]
DATA_BLOCK_HEADER_s header
int16_t minimumCellVoltage_mV[BS_NR_OF_STRINGS]