foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
bms_cfg.h File Reference

bms driver configuration header More...

#include "ftask_cfg.h"
#include <stdint.h>
Include dependency graph for bms_cfg.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BMS_REQ_ID_NOREQ   (0u)
 
#define BMS_REQ_ID_STANDBY   (3u)
 
#define BMS_REQ_ID_NORMAL   (1u)
 
#define BMS_REQ_ID_CHARGE   (2u)
 
#define BMS_NO_STRING_AVAILABLE   (255u)
 Functions searching for next string return this value if no further string is available. More...
 
#define BMS_STATEMACHINE_TASK_CYCLE_CONTEXT_MS   (10u)
 TODO. More...
 
#define BMS_STATEMACH_SHORTTIME   (1u)
 BMS state machine short time definition in BMS_Trigger() calls until next state/substate is processed. More...
 
#define BMS_STATEMACH_MEDIUMTIME   (5u)
 BMS state machine medium time definition in BMS_Trigger() calls until next state/substate is processed. More...
 
#define BMS_STATEMACH_LONGTIME   (10u)
 BMS state machine long time definition in BMS_Trigger() calls until next state/substate is processed. More...
 
#define BMS_WAIT_TIME_AFTER_CLOSING_STRING_CONTACTOR   (20u)
 
#define BMS_WAIT_TIME_AFTER_OPENING_STRING_CONTACTOR   (10u)
 
#define BMS_WAIT_TIME_BETWEEN_CLOSING_STRINGS   (10u)
 
#define BMS_STRING_CLOSE_TIMEOUT   (500u)
 Timeout in BMS_Trigger() calls when closing a string after which the state machines goes to error if the string still has not closed. More...
 
#define BMS_STRING_OPEN_TIMEOUT   (1000u)
 Timeout in BMS_Trigger() calls when opening a string after which the state machines goes to error if the string still has not opened. More...
 
#define BMS_NEXT_STRING_VOLTAGE_LIMIT_MV   (3000)
 Max voltage difference in mV between two strings to allow closing the next string. More...
 
#define BMS_AVERAGE_STRING_CURRENT_LIMIT_MA   (20000)
 
#define BMS_TIME_WAIT_AFTER_CLOSING_PRECHARGE   (100u)
 
#define BMS_TIME_WAIT_AFTER_OPENING_PRECHARGE   (50u)
 
#define BMS_TIME_WAIT_AFTERPRECHARGEFAIL   (300u)
 Time to wait in BMS_Trigger() calls after precharge opened because precharge failed. More...
 
#define BMS_OSCILLATION_TIMEOUT   (1000u)
 Timeout in 1*10ms to wait before re-entering to precharge. More...
 
#define BMS_PRECHARGE_TRIES   (3u)
 
#define BMS_PRECHARGE_VOLTAGE_THRESHOLD_mV   (1000LL) /* mV */
 
#define BMS_PRECHARGE_CURRENT_THRESHOLD_mA   (50) /* mA */
 
#define BMS_STATEMACH_TIMEAFTERPRECHARGEFAIL   (100u)
 
#define BMS_PRECHARGE_CLOSE_TIMEOUT   (500u)
 
#define BMS_PRECHARGE_OPEN_TIMEOUT   (500u)
 

Detailed Description

bms driver configuration header

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2020-02-24 (date of creation)
Updated
2023-02-03 (date of last update)
Version
v1.5.0
Prefix
BMS

Definition in file bms_cfg.h.

Macro Definition Documentation

◆ BMS_AVERAGE_STRING_CURRENT_LIMIT_MA

#define BMS_AVERAGE_STRING_CURRENT_LIMIT_MA   (20000)

Max average string current to allow closing next string

Definition at line 144 of file bms_cfg.h.

◆ BMS_NEXT_STRING_VOLTAGE_LIMIT_MV

#define BMS_NEXT_STRING_VOLTAGE_LIMIT_MV   (3000)

Max voltage difference in mV between two strings to allow closing the next string.

Definition at line 141 of file bms_cfg.h.

◆ BMS_NO_STRING_AVAILABLE

#define BMS_NO_STRING_AVAILABLE   (255u)

Functions searching for next string return this value if no further string is available.

Definition at line 80 of file bms_cfg.h.

◆ BMS_OSCILLATION_TIMEOUT

#define BMS_OSCILLATION_TIMEOUT   (1000u)

Timeout in 1*10ms to wait before re-entering to precharge.

Prevents mechanical close/open timer cycle in case the control units sends incorrect state requests.

Definition at line 163 of file bms_cfg.h.

◆ BMS_PRECHARGE_CLOSE_TIMEOUT

#define BMS_PRECHARGE_CLOSE_TIMEOUT   (500u)

Timeout in BMS_Trigger() calls when closing precharge after which the state machines goes to error if precharge still has not closed

Definition at line 184 of file bms_cfg.h.

◆ BMS_PRECHARGE_CURRENT_THRESHOLD_mA

#define BMS_PRECHARGE_CURRENT_THRESHOLD_mA   (50) /* mA */

Precharge threshold limit on current (in mA)

Definition at line 172 of file bms_cfg.h.

◆ BMS_PRECHARGE_OPEN_TIMEOUT

#define BMS_PRECHARGE_OPEN_TIMEOUT   (500u)

Timeout in BMS_Trigger() calls when opening precharge after which the state machines goes to error if precharge still has not opened

