This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMDSHVRESLLCKIT - PID values

Hello,

I am working with TI's HV LLC Kit.

I noticed in the code the following:

Pgain = 200; // Q10
Igain = 1; // Q10
Dgain = 5; // Q10

CNTL_2P2Z_CoefStruct1.b2 = _IQ16(Dgain);
CNTL_2P2Z_CoefStruct1.b1 = _IQ16(Igain - Pgain - Dgain - Dgain);
CNTL_2P2Z_CoefStruct1.b0 = _IQ16(Pgain + Igain + Dgain);
CNTL_2P2Z_CoefStruct1.a2 = _IQ26(0.0);
CNTL_2P2Z_CoefStruct1.a1 = _IQ26(1.0);
CNTL_2P2Z_CoefStruct1.max = Max_Period;
CNTL_2P2Z_CoefStruct1.min = Min_Period;

Why are some of the coefficient values being stored as _IQ16 values?  The Digital Power Library documentation mentions - 

Note that to preserve maximum resolution the coefficients are
saved in Q26 format and the saturation limits are stored in Q24 format to
match the output format

Also how were these PID value for the HV LLC Kit determined??

The accompanied code also has the following which are NOT used:

use_2P2Z = 0;
update_coeffs = 0;
b2_coeff = _IQ26(0.35);
b1_coeff = _IQ26(-1.45);
b0_coeff = _IQ26(1.33);
a2_coeff = _IQ26(-0.23);
a1_coeff = _IQ26(1.23);

Under what conditions would I want the code to use the above values?

Thanks,

Brent

  • Brent,

    I had discussed this on the thread below,

    -----------------------------------------

    Q formats are just a way of looking at the values, the 2p2z macro is doing it calculations based on Input in Q24  i.e. feedback and reference and coefficients in Q26, it outputs a Q24 number and saturates it.

    Now in the LLC kit the 2p2z output is thought of as the period value itself and not a pu number.

     For example assume that the LLC is at very light load and hence period is low, ~300. 

    The 2p2z block will provide the following number in Q24 0.29296875

    Does this number make sense? No.. but if you look at the same hex value as Q14 it is 300.0

    That's why we say that the PWMDriver accepts a Q14 number for the period. Inside the PWMdriver you will see that it shifts the valye by 14 so you are left with only the integer part i.e. 300. (this is in the documentation of the digital power library and to me this makes more sense)

    Another way of looking at it is that the 2p2z outputs a Q24 number and the driver writes a Q10 number to the PRD register (this is what is in the comments). 

    About the coefficients, the library is designed to work on Q26 numbers, internally the numbers are treated as Q26. However you can give me the same number and say it is in Q26 or say it is in Q10 or Q16 is does not matter.

    So for example the engineer who wrote the above code,  b2=_IQ16(Dgain)=_IQ16(5)=IQ24(0.00488) they are all the same. 

    I understand the documentation is very unclear on this, and i apologize for the confusion. 

    Also, 

    all of this convoluted maths was done to save one multiply with the sys clock value... and preserve more resolution. 

    Now the question is making it more cycle efficient and more precise we may have made it tougher to understand :) 

    trade-off as always..

    ----------------------------------------------------------------------

    I understand the confusion , we will make it more clean as we update this software. Let me know if i can clarify more on that discussion. For the other questions

    PID values were determined empirically, 

    That section is never used and should have been removed by the author of the code. 

  • Quick question to make sure I understand

    I think the following is incorrect in the reply:

    b2=_IQ16(Dgain)=_IQ16(5)=IQ24(0.00488) they are all the same. 

    I think it should be:

    b2=_IQ16(Dgain)=_IQ16(5)=IQ26(0.00488) they are all the same. 

    #define _IQ26(A) (long) ((A) * 67108864.0L)

    #define _IQ24(A) (long) ((A) * 16777216.0L)

    #define _IQ16(A) (long) ((A) * 65536.0L)

    Brent

  • Brent,

    yes your are correct in pointing out that mistake,