Bar Logo 3.8/7.6 kw Totem pole Demonstration Application (Part-No. (not specified))
 
Content
     
Loading...
Searching...
No Matches
drv_controller_TPBLPFC.c
Go to the documentation of this file.
1
10/*
11� [2024] Microchip Technology Inc. and its subsidiaries.
12
13 Subject to your compliance with these terms, you may use Microchip
14 software and any derivatives exclusively with Microchip products.
15 You are responsible for complying with 3rd party license terms
16 applicable to your use of 3rd party software (including open source
17 software) that may accompany Microchip software. SOFTWARE IS ?AS IS.?
18 NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS
19 SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT,
20 MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
21 WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
22 INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY
23 KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF
24 MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE
25 FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP?S
26 TOTAL LIABILITY ON ALL CLAIMS RELATED TO THE SOFTWARE WILL NOT
27 EXCEED AMOUNT OF FEES, IF ANY, YOU PAID DIRECTLY TO MICROCHIP FOR
28 THIS SOFTWARE.
29*/
30
32#include "PFC_frameworkSetup.h"
33
36
37
49int16_t PH1_AVG_CM2p2zErrorHistory[3] __attribute__((space(ymemory), far));
50int16_t PH1_AVG_CM2p2zACoefficients[2]__attribute__((space(xmemory)));
51int16_t PH1_AVG_CM2p2zControlHistory[2] __attribute__((space(ymemory), far));
52int16_t PH1_AVG_CM2p2zBCoefficients[3] __attribute__((space(xmemory)));
54
55int16_t PH2_AVG_CM2p2zErrorHistory[3] __attribute__((space(ymemory), far));
56int16_t PH2_AVG_CM2p2zACoefficients[2]__attribute__((space(xmemory)));
57int16_t PH2_AVG_CM2p2zControlHistory[2] __attribute__((space(ymemory), far));
58int16_t PH2_AVG_CM2p2zBCoefficients[3] __attribute__((space(xmemory)));
60
61
73int16_t VMC_2p2zErrorHistory[3] __attribute__((space(ymemory), far));
74int16_t VMC_2p2zACoefficients[2]__attribute__((space(xmemory)));
75int16_t VMC_2p2zControlHistory[2] __attribute__((space(ymemory), far));
76int16_t VMC_2p2zBCoefficients[3] __attribute__((space(xmemory)));
78
79
91{
92 uint16_t i_;
93
94 PHx_AVG_CM2p2z[1].aCoefficients = &PH1_AVG_CM2p2zACoefficients[0]; // Set up pointer to derived coefficients
95 PHx_AVG_CM2p2z[1].bCoefficients = &PH1_AVG_CM2p2zBCoefficients[0]; // Set up pointer to derived coefficients
96 PHx_AVG_CM2p2z[1].controlHistory = &PH1_AVG_CM2p2zControlHistory[0]; // Set up pointer to controller history
97 PHx_AVG_CM2p2z[1].errorHistory = &PH1_AVG_CM2p2zErrorHistory[0]; // Set up pointer to error history
98
99 PHx_AVG_CM2p2z[2].aCoefficients = &PH2_AVG_CM2p2zACoefficients[0]; // Set up pointer to derived coefficients
100 PHx_AVG_CM2p2z[2].bCoefficients = &PH2_AVG_CM2p2zBCoefficients[0]; // Set up pointer to derived coefficients
101 PHx_AVG_CM2p2z[2].controlHistory = &PH2_AVG_CM2p2zControlHistory[0]; // Set up pointer to controller history
102 PHx_AVG_CM2p2z[2].errorHistory = &PH2_AVG_CM2p2zErrorHistory[0]; // Set up pointer to error history
103
104#if HIGH_VOLTAGE==0
105 for(i_=0; i_<3; i_++)
106 {
107 PHx_AVG_CM2p2z[i_].preShift = ICOMP1LV_COMP_2P2Z_PRESHIFT;
108 PHx_AVG_CM2p2z[i_].postScaler = ICOMP1LV_COMP_2P2Z_POSTSCALER;
109 PHx_AVG_CM2p2z[i_].postShift = ICOMP1LV_COMP_2P2Z_POSTSHIFT;
110 PHx_AVG_CM2p2z[i_].minOutput = ICOMP1LV_COMP_2P2Z_MIN_CLAMP;
111 PHx_AVG_CM2p2z[i_].maxOutput = ICOMP1LV_COMP_2P2Z_MAX_CLAMP;
112 }
113 //Set coefficients
114 PH1_AVG_CM2p2zACoefficients[0] = ICOMP1LV_COMP_2P2Z_COEFF_A1;
115 PH1_AVG_CM2p2zACoefficients[1] = ICOMP1LV_COMP_2P2Z_COEFF_A2;
116 PH1_AVG_CM2p2zBCoefficients[0] = ICOMP1LV_COMP_2P2Z_COEFF_B0;
117 PH1_AVG_CM2p2zBCoefficients[1] = ICOMP1LV_COMP_2P2Z_COEFF_B1;
118 PH1_AVG_CM2p2zBCoefficients[2] = ICOMP1LV_COMP_2P2Z_COEFF_B2;
119 //Set coefficients
120 PH2_AVG_CM2p2zACoefficients[0] = ICOMP1LV_COMP_2P2Z_COEFF_A1;
121 PH2_AVG_CM2p2zACoefficients[1] = ICOMP1LV_COMP_2P2Z_COEFF_A2;
122 PH2_AVG_CM2p2zBCoefficients[0] = ICOMP1LV_COMP_2P2Z_COEFF_B0;
123 PH2_AVG_CM2p2zBCoefficients[1] = ICOMP1LV_COMP_2P2Z_COEFF_B1;
124 PH2_AVG_CM2p2zBCoefficients[2] = ICOMP1LV_COMP_2P2Z_COEFF_B2;
125#endif
126
127#if HIGH_VOLTAGE==1
128 for(i_=0; i_<3; i_++)
129 {
130 PHx_AVG_CM2p2z[i_].preShift = ICOMP1HV_COMP_2P2Z_PRESHIFT;
131 PHx_AVG_CM2p2z[i_].postScaler = ICOMP1HV_COMP_2P2Z_POSTSCALER;
132 PHx_AVG_CM2p2z[i_].postShift = ICOMP1HV_COMP_2P2Z_POSTSHIFT;
133 PHx_AVG_CM2p2z[i_].minOutput = ICOMP1HV_COMP_2P2Z_MIN_CLAMP;
134 PHx_AVG_CM2p2z[i_].maxOutput = ICOMP1HV_COMP_2P2Z_MAX_CLAMP;
135 }
136 //Set coefficients
137 PH1_AVG_CM2p2zACoefficients[0] = ICOMP1HV_COMP_2P2Z_COEFF_A1;
138 PH1_AVG_CM2p2zACoefficients[1] = ICOMP1HV_COMP_2P2Z_COEFF_A2;
139 PH1_AVG_CM2p2zBCoefficients[0] = ICOMP1HV_COMP_2P2Z_COEFF_B0;
140 PH1_AVG_CM2p2zBCoefficients[1] = ICOMP1HV_COMP_2P2Z_COEFF_B1;
141 PH1_AVG_CM2p2zBCoefficients[2] = ICOMP1HV_COMP_2P2Z_COEFF_B2;
142 //Set coefficients
143 PH2_AVG_CM2p2zACoefficients[0] = ICOMP1HV_COMP_2P2Z_COEFF_A1;
144 PH2_AVG_CM2p2zACoefficients[1] = ICOMP1HV_COMP_2P2Z_COEFF_A2;
145 PH2_AVG_CM2p2zBCoefficients[0] = ICOMP1HV_COMP_2P2Z_COEFF_B0;
146 PH2_AVG_CM2p2zBCoefficients[1] = ICOMP1HV_COMP_2P2Z_COEFF_B1;
147 PH2_AVG_CM2p2zBCoefficients[2] = ICOMP1HV_COMP_2P2Z_COEFF_B2;
148#endif
149
152
153 SMPS_Controller2P2ZInitialize(&PHx_AVG_CM2p2z[1]); // Clear histories
154 SMPS_Controller2P2ZInitialize(&PHx_AVG_CM2p2z[2]); // Clear histories
155}
156
157
169{
170 VMC_2p2z.aCoefficients = &VMC_2p2zACoefficients[0]; // Set up pointer to derived coefficients
171 VMC_2p2z.bCoefficients = &VMC_2p2zBCoefficients[0]; // Set up pointer to derived coefficients
172 VMC_2p2z.controlHistory = &VMC_2p2zControlHistory[0]; // Set up pointer to controller history
173 VMC_2p2z.errorHistory = &VMC_2p2zErrorHistory[0]; // Set up pointer to error history
174
175 VMC_2p2z.preShift = VCOMP1PH_COMP_2P2Z_PRESHIFT;
176 VMC_2p2z.postScaler = VCOMP1PH_COMP_2P2Z_POSTSCALER;
177 VMC_2p2z.postShift = VCOMP1PH_COMP_2P2Z_POSTSHIFT;
178 VMC_2p2z.minOutput = VCOMP1PH_COMP_2P2Z_MIN_CLAMP;
179 VMC_2p2z.maxOutput = VCOMP1PH_COMP_2P2Z_MAX_CLAMP;
180 //Set coefficients
181 VMC_2p2zACoefficients[0] = VCOMP1PH_COMP_2P2Z_COEFF_A1;
182 VMC_2p2zACoefficients[1] = VCOMP1PH_COMP_2P2Z_COEFF_A2;
183 VMC_2p2zBCoefficients[0] = VCOMP1PH_COMP_2P2Z_COEFF_B0;
184 VMC_2p2zBCoefficients[1] = VCOMP1PH_COMP_2P2Z_COEFF_B1;
185 VMC_2p2zBCoefficients[2] = VCOMP1PH_COMP_2P2Z_COEFF_B2;
186
188
189 SMPS_Controller2P2ZInitialize(&VMC_2p2z); // Clear histories
190
191}
192
193//==============================================================================
194//==============================================================================
195
void VoltageController_PwrCtrl_TPBLPFC_Init(void)
int16_t VMC_2p2zBCoefficients[3]
int16_t PH1_AVG_CM2p2zErrorHistory[3]
int16_t VMC_2p2zACoefficients[2]
int16_t PH1_AVG_CM2p2zBCoefficients[3]
void CurrentController_PwrCtrl_TPBLPFC_Init(void)
int16_t VMC_2p2zErrorHistory[3]
uint16_t VMC_2p2zReferenceSet
SMPS_2P2Z_T PHx_AVG_CM2p2z[3]
SMPS_2P2Z_T VMC_2p2z
int16_t PH2_AVG_CM2p2zACoefficients[2]
int16_t PH1_AVG_CM2p2zControlHistory[2]
uint16_t PH1_AVG_CM2p2zReferenceSet
int16_t PH2_AVG_CM2p2zBCoefficients[3]
int16_t PH2_AVG_CM2p2zControlHistory[2]
int16_t PH2_AVG_CM2p2zErrorHistory[3]
int16_t PH1_AVG_CM2p2zACoefficients[2]
uint16_t PH2_AVG_CM2p2zReferenceSet
int16_t VMC_2p2zControlHistory[2]
This is the driver header file for the power controller.
void SMPS_Controller2P2ZInitialize(SMPS_2P2Z_T *controllerData)
Allows the user to change the advanced operating parameters.
int16_t * controlHistory
uint16_t minOutput
int16_t postShift
int16_t * errorHistory
uint16_t maxOutput
int16_t postScaler
int16_t * aCoefficients
uint16_t preShift
int16_t * bCoefficients