Sie sind auf Seite 1von 10

DIgSILENT Technical Documentation

Fast Fourier Transformation

DIgSILENT GmbH Heinrich-Hertz-Strasse 9 D-72810 Gomaringen Tel.: +49 7072 9168 - 0 Fax: +49 7072 9168- 88 http://www.digsilent.de e-mail: mail@digsilent.de

Fast Fourier Transformation Published by DIgSILENT GmbH, Germany Copyright 2007. All rights reserved. Unauthorised copying or publishing of this or any part of this document is prohibited. TechRef ElmFft V1 Build 331 30.03.2007

Fast Fourier Transformation

Table of Contents

Table of Contents
1 GENERAL DESCRIPTION ....................................................................................................................................... 4 1.1 OPERATION .................................................................................................................................................................. 4 1.1.1 Basics......................................................................................................................................................................... 4 1.1.2 Calculating the frequency scale from the time scale ...................................................................................................... 6 1.2 WINDOW ...................................................................................................................................................................... 6 2 INPUT/OUTPUT DEFINITIONS OF SIMULATION MODEL ...................................................................................... 7 3 INPUT PARAMETER DEFINITIONS........................................................................................................................ 7 4 EXAMPLE CONFIGURATION .................................................................................................................................. 8 4.1 OVERVIEW .................................................................................................................................................................... 8 4.2 FREQUENCY <=> TIME SCALE....................................................................................................................................... 9 4.3 PLOTS......................................................................................................................................................................... 10

Fast Fourier Transformation

1 General Description

1 General Description
The Fast Fourier Transformation model is used for calculating a fast fourier transformation in the simulation. The spectral lines of the magnitude, phase, real part and imaginary part are output signals. In addition there is the option to apply a hanning window on the input signal. The fourier transformation model has the option to input three or one single signals.

1.1 Operation
1.1.1 Basics
X FFT Y

3.00
P1 P3

2.00 1.00

X 0.00
-1.00 -2.00 -3.00 0.000 1.25 1.00 0.75
P1 P2 P3 P4 P2 P4

0.012

0.024

0.036

0.048

[s]

0.060

Y 0.50
0.25 -0.00 -0.25 0.000

0.012

0.024

0.036

0.048

[s]

0.060

Figure 1 Plot Operation FFT Input and Output


The fft calculation outputs the left half of the spectrum. Therefore it is possible to perform a new fft calculation every n/2 values. Up to the first n samples after starting the simulation the output is set to 0. The first calculation is performed after n

Fast Fourier Transformation

DIgSILENT

1 General Description

samples. All following fft calculations are performed after another n/2 samples. The plot on top shows the analyzed wavevorm, the one on the bottom displays the magnitude of the frequencies. P1 in the frequency plot is calculated from the signal in P1 in the time plot. The following equations show the relation between sampling frequency, fft size and the output.

Tc =

1 fc n fc

(1)

T1 = Tc n = fc 2

(2)

f max =
df =

(3)

f 1 = c T1 n

(4)

The following variables have been used in the equations above:

Tc : Clock Period f c : Clock Frequency n : Number of Samples in FFT calculation T1 : Time sampled for one complete fft calculation f max :Highest frequency in fft calculation df : Delta f of frequency between spectral lines

With the settings used in the plots above:

f c = 12.8 kHz n = 256


the calculated values are:

T1 =

n 256 = = 20ms fc 12.8kHz


f c 12.8kHz = = 6.4kHz 2 2

f max =
df =

1 1 = = 50 Hz T1 20ms

Therefore a new calculation is completed every 10 ms. Every time that a spectrum has completed the ready signal is set to 1. Other models using the fft output as input value use the ready signal to trigger their calculations. If the ready signal is shown in a plot it can be used to calculate the time period sampled by the fft calculation or to mark the beginning of a new fft calculation.

Fast Fourier Transformation

1 General Description

1.1.2 Calculating the frequency scale from the time scale


The following formulas show how to calculate the frequency from the time scale.

dt = t t start i = dt f c f = i df
Calculating the time on the scale for a given frequency:

(5) (6) (7)

i=

f df i fc

(8)

dt =

(9)

t = t start + dt
The newly invented variables are:

(10)

