foxBMS - Unit Tests  1.3.0
The foxBMS Unit Tests API Documentation
sof_cfg.h
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2022, 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 sof_cfg.h
44  * @author foxBMS Team
45  * @date 2020-10-07 (date of creation)
46  * @updated 2022-05-30 (date of last update)
47  * @version v1.3.0
48  * @ingroup APPLICATION_CONFIGURATION
49  * @prefix SOF
50  *
51  * @brief Header for SOF configuration
52  *
53  */
54 
55 #ifndef FOXBMS__SOF_CFG_H_
56 #define FOXBMS__SOF_CFG_H_
57 
58 /*========== Includes =======================================================*/
59 #include "general.h"
60 
61 /*========== Macros and Definitions =========================================*/
62 
63 /**
64  * Maximum current in mA in charge direction that a string can sustain.
65  * Normally set once for the specific battery cell from data sheet
66  */
67 #define SOF_STRING_CURRENT_CONTINUOUS_CHARGE_mA (120000.00f)
68 
69 /**
70  * Different alarm levels for the maximum continuous charge current in mA.
71  * @{
72  */
73 #define SOF_MOL_STRING_CURRENT_CONTINUOUS_CHARGE_mA (10000.00f)
74 #define SOF_RSL_STRING_CURRENT_CONTINUOUS_CHARGE_mA (11500.00f)
75 #define SOF_MSL_STRING_CURRENT_CONTINUOUS_CHARGE_mA (12200.00f)
76 /**@}*/
77 
78 /**
79  * Maximum current in mA in discharge direction that a string can deliver.
80  * Normally set once for the specific battery cell from data sheet.
81  */
82 #define SOF_STRING_CURRENT_CONTINUOUS_DISCHARGE_mA (120000.00f)
83 
84 /**
85  * Different alarm levels for the maximum continuous string discharge current in mA.
86  * @{
87  */
88 #define SOF_MOL_STRING_CURRENT_CONTINUOUS_DISCHARGE_mA (10000.00f)
89 #define SOF_RSL_STRING_CURRENT_CONTINUOUS_DISCHARGE_mA (11500.00f)
90 #define SOF_MSL_STRING_CURRENT_CONTINUOUS_DISCHARGE_mA (12200.00f)
91 /**@}*/
92 
93 /**
94  * Current in mA that the string should be able to discharge when in
95  * limp home mode, i.e., something noncritical went wrong but it should be able
96  * to drive home. The value is chosen by the system engineer.
97  */
98 #define SOF_STRING_CURRENT_LIMP_HOME_mA (20000.00f)
99 
100 /**
101  * Different alarm levels for the limp home current in mA
102  * @{
103  */
104 #define SOF_MOL_STRING_CURRENT_LIMP_HOME_mA (20000.00f)
105 #define SOF_RSL_STRING_CURRENT_LIMP_HOME_mA (20000.00f)
106 #define SOF_MSL_STRING_CURRENT_LIMP_HOME_mA (20000.00f)
107 /**@}*/
108 
109 /**
110  * Cold temperature in deci °C where the derating of maximum discharge
111  * current starts, i.e., below this temperature battery pack should not deliver
112  * full discharge current.
113  */
114 #define SOF_TEMPERATURE_LOW_CUTOFF_DISCHARGE_ddegC (0)
115 
116 /**
117  * Different alarm levels for the cold temperature in deci °C where the
118  * derating of maximum discharge current starts, i.e., below this temperature
119  * battery pack should not deliver full discharge current.
120  * @{
121  */
122 #define SOF_MOL_TEMPERATURE_LOW_CUTOFF_DISCHARGE_ddegC (0)
123 #define SOF_RSL_TEMPERATURE_LOW_CUTOFF_DISCHARGE_ddegC (0)
124 #define SOF_MSL_TEMPERATURE_LOW_CUTOFF_DISCHARGE_ddegC (0)
125 /**@}*/
126 
127 /**
128  * Cold temperature in deci °C where the derating of maximum discharge
129  * current is fully applied, i.e., below this temperature battery pack should
130  * not deliver any current in discharge direction.
131  */
132 #define SOF_TEMPERATURE_LOW_LIMIT_DISCHARGE_ddegC (-100)
133 
134 /**
135  * Different alarm levels for the cold temperature in deci °C where the
136  * derating of maximum discharge current is fully applied. Below this
137  * temperature the battery pack should not deliver any current in discharge
138  * direction.
139  * @{
140  */
141 #define SOF_MOL_TEMPERATURE_LOW_LIMIT_DISCHARGE_ddegC (-100)
142 #define SOF_RSL_TEMPERATURE_LOW_LIMIT_DISCHARGE_ddegC (-100)
143 #define SOF_MSL_TEMPERATURE_LOW_LIMIT_DISCHARGE_ddegC (-100)
144 /**@}*/
145 
146 /**
147  * Cold temperature in deci °C where the derating of maximum charge current
148  * starts, i.e., below this temperature battery pack should not deliver full
149  * charge current.
150  */
151 #define SOF_TEMPERATURE_LOW_CUTOFF_CHARGE_ddegC (0)
152 
153 /**
154  * Different alarm levels for the cold temperature in deci °C where the
155  * derating of maximum charge current starts, i.e., below this temperature
156  * battery pack should not deliver full charge current
157  * @{
158  */
159 #define SOF_MOL_TEMPERATURE_LOW_CUTOFF_CHARGE_ddegC (0)
160 #define SOF_RSL_TEMPERATURE_LOW_CUTOFF_CHARGE_ddegC (0)
161 #define SOF_MSL_TEMPERATURE_LOW_CUTOFF_CHARGE_ddegC (0)
162 /**@}*/
163 
164 /**
165  * Cold temperature in deci °C where the derating of maximum charge current
166  * is fully applied, i.e., below this temperature battery pack should not
167  * deliver any current in charge direction.
168  */
169 #define SOF_TEMPERATURE_LOW_LIMIT_CHARGE_ddegC (-100)
170 
171 /**
172  * Different alarm levels for the cold temperature in deci °C where the
173  * derating of maximum charge current is fully applied. Below this temperature
174  * the battery pack should not deliver any current in charge direction.
175  * @{
176  */
177 #define SOF_MOL_TEMPERATURE_LOW_LIMIT_CHARGE_ddegC (-100)
178 #define SOF_RSL_TEMPERATURE_LOW_LIMIT_CHARGE_ddegC (-100)
179 #define SOF_MSL_TEMPERATURE_LOW_LIMIT_CHARGE_ddegC (-100)
180 /**@}*/
181 
182 /**
183  * Hot temperature in deci °C where the derating of maximum discharge
184  * current starts, i.e., above this temperature battery pack should not deliver
185  * full discharge current.
186  */
187 #define SOF_TEMPERATURE_HIGH_CUTOFF_DISCHARGE_ddegC (450)
188 
189 /**
190  * Different alarm levels for the high temperature in deci °C where the
191  * derating of maximum discharge current starts, i.e., above this temperature
192  * battery pack should not deliver full discharge current
193  * @{
194  */
195 #define SOF_MOL_TEMPERATURE_HIGH_CUTOFF_DISCHARGE_ddegC (450)
196 #define SOF_RSL_TEMPERATURE_HIGH_CUTOFF_DISCHARGE_ddegC (450)
197 #define SOF_MSL_TEMPERATURE_HIGH_CUTOFF_DISCHARGE_ddegC (450)
198 /**@}*/
199 
200 /**
201  * Hot temperature in deci °C where the derating of maximum discharge
202  * current is fully applied, i.e., above this temperature battery pack should
203  * not deliver any current in discharge direction.
204  */
205 #define SOF_TEMPERATURE_HIGH_LIMIT_DISCHARGE_ddegC (550)
206 
207 /**
208  * Different alarm levels for the high temperature in deci °C where the
209  * derating of maximum discharge current is fully applied. Above this
210  * temperature the battery pack should not deliver any current in discharge
211  * direction.
212  * @{
213  */
214 #define SOF_MOL_TEMPERATURE_HIGH_LIMIT_DISCHARGE_ddegC (550)
215 #define SOF_RSL_TEMPERATURE_HIGH_LIMIT_DISCHARGE_ddegC (550)
216 #define SOF_MSL_TEMPERATURE_HIGH_LIMIT_DISCHARGE_ddegC (550)
217 /**@}*/
218 
219 /**
220  * Hot temperature in deci °C where the derating of maximum charge current
221  * starts, i.e., above this temperature battery pack should not deliver full
222  * charge current.
223  */
224 #define SOF_TEMPERATURE_HIGH_CUTOFF_CHARGE_ddegC (450)
225 
226 /**
227  * Different alarm levels for the high temperature in deci °C where the
228  * derating of maximum charge current starts, i.e., above this temperature
229  * battery pack should not deliver full charge current
230  * @{
231  */
232 #define SOF_MOL_TEMPERATURE_HIGH_CUTOFF_CHARGE_ddegC (450)
233 #define SOF_RSL_TEMPERATURE_HIGH_CUTOFF_CHARGE_ddegC (450)
234 #define SOF_MSL_TEMPERATURE_HIGH_CUTOFF_CHARGE_ddegC (450)
235 /**@}*/
236 
237 /**
238  * Hot temperature in deci °C where the derating of maximum charge current
239  * is fully applied, i.e., above this temperature battery pack should not
240  * deliver any current in charge direction.
241  */
242 #define SOF_TEMPERATURE_HIGH_LIMIT_CHARGE_ddegC (550)
243 
244 /**
245  * Different alarm levels for the high temperature in deci °C where the
246  * derating of maximum charge current is fully applied. Above this temperature
247  * the battery pack should not deliver any current in charge direction.
248  * @{
249  */
250 #define SOF_MOL_TEMPERATURE_HIGH_LIMIT_CHARGE_ddegC (550)
251 #define SOF_RSL_TEMPERATURE_HIGH_LIMIT_CHARGE_ddegC (550)
252 #define SOF_MSL_TEMPERATURE_HIGH_LIMIT_CHARGE_ddegC (550)
253 /**@}*/
254 
255 /**
256  * Above this voltage value battery pack should not be exposed to full current in charge direction.
257  */
258 #define SOF_VOLTAGE_CUTOFF_CHARGE_mV (2400)
259 
260 /**
261  * Different alarm levels for the upper voltage limit where the derating of
262  * maximum charge current starts. Above this value the battery pack
263  * should not deliver full current in charge direction.
264  * @{
265  */
266 #define SOF_MOL_VOLTAGE_CUTOFF_CHARGE_mV (2400)
267 #define SOF_RSL_VOLTAGE_CUTOFF_CHARGE_mV (2400)
268 #define SOF_MSL_VOLTAGE_CUTOFF_CHARGE_mV (2400)
269 /**@}*/
270 
271 /**
272  * Above this voltage value battery pack should not be exposed to any current in charge direction.
273  */
274 #define SOF_VOLTAGE_LIMIT_CHARGE_mV (2550)
275 
276 /**
277  * Different alarm levels for the upper voltage limit where the derating of
278  * maximum charge current is fully applied. Above this value the battery pack
279  * should not deliver any current in charge direction.
280  * @{
281  */
282 #define SOF_MOL_VOLTAGE_LIMIT_CHARGE_mV (2550)
283 #define SOF_RSL_VOLTAGE_LIMIT_CHARGE_mV (2550)
284 #define SOF_MSL_VOLTAGE_LIMIT_CHARGE_mV (2550)
285 /**@}*/
286 
287 /**
288  * Below this voltage value battery pack should not deliver full current in discharge direction.
289  */
290 #define SOF_VOLTAGE_CUTOFF_DISCHARGE_mV (2000)
291 
292 /**
293  * Different alarm levels for the lower voltage limit where the derating of
294  * maximum discharge current starts. Below this value the battery pack
295  * should not deliver full current in discharge direction.
296  * @{
297  */
298 #define SOF_MOL_VOLTAGE_CUTOFF_DISCHARGE_mV (2000)
299 #define SOF_RSL_VOLTAGE_CUTOFF_DISCHARGE_mV (2000)
300 #define SOF_MSL_VOLTAGE_CUTOFF_DISCHARGE_mV (2000)
301 /**@}*/
302 
303 /**
304  * Below this voltage value battery pack should not deliver any current in discharge direction.
305  */
306 #define SOF_VOLTAGE_LIMIT_DISCHARGE_mV (1750)
307 
308 /**
309  * Different alarm levels for the lower voltage limit where the derating of
310  * maximum discharge is fully applied. Below this value the battery pack
311  * should not deliver any current in discharge direction.
312  * @{
313  */
314 #define SOF_MOL_VOLTAGE_LIMIT_DISCHARGE_mV (1750)
315 #define SOF_RSL_VOLTAGE_LIMIT_DISCHARGE_mV (1750)
316 #define SOF_MSL_VOLTAGE_LIMIT_DISCHARGE_mV (1750)
317 /**@}*/
318 
319 /**
320  * structure for configuration of SoF Calculation
321  */
322 typedef struct {
323  /** Current derating limits @{ */
327  /**@}*/
328 
329  /** Low temperature derating limits @{ */
334  /**@}*/
335 
336  /** High temperature derating limits @{ */
341  /**@}*/
342 
343  /** Cell voltage derating limits @{ */
348  /**@}*/
349 } SOF_CONFIG_s;
350 
351 /*========== Extern Constant and Variable Declarations ======================*/
352 
353 /**
354  * Configuration values for the SOF window of the recommended battery current
355  */
357 
358 /**
359  * Configuration values for the SOF window of the different alarm levels (MOL,
360  * RSL and MSL)
361  * @{
362  */
366 /**@}*/
367 
368 /*========== Extern Function Prototypes =====================================*/
369 
370 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
371 
372 #endif /* FOXBMS__SOF_CFG_H_ */
General macros and definitions for the whole platform.
const SOF_CONFIG_s sof_recommendedCurrent
Definition: sof_cfg.c:64
const SOF_CONFIG_s sof_recommendedSafetyLimit
Definition: sof_cfg.c:98
const SOF_CONFIG_s sof_configMaximumSafetyLimit
Definition: sof_cfg.c:115
const SOF_CONFIG_s sof_maximumOperatingLimit
Definition: sof_cfg.c:81
float maximumDischargeCurrent_mA
Definition: sof_cfg.h:324
float maximumChargeCurrent_mA
Definition: sof_cfg.h:325
int16_t limitLowTemperatureCharge_ddegC
Definition: sof_cfg.h:333
int16_t limitLowerCellVoltage_mV
Definition: sof_cfg.h:347
int16_t limitUpperCellVoltage_mV
Definition: sof_cfg.h:345
int16_t cutoffHighTemperatureDischarge_ddegC
Definition: sof_cfg.h:337
int16_t cutoffHighTemperatureCharge_ddegC
Definition: sof_cfg.h:339
int16_t limitHighTemperatureCharge_ddegC
Definition: sof_cfg.h:340
int16_t cutoffLowerCellVoltage_mV
Definition: sof_cfg.h:346
float limpHomeCurrent_mA
Definition: sof_cfg.h:326
int16_t limitHighTemperatureDischarge_ddegC
Definition: sof_cfg.h:338
int16_t limitLowTemperatureDischarge_ddegC
Definition: sof_cfg.h:331
int16_t cutoffLowTemperatureCharge_ddegC
Definition: sof_cfg.h:332
int16_t cutoffLowTemperatureDischarge_ddegC
Definition: sof_cfg.h:330
int16_t cutoffUpperCellVoltage_mV
Definition: sof_cfg.h:344