Bar Logo Dual Active Bridge Development Board (Part-No. )
 
Content
     
Loading...
Searching...
No Matches
config.h
1
2#ifndef CONFIG_H
3#define CONFIG_H
4
5#include <xc.h> // include processor files - each processor file is guarded.
6#include <stdint.h> // include standard integer data types
7#include <stdbool.h> // include standard boolean data types
8#include <stddef.h> // include standard definition data types
9
10
14#define PERIOD_MODULATION_DEMO false
15#define DCDC400V_SYSTEM true
16#define DCDC800V_SYSTEM false
17#define ENABLE_VLOOP_AGC false
// end of group ~~~~~~~~~~~~~~~~~~~~
19
20
24#define MAXIMUM_SWITCHING_FREQUENCY (float)170.0e+3//230.0e+3 ///< Maximum Switching frequency in [Hz]
25#define MINIMUM_SWITCHING_FREQUENCY (float) 65.0e+3
26
27#define MINIMUM_DEADTIME (float)150e-9
28#define MAXIMUM_DEADTIME (float)500e-9
29#define MINIMUM_PHASESHIFTED_PULSE (float) 80e-9
30
31#define PRI_TO_SEC_PHASE_DEGREES_LIMIT 90u
32
33#if defined(PERIOD_MODULATION_DEMO) && (PERIOD_MODULATION_DEMO == true)
34#define PRI_TO_SEC_PHASE_TARGET 830u
35#define PERIODSTEP (2<<3)
36#define PHASETIMESTEP (1<<3)
37#endif
// end of group pwm-fundamentals ~~~~~~~~~~~~~~~~~~~~
39
40
44#define VPLOOP_ILOOP_EXE_RATIO (uint16_t)(10 / 2)
45#define AGC_MINIMUM_VIN_THRESHOLD 160u
46#define AGC_MINIMUM_ISEC_THRESHOLD 7
// end of group ~~~~~~~~~~~~~~~~~~~~
48
49//------------------------------------------------------------------------------
50// fault related parameters
51//------------------------------------------------------------------------------
52// #defines for fault thresholds in human readable form (SI or derived SI units)
53
54// all fault parameters follow the same convention
55// for example, for ISEC_CT over current protection
56// if fault clear:
57// if ISEC_CT > ISEC_OC_THRES_TRIG_AMPS for longer than ISEC_OC_T_BLANK_TRIG_SEC
58// then set fault
59// if fault set:
60// if ISEC_CT <= ISEC_OC_THRES_CLEAR_AMPS for longer than ISEC_OC_T_BLANK_CLEAR_SEC
61// then clear fault
62// ISEC_OC_TICK_SEC is the rate at which the fault handler is invoked
63// it is required for the firmware to measure trigger and clear blanking times
64
65
69#define T_ADC_SAMPLE_SECS (float) (10.0e-6)
70
71#define IPRI_OC_THRES_TRIG_AMPS (float) (39.0)
72#define IPRI_OC_THRES_CLEAR_AMPS (float) (2.0)
73#define IPRI_OC_T_BLANK_TRIG_SEC (float) (50.0e-6)
74#define IPRI_OC_T_BLANK_CLEAR_SEC (float) (0.0)
75#define IPRI_OC_TICK_SEC (T_ADC_SAMPLE_SECS)
76
77#define IPRI_SC_THRES_TRIG_AMPS (float) (39.0)
// end of group ~~~~~~~~~~~~~~~~~~~~
79
80
84#define ISEC_OC_THRES_TRIG_AMPS (float) (49.0)
85#define ISEC_OC_THRES_CLEAR_AMPS (float) (2.0)
86#define ISEC_OC_T_BLANK_TRIG_SEC (float) (50.0e-6)
87#define ISEC_OC_T_BLANK_CLEAR_SEC (float) (0.0)
88#define ISEC_OC_TICK_SEC (T_ADC_SAMPLE_SECS)
89
90#define ISEC_SC_THRES_TRIG_AMPS (float) (49.0)
91#define ISEC_LOAD_STEP_CLAMPING_AMPS (float) (1.5)
// end of group ~~~~~~~~~~~~~~~~~~~~
93
94
98#if(DCDC400V_SYSTEM)
99 #define VPRI_OV_THRES_TRIG_VOLTS (float)(700.0)
100 #define VPRI_OV_THRES_CLEAR_VOLTS (float)(600.0)
101#elif(DCDC800V_SYSTEM)
102 #define VPRI_OV_THRES_TRIG_VOLTS (float)900.0
103 #define VPRI_OV_THRES_CLEAR_VOLTS (float)800.0
104#endif
105#define VPRI_OV_T_BLANK_TRIG_SEC (float) (0.0)
106#define VPRI_OV_T_BLANK_CLEAR_SEC (float) (0.0)
107#define VPRI_OV_TICK_SEC (T_ADC_SAMPLE_SECS)
108
109#if(DCDC400V_SYSTEM)
110 #define VPRI_UV_THRES_TRIG_VOLTS (float)(300.0)
111 #define VPRI_UV_THRES_CLEAR_VOLTS (float)(200.0)
112#elif(DCDC800V_SYSTEM)
113 #define VPRI_UV_THRES_TRIG_VOLTS (float)450.0
114 #define VPRI_UV_THRES_CLEAR_VOLTS (float)300.0
115#endif
116#define VPRI_UV_T_BLANK_TRIG_SEC (float) (0.0)
117#define VPRI_UV_T_BLANK_CLEAR_SEC (float) (0.0)
118#define VPRI_UV_TICK_SEC (T_ADC_SAMPLE_SECS)
// end of group ~~~~~~~~~~~~~~~~~~~~
120
121
125#if(DCDC400V_SYSTEM)
126#define VSEC_OV_THRES_TRIG_VOLTS (float)(500.0)
127#define VSEC_OV_THRES_CLEAR_VOLTS (float) (20.0)
128#elif(DCDC800V_SYSTEM)
129#define VSEC_OV_THRES_TRIG_VOLTS (float)950.0
130#define VSEC_OV_THRES_CLEAR_VOLTS (float) 20.0
131#endif
132#define VSEC_OV_T_BLANK_TRIG_SEC (float) (1.0e-3)
133#define VSEC_OV_T_BLANK_CLEAR_SEC (float) (10.0e-3)
134#define VSEC_OV_TICK_SEC (T_ADC_SAMPLE_SECS)
135
136#if(DCDC400V_SYSTEM)
137#define VSEC_UV_THRES_TRIG_VOLTS (float)(100.0)
138#define VSEC_UV_THRES_CLEAR_VOLTS (float) (50.0)
139#elif(DCDC800V_SYSTEM)
140#define VSEC_UV_THRES_TRIG_VOLTS (float)550.0
141#define VSEC_UV_THRES_CLEAR_VOLTS (float) 50.0
142#endif
143#define VSEC_UV_T_BLANK_TRIG_SEC (float) (0.0)
144#define VSEC_UV_T_BLANK_CLEAR_SEC (float) (0.0)
145#define VSEC_UV_TICK_SEC (T_ADC_SAMPLE_SECS)
146
147#define VSEC_LOAD_STEP_CLAMPING_VOLTS (float) (16)
148#define VPRIM_LOAD_STEP_CLAMPING_VOLTS (float) (16)
// end of group ~~~~~~~~~~~~~~~~~~~~
150
151
155#define VRAIL_5V_UV_THRES_TRIG_VOLTS (float) (3.5)
156#define VRAIL_5V_UV_THRES_CLEAR_VOLTS (float) (3.8)
157#define VRAIL_5V_UV_T_BLANK_TRIG_SEC (float) (50.0e-6)
158#define VRAIL_5V_UV_T_BLANK_CLEAR_SEC (float) (0.0)
159#define VRAIL_5V_UV_TICK_SEC (T_ADC_SAMPLE_SECS)
// end of group ~~~~~~~~~~~~~~~~~~~~
161
162
166#define TEMPERATURE_PBV_OFFSET_CELSIUS (40u)
167#define OTP_THRES_TRIG_CELCIUS (80u)
168#define OTP_THRES_CLEAR_CELCIUS (70u)
169#define FAULT_PERSISTENCE_COUNT_TEMP (4u)
170
171// Stabilize the temperature around 40 degrees C by varying
172// the fan speed
173#define NOMINAL_TEMPERATURE_THRESHOLD (float) (40.0) //< Degrees Celcius
174#define TEMPERATURE_HYSTERESIS (float) (1.0)
175
// end of group ~~~~~~~~~~~~~~~~~~~~
177
178
179//------------------------------------------------------------------------------
180// control (for debug only)
181//------------------------------------------------------------------------------
182
186#define DAC_DEBUG false
187#define OPEN_LOOP_POTI false
188#define OPEN_LOOP_PBV false
189
190#if((OPEN_LOOP_POTI == true) || (OPEN_LOOP_PBV == true))
191#define CURRENT_CALIBRATION false
192#else
193#define CURRENT_CALIBRATION true
194#endif
195#define VPRI_OPTOCOUPLER_POLARITY false
196
// end of group ~~~~~~~~~~~~~~~~~~~~
198
199//------------------------------------------------------------------------------
200// fault disables (for debug only)
201// during debug mode, Current calibration needs to be set to false
202//------------------------------------------------------------------------------
203#define FAULT_VPRI_OV true
204#define FAULT_VPRI_UV false
205#define FAULT_ISEC_OC true
206#define FAULT_IPRI_OC true
207#define FAULT_VSEC_OV true
208#define FAULT_PS_OTP true
209#define FAULT_SHORT_CCT true
210#define FAULT_VRAIL_5V true
211#define LOAD_DISCONNECT true
212//------------------------------------------------------------------------------
213
214#endif /* CONFIG_H */
215