Bar Logo 4kW dsPIC33C PSFB DC-DC DA (Part-No. )
 
Content
     
Loading...
Searching...
No Matches
config.h
1#ifndef CONFIG_H
2#define CONFIG_H
3
4#include <xc.h> // include processor files - each processor file is guarded.
5#include <stdint.h> // include standard integer data types
6#include <stdbool.h> // include standard boolean data types
7#include <stddef.h> // include standard definition data types
8
9
13// #define PERIOD_MODULATION_DEMO false ///< Modulates the period; for further development
14// #define DCDC400V_SYSTEM true ///< When true, operates the DAB with protection thresholds for 400V output
15// #define DCDC800V_SYSTEM false ///< When true, operates the DAB with protection thresholds for 800V output
16
17 // end of group ~~~~~~~~~~~~~~~~~~~~
18
19
23// #define MAXIMUM_SWITCHING_FREQUENCY (float)170.0e+3//230.0e+3 ///< Maximum Switching frequency in [Hz]
24// #define MINIMUM_SWITCHING_FREQUENCY (float) 65.0e+3 ///< Minimum Switching frequency in [Hz]
25
26// #define MINIMUM_DEADTIME (float)150e-9 ///< Minimum Deadtime in seconds [sec]
27// #define MAXIMUM_DEADTIME (float)500e-9 ///< Maximum Deadtime in seconds [sec]
28// #define MINIMUM_PHASESHIFTED_PULSE (float)300e-9//(float) 80e-9 ///< Minimum phase shifted pulse in seconds [sec]
29
30// #define PRI_TO_SEC_PHASE_DEGREES_LIMIT 90u ///< Maximum Limit for primary to secondary phase in degrees [deg]
31
32// #if defined(PERIOD_MODULATION_DEMO) && (PERIOD_MODULATION_DEMO == true)
33// #define PRI_TO_SEC_PHASE_TARGET 830u ///< Primary to Secondary phase target before switching to period modulation
34// #define PERIODSTEP (2<<3) ///< period increment with 3LSBs needs to be 0 based from PWM FRM with cascaded PWM
35// #define PHASETIMESTEP (1<<3) ///< Phase increment with 3LSBs needs to be 0 based from PWM FRM with cascaded PWM
36// #endif
37 // end of group pwm-fundamentals ~~~~~~~~~~~~~~~~~~~~
38
39
43// #define VPLOOP_ILOOP_EXE_RATIO (uint16_t)(10 / 2) ///< ratio of ILOOP /VPLOOP execution [100KHz / 10KHz], the divide 2 is for interleaved VLoop and PLoop
44// #define AGC_MINIMUM_VIN_THRESHOLD 160u ///< Minimum VIN threshold to activate AGC in [V]
45// #define AGC_MINIMUM_ISEC_THRESHOLD 7 ///< Minimum current threshold to activate AGC in [A]
46// #define AGC_MINIMUM_VIN_THRESHOLD_SEC 160u ///< Minimum VIN secondary threshold to activate AGC reverse mode in [V]
47// TODO: could define droop coefficient here
48 // end of group ~~~~~~~~~~~~~~~~~~~~
49
50//------------------------------------------------------------------------------
51// fault related parameters
52//------------------------------------------------------------------------------
53// #defines for fault thresholds in human readable form (SI or derived SI units)
54
55// all fault parameters follow the same convention
56// for example, for ISEC_CT over current protection
57// if fault clear:
58// if ISEC_CT > ISEC_OC_THRES_TRIG_AMPS for longer than ISEC_OC_T_BLANK_TRIG_SEC
59// then set fault
60// if fault set:
61// if ISEC_CT <= ISEC_OC_THRES_CLEAR_AMPS for longer than ISEC_OC_T_BLANK_CLEAR_SEC
62// then clear fault
63// ISEC_OC_TICK_SEC is the rate at which the fault handler is invoked
64// it is required for the firmware to measure trigger and clear blanking times
65
66
71#define T_ADC_SAMPLE_SECS (float) (10.0e-6)
72
73// #define IPRI_OC_THRES_TRIG_AMPS (float) (15.0) ///< Primary over current trigger threshold
74// #define IPRI_OC_THRES_CLEAR_AMPS (float) (2.0)
75// #define IPRI_OC_T_BLANK_TRIG_SEC (float) (10.0e-6)
76// #define IPRI_OC_T_BLANK_CLEAR_SEC (float) (0.0)
77// #define IPRI_OC_TICK_SEC (T_ADC_SAMPLE_SECS)
78
79#define IPRI_SC_THRES_TRIG_AMPS (float) (15.0)
80 // end of group ~~~~~~~~~~~~~~~~~~~~
81
82
86#define ISEC_OC_THRES_TRIG_AMPS (float) (220.0)
87#define ISEC_OC_THRES_CLEAR_AMPS (float) (2.0)
88#define ISEC_OC_T_BLANK_TRIG_SEC (float) (10.0e-6)
89#define ISEC_OC_T_BLANK_CLEAR_SEC (float) (10.0e-6)
90#define ISEC_OC_TICK_SEC (T_ADC_SAMPLE_SECS)
91
92#define ISEC_SC_THRES_TRIG_AMPS (float) (220.0)
93// #define ISEC_LOAD_STEP_CLAMPING_AMPS (float) (1.5)
94 // end of group ~~~~~~~~~~~~~~~~~~~~
95
96
100// #if(DCDC400V_SYSTEM)
101// #define VPRI_OV_THRES_TRIG_VOLTS (float)(700.0)
102// #define VPRI_OV_THRES_CLEAR_VOLTS (float)(600.0)
103// #elif(DCDC800V_SYSTEM)
104#define VPRI_OV_THRES_TRIG_VOLTS (float)890.0
105#define VPRI_OV_THRES_CLEAR_VOLTS (float)800.0
106// #endif
107
108#define VPRI_OV_T_BLANK_TRIG_SEC (float) (10.0e-6)
109#define VPRI_OV_T_BLANK_CLEAR_SEC (float) (10.0e-6)
110#define VPRI_OV_TICK_SEC (T_ADC_SAMPLE_SECS)
111
112// #if(DCDC400V_SYSTEM)
113// #define VPRI_UV_THRES_TRIG_VOLTS (float)(300.0)
114// #define VPRI_UV_THRES_CLEAR_VOLTS (float)(200.0)
115// #elif(DCDC800V_SYSTEM)
116#define VPRI_UV_THRES_TRIG_VOLTS (float)400.0
117#define VPRI_UV_THRES_CLEAR_VOLTS (float)390.0
118// #endif
119#define VPRI_UV_T_BLANK_TRIG_SEC (float) (10.0e-6)
120#define VPRI_UV_T_BLANK_CLEAR_SEC (float) (10.0e-6)
121#define VPRI_UV_TICK_SEC (T_ADC_SAMPLE_SECS)
122
123 // end of group ~~~~~~~~~~~~~~~~~~~~
124
125
129// #if(DCDC400V_SYSTEM)
130// #define VSEC_OV_THRES_TRIG_VOLTS (float)(500.0)
131// #define VSEC_OV_THRES_CLEAR_VOLTS (float) (20.0)
132// #elif(DCDC800V_SYSTEM)
133#define VSEC_OV_THRES_TRIG_VOLTS (float)18.0
134#define VSEC_OV_THRES_CLEAR_VOLTS (float)11.0
135//#endif
136#define VSEC_OV_T_BLANK_TRIG_SEC (float) (10.0e-6)
137#define VSEC_OV_T_BLANK_CLEAR_SEC (float) (10.0e-6)
138#define VSEC_OV_TICK_SEC (T_ADC_SAMPLE_SECS)
139
140// #if(DCDC400V_SYSTEM)
141// #define VSEC_UV_THRES_TRIG_VOLTS (float)(100.0)
142// #define VSEC_UV_THRES_CLEAR_VOLTS (float) (50.0)
143// #elif(DCDC800V_SYSTEM)
144#define VSEC_UV_THRES_TRIG_VOLTS (float) 4.0
145#define VSEC_UV_THRES_CLEAR_VOLTS (float) 6.0
146// #endif
147#define VSEC_UV_T_BLANK_TRIG_SEC (float) (10.0e-6)
148#define VSEC_UV_T_BLANK_CLEAR_SEC (float) (10.0e-6)
149#define VSEC_UV_TICK_SEC (T_ADC_SAMPLE_SECS)
150
151// #define VSEC_LOAD_STEP_CLAMPING_VOLTS (float) (16)
152// #define VPRIM_LOAD_STEP_CLAMPING_VOLTS (float) (16)
153 // end of group ~~~~~~~~~~~~~~~~~~~~
154
155
159#define VRAIL_5V_UV_THRES_TRIG_VOLTS (float) (4)
160#define VRAIL_5V_UV_THRES_CLEAR_VOLTS (float) (4.2)
161#define VRAIL_5V_UV_T_BLANK_TRIG_SEC (float) (10.0e-6)
162#define VRAIL_5V_UV_T_BLANK_CLEAR_SEC (float) (10.0e-6)
163#define VRAIL_5V_UV_TICK_SEC (T_ADC_SAMPLE_SECS)
164 // end of group ~~~~~~~~~~~~~~~~~~~~
165
166
170// #define TEMPERATURE_PBV_OFFSET_CELSIUS (40u) ///< To allow the PBV to support up to -40C, an offset was added
171#define OTP_THRES_TRIG_CELCIUS (70u)
172#define OTP_THRES_CLEAR_CELCIUS (65u)
173#define FAULT_PERSISTENCE_COUNT_TEMP (2u)
174
175// // Stabilize the temperature around 40 degrees C by varying
176// // the fan speed
177// #define NOMINAL_TEMPERATURE_THRESHOLD (float) (40.0) //< Degrees Celcius
178// #define TEMPERATURE_HYSTERESIS (float) (1.0) ///< Degrees Celcius
179
180 // end of group ~~~~~~~~~~~~~~~~~~~~
181
182
183//------------------------------------------------------------------------------
184// control (for debug only)
185//------------------------------------------------------------------------------
186
190// #define DAC_DEBUG false ///< test values with PIM DAC output
191// #define OPEN_LOOP_POTI false ///< test the code with Digital Power Development Board; runs in openloop using potentiometer
192// #define OPEN_LOOP_PBV false ///< use Power Board visualizer to change the parameters in Open loop operation
193
194// #if((OPEN_LOOP_POTI == true) || (OPEN_LOOP_PBV == true))
195// #define CURRENT_CALIBRATION false ///< Enable current calibration
196// #else
197// #define CURRENT_CALIBRATION true ///< Enable current calibration
198// #endif
199// #define VPRI_OPTOCOUPLER_POLARITY false ///< false if not inverted; true if inverted
200
201 // end of group ~~~~~~~~~~~~~~~~~~~~
202
203//------------------------------------------------------------------------------
204// fault disables (for debug only)
205// during debug mode, Current calibration needs to be set to false
206//------------------------------------------------------------------------------
207#define FAULT_VPRI_OV true
208#define FAULT_VPRI_UV true
209#define FAULT_ISEC_OC true
210//#define FAULT_IPRI_OC_ true
211#define FAULT_VSEC_OV true
212#define FAULT_PS_OTP true
213#define FAULT_SHORT_CCT false
214#define FAULT_VRAIL_5V false
215#define LOAD_DISCONNECT false
216//------------------------------------------------------------------------------
217
218#endif /* CONFIG_H */
219