TechRef FFT
TechRef FFT
Heinrich-Hertz-Str. 9
72810 - Gomaringen
Germany
http://www.digsilent.de
[email protected]
r608
Copyright ©2011, DIgSILENT GmbH. Copyright of this document belongs to DIgSILENT GmbH.
No part of this document may be reproduced, copied, or transmitted in any form, by any means
electronic or mechanical, without the prior written permission of DIgSILENT GmbH.
Contents
1 General Description 3
1.1 Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2 Dynamic Simulation 6
3 Example Configuration 6
3.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.3 Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
A Parameter Definitions 10
List of Figures 11
List of Tables 12
1 General Description
The Fast Fourier Transformation (FFT) 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
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 samples. All following FFT
calculations are performed after another n/2 samples. The plot on top shows the analyzed
waveform, 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.
1
Tc = (1)
fc
n
T1 = Tc · n = (2)
fc
fc
fmax = (3)
2
1 fc
df = = (4)
T1 n
• Tc : Clock period
• fc : Clock frequency
• n : Number of samples in FFT calculation
• T1 : Time sampled for one complete fft calculation
• fmax : Highest frequency in fft calculation
• df : Delta f of frequency between spectral lines
fc = 12.8kHz
n = 256
n 256
T1 = = = 20ms
fc 12.8kHz
fc 12.8kHz
fmax = = = 6.4kHz
2 2
1 1
df = = = 50Hz
T1 20ms
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.
dt = t − tstart (5)
i = dt · fc (6)
f = i · df (7)
f
i= (8)
df
i
dt = (9)
fc
t = tstart + dt (10)
• dt : Time difference on time scale between current time and start of current spectrum
• t : Time
• i : Index in spectrum
• tstart : Time at start of current spectrum
• f : Frequency
1.2 Window
There are two different windows for the FFT calculation. These are:
2πi
yi = xi 1 − cos
n
input_A mag_A
mag
input_B mag_B
phase
input_C mag_C input
re
phase_A cl Single Phase
im
phase_B
ready
phase_C
re_A
Three Phase
re_B
re_C
im_A
im_B
im_C
cl ready
mag
2 Dynamic Simulation
phase
input
re
cl Single Phase
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 Example Configuration
3.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 (ElmFsrc) model. The output yo of the Fourier Source is a waveform created from given
harmonic orders and their corresponding amplitudes.
DIgSILENT
FFT 1 ph:
Output cl
Clock 0
ElmClock
FFT
Fourier Source
ElmFft
yo input
Waveform A 1
ElmFsrc
To get the starting times of the spectra plot ready of the FFT calculation. The output looks like:
DIgSILENT
1.25
30.0781 ms 40.0781 ms
1.0000 1.0000
1.00
0.75 40.9375 ms
0.3500 p.u.
0.50
41.7187 ms
0.25 0.0850 p.u.
0.00
25.00 29.00 33.00 37.00 41.00 [ms] 45.00
For example it is assumed that we want to calculate the frequency of the spectral line around
40.9375ms. From the ready output we get the starting time of the spectrum which is 40.0781ms
in the given example. The time between two consecutive FFT calculations is:
n 1
The FFT is calculated every 2 values. Therefore T1 = 2 · Tr = 2 · 10ms = 20ms and df = T1 =
1
20ms = 50Hz
Time between spectral line of interest and start dt = t − tstart = 40.9375ms − 40.0781ms =
0.8594ms
The index of the spectral line is i = dt · fc = 0.8594ms · 12.8kHz = 11
The frequency of the spectral line around 40.9375ms in the plot is f = i·df = 11·50Hz = 550Hz
It is assumed that we want to calculate the value on the time scale for a given frequency of
1050Hz
f 1050Hz
The index of the spectral line is i = df = 50Hz = 21
i
The difference on the time scale between the spectral line and the start of the FFT is dt = fc =
21
12.8kHz = 1.64ms
The value on the time scale results in t = tstart + dt = 40.0781ms + 1.641ms = 41.719ms
3.3 Plots
DIgSILENT
3.00
2.00
1.00
-0.00
-1.00
-2.00
-3.00
0.040 0.048 0.056 0.064 0.072 [s] 0.080
FFT Analysis: Input Signal
1.25
1.00
0.75
0.50
0.25
-0.00
-0.25
0.040 0.041 0.042 0.043 0.044 [s] 0.045
FFT Analysis: Magnitude / (n/2)
A Parameter Definitions
List of Figures
List of Tables