|
foxBMS
1.0.0
The foxBMS Battery Management System API Documentation
|
Go to the documentation of this file.
74 #define SYS_SAVELASTSTATES(x) \
75 (x)->lastState = (x)->state; \
76 (x)->lastSubstate = (x)->substate
97 .illegalRequestsCounter = 0,
98 .initializationTimeout = 0,
166 return multipleCalls;
170 #pragma diag_suppress 179
171 #pragma WEAK(SYS_SetState)
179 pSystemState->
timer = idleTime;
184 #pragma diag_suppress 179
185 #pragma WEAK(SYS_SetSubstate)
201 switch (pSystemState->
state) {
223 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
324 if (balancingInitializationState ==
STD_OK) {
346 if (balancingGlobalEnableState ==
BAL_OK) {
409 #if CURRENT_SENSOR_ISABELLENHUETTE_TRIGGERED
415 pSystemState->
timer = SYS_FSM_LONG_TIME_MS;
421 bool allSensorsPresent =
true;
422 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
435 allSensorsPresent =
false;
439 if (allSensorsPresent ==
true) {
468 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
527 return ranStateMachine;
601 bool earlyExit =
false;
610 if (earlyExit ==
false) {
611 if (pSystemState->
timer > 0u) {
612 if ((--pSystemState->
timer) > 0u) {
620 if (earlyExit ==
false) {
static void SYS_SetSubstate(SYS_STATE_s *pSystemState, SYS_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next substate and the timer value of the state variable.
Implementation of the tasks used by the system, headers.
@ SYS_STATEMACH_INITIALIZATION
Headers for the driver for the storage in the EEPROM memory.
@ SYS_WAIT_CURRENT_SENSOR_PRESENCE
#define BALANCING_DEFAULT_INACTIVE
STD_RETURN_TYPE_e SYS_Trigger(SYS_STATE_s *pSystemState)
tick function, call this to advance the state machine
bool deepDischargeFlag[BS_NR_OF_STRINGS]
@ SYS_STATEMACH_INITIALIZE_MISC
bool CAN_IsCurrentSensorCcPresent(uint8_t stringNumber)
get flag if CC message from current sensor is received.
enum SYS_FSM_SUBSTATES SYS_FSM_SUBSTATES_e
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
static SYS_STATE_REQUEST_e SYS_TransferStateRequest(void)
transfers the current state request to the state machine.
void SOE_Init(bool ec_present, uint8_t stringNumber)
initializes startup state-of-energy (SOE) related values
STD_RETURN_TYPE_e BAL_GetInitializationState(void)
gets the initialization state.
@ SYS_WAIT_INITIALIZATION_BAL_GLOBAL_ENABLE
void SOC_Init(bool ccPresent, uint8_t stringNumber)
initializes startup SOC-related values like lookup from nonvolatile ram at startup
enum SYS_STATE_REQUEST SYS_STATE_REQUEST_e
Header for the driver for balancing.
SYS_STATEMACH_SUB_e substate
#define SYS_FSM_MEDIUM_TIME
@ ILCK_STATE_INIT_REQUEST
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diag_id, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
#define SYS_FSM_SHORT_TIME
uint32_t illegalRequestsCounter
bool MEAS_IsFirstMeasurementCycleFinished(void)
Checks if the first MIC measurement cycle was made.
static void SYS_SetState(SYS_STATE_s *pSystemState, SYS_FSM_STATES_e nextState, SYS_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next state, the next substate and the timer value of the state variable.
@ SYS_STATEMACH_INITIALIZE_BMS
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
STD_RETURN_TYPE_e MEAS_StartMeasurement(void)
Makes the initialization request to the MIC state machine.
@ SBC_STATEMACHINE_RUNNING
@ SBC_STATEMACHINE_UNDEFINED
@ SYS_STATEMACH_CHECK_CURRENT_SENSOR_PRESENCE
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
@ ILCK_STATEMACH_UNDEFINED
#define CURRENT_SENSOR_PRESENT
SBC_STATEMACHINE_e SBC_GetState(SBC_STATE_s *pInstance)
gets the current state of passed state variable
@ SYS_WAIT_FIRST_MEASUREMENT_CYCLE
#define SYS_SAVELASTSTATES(x)
uint16_t initializationTimeout
enum SYS_FSM_STATES SYS_FSM_STATES_e
SYS_STATE_REQUEST_e stateRequest
#define SYS_TASK_CYCLE_CONTEXT_MS
#define SYS_STATEMACH_BAL_INITIALIZATION_TIMEOUT_MS
@ ILCK_STATEMACH_WAIT_FIRST_REQUEST
@ SYS_STATEMACH_UNINITIALIZED
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),...
@ SYS_STATE_ERROR_REQUEST
@ BAL_STATE_GLOBAL_ENABLE_REQUEST
FRAM_DEEP_DISCHARGE_FLAG_s fram_deepDischargeFlags
@ SYS_STATEMACH_FIRST_MEASUREMENT_CYCLE
@ SYS_ALREADY_INITIALIZED
@ FRAM_BLOCK_ID_DEEP_DISCHARGE_FLAG
Header for SOX module, responsible for current derating calculation.
STD_RETURN_TYPE_e BMS_GetInitializationState(void)
Gets the initialization state.
@ BAL_STATE_GLOBAL_DISABLE_REQUEST
static SYS_RETURN_TYPE_e SYS_CheckStateRequest(SYS_STATE_REQUEST_e stateRequest)
checks the state requests that are made.
ILCK_STATEMACH_e ILCK_GetState(void)
gets the current state.
enum SBC_STATEMACHINE SBC_STATEMACHINE_e
ILCK_RETURN_TYPE_e ILCK_SetStateRequest(ILCK_STATE_REQUEST_e statereq)
sets the current state request of the state variable ilck_state.
enum SYS_RETURN_TYPE SYS_RETURN_TYPE_e
Header for the driver for the SBC module.
void SOF_Init(void)
initializes the area for SOF (where derating starts and is fully active).
@ SYS_WAIT_INITIALIZATION_BMS
@ SYS_WAIT_INITIALIZATION_BAL
bool CAN_IsCurrentSensorPresent(uint8_t stringNumber)
set flag for presence of current sensor.
Headers for the driver for the measurements needed by the BMS (e.g., I,V,T).
enum BAL_RETURN_TYPE BAL_RETURN_TYPE_e
SBC_STATE_s sbc_stateMcuSupervisor
@ SYS_STATEMACH_INITIALIZE_BALANCING
#define NULL_PTR
Null pointer.
@ SYS_CURRENT_SENSOR_PRESENCE_ERROR
static STD_RETURN_TYPE_e SYS_RunStateMachine(SYS_STATE_s *pSystemState)
Defines the state transitions.
@ SYS_STATEMACH_INITIALIZE_SBC
STD_RETURN_TYPE_e FRAM_Read(FRAM_BLOCK_ID_e blockId)
Reads a variable from the FRAM.
void ALGO_UnlockInitialization(void)
Calling this function sets a signal that lets ALGO_Initialization() know that the initialization has ...
API header for the insulation monitoring device.
void SYS_SendBootMessage(uint8_t directTransmission)
Function to send out boot message with SW version.
SBC_RETURN_TYPE_e SBC_SetStateRequest(SBC_STATE_s *pInstance, SBC_STATE_REQUEST_e stateRequest)
sets the current state request of passed state variable
BAL_RETURN_TYPE_e BAL_SetStateRequest(BAL_STATE_REQUEST_e stateRequest)
sets the current state request of the state variable bal_state.
SYS_RETURN_TYPE_e SYS_SetStateRequest(SYS_STATE_REQUEST_e stateRequest)
sets the current state request of the state variable sys_state.
Header for the driver for the CAN module.
bool CAN_IsCurrentSensorEcPresent(uint8_t stringNumber)
get flag if EC message from current sensor is received
@ ILCK_STATE_OPEN_REQUEST
@ SYS_STATEMACH_INITIALIZE_INTERLOCK
#define SYS_STATEMACH_INITIALIZATION_TIMEOUT_MS
#define SYS_STATEMACHINE_SBC_INIT_TIMEOUT_MS
static SYS_CHECK_MULTIPLE_CALLS_e SYS_CheckMultipleCalls(SYS_STATE_s *pSystemState)
check for multiple calls of state machine trigger function
@ SYS_STATEMACH_INITIALIZED
@ SYS_WAIT_INITIALIZATION_SBC
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
Headers for the driver for the interlock.
@ SYS_WAIT_INITIALIZATION_INTERLOCK
enum SYS_CHECK_MULTIPLE_CALLS SYS_CHECK_MULTIPLE_CALLS_e
@ DIAG_ID_DEEP_DISCHARGE_DETECTED
BMS_RETURN_TYPE_e BMS_SetStateRequest(BMS_STATE_REQUEST_e statereq)
sets the current state request of the state variable bms_state.
void CAN_EnablePeriodic(bool command)
enable/disable the periodic transmit/receive.
#define SYS_FSM_LONG_TIME
Header for the driver for the FRAM module.