74 #define SYS_SAVELASTSTATES(x) \
75 (x)->lastState = (x)->state; \
76 (x)->lastSubstate = (x)->substate
79 #define SYS_BIST_GENERAL_MAGIC_NUMBER (42u)
100 .illegalRequestsCounter = 0,
101 .initializationTimeout = 0,
169 return multipleCalls;
173 #pragma diag_suppress 179
174 #pragma WEAK(SYS_SetState)
182 pSystemState->
timer = idleTime;
187 #pragma diag_suppress 179
188 #pragma WEAK(SYS_SetSubstate)
204 switch (pSystemState->
state) {
226 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
338 if (balancingInitializationState ==
STD_OK) {
360 if (balancingGlobalEnableState ==
BAL_OK) {
423 #if CURRENT_SENSOR_ISABELLENHUETTE_TRIGGERED
429 pSystemState->
timer = SYS_FSM_LONG_TIME_MS;
435 bool allSensorsPresent =
true;
436 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
449 allSensorsPresent =
false;
453 if (allSensorsPresent ==
true) {
482 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
542 return ranStateMachine;
624 bool earlyExit =
false;
633 if (earlyExit ==
false) {
634 if (pSystemState->
timer > 0u) {
635 if ((--pSystemState->
timer) > 0u) {
643 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_RETURN_TYPE_e BAL_SetStateRequest(BAL_STATE_REQUEST_e stateRequest)
sets the current state request of the state variable bal_state.
@ BAL_STATE_GLOBAL_ENABLE_REQUEST
@ BAL_STATE_GLOBAL_DISABLE_REQUEST
enum BAL_RETURN_TYPE BAL_RETURN_TYPE_e
#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_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 diag_id, 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.
STD_RETURN_TYPE_e FRAM_Read(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.
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
#define REPEAT_MAXIMUM_REPETITIONS
#define REPEAT_U(x, n)
Macro that helps to generate a series of literals (for array initializers).
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.
ILCK_STATEMACH_e ILCK_GetState(void)
gets the current state.
Headers for the driver for the interlock.
@ ILCK_STATEMACH_WAIT_FIRST_REQUEST
@ ILCK_STATEMACH_UNDEFINED
@ ILCK_STATE_OPEN_REQUEST
@ ILCK_STATE_INIT_REQUEST
STD_RETURN_TYPE_e MEAS_StartMeasurement(void)
Makes the initialization request to the MIC state machine.
bool MEAS_IsFirstMeasurementCycleFinished(void)
Checks if the first MIC measurement cycle was made.
Headers for the driver for the measurements needed by the BMS (e.g., I,V,T).
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.
Implementation of the tasks used by the system, headers.
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
enum SBC_STATEMACHINE SBC_STATEMACHINE_e
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_SoeInit(bool ec_present, uint8_t stringNumber)
Wrapper for algorithm specific SOE initialization.
void SE_SocInit(bool cc_present, uint8_t stringNumber)
Wrapper for algorithm specific SOC initialization.
Header for state-estimation module responsible for the estimation of state-of-charge (SOC),...
bool deepDischargeFlag[BS_NR_OF_STRINGS]
uint32_t illegalRequestsCounter
SYS_STATE_REQUEST_e stateRequest
uint16_t initializationTimeout
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.
#define SYS_SAVELASTSTATES(x)
#define SYS_BIST_GENERAL_MAGIC_NUMBER
enum SYS_CHECK_MULTIPLE_CALLS SYS_CHECK_MULTIPLE_CALLS_e
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
enum SYS_FSM_STATES SYS_FSM_STATES_e
@ SYS_STATEMACH_SYSTEM_BIST
@ SYS_STATEMACH_INITIALIZE_SBC
@ SYS_STATEMACH_UNINITIALIZED
@ SYS_STATEMACH_INITIALIZE_BALANCING
@ SYS_STATEMACH_INITIALIZATION
@ 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
@ SYS_ALREADY_INITIALIZED
enum SYS_FSM_SUBSTATES SYS_FSM_SUBSTATES_e
enum SYS_RETURN_TYPE SYS_RETURN_TYPE_e
@ SYS_STATE_ERROR_REQUEST
@ SYS_WAIT_FIRST_MEASUREMENT_CYCLE
@ SYS_WAIT_INITIALIZATION_BAL_GLOBAL_ENABLE
@ SYS_WAIT_INITIALIZATION_BMS
@ SYS_WAIT_INITIALIZATION_SBC
@ SYS_WAIT_INITIALIZATION_BAL
@ SYS_WAIT_INITIALIZATION_INTERLOCK
@ SYS_CURRENT_SENSOR_PRESENCE_ERROR
@ SYS_WAIT_CURRENT_SENSOR_PRESENCE
enum SYS_STATE_REQUEST SYS_STATE_REQUEST_e
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_TASK_CYCLE_CONTEXT_MS
#define SYS_FSM_SHORT_TIME