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