MaxTotalHarmonicDistortion2 model

Requirements.Examples.Elementary.ChecksInFixedWindow_withFFT.MaxTotalHarmonicDistortion2  · source

Icon of MaxTotalHarmonicDistortion2

Example for MaxTotalHarmonicDistortion block with two FFT computations (a rising condition input triggers an FFT calculation. The Total Harmonic Distortion (THD) of the FFTs must be below the given limit)

Extends Modelica.Icons.Example

Using check block MaxTotalHarmonicDistortion as

The amplitutes of the FFT are dynamically displayed in the icon of the block (in black). The computed amplitude of the base frequency is shown in green:

Simulating this examples results in

simulation result

As can be seen, the first FFT fulfills the check (THD < THDmax), whereas the second FFT has a too large THD value.

Revisions

DateDescription
Nov. 29, 2015Initial version implemented by Martin R. Kuhn and Martin Otter (DLR Institute of System Dynamics and Control)
The research leading to these results has received funding from the European Union’s Seventh Framework Programme (FP7/2007-2016) for the Clean Sky Joint Technology Initiative under grant agreement no. CSJU-GAM-SGO-2008-001.

Components and variables

NameTypeDescription
maxTHD1Requirements.ChecksInFixedWindow_withFFT.MaxTotalHarmonicDistortionFFT of u with base frequency 2 Hz; the total harmonic distortion must stay below 0.1
sine1Modelica.Blocks.Sources.SineFundamental: sine of amplitude 3 at 2 Hz
sine2Modelica.Blocks.Sources.SineSecond harmonic: amplitude 0.2 at 4 Hz
constModelica.Blocks.Sources.ConstantConstant offset 2.5
multiSumModelica.Blocks.Math.MultiSumSum of offset, fundamental and harmonics: the analysed signal
sine3Modelica.Blocks.Sources.SineThird harmonic: amplitude 0.3 at 6 Hz, starting at 7 s
sine4Modelica.Blocks.Sources.SineFourth harmonic: amplitude 0.15 at 8 Hz
sine5Modelica.Blocks.Sources.SineFifth harmonic: amplitude 0.1 at 10 Hz
booleanTableModelica.Blocks.Sources.BooleanTableCondition with rising edges at 1 s and 9 s: two FFT computations