PID controller is just a particular case of 2P2Z controller, just A1= -1 and A2 =0. Few examples from Ti put A1 = 1 to go from PID to 2P2Z instead of -1 !!!!!!!!!!!!! see code bellow ( line : CNTL_2P2Z_CoefStruct1.a1 = _IQ26(1.0); // A1 = 1 )
please any idea why ?
Thank you
Hamid
/ ADC feedback connections
ADCDRV_1ch_Rlt1 = &Adc_Vout1;
ADCDRV_1ch_Rlt2 = &Adc_Vout2;
//2P2Z connections for the Voltage Loop - Ch1
CNTL_2P2Z_Ref1 = &Vout1SetSlewed; // Slewed Voltage command
CNTL_2P2Z_Out1 = &Duty1A; // Duty command
CNTL_2P2Z_Fdbk1 = &Adc_Vout1; // O/P Voltage feedback
CNTL_2P2Z_Coef1 = &CNTL_2P2Z_CoefStruct1.b2; // point to first coeff.
// Coefficients for the Voltage Loop - PID coefficients & Clamping (Q26)
Dmax1 = _IQ24(0.8);
Pgain1 = _IQ26(0.001953);
Igain1 = _IQ26(0.003);
Dgain1 = _IQ26(0.0);
// Coefficient init - Coeeficient values in Q26
CNTL_2P2Z_CoefStruct1.b2 = Dgain1; // B2
CNTL_2P2Z_CoefStruct1.b1 = (Igain1-Pgain1-Dgain1-Dgain1); // B1
CNTL_2P2Z_CoefStruct1.b0 = (Pgain1 + Igain1 + Dgain1); // B0
CNTL_2P2Z_CoefStruct1.a2 = 0.0; // A2 = 0
CNTL_2P2Z_CoefStruct1.a1 = _IQ26(1.0); // A1 = 1
CNTL_2P2Z_CoefStruct1.max = Dmax1; //Clamp Hi
CNTL_2P2Z_CoefStruct1.min = _IQ24(0.0); //Clamp Min
//2P2Z connections for the Voltage Loop - Ch2
CNTL_2P2Z_Ref2 = &Vout2SetSlewed; // Slewed Voltage command
CNTL_2P2Z_Out2 = &Iref2; // Peak current reference command
CNTL_2P2Z_Fdbk2 = &Adc_Vout2; // O/P Voltage feedback
CNTL_2P2Z_Coef2 = &CNTL_2P2Z_CoefStruct2.b2; // point to first coeff.
// Coefficients for the Voltage Loop - PID coefficients & Clamping (Q26)
Dmax2 = _IQ24(0.8);
Pgain2 = _IQ26(0.001953);
Igain2 = _IQ26(0.003);
Dgain2 = _IQ26(0.0);
// Coefficient init - Coeeficient values in Q26