foxBMS  1.3.0
The foxBMS Battery Management System API Documentation
bender_ir155_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 bender_ir155_cfg.h
44  * @author foxBMS Team
45  * @date 2021-09-17 (date of creation)
46  * @updated 2022-05-30 (date of last update)
47  * @version v1.3.0
48  * @ingroup DRIVERS_CONFIGURATION
49  * @prefix IR155
50  *
51  * @brief Headers for the configuration for the insulation monitoring
52  *
53  *
54  */
55 
56 #ifndef FOXBMS__BENDER_IR155_CFG_H_
57 #define FOXBMS__BENDER_IR155_CFG_H_
58 
59 /*========== Includes =======================================================*/
60 #include "general.h"
61 
62 #include "HL_het.h"
63 
64 /* clang-format off */
65 #include "imd.h"
66 /* clang-format on */
67 
68 /*========== Macros and Definitions =========================================*/
69 
70 /**
71  * During this time, the results of Bender Isometer aren't to be trusted
72  * wait time in [ms] <= 65535;
73  * IR155_WAIT_TIME_AFTER_GNDERROR
74  * \par Type:
75  * int
76  * \par Range:
77  * 0 < x <=65535
78  * \par Unit:
79  * ms
80  * \par Default:
81  * 25000
82 */
83 #define IR155_WAIT_TIME_AFTER_GROUND_ERROR_ms (25000u)
84 
85 /** Time after startup, until the first valid measurement result is available */
86 #define IR155_STARTUP_TIME_ms (2200u)
87 
88 /* Symbolic names for the different measurement modes of Bender Isometer. */
89 
90 /** 0 Hz -> Hi > short-circuit to Ub + (Kl. 15); Low > IMD off or short-circuit
91  * to Kl. 31 */
92 #define IR155_MINIMUM_FREQUENCY_Hz (5.0f) /* Define a minimum frequency as 0 Hz can not be measured by PWM module */
93 
94 /** 10 Hz -> Normal condition. Insulation measurement DCP starts two seconds
95  * after power on; First successful insulation measurement at ? 17.5 s.
96  * PWM active 5...95 % */
97 #define IR155_NORMAL_CONDITION_FREQUENCY_Hz (10.0f)
98 
99 /** 20 Hz -> undervoltage condition. Insulation measurement DCP (continuous
100  * measurement); starts two seconds after power on; PWM active 5...95 %;
101  * First successful insulation measurement at ? 17.5 s, Undervoltage detection
102  * 0...500 V (Bender configurable) */
103 #define IR155_UNDERVOLTAGE_FREQUENCY_Hz (20.0f)
104 
105 /** 30 Hz -> Speed start measurement. Insulation measurement (only good/bad
106  * evaluation), starts directly after power on ? 2 s; PWM 5...10 % (good) and
107  * 90...95 % (bad) */
108 #define IR155_SPEEDSTART_FREQUENCY_Hz (30.0f)
109 
110 /** 40 Hz -> Device error */
111 #define IR155_IMD_DEVICE_ERROR_FREQUENCY_Hz (40.0f)
112 
113 /** 50 Hz -> Connection fault earth. Fault detected on the earth connection
114  * (Kl. 31), PWM 47.5...52.5 % */
115 #define IR155_GROUND_ERROR_FREQUENCY_Hz (50.0f)
116 
117 /** The exact frequency of the pwm signal cannot be measured due to inaccuracies.
118  * Thus, a interval is used to detect any deviations. The interval is for example
119  * selected as 50 Hz +/- IR155_MEASUREMENT_INTERVAL_RANGE_Hz */
120 #define IR155_MEASUREMENT_INTERVAL_RANGE_Hz (1.0f)
121 
122 /* Min and max values are defined for tolerance purposes of the measurement. */
123 #define IR155_NORMAL_CONDITION_UPPER_FREQUENCY_Hz \
124  (IR155_NORMAL_CONDITION_FREQUENCY_Hz + IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
125 #define IR155_NORMAL_CONDITION_LOWER_FREQUENCY_Hz \
126  (IR155_NORMAL_CONDITION_FREQUENCY_Hz - IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
127 
128 #define IR155_UNDERVOLTAGE_UPPER_FREQUENCY_Hz (IR155_UNDERVOLTAGE_FREQUENCY_Hz + IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
129 #define IR155_UNDERVOLTAGE_LOWER_FREQUENCY_Hz (IR155_UNDERVOLTAGE_FREQUENCY_Hz - IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
130 
131 #define IR155_SPEEDSTART_UPPER_FREQUENCY_Hz (IR155_SPEEDSTART_FREQUENCY_Hz + IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
132 #define IR155_SPEEDSTART_LOWER_FREQUENCY_Hz (IR155_SPEEDSTART_FREQUENCY_Hz - IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
133 
134 #define IR155_IMD_DEVICE_ERROR_UPPER_FREQUENCY_Hz \
135  (IR155_IMD_DEVICE_ERROR_FREQUENCY_Hz + IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
136 #define IR155_IMD_DEVICE_ERROR_LOWER_FREQUENCY_Hz \
137  (IR155_IMD_DEVICE_ERROR_FREQUENCY_Hz - IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
138 
139 #define IR155_GROUND_ERROR_UPPER_FREQUENCY_Hz (IR155_GROUND_ERROR_FREQUENCY_Hz + IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
140 #define IR155_GROUND_ERROR_LOWER_FREQUENCY_Hz (IR155_GROUND_ERROR_FREQUENCY_Hz - IR155_MEASUREMENT_INTERVAL_RANGE_Hz)
141 
142 /** Register that the supply enable pin is connected to. */
143 #define IR155_SUPPLY_ENABLE_PORT (hetREG1)
144 
145 /** Pin that the supply enable pin is connected to. */
146 #define IR155_SUPPLY_ENABLE_PIN (25u)
147 
148 /** Register that the input status pin (OHKS) is connected to. */
149 #define IR155_DIGITAL_STATUS_INPUT_PORT (hetREG1)
150 
151 /** Pin that the input status pin (IM_OK) is connected to. */
152 #define IR155_DIGITAL_STATUS_INPUT_PIN (27u)
153 
154 /** Register that the input PWM signal (IM_PWM) is connected to. */
155 #define IR155_PWM_SIGNAL_PORT (hetREG2) /* TODO: this is correct? */
156 
157 /** Pin that the input PWM signal pin (IM_PWM) is connected to. */
158 #define IR155_PWM_SIGNAL_PIN (27u) /* TODO: this is correct? */
159 
160 /*========== Extern Constant and Variable Declarations ======================*/
161 
162 /*========== Extern Function Prototypes =====================================*/
163 
164 /*========== Externalized Static Functions Prototypes (Unit Test) ===========*/
165 
166 #endif /* FOXBMS__BENDER_IR155_CFG_H_ */
General macros and definitions for the whole platform.
API header for the insulation monitoring device.