dt : Time difference on time scale between current time and start of current spectrum t : Time i : Index in spectrum t start :Time at start of current spectrum f : Frequency

1.2 Window
There are two different windows for the fft calculation. These are: 1. 2. Rectangular (no window) Hanning Window, where the following filter is applied to the input:

2i y i = x i 1 cos n
with n = Number of Samples in FFT calculation

Fast Fourier Transformation

2 Input/Output Definitions of Simulation Model

2 Input/Output Definitions of Simulation Model


Three Phase input_A input_B input_C mag_A mag_B mag_C
cl

Single Phase mag input phase re im ready

phase_A phase_B phase_C re_A re_B re_C im_A im_B im_C cl ready

Figure 2 Signal Definitions


The input signals input and cl must always be connected for using the model in the simulation. input_A, input_B and input_C need not to be connected. Input values not connected are set to 0.

3 Input Parameter Definitions


Table 1: Parameter Definitions
Parameter loc_name nphase nsamp I_win Description Name Number of Phases Buffer Size Window Unit

Fast Fourier Transformation

4 Example Configuration

4 Example Configuration
4.1 Overview
The following example shows a small configuration where the Fast Fourier Transformation model is used to perform a fft analysis on a signal. The analyzed signal is created with the Fourier Source model. The output yo of the Fourier Source is a waveform created from given harmonic orders and their corresponding amplitudes.
DIgSILENT

FFT 1 ph:
Clock Fast Fourier Transformation

Clock ElmClock
Fourier Source

output

cl

FFT ElmFft
yo

Waveform A ElmFsrc

input

Figure 3 Block Diagram

Table 2: Example Settings


Object Simulation Clock FFT ComInc ElmClock ElmFft Variable dtemt and dtout_emt cFreq nsamp i_win Fourier Source ElmFsrc Frequency 0.0 50.0 250.0 350.0 550.0 750.0 1050.0 1650.0 Value 5.0e-6 s 12.8 kHz 256 no window Amplitude 0.200 1.000 0.200 0.180 0.350 0.150 0.085 0.100

Fast Fourier Transformation

4 Example Configuration

4.2 Frequency <=> Time Scale


To get the starting times of the spectra plot ready of the fft calculation. The output looks like:
DIgSILENT

1.25 1.00 0.75 0.50 0.25 0.00 25.00 41.7187 ms 0.0850 p.u. 30.0781 ms 1.0000 40.0781 ms 1.0000 40.9375 ms 0.3500 p.u.

29.00

33.00

37.00

41.00

[ms]

45.00

Figure 4 ready Output


For example it is assumed that we want to calculate the frequency of the spectral line around output we get the starting time of the spectrum which is consecutive fft calculations is:

40.9375ms .From the ready 40.0781ms in the given example. The time beetween two

Tr = 40.0781ms 30.0781ms = 10ms


The fft is calculated every

n 1 1 values. Therefore T1 = 2 Tr = 2 10ms = 20ms and d f = = = 50 Hz 2 T1 20ms dt = t t start = 40.9375ms 40.0781ms = 0.8594ms

Time between spectral line of interest and start The index of the spectral line is

i = dt f c = 0.8594ms 12.8kHz = 11 40.9375ms in the plot is f = i df = 11 50 Hz = 550 Hz 1050 Hz

The frequency of the spectral line around

It is assumed that we want to calculate the value on the time scale for a given frequency of

The index of the spectral line is

i=

f 1050 Hz = = 21 df 50 Hz
dt = i 21 = = 1.64ms f c 12.8kHz

The difference on the time scale between the spectral line and the start of the fft is

The value on the time scale results in

t = t start + dt = 40.0781ms + 1.641ms = 41.719ms

Fast Fourier Transformation

4 Example Configuration

4.3 Plots
3.00
DIgSILENT

2.00

1.00

-0.00

-1.00

-2.00

-3.00 0.040

0.048 0.056 FFT Analysis: Input Signal

0.064

0.072

[s]

0.080

1.25

1.00

0.75

0.50

0.25

-0.00

-0.25 0.040

0.041 0.042 FFT Analysis: Magnitude / (n/2)

0.043

0.044

[s]

0.045

Figure 5: FFT Plot

Fast Fourier Transformation

10