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.

TMS320F28035: need help in C2000 2p2z design

Part Number: TMS320F28035
Other Parts Discussed in Thread: POWERSUITE

dear all,

in case of 2p2z design, How to design the following:

1. Configure Scaling Constants

2. Calculate 2p2z coefficient

3. How to select which Qmath operator to apply. Wheather Q15 or Q24 etc. Also how to apply Q operator. Is there any example. Is IQ operator is different from Q operator.

  • Snehasish,

    Like all fixed point code, the programmer must understand the numerical range of the variables and ensure the Q format is capable of handling it. One benefit of the IQ math library is it permits this to be done entirely in C. Typically, a 2P2Z compensator will see the servo loop error at it's input. This is the difference between some reference command and an ADC result, both of which will have known range and resolution. Often, users choose to normalise the input range so it is bounded by +/-1.

    The compensator output may be passed to a PWM register as a fixed point unsigned integer, so again you have to take care to scale it correctly. It's application dependent, each case will be different, so I can only provide general guidelines.

    'IQ' (Integer-Quotient) is the name given to the 32-bit format we use in our fixed point kit development. 'Q' format is a more general may concept which may apply to fixed point variables of any length. The quickstart guide in the IQmath library gives a good overview of the IQ format and functions.

    You will normally compute the coefficients using Matlab or some similar tool. There are several ways to go about this. I'm assuming you are familiar with this part - let me know if not. If you compute the coefficients as floating point you will have to represent them in your selected IQ type when you write the code. For example, if A1 = 0.1234f and you select IQ24 format, you would write: A1 = _IQ24(0.1234);

    Any C2000 fixed point development kit will provide you with good code examples. You could try the solar explorer kit, for example. The battery charger component uses a 2P2Z compensator to control a SEPIC converter.

    Regards,

    Richard
  • Dear Richard

    I appreciate for your early response. I am new to this microcontroller. Please guide me how to compute the co-efficient. Which tool to be used. Please provide any document with example. Also please provide some document that illustrates how to convert to IQ & Q format with example.

  • Dear Snehasish,

    There are various tools available to find the discrete coefficients.  I prefer Matlab to so this.  There is a summary of the various conversion methods and their application to a 3P3Z compensator in part 4 of the video series on this page:
    https://sites.google.com/site/controltheoryseminars/home/control-theory-fundamentals-seminar
    You can also download a tutorial and example Matlab scripts there, which I hope will be helpful.  You may also like to investigate the powerSUITE tool, which allows you to design the compensator and measure its performance on a C2000 device.

    Once you have computed the coefficients, you can convert them into your selected IQ format using the method I gave in my previous post.  The compiler and IQmath library will take care of the conversion when you do that.

    Regards,

    Richard