how to calculate the THD for ac current

cancel
Showing results for 
Search instead for 
Did you mean: 

how to calculate the THD for ac current

164 Views
Contributor I

how to use the FFT-Based to find the THD of ac current ?

0 Kudos
4 Replies

29 Views
Contributor I

Xiangjun rong,

Yes , I already use your above mention but I don't how to further use the arm_cfft_q15 , and no any example about arm_cfft_q15 . And how to the funcamental and second  , third .. 9th harmonic compinent  to calculate the THD . Right now I used the MKL16Z128  mcu , Can you give me C program in detail. I tried more time and cannot solved the problem  .

Thank you very much!

Wallace

0 Kudos

29 Views
NXP TechSupport
NXP TechSupport

Hi, Wallace,

Regarding your question, unfortunately, I have not the example code. But you can follow up as the procedure:

1)configure ADC converter and use hardware triggering mode by setting the ADCx_SC2[ADTRG]

2)configure the PIT so that the sampling frequency is for example fs=256*FREQsignal. Configure the SIM_SOPT7 register, in detail, set ADC0ALTTRGEN bit, clear ADC0PRETRGSEL assuming that you use ADC0_SA to save sample, select ADC0TRGSEL as 0100 to select PIT0 as triggering source.

3)use polling or interrupt mode to get 256 samples, which are within ONE signal cycle

4)Regarding the question how to call FFT, pls refer to the case:

https://community.nxp.com/thread/325915 

5)Because  you use ONE cycle of the signal, the Bin 1 is the fundamental component, the Bin 2,3,4...9 are the harmonic components.

Hope it can help you

BR

XiangJun Rong

0 Kudos

29 Views
Contributor I

Thanks for your replied , let me try again.

0 Kudos

29 Views
NXP TechSupport
NXP TechSupport

Hi, Wallace,

Of course, you can use ADC to sample external AC current and do FFT, then calculate the THD(total harmonic distortion). From hardware, you can select a processor for example Kinetis family, which has on-chip ADC, and the ADC supports hardware triggering.

Do you know the AC current signal exact frequency? what is the AC current frequency?

If the AC current frequency is known, for example 50HZ, you can set the PIT to generate 12.8KHz trigger signal to trigger ADC, you can get 256 points in ONE AC cycle, then remove the DC component in time domain, do FFT, you can get the fundamental component and second, third,...9th component, then figure out the THD.

Hope it can help you

BR

Xiangjun rong

0 Kudos