get_ns function

Requirements.ChecksInFixedWindow_withFFT.Internal.get_ns  · source

Icon of get_ns

Return number of sample points

Extends Modelica.Icons.Function

Returns the number of sample points ns of the FFT buffer for a maximum frequency of interest f_max and a frequency resolution f_resolution. Starting from 2*ceil(f_max*f_max_factor/f_resolution) (so that the maximum FFT frequency is at least f_max_factor*f_max), ns is increased in steps of 2 until it is even and can be written as ns = 2^i*3^j*5^k, which is the size the FFT of the Modelica Standard Library computes efficiently. Requires f_resolution > 0 and f_max > f_resolution (asserted). Used to set parameter ns of PartialFFT.

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.

Inputs

NameTypeDescription
f_max inputSI.FrequencyMaximum frequency of interest
f_resolution inputSI.FrequencyFrequency resolution
f_max_factor inputIntegerMaximum FFT frequency >= f_max*f_max_factor (sample frequency = 2*Maximum FFT Frequency)

Outputs

NameTypeDescription
ns outputIntegerNumber of sample points that can be expressed as ns = 2^i*3^j*5^k and ns is even