-
Notifications
You must be signed in to change notification settings - Fork 156
Open
Description
Hello,
After performing some static code analysis on bms.c state machine, I wonder if I found a fatal flaw for general progression inside the "NORMAL" state.
It seems like BMS_NORMAL_CLOSE_SECOND_STRING_CONTACTOR is only able to exit due to timeout, which should never occur due to constant reset in the entrance of the substate. So it seems to me that the whole BMS state machine will get stuck in the "NORMAL" state
else if (bms_state.substate == BMS_NORMAL_CLOSE_SECOND_STRING_CONTACTOR) {
contactorState = CONT_GetContactorState(nextStringNumber, CONT_MINUS);
if (contactorState == CONT_SWITCH_ON) {
/* First string contactor closed. Close second string contactor */
CONT_CloseContactor(nextStringNumber, CONT_PLUS);
bms_state.timer = BMS_WAIT_TIME_AFTER_CLOSING_STRING_CONTACTOR;
bms_state.substate = BMS_NORMAL_CLOSE_SECOND_STRING_CONTACTOR;
} else if (bms_state.stringCloseTimeout == 0u) {
/* String takes too long to close */
bms_state.timer = BMS_STATEMACH_SHORTTIME;
bms_state.state = BMS_STATEMACH_OPEN_CONTACTORS;
bms_state.nextstate = BMS_STATEMACH_ERROR;
bms_state.substate = BMS_ENTRY;
break;
} else {
/* String minus contactor has not been closed successfully. Re-trigger closing */
CONT_CloseContactor(nextStringNumber, CONT_MINUS);
bms_state.timer = BMS_STATEMACH_SHORTTIME;
}
Metadata
Metadata
Assignees
Labels
No labels