findBaseFrequency function

Requirements.ChecksInFixedWindow_withFFT.Internal.findBaseFrequency  · source

Icon of findBaseFrequency

Find real base frequency (search around an interval of f_base for the largest amplitude

Extends Modelica.Icons.Function

Searches the amplitude spectrum A_buf (A_buf[i] at frequency (i-1)*f_resolution) for the largest amplitude near the nominal base frequency f_base and returns this real base frequency f_baseReal, its amplitude A_baseReal and its index index_baseReal. The search interval is meant to be f_base ± searchInterval [%], that is the indices from floor(f1/f_resolution)+1 to ceil(f2/f_resolution)+1 with f1 = (1 - searchInterval/100)*f_base and f2 = (1 + searchInterval/100)*f_base, limited to 1 .. size(A_buf,1). If both indices coincide, the range is widened by one frequency point on each side (again limited to 1 .. size(A_buf,1)).

Used by checkRelativeDomain and checkTHD.

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.
Dec. 3, 2026Upper search index computed from f2 instead of f1 (the range above f_base was never searched); if both indices coincide, the range is widened by one point on each side instead of to the whole spectrum (which also gave index 0 or nf+1, out of range); the lower index is limited to nf (H. Tummescheit, Model Based Innovation LLC)

Inputs

NameTypeDescription
f_resolution inputSI.FrequencyFrequency resolution of A_buf
f_base inputSI.FrequencyNominal base frequency
searchInterval inputRealin [%] of f_base
A_buf[…] inputRealAmplitudes (A_buf[i] at frequency (i-1)*f_resolution)

Outputs

NameTypeDescription
f_baseReal outputSI.FrequencyReal base frequency (largest amplitude in the search range)
A_baseReal outputRealAmplitude at f_baseReal
index_baseReal outputIntegerIndex of f_baseReal in A_buf