- Home
- :
- General Purpose Microcontrollers
- :
- Kinetis Microcontrollers
- :
- how to calculate the THD for ac current

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

how to calculate the THD for ac current

12-30-2018
02:21 AM

171 Views

kwyeung

Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

4 Replies

01-03-2019
12:51 AM

36 Views

kwyeung

Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

01-03-2019
10:31 PM

36 Views

xiangjun_rong

NXP TechSupport

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

01-04-2019
12:43 AM

36 Views

kwyeung

Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Thanks for your replied , let me try again.

01-02-2019
01:35 AM

36 Views

xiangjun_rong

NXP TechSupport

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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