foxBMS  1.4.0
The foxBMS Battery Management System API Documentation
bms_cfg.h File Reference

bms driver configuration header More...

#include "general.h"
#include "ftask_cfg.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 statemachine short time definition in BMS_Trigger() calls until next state/substate is processed. More...
 
#define BMS_STATEMACH_MEDIUMTIME   (5u)
 BMS statemachine medium time definition in BMS_Trigger() calls until next state/substate is processed. More...
 
#define BMS_STATEMACH_LONGTIME   (10u)
 BMS statemachine long time definition in BMS_Trigger() calls until next state/substate is processed. More...
 
#define BMS_TIME_WAIT_AFTER_STRING_CLOSED   (20u)
 
#define BMS_TIME_WAIT_AFTER_OPENING_STRING   (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)
 
#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
2022-07-28 (date of last update)
Version
v1.4.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 137 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 134 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 79 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 156 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 177 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 165 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 183 of file bms_cfg.h.

◆ BMS_PRECHARGE_TRIES

#define BMS_PRECHARGE_TRIES   (3u)

Number of allowed tries to close contactors

Definition at line 159 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 162 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 74 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 65 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 71 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 68 of file bms_cfg.h.

◆ BMS_STATEMACH_LONGTIME

#define BMS_STATEMACH_LONGTIME   (10u)

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

Definition at line 113 of file bms_cfg.h.

◆ BMS_STATEMACH_MEDIUMTIME

#define BMS_STATEMACH_MEDIUMTIME   (5u)

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

Definition at line 107 of file bms_cfg.h.

◆ BMS_STATEMACH_SHORTTIME

#define BMS_STATEMACH_SHORTTIME   (1u)

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

Definition at line 101 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 171 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 91 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 125 of file bms_cfg.h.

◆ BMS_STRING_OPEN_TIMEOUT

#define BMS_STRING_OPEN_TIMEOUT   (1000u)

Timeout in BMS_Trigger() calls to wait after opening a string

Definition at line 128 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 140 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 143 of file bms_cfg.h.

◆ BMS_TIME_WAIT_AFTER_OPENING_STRING

#define BMS_TIME_WAIT_AFTER_OPENING_STRING   (10u)

Time in BMS_Trigger() calls to wait after opening a string

Definition at line 119 of file bms_cfg.h.

◆ BMS_TIME_WAIT_AFTER_STRING_CLOSED

#define BMS_TIME_WAIT_AFTER_STRING_CLOSED   (20u)

Time in BMS_Trigger() calls to wait after closing a string

Definition at line 116 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 149 of file bms_cfg.h.