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/TMS320F28035: How to calculate RMS of three-phase line current

Part Number: TMS320F28035
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi,all

I got a adc value buffer with 20points, the range of each value is 0-4095, so current I = (ADVALUE*3.3/4095)*5,  5 is current-adVoltage ratio ,below is how I calculate it.

1. Calculate the current value for each data in the array, I = (ADVALUE*3.3/4095)*5

2. calculage RMS ,Irms = sqrt((I1^2 + I2^2 + I3^2 +...)/20)

There is also a method i can think of, 

1.Calculate the RMS of ADrms = sqrt((buff[1]^2 + buff[2]^2 + buff[3]^2 +...)/20)

2.Multiply by a coefficient,Irms = k* ADrms, k = sqrt(3.3*5/4095)

Through debugging, i found It takes up too many clock cycles. 

I don't know how to handle these formulas with IQmath libraries.

Can anyone provide a reference method? 

thanks in advance

  • The device you are using has a fixed-point core, and a floating point accelerator (CLA). Depending on whether your CLA is already being used up or not, there are a couple of alternate approaches you can explore. You could run the math on the C28x core using IQMath. Please refer to the IQmath user guide in C2000Ware (\C2000Ware_2_00_00_02\libraries\math\IQmath\c28\docs) for guidance on how to convert floating point values to fixed-point values, and then how to further perform specific operations with them.

    Alternately, you can use the CLA and remain in the floating point domain. Refer to C2000Ware_2_00_00_02\libraries\math\CLAmath\c28\examples, there is a specific example on square root (sqrt).

    Thanks,

    Sira

  • Hi, Thanks for your reply

    Following your suggestion, I've started to read docs about IQmath. 

    In addition, do you have a routine for calculating RMS?

    Thanks,

  • Please refer to the Digital Power SDK.

    http://www.ti.com/tool/C2000WARE-DIGITALPOWER-SDK

    C:\ti\C2000Ware_DigitalPower_SDK_2_00_01_00\libraries\power_measurement\include\ power_meas_sine_analyzer.h