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.

CCS/TMS320F28069: How to calculate the integral of a variable

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE, C2000WARE-DIGITALPOWER-SDK

Tool/software: Code Composer Studio

I would like to know the best and most accurate method by which the integral of a variable signal could be calculated. I need to obtain the value of theta by integrating the value of omega as shown in the reference image. Is numerical methods of integration such as trapezoidal rule the only option ?

  • Do you have any sampling time also? if yes. 

    Ts = sampling time. 

    w = Frequency. 

    step = w*Ts; 

    now 

    Theta = Theta + step 

    and 

    mask  and make theta zero after reaching 2*PI; 

    where PI = 3.14;

    Maybe this help you. 

    Ashutosh

  • Thanks Ashutosh for the quick reply. Is it fine if sampling time is set as 1 second. Could you please help me to write complete code for the below block diagram where current and frequency controllers are PI controllers. I want to know how I could implement a PI controller using equation.

  • Please see the application notes

    www.ti.com/.../sprabt3a.pdf

    www.ti.com/.../sprabt4a.pdf

    Also the code for these is available in controlSUITE (1ph and 3ph PLL) and C200Ware-DIGITALPOWER-DSK(1ph PLL)
  • Hi DAN,

    In addition to Mr. Manish Sir, you also go through the pdf attached by me. In this, you got all the modules which use to implement the above control loop. Still, you have some difficulty please give me the reply.

    Now the sampling time of 1 Sec is too large for PLL locking. There is 50 / 60 Hz mains are present in the worldwide most application. which means you need to take at lease 150 Sample per second for PLL as well as for the PI controller and sensors.

    6825.DMC MATH_v13.1.pdf

  • Hi Ashutosh

    I have referred to the pdf file attached and would like to know how to input data in the IQ24 format as required by the module. It would be helpful if you could provide code to convert data from floating point to IQ24 format and from IQ24 format back to floating point.
  • Dan,

    you are on F28069 which has floating point processor. I'll highly recommend just using floating point, so you don't have to go through the learning curve on IQmath which is only needed for fixed-point processors.

    -Manish 

  • All the modules available including the one for PLL and PI controllers are require input in IQ24 format. How could I modify the module to work with floating point input or is there a way I can implement the same code contained in the module for floating point inputs.
  • Dan,

    the code is avaialble in floating point as well,

    please refer to

    C:\ti\controlSUITE\libs\app_libs\solar\v1.2\float

    At the time of writing of those documents we had fixed point processors which we were focusssing on due to cost.

    In 2018, floating point is a given in these application, and should be the way forward for any company that wants to focus on long term savings and the cost differences are still there but closing.

    We also have several system examples that run these in fixed point in controlSUITE and floating point in the C2000Ware Digital POwer SDK

    Please refer to the UG , SolarLib.pdf for instructions on how to use.
  • I would also like to know if there a module /code to implement a PI controller in floating point. Thanks
  • Dan,

    there are several in the controlSUITE, however our best recommendation and one we are maintaining and supporting is the Digital Controller Library (DCL), it's latest version is in the C2000Ware-DIGITALPOWER-SDK and the latest C2000Ware. Please download these and browse to

    C:\ti\C2000Ware_1_00_05_00_Software\libraries\control\DCL\c28