75 #define SYS_SAVELASTSTATES(x) \
76 (x)->lastState = (x)->state; \
77 (x)->lastSubstate = (x)->substate
80 #define SYS_BIST_GENERAL_MAGIC_NUMBER (42u)
101 .illegalRequestsCounter = 0,
102 .initializationTimeout = 0,
170 return multipleCalls;
174 #pragma diag_suppress 179
175 #pragma WEAK(SYS_SetState)
183 pSystemState->
timer = idleTime;
188 #pragma diag_suppress 179
189 #pragma WEAK(SYS_SetSubstate)
203 bool imdInitialized =
false;
205 switch (pSystemState->
state) {
327 if (balancingInitializationState ==
STD_OK) {
349 if (balancingGlobalEnableState ==
BAL_OK) {
412 #if defined(CURRENT_SENSOR_ISABELLENHUETTE_TRIGGERED)
418 pSystemState->
timer = SYS_FSM_LONG_TIME_MS;
424 bool allSensorsPresent =
true;
439 allSensorsPresent =
false;
443 if (allSensorsPresent ==
true) {
513 if (imdInitialized ==
true) {
586 return ranStateMachine;
668 bool earlyExit =
false;
677 if (earlyExit ==
false) {
678 if (pSystemState->
timer > 0u) {
679 if ((--pSystemState->
timer) > 0u) {
687 if (earlyExit ==
false) {
void ALGO_UnlockInitialization(void)
Calling this function sets a signal that lets ALGO_Initialization() know that the initialization has ...
Headers for the driver for the storage in the EEPROM memory.
Header for the driver for balancing.
STD_RETURN_TYPE_e BAL_GetInitializationState(void)
gets the initialization state.
@ BAL_STATE_GLOBAL_ENABLE_REQUEST
@ BAL_STATE_GLOBAL_DISABLE_REQUEST
BAL_RETURN_TYPE_e BAL_SetStateRequest(BAL_STATE_REQUEST_e stateRequest)
sets the current state request of the state variable bal_state.
#define BS_NR_OF_STRINGS
Number of parallel strings in the battery pack.
#define CURRENT_SENSOR_PRESENT
#define BALANCING_DEFAULT_INACTIVE
BMS_RETURN_TYPE_e BMS_SetStateRequest(BMS_STATE_REQUEST_e statereq)
sets the current state request of the state variable bms_state.
STD_RETURN_TYPE_e BMS_GetInitializationState(void)
Gets the initialization state.
bool CAN_IsCurrentSensorCcPresent(uint8_t stringNumber)
get flag if CC message from current sensor is received.
bool CAN_IsCurrentSensorEcPresent(uint8_t stringNumber)
get flag if EC message from current sensor is received
bool CAN_IsCurrentSensorPresent(uint8_t stringNumber)
set flag for presence of current sensor.
void CAN_Initialize(void)
Enables the CAN transceiver.. This function sets th pins to enable the CAN transceiver....
void CAN_EnablePeriodic(bool command)
enable/disable the periodic transmit/receive.
Header for the driver for the CAN module.
void DATA_ExecuteDataBist(void)
Executes a built-in self-test for the database module.
DIAG_RETURNTYPE_e DIAG_Handler(DIAG_ID_e diagId, DIAG_EVENT_e event, DIAG_IMPACT_LEVEL_e impact, uint32_t data)
DIAG_Handler provides generic error handling, based on diagnosis group.
@ DIAG_ID_DEEP_DISCHARGE_DETECTED
#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.
FRAM_RETURN_TYPE_e FRAM_ReadData(FRAM_BLOCK_ID_e blockId)
Reads a variable from the FRAM.
Header for the driver for the FRAM module.
FRAM_DEEP_DISCHARGE_FLAG_s fram_deepDischargeFlags
@ FRAM_BLOCK_ID_DEEP_DISCHARGE_FLAG
#define NULL_PTR
Null pointer.
#define GEN_REPEAT_U(x, n)
Macro that helps to generate a series of literals (for array initializers).
#define GEN_REPEAT_MAXIMUM_REPETITIONS
bool IMD_GetInitializationState(void)
Gets the initialization state.
IMD_RETURN_TYPE_e IMD_RequestInitialization(void)
Request initialization of IMD statemachine.
API header for the insulation monitoring device.
ILCK_RETURN_TYPE_e ILCK_SetStateRequest(ILCK_STATE_REQUEST_e statereq)
sets the current state request of the state variable ilck_state.
Headers for the driver for the interlock.
@ ILCK_STATE_INITIALIZATION_REQUEST
STD_RETURN_TYPE_e MEAS_StartMeasurement(void)
Makes the initialization request to the AFE state machine.
bool MEAS_IsFirstMeasurementCycleFinished(void)
Checks if the first AFE measurement cycle was made.
Headers for the driver for the measurements needed by the BMS (e.g., I,V,T).
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.
SBC_STATEMACHINE_e SBC_GetState(SBC_STATE_s *pInstance)
gets the current state of passed state variable
SBC_STATE_s sbc_stateMcuSupervisor
SBC_RETURN_TYPE_e SBC_SetStateRequest(SBC_STATE_s *pInstance, SBC_STATE_REQUEST_e stateRequest)
sets the current state request of passed state variable
Header for the driver for the SBC module.
@ SBC_STATEMACHINE_RUNNING
@ SBC_STATEMACHINE_UNDEFINED
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.
void SE_InitializeSoe(bool ec_present, uint8_t stringNumber)
Wrapper for algorithm specific SOE initialization.
void SE_InitializeSoc(bool ccPresent, uint8_t stringNumber)
Wrapper for algorithm specific SOC initialization.
void SE_InitializeSoh(uint8_t stringNumber)
Wrapper for algorithm specific SOH initialization.
Header for state-estimation module responsible for the estimation of state-of-charge (SOC),...
bool deepDischargeFlag[BS_NR_OF_STRINGS]
uint16_t initializationTimeout
uint32_t illegalRequestsCounter
SYS_STATE_REQUEST_e stateRequest
SYS_STATEMACH_SUB_e substate
static SYS_STATE_REQUEST_e SYS_TransferStateRequest(void)
transfers the current state request to the state machine.
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_CHECK_MULTIPLE_CALLS_e
#define SYS_SAVELASTSTATES(x)
#define SYS_BIST_GENERAL_MAGIC_NUMBER
SYS_RETURN_TYPE_e SYS_SetStateRequest(SYS_STATE_REQUEST_e stateRequest)
sets the current state request of the state variable sys_state.
static STD_RETURN_TYPE_e SYS_RunStateMachine(SYS_STATE_s *pSystemState)
Defines the state transitions.
static SYS_RETURN_TYPE_e SYS_CheckStateRequest(SYS_STATE_REQUEST_e stateRequest)
checks the state requests that are made.
STD_RETURN_TYPE_e SYS_Trigger(SYS_STATE_s *pSystemState)
tick function, call this to advance the state machine
void SYS_GeneralMacroBist(void)
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.
static SYS_CHECK_MULTIPLE_CALLS_e SYS_CheckMultipleCalls(SYS_STATE_s *pSystemState)
check for multiple calls of state machine trigger function
@ SYS_BAL_INITIALIZATION_ERROR
@ SYS_WAIT_FIRST_MEASUREMENT_CYCLE
@ SYS_WAIT_INITIALIZATION_IMD
@ SYS_SBC_INITIALIZATION_ERROR
@ SYS_WAIT_INITIALIZATION_BAL_GLOBAL_ENABLE
@ SYS_BMS_INITIALIZATION_ERROR
@ SYS_WAIT_INITIALIZATION_BMS
@ SYS_WAIT_INITIALIZATION_SBC
@ SYS_WAIT_INITIALIZATION_BAL
@ SYS_CURRENT_SENSOR_PRESENCE_ERROR
@ SYS_MEAS_INITIALIZATION_ERROR
@ SYS_WAIT_CURRENT_SENSOR_PRESENCE
@ SYS_IMD_INITIALIZATION_ERROR
@ SYS_ALREADY_INITIALIZED
@ SYS_STATE_INITIALIZATION_REQUEST
@ SYS_STATE_ERROR_REQUEST
@ SYS_STATEMACH_INITIALIZE_CAN
@ SYS_STATEMACH_SYSTEM_BIST
@ SYS_STATEMACH_INITIALIZE_SBC
@ SYS_STATEMACH_UNINITIALIZED
@ SYS_STATEMACH_INITIALIZE_BALANCING
@ SYS_STATEMACH_INITIALIZATION
@ SYS_STATEMACH_INITIALIZE_IMD
@ SYS_STATEMACH_INITIALIZE_MISC
@ SYS_STATEMACH_INITIALIZED
@ SYS_STATEMACH_FIRST_MEASUREMENT_CYCLE
@ SYS_STATEMACH_INITIALIZE_BMS
@ SYS_STATEMACH_CHECK_CURRENT_SENSOR_PRESENCE
@ SYS_STATEMACH_INITIALIZE_INTERLOCK
void SYS_SendBootMessage(void)
Function to send out boot message with SW version.
#define SYS_FSM_MEDIUM_TIME
#define SYS_STATEMACH_BAL_INITIALIZATION_TIMEOUT_MS
#define SYS_STATEMACH_INITIALIZATION_TIMEOUT_MS
#define SYS_FSM_LONG_TIME
#define SYS_STATEMACHINE_SBC_INIT_TIMEOUT_MS
#define SYS_STATEMACH_INITIALIZATION_REQUEST_RETRY_COUNTER
#define SYS_STATEMACH_IMD_INITIALIZATION_TIMEOUT_MS
#define SYS_TASK_CYCLE_CONTEXT_MS
#define SYS_FSM_SHORT_TIME