Skip to content

BMS_NORMAL_CLOSE_SECOND_STRING_CONTACTOR BMS substate only exits on timeout #68

@GustavVaeridion

Description

@GustavVaeridion

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;
    }

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions