WithinRelativeDomain model

Requirements.ChecksInFixedWindow_withFFT.WithinRelativeDomain  · source

Icon of WithinRelativeDomain

A rising condition input triggers an FFT calculation. The amplitudes of the FFTs must be below a frequency dependent limit that is defined relative to the amplitude of the base frequency

Extends Internal.PartialFFT

Syntax

property = WithinRelativeFFTdomain(condition=..., u=..., f_max=..., f_resolution=..., f_base=...., maxAmplitude=...).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_max 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 amplitudes must be below the polygon defined by parameter maxAmplitude (maxAmplitude[fi,Ai] defines the maximum amplitude Ai in [% of amplitude at base frequency] at frequency point fi in [Hz]. fi ≥ 0 required). The amplitude of the base frequency is defined to be the largest amplitude of the computed FFT around the frequency:

   f_base - df ≤ f ≤ f_base + df

and the frequency difference df is computed from the advanced parameter searchInterval (default = 5 %) as:

   df = f_base*searchInterval/100

The check is performed in the range: 0 ≤ f ≤ min(f_max, maxAmplitude[end,1]) and the maxAmplitude values are linearly interpolated for this check.

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), as well as the maximume amplitudes maxAmplitude (in red). The computed amplitude of the base frequency is shown in green (so this amplitude is 100 %)

Simulating this examples results in

simulation result

As can be seen, the simulation is terminate (via instance terminate1 of block FallingEdgeTerminate) once the FFT has been computed (signaled via the falling edge of FFT_computation). Since all FFT amplitudes between 0 ≤ f ≤ min(f_max, maxAmplitude[end,1]) are below the maximally allowed limit, the block returns Property.Satisfied.

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:

The amplitutes of the FFT are dynamically displayed in the icon of the block (in black), as well as the maximume amplitudes maxAmplitude (in red). At the end of the simulation, one of the amplitudes is larger as allowed:

Simulating this examples results in

simulation result

As can be seen, the first FFT fulfills the check (scaledDistance = 0), whereas the second FFT has amplitudes that are larger as allowed (scaledDistance = -0.1).

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.
Sept. 14, 2026The whole evaluation at an FFT instant is one function call (Internal.checkRelativeDomain) instead of eight equations in a when-clause: a tool that evaluates a when-body with the pre-event values of the variables assigned in that same when-clause (Modelon Impact) checked the FFT against a limit curve scaled by the previous base amplitude. Results in Dymola and OpenModelica are unchanged (H. Tummescheit, Model Based Innovation LLC)

Parameters

NameTypeDescription
f_base parameterSI.FrequencyBase frequency (100 % amplitude = largest amplitude around f_base)
searchInterval parameterRealSearch interval [%] around base frequency f_base for real base frequency (with largest amplitude)
maxAmplitude[…] parameterRealMaximum allowed amplitude: Real[:,2] array with [frequency in Hz, amplitude[%]]

Components and variables

NameTypeDescription
f_base2 discreteSI.FrequencyReal base frequency (frequency with largest amplitude around f_base)
A_base2 discreteRealAmplitude at the real base frequency (= largest amplitude around f_base)
f_base2_line[…] discreteRealVertical line at the real base frequency in icon coordinates
A_max_plot discreteRealAmplitude at the top of the icon plot (= largest scaled limit + 10 % of A_base2)
A_max_plot_perCent discreteRealA_max_plot in [%] of A_base2 (shown in the icon)
maxAmplitude2[…] discreteRealMaximum allowed amplitude: Real[:,2] array with [frequency in Hz, amplitude]
maxAmplitudePlot[…] discreteRealScaled limit curve maxAmplitude2 in icon coordinates (red line in the icon)