.Modelica_Requirements.ChecksInFixedWindow_withFFT.MaxTotalHarmonicDistortion

Information

Syntax

property = MaxTotalHarmonicDistortion(condition=..., u=..., f_resolution=..., f_base=...., n_harmonics=..., THDmax=...).y;

Description

Whenever the Boolean input condition has a rising edge, the Real input u is sampled and stored in a buffer. Once enough values of u are stored in the buffer (depending on parameters f_base, n_harmonics and f_resolution) a Fast Fourier Transform (FFT) of the buffer u-values is computed. The amplitudes and frequencies of the computed FFT are stored on file and displayed in the icon. The Total Harmonic Distortion (THD) of the amplitudes must be below the given limit THDmax (in [%]). The theoretical THD is defined as:

   THD_theoretical = sqrt( sum( A(i*f_base)^2 ) ) / A(f_base);  i = 2,3,...

where parameter f_base is the base frequency and A(f) is the amplitude at frequency f. The THD is computed within this block by using the maximum amplitude within a small interval around the higher harmonic frequencies (i*f_base; i=2,3,...).

After the FFT computation has been performed it is checked that the THD value is within the required limit:

   THD ≤ THDmax 

where THDmax is the maximum allowed THD value. The default value is 0.1 (so 10 %).

For more details, see the description of package ChecksInFixedWindow_withFFT.

Example

This block is demonstrated with the following first example:

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

Simulating this examples results in

simulation result

A plot of the FFT result file is shown in the next figure:

This block can be also used to compute several FFTs along a simulation as demonstrated with the following second example:

Since in the second FFT calculation the THD value is larger as THDmax, the icon is displayed in light red.

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

Date Description
Nov. 29, 2015 Initial 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.

Generated at 2024-04-25T18:15:59Z by OpenModelicaOpenModelica 1.22.3 using GenerateDoc.mos