foxBMS  1.6.0
The foxBMS Battery Management System API Documentation
sof_trapezoid_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 sof_trapezoid_cfg.h
44  * @author foxBMS Team
45  * @date 2020-10-07 (date of creation)
46  * @updated 2023-10-12 (date of last update)
47  * @version v1.6.0
48  * @ingroup APPLICATION_CONFIGURATION
49  * @prefix SOF
50  *
51  * @brief Header for SOF configuration
52  *
53  */
54 
55 #ifndef FOXBMS__SOF_TRAPEZOID_CFG_H_
56 #define FOXBMS__SOF_TRAPEZOID_CFG_H_
57 
58 /*========== Includes =======================================================*/
59 
60 #include "battery_cell_cfg.h"
61 #include "battery_system_cfg.h"
62 
63 #include <math.h>
64 #include <stdint.h>
65 
66 /*========== Macros and Definitions =========================================*/
67 
68 /**
69  * Maximum current in mA in charge direction that a string can sustain.
70  * Normally set once for the specific battery cell from data sheet
71  */
72 #define SOF_STRING_CURRENT_CONTINUOUS_CHARGE_mA \
73  ((float_t)BC_CURRENT_MAX_CHARGE_MOL_mA * BS_NR_OF_PARALLEL_CELLS_PER_CELL_BLOCK)
74 
75 /**
76  * Maximum current in mA in discharge direction that a string can deliver.
77  * Normally set once for the specific battery cell from data sheet.
78  */
79 #define SOF_STRING_CURRENT_CONTINUOUS_DISCHARGE_mA \
80  ((float_t)BC_CURRENT_MAX_DISCHARGE_MOL_mA * BS_NR_OF_PARALLEL_CELLS_PER_CELL_BLOCK)
81 
82 /**
83  * Current in mA that the string should be able to discharge when in
84  * limp home mode, i.e., something noncritical went wrong but it should be able
85  * to drive home. The value is chosen by the system engineer.
86  */
87 #define SOF_STRING_CURRENT_LIMP_HOME_mA (20000.00f)
88 
89 /**
90  * Cold temperature in deci &deg;C where the derating of maximum discharge
91  * current starts, i.e., below this temperature battery pack should not deliver
92  * full discharge current.
93  */
94 #define SOF_TEMPERATURE_LOW_CUTOFF_DISCHARGE_ddegC (BC_TEMPERATURE_MIN_DISCHARGE_MOL_ddegC)
95 
96 /**
97  * Cold temperature in deci &deg;C where the derating of maximum discharge
98  * current is fully applied, i.e., below this temperature battery pack should
99  * not deliver any current in discharge direction.
100  */
101 #define SOF_TEMPERATURE_LOW_LIMIT_DISCHARGE_ddegC (BC_TEMPERATURE_MIN_DISCHARGE_MSL_ddegC)
102 
103 /**
104  * Cold temperature in deci &deg;C where the derating of maximum charge current
105  * starts, i.e., below this temperature battery pack should not deliver full
106  * charge current.
107  */
108 #define SOF_TEMPERATURE_LOW_CUTOFF_CHARGE_ddegC (BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC)
109 
110 /**
111  * Cold temperature in deci &deg;C where the derating of maximum charge current
112  * is fully applied, i.e., below this temperature battery pack should not
113  * deliver any current in charge direction.
114  */
115 #define SOF_TEMPERATURE_LOW_LIMIT_CHARGE_ddegC (BC_TEMPERATURE_MIN_CHARGE_MSL_ddegC)
116 
117 /**
118  * Hot temperature in deci &deg;C where the derating of maximum discharge
119  * current starts, i.e., above this temperature battery pack should not deliver
120  * full discharge current.
121  */
122 #define SOF_TEMPERATURE_HIGH_CUTOFF_DISCHARGE_ddegC (BC_TEMPERATURE_MAX_DISCHARGE_MOL_ddegC)
123 
124 /**
125  * Hot temperature in deci &deg;C where the derating of maximum discharge
126  * current is fully applied, i.e., above this temperature battery pack should
127  * not deliver any current in discharge direction.
128  */
129 #define SOF_TEMPERATURE_HIGH_LIMIT_DISCHARGE_ddegC (BC_TEMPERATURE_MAX_DISCHARGE_MSL_ddegC)
130 
131 /**
132  * Hot temperature in deci &deg;C where the derating of maximum charge current
133  * starts, i.e., above this temperature battery pack should not deliver full
134  * charge current.
135  */
136 #define SOF_TEMPERATURE_HIGH_CUTOFF_CHARGE_ddegC (BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC)
137 
138 /**
139  * Hot temperature in deci &deg;C where the derating of maximum charge current
140  * is fully applied, i.e., above this temperature battery pack should not
141  * deliver any current in charge direction.
142  */
143 #define SOF_TEMPERATURE_HIGH_LIMIT_CHARGE_ddegC (BC_TEMPERATURE_MAX_CHARGE_MSL_ddegC)
144 
145 /**
146  * Above this voltage value battery pack should not be exposed to full current in charge direction.
147  */
148 #define SOF_VOLTAGE_CUTOFF_CHARGE_mV (BC_VOLTAGE_MAX_MOL_mV)
149 
150 /**
151  * Above this voltage value battery pack should not be exposed to any current in charge direction.
152  */
153 #define SOF_VOLTAGE_LIMIT_CHARGE_mV (BC_VOLTAGE_MAX_RSL_mV)
154 
155 /**
156  * Below this voltage value battery pack should not deliver full current in discharge direction.
157  */
158 #define SOF_VOLTAGE_CUTOFF_DISCHARGE_mV (BC_VOLTAGE_MIN_MOL_mV)
159 
160 /**
161  * Below this voltage value battery pack should not deliver any current in discharge direction.
162  */
163 #define SOF_VOLTAGE_LIMIT_DISCHARGE_mV (BC_VOLTAGE_MIN_RSL_mV)
164 
165 /**
166  * structure for configuration of SoF Calculation
167  */
168 typedef struct {
169  /** Current derating limits @{ */
173  /**@}*/
174 
175  /** Low temperature derating limits @{ */
180  /**@}*/
181 
182  /** High temperature derating limits @{ */
187  /**@}*/
188 
189  /** Cell voltage derating limits @{ */
194  /**@}*/
195 } SOF_CONFIG_s;
196 
197 /*========== Extern Constant and Variable Declarations ======================*/
198 
199 /**
200  * Configuration values for the SOF window of the recommended battery current
201  */
203 
204 /*========== Extern Function Prototypes =====================================*/
205 
206 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
207 #ifdef UNITY_UNIT_TEST
208 #endif
209 
210 #endif /* FOXBMS__SOF_TRAPEZOID_CFG_H_ */
Configuration of the battery cell (e.g., minimum and maximum cell voltage)
Configuration of the battery system (e.g., number of battery modules, battery cells,...
const SOF_CONFIG_s sof_recommendedCurrent
float_t maximumChargeCurrent_mA
float_t limpHomeCurrent_mA
int16_t limitLowTemperatureCharge_ddegC
int16_t limitLowerCellVoltage_mV
int16_t limitUpperCellVoltage_mV
int16_t cutoffHighTemperatureDischarge_ddegC
int16_t cutoffHighTemperatureCharge_ddegC
int16_t limitHighTemperatureCharge_ddegC
int16_t cutoffLowerCellVoltage_mV
float_t maximumDischargeCurrent_mA
int16_t limitHighTemperatureDischarge_ddegC
int16_t limitLowTemperatureDischarge_ddegC
int16_t cutoffLowTemperatureCharge_ddegC
int16_t cutoffLowTemperatureDischarge_ddegC
int16_t cutoffUpperCellVoltage_mV