PartialFFT partial model
Requirements.ChecksInFixedWindow_withFFT.Internal.PartialFFT
· source
Partial model containing the common part of the FFT blocks
Partial model with the common part of the FFT check blocks
WithinAbsoluteDomain,
WithinRelativeDomain and
MaxTotalHarmonicDistortion:
the interfaces, the sampling of input u into a buffer, the FFT computation, the storage of
the FFT on file, and the property output y.
From f_max and f_resolution the number of sample points ns is
computed with get_ns (even, ns = 2^i*3^j*5^k, maximum FFT
frequency f_max_FFT ≥ 5*f_max), together with the sample period
Ts = 1/(2*f_max_FFT) and the period T = (ns-1)*Ts one FFT needs.
At a rising edge of condition (or if condition is true at initialization),
u is sampled every Ts and stored in buffer u_buf;
FFT_computation is true while the buffer is filled. When ns samples are stored, or the
simulation terminates with a partially filled buffer, fftScaled computes the
amplitudes A_buf of the first np frequency points (up to f_max_plot);
if storeFFTonFile = true they are stored with saveFFTonFile
in file <modelName>/FFT.<instanceName>.<index>.mat. Files of previous runs are removed
at initialization with removeFFTresultFiles.
An extending block must compute yFFT and scaledDistance (and may set
fA_plot) in a when-clause with the same condition as the FFT computation. Output y is
Undefined before the first rising edge of condition, Undecided while the first buffer is filled and
yFFT once an FFT has been computed. The optional output margin = scaledDistance/scale
is the normalized margin (≥ 0 exactly when the check holds).
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. |
| Sept. 14, 2026 | A condition that is already true at initialization starts the FFT explicitly (initial() and condition): a tool that initializes pre(condition) to the condition's own value instead of honouring the initial equation pre(condition) = false (Modelon Impact) never saw the edge and the block stayed dead for the whole run (H. Tummescheit, Model Based Innovation LLC) |
Parameters
| Name | Type | Description |
|---|---|---|
storeFFTonFile parameter | Boolean | = true, if FFT results shall be stored on file <modelName>/FFT.<instanceName>.<index>.mat |
f_max parameter | SI.Frequency | Maximum frequency of interest (sampling frequency >= 10*f_max) |
f_resolution parameter | SI.Frequency | Frequency resolution (frequency axis points are an integer multiple of f_resolution) |
scale parameter | Real | Scale of the margin: margin = scaledDistance/scale, with scale the requirement's tolerance (1 = the scaled distance itself) |
computeMargin parameter | Boolean | = true, if the normalized margin output is provided |
ns parameter | Integer | Number of FFT sample points (is even and can be expressed as ns = 2^i*3^j*5^k) |
f_max_FFT parameter | SI.Frequency | Maximum frequency used by FFT |
nf parameter | Integer | Number of frequency points |
Ts parameter | SI.Time | Sample period |
T parameter | SI.Time | Simulation time for one FFT calculation |
np parameter | Integer | Number of frequency points used for plotting (only up to interested frequency) |
f_max_plot parameter | SI.Frequency | Largest frequency shown in the icon plot and stored on file |
Components and variables
| Name | Type | Description |
|---|---|---|
condition | Modelica.Blocks.Interfaces.BooleanInput | Boolean input condition signal (a rising edge signals to store u-values in a buffer; if there are enough values in the buffer, an FFT is computed) |
u | Modelica.Blocks.Interfaces.RealInput | Signal on which an FFT is performed |
y | Requirements.Interfaces.PropertyOutput | Property output signal (= Satisfied, if FFT Amplitudes of u are within maxAmplitude) |
FFT_computation | Modelica.Blocks.Interfaces.BooleanOutput | = true, when u is stored in buffer for FFT computation |
scaledDistance | Modelica.Blocks.Interfaces.RealOutput | Minimum distance of FFT Amplitudes of u to maxAmplitude (>= 0 if inside, otherwise outside of maxAmplitude) |
margin | Requirements.Interfaces.MarginOutput | Normalized margin of the last FFT check: >= 0 exactly when it holds, in units of scale |
periods_ok | Boolean | = true, if all periods for FFT computations have been long enough |
fillColor[…] | Integer | Fill colour of the icon's plot area (grey if satisfied, light red if violated) |
fA_plot[…] | Real | [frequency, amplitude] matrix used for plotting in icon |