Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BMS_INTERLOCK_CHECKED seems pointless #67

Open
GustavVaeridion opened this issue Dec 13, 2024 · 1 comment
Open

BMS_INTERLOCK_CHECKED seems pointless #67

GustavVaeridion opened this issue Dec 13, 2024 · 1 comment

Comments

@GustavVaeridion
Copy link

Hello,

The substate BMS_INTERLOCK_CHECKED inside [bms.c] BMS state IDLE seems to be pointless. I would highly recommend including BMS_CHECK_ERROR_FLAGS_INTERLOCK and BMS_INTERLOCK_CHECKED into BMS_CHECK_ERROR_FLAGS, for example:

} else if (bms_state.substate == BMS_CHECK_ERROR_FLAGS_INTERLOCK) {
    if (BMS_IsBatterySystemStateOkay() == STD_NOT_OK) {
        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 {
        bms_state.timer    = BMS_STATEMACH_SHORTTIME;
        bms_state.substate = BMS_INTERLOCK_CHECKED;
        break;
    }
} else if (bms_state.substate == BMS_INTERLOCK_CHECKED) {
    bms_state.timer    = BMS_STATEMACH_SHORTTIME;
    bms_state.substate = BMS_CHECK_ERROR_FLAGS;
    break;
} else if (bms_state.substate == BMS_CHECK_ERROR_FLAGS) {
    if (BMS_IsBatterySystemStateOkay() == STD_NOT_OK) {
        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;

Identical result:

/*Check interlock and error state*/
if (bms_state.substate == BMS_CHECK_ERROR_FLAGS) {
    if (BMS_IsBatterySystemStateOkay() == STD_NOT_OK) {
        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;

This should help streamline the state machine logic and contribute to ASIL D certification.

@foxBMS
Copy link
Owner

foxBMS commented Dec 20, 2024

Dear @GustavVaeridion ,

Thank you for your feedback. We will have a look at this.

Best regards,
The foxBMS Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants