foxBMS - Unit Tests  1.5.0
The foxBMS Unit Tests API Documentation
battery_cell_cfg.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2023, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file battery_cell_cfg.h
44  * @author foxBMS Team
45  * @date 2017-03-14 (date of creation)
46  * @updated 2023-02-03 (date of last update)
47  * @version v1.5.0
48  * @ingroup BATTERY_CELL_CONFIGURATION
49  * @prefix BC
50  *
51  * @brief Configuration of the battery cell (e.g., minimum and maximum cell
52  * voltage)
53  *
54  * @details This files contains basic macros of the battery cell in order to
55  * derive needed inputs in other parts of the software. These macros
56  * are all depended on the hardware.
57  *
58  */
59 
60 #ifndef FOXBMS__BATTERY_CELL_CFG_H_
61 #define FOXBMS__BATTERY_CELL_CFG_H_
62 
63 /*========== Includes =======================================================*/
64 
65 #include <math.h>
66 #include <stdint.h>
67 
68 /*========== Macros and Definitions =========================================*/
69 
70 /**
71  * @brief Maximum temperature limit during discharge.
72  * @details When maximum safety limit (MSL) is violated, error state is
73  * requested and contactors will open. When recommended safety limit
74  * (RSL) or maximum operating limit (MOL) is violated, the respective
75  * flag will be set.
76  * @ptype int
77  * @unit deci &deg;C
78  */
79 /**@{*/
80 #define BC_TEMPERATURE_MAX_DISCHARGE_MSL_ddegC (550)
81 #define BC_TEMPERATURE_MAX_DISCHARGE_RSL_ddegC (500)
82 #define BC_TEMPERATURE_MAX_DISCHARGE_MOL_ddegC (450)
83 /**@}*/
84 
85 /**
86  * @brief Minimum temperature limit during discharge.
87  * @details When maximum safety limit (MSL) is violated, error state is
88  * requested and contactors will open. When recommended safety limit
89  * (RSL) or maximum operating limit (MOL) is violated, the respective
90  * flag will be set.
91  * @ptype int
92  * @unit deci &deg;C
93  */
94 /**@{*/
95 #define BC_TEMPERATURE_MIN_DISCHARGE_MSL_ddegC (-200)
96 #define BC_TEMPERATURE_MIN_DISCHARGE_RSL_ddegC (-150)
97 #define BC_TEMPERATURE_MIN_DISCHARGE_MOL_ddegC (-100)
98 /**@}*/
99 
100 /**
101  * @brief Maximum temperature limit during charge.
102  * @details When maximum safety limit (MSL) is violated, error state is
103  * requested and contactors will open. When recommended safety limit
104  * (RSL) or maximum operating limit (MOL) is violated, the respective
105  * flag will be set.
106  * @ptype int
107  * @unit deci &deg;C
108  */
109 /**@{*/
110 #define BC_TEMPERATURE_MAX_CHARGE_MSL_ddegC (450)
111 #define BC_TEMPERATURE_MAX_CHARGE_RSL_ddegC (400)
112 #define BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC (350)
113 /**@}*/
114 
115 /**
116  * @brief Minimum temperature limit during discharge.
117  * @details When maximum safety limit (MSL) is violated, error state is
118  * requested and contactors will open. When recommended safety limit
119  * (RSL) or maximum operating limit (MOL) is violated, the respective
120  * flag will be set.
121  * @ptype int
122  * @unit deci &deg;C
123  */
124 /**@{*/
125 #define BC_TEMPERATURE_MIN_CHARGE_MSL_ddegC (-200)
126 #define BC_TEMPERATURE_MIN_CHARGE_RSL_ddegC (-150)
127 #define BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC (-100)
128 /**@}*/
129 
130 /**
131  * @brief Maximum cell voltage limit.
132  * @details When maximum safety limit (MSL) is violated, error state is
133  * requested and contactors will open. When recommended safety limit
134  * (RSL) or maximum operating limit (MOL) is violated, the respective
135  * flag will be set.
136  * @ptype int
137  * @unit mV
138  */
139 /**@{*/
140 #define BC_VOLTAGE_MAX_MSL_mV (2800)
141 #define BC_VOLTAGE_MAX_RSL_mV (2750)
142 #define BC_VOLTAGE_MAX_MOL_mV (2720)
143 /**@}*/
144 
145 /**
146  * @brief nominal cell voltage according to data sheet
147  * @ptype int
148  * @unit mV
149  */
150 #define BC_VOLTAGE_NOMINAL_mV (2500)
151 
152 /**
153  * @brief Minimum cell voltage limit.
154  * @details When maximum safety limit (MSL) is violated, error state is
155  * requested and contactors will open. When recommended safety limit
156  * (RSL) or maximum operating limit (MOL) is violated, the respective
157  * flag will be set.
158  * @ptype int
159  * @unit mV
160  */
161 /**@{*/
162 #define BC_VOLTAGE_MIN_MSL_mV (1700)
163 #define BC_VOLTAGE_MIN_RSL_mV (1750)
164 #define BC_VOLTAGE_MIN_MOL_mV (1780)
165 /**@}*/
166 
167 /**
168  * @brief Deep-discharge cell voltage limit.
169  * @details If this voltage limit is violated, the cell is faulty. The BMS will
170  * not allow a closing of the contactors until this cell is replaced.
171  * A replacement of the cell is confirmed by sending the respective
172  * CAN debug message
173  * @ptype int
174  * @unit mV
175  */
176 #define BC_VOLTAGE_DEEP_DISCHARGE_mV (BC_VOLTAGE_MIN_MSL_mV)
177 
178 /**
179  * @brief Maximum discharge current limit.
180  * @details When maximum safety limit (MSL) is violated, error state is
181  * requested and contactors will open. When recommended safety limit
182  * (RSL) or maximum operating limit (MOL) is violated, the respective
183  * flag will be set.
184  * @ptype int
185  * @unit mA
186  */
187 /**@{*/
188 #define BC_CURRENT_MAX_DISCHARGE_MSL_mA (180000u)
189 #define BC_CURRENT_MAX_DISCHARGE_RSL_mA (175000u)
190 #define BC_CURRENT_MAX_DISCHARGE_MOL_mA (170000u)
191 /**@}*/
192 
193 /**
194  * @brief Maximum charge current limit.
195  * @details When maximum safety limit (MSL) is violated, error state is
196  * requested and contactors will open. When recommended safety limit
197  * (RSL) or maximum operating limit (MOL) is violated, the respective
198  * flag will be set.
199  * @ptype int
200  * @unit mA
201  */
202 /**@{*/
203 #define BC_CURRENT_MAX_CHARGE_MSL_mA (180000u)
204 #define BC_CURRENT_MAX_CHARGE_RSL_mA (175000u)
205 #define BC_CURRENT_MAX_CHARGE_MOL_mA (170000u)
206 /**@}*/
207 
208 /**
209  * @brief Cell capacity used for SOC calculation
210  * @ptype int
211  * @unit mAh
212  */
213 #define BC_CAPACITY_mAh (3500u)
214 
215 /**
216  * @brief Cell energy
217  * @ptype float
218  * @unit Wh
219  */
220 #define BC_ENERGY_Wh (10.0f)
221 
222 #if BC_VOLTAGE_MIN_MSL_mV < BC_VOLTAGE_DEEP_DISCHARGE_mV
223 #error "Configuration error! - Maximum safety limit for under voltage can't be lower than deep-discharge limit"
224 #endif
225 
226 /** structure for lookup table */
227 typedef struct {
228  const int16_t voltage_mV; /*!< cell voltage in mV */
229  const float_t value; /*!< corresponding value, can be SOC/SOE in % or capacity/energy */
230 } BC_LUT_s;
231 
232 /*========== Extern Constant and Variable Declarations ======================*/
233 extern uint16_t bc_stateOfChargeLookupTableLength; /*!< length of the SOC lookup table */
234 extern const BC_LUT_s bc_stateOfChargeLookupTable[]; /*!< SOC lookup table */
235 
236 extern uint16_t bc_stateOfEnergyLookupTableLength; /*!< length of the SOE lookup table */
237 extern const BC_LUT_s bc_stateOfEnergyLookupTable[]; /*!< SOE lookup table */
238 
239 /*========== Extern Function Prototypes =====================================*/
240 
241 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
242 #ifdef UNITY_UNIT_TEST
243 #endif
244 
245 #endif /* FOXBMS__BATTERY_CELL_CFG_H_ */
uint16_t bc_stateOfChargeLookupTableLength
uint16_t bc_stateOfEnergyLookupTableLength
const BC_LUT_s bc_stateOfEnergyLookupTable[]
const BC_LUT_s bc_stateOfChargeLookupTable[]
const int16_t voltage_mV
const float_t value