Definition at line 190 of file bms_cfg.h.

◆ BMS_PRECHARGE_TRIES

#define BMS_PRECHARGE_TRIES   (3u)

Number of allowed tries to close contactors

Definition at line 166 of file bms_cfg.h.

◆ BMS_PRECHARGE_VOLTAGE_THRESHOLD_mV

#define BMS_PRECHARGE_VOLTAGE_THRESHOLD_mV   (1000LL) /* mV */

Precharge threshold limit on voltage (in mV)

Definition at line 169 of file bms_cfg.h.

◆ BMS_REQ_ID_CHARGE

#define BMS_REQ_ID_CHARGE   (2u)

ID to request the CHARGE state via CAN

Definition at line 75 of file bms_cfg.h.

◆ BMS_REQ_ID_NOREQ

#define BMS_REQ_ID_NOREQ   (0u)

ID to send a message without request

Definition at line 66 of file bms_cfg.h.

◆ BMS_REQ_ID_NORMAL

#define BMS_REQ_ID_NORMAL   (1u)

ID to request the NORMAL state via CAN

Definition at line 72 of file bms_cfg.h.

◆ BMS_REQ_ID_STANDBY

#define BMS_REQ_ID_STANDBY   (3u)

ID to request the STANDBY state via CAN

Definition at line 69 of file bms_cfg.h.

◆ BMS_STATEMACH_LONGTIME

#define BMS_STATEMACH_LONGTIME   (10u)

BMS state machine long time definition in BMS_Trigger() calls until next state/substate is processed.

Definition at line 114 of file bms_cfg.h.

◆ BMS_STATEMACH_MEDIUMTIME

#define BMS_STATEMACH_MEDIUMTIME   (5u)

BMS state machine medium time definition in BMS_Trigger() calls until next state/substate is processed.

Definition at line 108 of file bms_cfg.h.

◆ BMS_STATEMACH_SHORTTIME

#define BMS_STATEMACH_SHORTTIME   (1u)

BMS state machine short time definition in BMS_Trigger() calls until next state/substate is processed.

Definition at line 102 of file bms_cfg.h.

◆ BMS_STATEMACH_TIMEAFTERPRECHARGEFAIL

#define BMS_STATEMACH_TIMEAFTERPRECHARGEFAIL   (100u)

Time to wait after contactors opened because precharge failed in BMS_Trigger() calls

Definition at line 178 of file bms_cfg.h.

◆ BMS_STATEMACHINE_TASK_CYCLE_CONTEXT_MS

#define BMS_STATEMACHINE_TASK_CYCLE_CONTEXT_MS   (10u)

TODO.

This define MUST represent the cycle time of the task in which context the functions run, e.g., if the BMS_Trigger() is running in the 10 ms task then the define must be set to 10. This sets the minimum time between two subsequent executed states/substates. Define is only used for compile-time assertion, it has no programatic influence on the actual code.

Definition at line 92 of file bms_cfg.h.

◆ BMS_STRING_CLOSE_TIMEOUT

#define BMS_STRING_CLOSE_TIMEOUT   (500u)

Timeout in BMS_Trigger() calls when closing a string after which the state machines goes to error if the string still has not closed.

Definition at line 129 of file bms_cfg.h.

◆ BMS_STRING_OPEN_TIMEOUT

#define BMS_STRING_OPEN_TIMEOUT   (1000u)

Timeout in BMS_Trigger() calls when opening a string after which the state machines goes to error if the string still has not opened.

Definition at line 135 of file bms_cfg.h.

◆ BMS_TIME_WAIT_AFTER_CLOSING_PRECHARGE

#define BMS_TIME_WAIT_AFTER_CLOSING_PRECHARGE   (100u)

Delay after closing precharge in BMS_Trigger() calls

Definition at line 147 of file bms_cfg.h.

◆ BMS_TIME_WAIT_AFTER_OPENING_PRECHARGE

#define BMS_TIME_WAIT_AFTER_OPENING_PRECHARGE   (50u)

Delay after opening precharge in BMS_Trigger() calls

Definition at line 150 of file bms_cfg.h.

◆ BMS_TIME_WAIT_AFTERPRECHARGEFAIL

#define BMS_TIME_WAIT_AFTERPRECHARGEFAIL   (300u)

Time to wait in BMS_Trigger() calls after precharge opened because precharge failed.

Definition at line 156 of file bms_cfg.h.

◆ BMS_WAIT_TIME_AFTER_CLOSING_STRING_CONTACTOR

#define BMS_WAIT_TIME_AFTER_CLOSING_STRING_CONTACTOR   (20u)

Time in BMS_Trigger() calls to wait after closing any string minus or string plus contactor

Definition at line 117 of file bms_cfg.h.

◆ BMS_WAIT_TIME_AFTER_OPENING_STRING_CONTACTOR

#define BMS_WAIT_TIME_AFTER_OPENING_STRING_CONTACTOR   (10u)

Time in BMS_Trigger() calls to wait after opening any string minus or string plus contactor

Definition at line 120 of file bms_cfg.h.

◆ BMS_WAIT_TIME_BETWEEN_CLOSING_STRINGS

#define BMS_WAIT_TIME_BETWEEN_CLOSING_STRINGS   (10u)

Time in BMS_Trigger() calls to wait between closing complete strings

Definition at line 123 of file bms_cfg.h.