foxBMS  1.0.0
The foxBMS Battery Management System API Documentation
bms.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der
4  * angewandten Forschung e.V. All rights reserved.
5  *
6  * BSD 3-Clause License
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * We kindly request you to use one or more of the following phrases to refer
31  * to foxBMS in your hardware, software, documentation or advertising
32  * materials:
33  *
34  * ″This product uses parts of foxBMS®″
35  *
36  * ″This product includes parts of foxBMS®″
37  *
38  * ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file bms.h
44  * @author foxBMS Team
45  * @date 2020-02-24 (date of creation)
46  * @updated 2020-02-24 (date of last update)
47  * @ingroup ENGINE
48  * @prefix BMS
49  *
50  * @brief bms driver header
51  *
52  *
53  */
54 
55 #ifndef FOXBMS__BMS_H_
56 #define FOXBMS__BMS_H_
57 
58 /*========== Includes =======================================================*/
59 #include "battery_system_cfg.h"
60 #include "bms_cfg.h"
61 
62 /*========== Macros and Definitions =========================================*/
63 
64 /** Symbolic names for battery system state */
65 typedef enum BMS_CURRENT_FLOW_STATE {
66  BMS_CHARGING, /*!< battery is charged */
67  BMS_DISCHARGING, /*!< battery is discharged */
68  BMS_RELAXATION, /*!< battery relaxation ongoing */
69  BMS_AT_REST, /*!< battery is resting */
71 
72 /** Symbolic names for busyness of the syscontrol */
73 typedef enum BMS_CHECK {
74  BMS_CHECK_OK, /*!< syscontrol ok */
75  BMS_CHECK_BUSY, /*!< syscontrol busy */
76  BMS_CHECK_NOT_OK, /*!< syscontrol not ok */
78 
79 /** Symbolic names to take precharge into account or not */
80 typedef enum BMS_CONSIDER_PRECHARGE {
81  BMS_DO_NOT_TAKE_PRECHARGE_INTO_ACCCOUNT, /*!< do not take precharge into account */
82  BMS_TAKE_PRECHARGE_INTO_ACCCOUNT, /*!< do take precharge into account */
84 
85 /** States of the SYS state machine */
86 typedef enum BMS_STATEMACH {
87  /* Init-Sequence */
102 
103 /** CAN states of the BMS state machine */
104 typedef enum BMS_CANSTATE {
105  /* Init-Sequence */
117 
118 /** Substates of the SYS state machine */
119 typedef enum BMS_STATEMACH_SUB {
120  BMS_ENTRY, /*!< Substate entry state */
121  BMS_CHECK_ERROR_FLAGS_INTERLOCK, /*!< Substate check measurements after interlock closed */
122  BMS_INTERLOCK_CHECKED, /*!< Substate interlocked checked */
123  BMS_CHECK_STATE_REQUESTS, /*!< Substate check if there is a state request */
124  BMS_CHECK_BALANCING_REQUESTS, /*!< Substate check if there is a balancing request */
125  BMS_CHECK_ERROR_FLAGS, /*!< Substate check if any error flag set */
126  BMS_CHECK_CONTACTOR_NORMAL_STATE, /*!< Substate in precharge, check if there contactors reached normal */
127  BMS_CHECK_CONTACTOR_CHARGE_STATE, /*!< Substate in precharge, check if there contactors reached normal */
128  BMS_OPEN_INTERLOCK, /*!< Substate in error to open interlock after contactors have been opened */
129  BMS_CHECK_INTERLOCK_CLOSE_AFTER_ERROR, /*!< Substate in error to close interlock after all error flags were reset */
153 
154 /** State requests for the BMS statemachine */
155 typedef enum BMS_STATE_REQUEST {
156  BMS_STATE_INIT_REQUEST, /*!< request for initialization */
157  BMS_STATE_ERROR_REQUEST, /*!< request for ERROR state */
158  BMS_STATE_NO_REQUEST, /*!< dummy request for no request */
160 
161 /**
162  * Possible return values when state requests are made to the SYS statemachine
163  */
164 typedef enum BMS_RETURN_TYPE {
165  BMS_OK, /*!< CONT --> ok */
166  BMS_BUSY_OK, /*!< CONT under load --> ok */
167  BMS_REQUEST_PENDING, /*!< requested to be executed */
168  BMS_ILLEGAL_REQUEST, /*!< Request can not be executed */
169  BMS_ALREADY_INITIALIZED, /*!< Initialization of LTC already finished */
170  BMS_ILLEGAL_TASK_TYPE, /*!< Illegal */
172 
173 /** Powerline type (discharge or charge) */
174 typedef enum BMS_POWERLINE_TYPE {
175  BMS_PL_OPEN, /* contactors open */
176  BMS_PL_0, /* discharge */
177  BMS_PL_1, /* charge */
179 
180 /**
181  * This structure contains all the variables relevant for the CONT state
182  * machine. The user can get the current state of the CONT state machine with
183  * this variable
184  */
185 typedef struct BMS_STATE {
186  uint16_t timer; /*!< time in ms before the state machine processes the next state, e.g. in counts of 1ms */
187  BMS_STATE_REQUEST_e stateRequest; /*!< current state request made to the state machine */
188  BMS_STATEMACH_e state; /*!< current state of State Machine */
189  BMS_STATEMACH_SUB_e substate; /*!< current substate of the state machine */
190  BMS_STATEMACH_e laststate; /*!< previous state of the state machine */
191  BMS_STATEMACH_SUB_e lastsubstate; /*!< previous substate of the state machine */
192  uint32_t ErrRequestCounter; /*!< counts the number of illegal requests to the LTC state machine */
193  STD_RETURN_TYPE_e initFinished; /*!< #STD_OK if the initialization has passed, #STD_NOT_OK otherwise */
194  uint8_t triggerentry; /*!< counter for re-entrance protection (function running flag) */
195  uint8_t counter; /*!< general purpose counter */
196  BMS_CURRENT_FLOW_STATE_e currentFlowState; /*!< state of battery system */
197  uint32_t restTimer_10ms; /*!< timer until battery system is at rest */
198  uint16_t OscillationTimeout; /*!< timeout to prevent oscillation of contactors */
199  uint8_t PrechargeTryCounter; /*!< timeout to prevent oscillation of contactors */
200  BMS_POWERLINE_TYPE_e powerline; /*!< powerline type (discharge or charge) */
201  uint8_t numberOfClosedStrings; /*!< number of closed strings */
202  uint16_t stringOpenTimeout; /*!< timeout to abort if string opening takes too long */
203  uint32_t nextstringclosedtimer; /*!< timer to wait if the next string was closed */
204  uint16_t stringCloseTimeout; /*!< timeout to abort if a string takes too long to close */
205  BMS_STATEMACH_e nextstate; /*!< next state of the State Machine */
206  uint8_t firstClosedString; /*!< strings with highest or lowest voltage, that was closed first */
207  uint16_t prechargeOpenTimeout; /*!< timeout to abort if string opening takes too long */
208  uint16_t prechargeCloseTimeout; /*!< timeout to abort if a string takes too long to close */
209  uint8_t closedPrechargeContactors[BS_NR_OF_STRINGS]; /*!< strings whose precharge contactors are closed */
210  uint8_t closedStrings[BS_NR_OF_STRINGS]; /*!< strings whose contactors are closed */
211  uint8_t deactivatedStrings[BS_NR_OF_STRINGS]; /*!< Deactivated strings after error detection, cannot be closed */
213 
214 /*========== Extern Constant and Variable Declarations ======================*/
215 
216 /*========== Extern Function Prototypes =====================================*/
217 /**
218  * @brief sets the current state request of the state variable bms_state.
219  * @details This function is used to make a state request to the state machine,
220  * e.g, start voltage measurement, read result of voltage measurement,
221  * re-initialization.
222  * It calls #BMS_CheckStateRequest() to check if the request is valid.
223  * The state request is rejected if is not valid. The result of the
224  * check is returned immediately, so that the requester can act in
225  * case it made a non-valid state request.
226  * @param statereq state request to set
227  * @return current state request
228  */
230 
231 /**
232  * @brief Returns the current state.
233  * @details This function is used in the functioning of the SYS state machine.
234  * @return current state, taken from BMS_STATEMACH_e
235  */
236 extern BMS_STATEMACH_e BMS_GetState(void);
237 
238 /**
239  * @brief Gets the initialization state.
240  * @details This function is used for getting the BMS initialization state.
241  * @return #STD_OK if initialized, otherwise #STD_NOT_OK
242  */
244 
245 /**
246  * @brief trigger function for the SYS driver state machine.
247  * @details This function contains the sequence of events in the SYS state
248  * machine. It must be called time-triggered, every 10 milliseconds.
249  */
250 extern void BMS_Trigger(void);
251 
252 /**
253  * @brief Returns current battery system state (charging/discharging,
254  * resting or in relaxation phase)
255  *
256  * @return #BMS_CURRENT_FLOW_STATE_e
257  */
259 
260 /**
261  * @brief Get current flow direction, current value as function parameter
262  * @param[in] current_mA current that is flowing
263  * @return #BMS_DISCHARGING or #BMS_CHARGING depending on current direction.
264  * Return #BMS_AT_REST. ((type: #BMS_CURRENT_FLOW_STATE_e)
265  */
266 extern BMS_CURRENT_FLOW_STATE_e BMS_GetCurrentFlowDirection(int32_t current_mA);
267 
268 /**
269  * @brief Returns string state (closed or open)
270  * @param[in] stringNumber string addressed
271  * @return false if string is open, true if string is closed
272  */
273 extern bool BMS_IsStringClosed(uint8_t stringNumber);
274 
275 /**
276  * @brief Returns if string is currently precharging or not
277  * @param[in] stringNumber string addressed
278  * @return false if precharge contactor is open, true if closed and string is
279  * precharging
280  */
281 extern bool BMS_IsStringPrecharging(uint8_t stringNumber);
282 
283 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
284 #ifdef UNITY_UNIT_TEST
285 /* database.h is only included in bms.c and there used as function parameter
286  * for static functions. Thus, we need to add the required include here. */
287 #include "database.h"
288 
289 extern BMS_RETURN_TYPE_e TEST_BMS_CheckStateRequest(BMS_STATE_REQUEST_e statereq);
290 extern BMS_STATE_REQUEST_e TEST_BMS_TransferStateRequest(void);
291 extern uint8_t TEST_BMS_CheckReEntrance(void);
292 extern uint8_t TEST_BMS_CheckCanRequests(void);
293 extern STD_RETURN_TYPE_e TEST_BMS_CheckAnyErrorFlagSet(void);
294 extern void TEST_BMS_GetMeasurementValues(void);
295 extern void TEST_BMS_CheckOpenSenseWire(void);
296 extern STD_RETURN_TYPE_e TEST_BMS_CheckPrecharge(uint8_t stringNumber, DATA_BLOCK_PACK_VALUES_s *pPackValues);
297 extern uint8_t TEST_BMS_GetHighestString(BMS_CONSIDER_PRECHARGE_e precharge, DATA_BLOCK_PACK_VALUES_s *pPackValues);
298 extern uint8_t TEST_BMS_GetClosestString(BMS_CONSIDER_PRECHARGE_e precharge, DATA_BLOCK_PACK_VALUES_s *pPackValues);
299 extern uint8_t TEST_BMS_GetLowestString(BMS_CONSIDER_PRECHARGE_e precharge, DATA_BLOCK_PACK_VALUES_s *pPackValues);
300 extern int32_t TEST_BMS_GetStringVoltageDifference(uint8_t string, DATA_BLOCK_PACK_VALUES_s *pPackValues);
301 extern int32_t TEST_BMS_GetAverageStringCurrent(DATA_BLOCK_PACK_VALUES_s *pPackValues);
302 extern void TEST_BMS_UpdateBatsysState(DATA_BLOCK_PACK_VALUES_s *pPackValues);
303 #endif
304 
305 #endif /* FOXBMS__BMS_H_ */
BMS_GetInitializationState
STD_RETURN_TYPE_e BMS_GetInitializationState(void)
Gets the initialization state.
Definition: bms.c:592
BMS_CHECK_ERROR_FLAGS_PRECHARGE
@ BMS_CHECK_ERROR_FLAGS_PRECHARGE
Definition: bms.h:139
BMS_STATE_NO_REQUEST
@ BMS_STATE_NO_REQUEST
Definition: bms.h:158
BMS_CHECK_ERROR_FLAGS
@ BMS_CHECK_ERROR_FLAGS
Definition: bms.h:125
BMS_CHECK_BALANCING_REQUESTS
@ BMS_CHECK_BALANCING_REQUESTS
Definition: bms.h:124
BMS_CANSTATE_e
enum BMS_CANSTATE BMS_CANSTATE_e
BMS_STATEMACH_SUB_e
enum BMS_STATEMACH_SUB BMS_STATEMACH_SUB_e
BMS_OPEN_STRINGS_EXIT
@ BMS_OPEN_STRINGS_EXIT
Definition: bms.h:151
bms_cfg.h
bms driver configuration header
BMS_BUSY_OK
@ BMS_BUSY_OK
Definition: bms.h:166
BMS_CURRENT_FLOW_STATE_e
enum BMS_CURRENT_FLOW_STATE BMS_CURRENT_FLOW_STATE_e
BMS_STATE_s
struct BMS_STATE BMS_STATE_s
BMS_STATEMACH_ERROR
@ BMS_STATEMACH_ERROR
Definition: bms.h:98
BMS_CLOSE_FIRST_STRING_PRECHARGE_STATE
@ BMS_CLOSE_FIRST_STRING_PRECHARGE_STATE
Definition: bms.h:137
BMS_STATE
Definition: bms.h:185
BMS_CHECK_ERROR_FLAGS_PRECHARGE_FIRST_STRING
@ BMS_CHECK_ERROR_FLAGS_PRECHARGE_FIRST_STRING
Definition: bms.h:140
BMS_CHECK_ERROR_FLAGS_PRECHARGE_CLOSINGSTRINGS
@ BMS_CHECK_ERROR_FLAGS_PRECHARGE_CLOSINGSTRINGS
Definition: bms.h:143
BMS_PL_0
@ BMS_PL_0
Definition: bms.h:176
BMS_STATEMACH_UNINITIALIZED
@ BMS_STATEMACH_UNINITIALIZED
Definition: bms.h:88
BMS_PRECHARGE_CHECK_VOLTAGES
@ BMS_PRECHARGE_CHECK_VOLTAGES
Definition: bms.h:132
BMS_CHECK_STRING_OPEN
@ BMS_CHECK_STRING_OPEN
Definition: bms.h:150
STD_RETURN_TYPE_e
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
BMS_GetBatterySystemState
BMS_CURRENT_FLOW_STATE_e BMS_GetBatterySystemState(void)
Returns current battery system state (charging/discharging, resting or in relaxation phase)
Definition: bms.c:1230
BMS_OPEN_INTERLOCK
@ BMS_OPEN_INTERLOCK
Definition: bms.h:128
BMS_CANSTATE
BMS_CANSTATE
Definition: bms.h:104
BMS_CHECK_CONTACTOR_CHARGE_STATE
@ BMS_CHECK_CONTACTOR_CHARGE_STATE
Definition: bms.h:127
BMS_ILLEGAL_REQUEST
@ BMS_ILLEGAL_REQUEST
Definition: bms.h:168
BMS_POWERLINE_TYPE_e
enum BMS_POWERLINE_TYPE BMS_POWERLINE_TYPE_e
BMS_CHECK_NOT_OK
@ BMS_CHECK_NOT_OK
Definition: bms.h:76
BMS_STATEMACH_IDLE
@ BMS_STATEMACH_IDLE
Definition: bms.h:91
BMS_CANSTATE_ERROR
@ BMS_CANSTATE_ERROR
Definition: bms.h:115
BMS_STATE::state
BMS_STATEMACH_e state
Definition: bms.h:188
BMS_STATE::PrechargeTryCounter
uint8_t PrechargeTryCounter
Definition: bms.h:199
BMS_STATE::nextstringclosedtimer
uint32_t nextstringclosedtimer
Definition: bms.h:203
BMS_STATE::laststate
BMS_STATEMACH_e laststate
Definition: bms.h:190
BMS_STATEMACH_INITIALIZED
@ BMS_STATEMACH_INITIALIZED
Definition: bms.h:90
BMS_STATE_REQUEST_e
enum BMS_STATE_REQUEST BMS_STATE_REQUEST_e
battery_system_cfg.h
Configuration of the battery system (e.g., number of battery modules, battery cells,...
BMS_SetStateRequest
BMS_RETURN_TYPE_e BMS_SetStateRequest(BMS_STATE_REQUEST_e statereq)
sets the current state request of the state variable bms_state.
Definition: bms.c:600
BMS_CANSTATE_OPENCONTACTORS
@ BMS_CANSTATE_OPENCONTACTORS
Definition: bms.h:110
BMS_INTERLOCK_CHECKED
@ BMS_INTERLOCK_CHECKED
Definition: bms.h:122
BMS_STATEMACH
BMS_STATEMACH
Definition: bms.h:86
BMS_STATE::deactivatedStrings
uint8_t deactivatedStrings[BS_NR_OF_STRINGS]
Definition: bms.h:211
BMS_RETURN_TYPE_e
enum BMS_RETURN_TYPE BMS_RETURN_TYPE_e
BMS_CANSTATE_CHARGE
@ BMS_CANSTATE_CHARGE
Definition: bms.h:114
BMS_STATE::OscillationTimeout
uint16_t OscillationTimeout
Definition: bms.h:198
BMS_PL_1
@ BMS_PL_1
Definition: bms.h:177
BMS_STATEMACH_UNDEFINED
@ BMS_STATEMACH_UNDEFINED
Definition: bms.h:99
BMS_STATEMACH_e
enum BMS_STATEMACH BMS_STATEMACH_e
BMS_STATE::prechargeCloseTimeout
uint16_t prechargeCloseTimeout
Definition: bms.h:208
BMS_OPEN_ALL_PRECHARGES
@ BMS_OPEN_ALL_PRECHARGES
Definition: bms.h:146
BMS_ENTRY
@ BMS_ENTRY
Definition: bms.h:120
BMS_STATEMACH_CHARGE
@ BMS_STATEMACH_CHARGE
Definition: bms.h:97
BMS_OPEN_SECOND_CONTACTOR_PLUS
@ BMS_OPEN_SECOND_CONTACTOR_PLUS
Definition: bms.h:136
BMS_STATEMACH_NORMAL
@ BMS_STATEMACH_NORMAL
Definition: bms.h:95
BMS_REQUEST_PENDING
@ BMS_REQUEST_PENDING
Definition: bms.h:167
BMS_CHECK_ERROR_FLAGS_INTERLOCK
@ BMS_CHECK_ERROR_FLAGS_INTERLOCK
Definition: bms.h:121
BMS_STATE::counter
uint8_t counter
Definition: bms.h:195
BMS_OK
@ BMS_OK
Definition: bms.h:165
BMS_DO_NOT_TAKE_PRECHARGE_INTO_ACCCOUNT
@ BMS_DO_NOT_TAKE_PRECHARGE_INTO_ACCCOUNT
Definition: bms.h:81
BMS_PRECHARGE_CLOSE_PRECHARGE
@ BMS_PRECHARGE_CLOSE_PRECHARGE
Definition: bms.h:131
BMS_Trigger
void BMS_Trigger(void)
trigger function for the SYS driver state machine.
Definition: bms.c:614
BMS_STATEMACH_STANDBY
@ BMS_STATEMACH_STANDBY
Definition: bms.h:93
BMS_STATE::powerline
BMS_POWERLINE_TYPE_e powerline
Definition: bms.h:200
BMS_STATE::ErrRequestCounter
uint32_t ErrRequestCounter
Definition: bms.h:192
BMS_STATE::closedStrings
uint8_t closedStrings[BS_NR_OF_STRINGS]
Definition: bms.h:210
BMS_DISCHARGING
@ BMS_DISCHARGING
Definition: bms.h:67
BMS_CHECK
BMS_CHECK
Definition: bms.h:73
BMS_CANSTATE_INITIALIZATION
@ BMS_CANSTATE_INITIALIZATION
Definition: bms.h:107
BMS_STATE::stateRequest
BMS_STATE_REQUEST_e stateRequest
Definition: bms.h:187
BMS_CHARGING
@ BMS_CHARGING
Definition: bms.h:66
BMS_STATE::substate
BMS_STATEMACH_SUB_e substate
Definition: bms.h:189
BMS_STATE::numberOfClosedStrings
uint8_t numberOfClosedStrings
Definition: bms.h:201
BMS_STATEMACH_DISCHARGE
@ BMS_STATEMACH_DISCHARGE
Definition: bms.h:96
BMS_OPEN_STRINGS_ENTRY
@ BMS_OPEN_STRINGS_ENTRY
Definition: bms.h:148
BMS_CONSIDER_PRECHARGE_e
enum BMS_CONSIDER_PRECHARGE BMS_CONSIDER_PRECHARGE_e
BMS_PL_OPEN
@ BMS_PL_OPEN
Definition: bms.h:175
BMS_AT_REST
@ BMS_AT_REST
Definition: bms.h:69
BMS_OPEN_STRINGS
@ BMS_OPEN_STRINGS
Definition: bms.h:149
BMS_CANSTATE_STANDBY
@ BMS_CANSTATE_STANDBY
Definition: bms.h:111
BMS_GetCurrentFlowDirection
BMS_CURRENT_FLOW_STATE_e BMS_GetCurrentFlowDirection(int32_t current_mA)
Get current flow direction, current value as function parameter.
Definition: bms.c:1234
BMS_OPEN_SECOND_CONTACTOR_MINUS
@ BMS_OPEN_SECOND_CONTACTOR_MINUS
Definition: bms.h:135
BMS_CHECK_STRING_CLOSED
@ BMS_CHECK_STRING_CLOSED
Definition: bms.h:142
BMS_CHECK_CONTACTOR_NORMAL_STATE
@ BMS_CHECK_CONTACTOR_NORMAL_STATE
Definition: bms.h:126
BMS_STATEMACH_SUB
BMS_STATEMACH_SUB
Definition: bms.h:119
BMS_RETURN_TYPE
BMS_RETURN_TYPE
Definition: bms.h:164
BMS_CONSIDER_PRECHARGE
BMS_CONSIDER_PRECHARGE
Definition: bms.h:80
BMS_ALREADY_INITIALIZED
@ BMS_ALREADY_INITIALIZED
Definition: bms.h:169
BMS_STATE::stringOpenTimeout
uint16_t stringOpenTimeout
Definition: bms.h:202
BMS_STATE::currentFlowState
BMS_CURRENT_FLOW_STATE_e currentFlowState
Definition: bms.h:196
BMS_PRECHARGE_CLOSE_MINUS
@ BMS_PRECHARGE_CLOSE_MINUS
Definition: bms.h:130
BMS_STATE::initFinished
STD_RETURN_TYPE_e initFinished
Definition: bms.h:193
BMS_CHECK_e
enum BMS_CHECK BMS_CHECK_e
DATA_BLOCK_PACK_VALUES
Definition: database_cfg.h:185
BMS_CHECK_CLOSE_FIRST_STRING_PRECHARGE_STATE
@ BMS_CHECK_CLOSE_FIRST_STRING_PRECHARGE_STATE
Definition: bms.h:138
BMS_STATE::lastsubstate
BMS_STATEMACH_SUB_e lastsubstate
Definition: bms.h:191
BMS_STATE_INIT_REQUEST
@ BMS_STATE_INIT_REQUEST
Definition: bms.h:156
BMS_GetState
BMS_STATEMACH_e BMS_GetState(void)
Returns the current state.
Definition: bms.c:596
BMS_CANSTATE_PRECHARGE
@ BMS_CANSTATE_PRECHARGE
Definition: bms.h:112
BMS_CHECK_ALL_PRECHARGES_OPEN
@ BMS_CHECK_ALL_PRECHARGES_OPEN
Definition: bms.h:147
BMS_CHECK_STATE_REQUESTS
@ BMS_CHECK_STATE_REQUESTS
Definition: bms.h:123
BMS_STATEMACH_INITIALIZATION
@ BMS_STATEMACH_INITIALIZATION
Definition: bms.h:89
database.h
Database module header.
BMS_CHECK_INTERLOCK_CLOSE_AFTER_ERROR
@ BMS_CHECK_INTERLOCK_CLOSE_AFTER_ERROR
Definition: bms.h:129
BMS_CANSTATE_UNINITIALIZED
@ BMS_CANSTATE_UNINITIALIZED
Definition: bms.h:106
BMS_IsStringPrecharging
bool BMS_IsStringPrecharging(uint8_t stringNumber)
Returns if string is currently precharging or not.
Definition: bms.c:1266
BMS_STATE::restTimer_10ms
uint32_t restTimer_10ms
Definition: bms.h:197
BMS_STATE::firstClosedString
uint8_t firstClosedString
Definition: bms.h:206
BMS_RELAXATION
@ BMS_RELAXATION
Definition: bms.h:68
BMS_CURRENT_FLOW_STATE
BMS_CURRENT_FLOW_STATE
Definition: bms.h:65
BMS_STATE_ERROR_REQUEST
@ BMS_STATE_ERROR_REQUEST
Definition: bms.h:157
BMS_NORMAL_CLOSE_NEXT_STRING
@ BMS_NORMAL_CLOSE_NEXT_STRING
Definition: bms.h:145
BMS_ILLEGAL_TASK_TYPE
@ BMS_ILLEGAL_TASK_TYPE
Definition: bms.h:170
BMS_CANSTATE_INITIALIZED
@ BMS_CANSTATE_INITIALIZED
Definition: bms.h:108
BMS_STATE::stringCloseTimeout
uint16_t stringCloseTimeout
Definition: bms.h:204
BMS_CANSTATE_NORMAL
@ BMS_CANSTATE_NORMAL
Definition: bms.h:113
BMS_STATEMACH_RESERVED1
@ BMS_STATEMACH_RESERVED1
Definition: bms.h:100
BMS_CHECK_ERROR_FLAGS_CLOSINGPRECHARGE
@ BMS_CHECK_ERROR_FLAGS_CLOSINGPRECHARGE
Definition: bms.h:144
BMS_STATE::prechargeOpenTimeout
uint16_t prechargeOpenTimeout
Definition: bms.h:207
BMS_CANSTATE_IDLE
@ BMS_CANSTATE_IDLE
Definition: bms.h:109
BMS_STATEMACH_PRECHARGE
@ BMS_STATEMACH_PRECHARGE
Definition: bms.h:94
BMS_STATE::nextstate
BMS_STATEMACH_e nextstate
Definition: bms.h:205
BMS_IsStringClosed
bool BMS_IsStringClosed(uint8_t stringNumber)
Returns string state (closed or open)
Definition: bms.c:1257
BMS_OPEN_FIRST_CONTACTOR
@ BMS_OPEN_FIRST_CONTACTOR
Definition: bms.h:134
BMS_POWERLINE_TYPE
BMS_POWERLINE_TYPE
Definition: bms.h:174
BMS_STATE_REQUEST
BMS_STATE_REQUEST
Definition: bms.h:155
BMS_STATE::closedPrechargeContactors
uint8_t closedPrechargeContactors[BS_NR_OF_STRINGS]
Definition: bms.h:209
BMS_CHECK_BUSY
@ BMS_CHECK_BUSY
Definition: bms.h:75
BMS_TAKE_PRECHARGE_INTO_ACCCOUNT
@ BMS_TAKE_PRECHARGE_INTO_ACCCOUNT
Definition: bms.h:82
BMS_STATEMACH_OPENCONTACTORS
@ BMS_STATEMACH_OPENCONTACTORS
Definition: bms.h:92
BMS_CHECK_OK
@ BMS_CHECK_OK
Definition: bms.h:74
BMS_STATE::timer
uint16_t timer
Definition: bms.h:186
BMS_PRECHARGE_CLOSE_NEXT_STRING
@ BMS_PRECHARGE_CLOSE_NEXT_STRING
Definition: bms.h:141
BS_NR_OF_STRINGS
#define BS_NR_OF_STRINGS
Definition: battery_system_cfg.h:89
BMS_PRECHARGE_OPEN_PRECHARGE
@ BMS_PRECHARGE_OPEN_PRECHARGE
Definition: bms.h:133
BMS_STATE::triggerentry
uint8_t triggerentry
Definition: bms.h:194