RealFFT
Sampling and FFT of input u
Library
Modelica/Blocks/Math
Description
This block samples the input signal, calculates the Fast Fourier Transform by function Math.realFFT,and (when simulation terminates) writes the output to result file resultFileName by function Math.realFFTwriteToFile.
The number of sampling points as well as the samplePeriod is calculated from desired maximum frequency f_max and frequency resolution f_res.
Note
The user has to take care that enough points can be sampled before the simulation ends: startTime + (ns - 1)*samplePeriod <= stopTime.
The result file is written as mat, first column = frequency, second column = amplitudes, third column = phases. The frequency points are separated by rows with amplitude and phase = 0,so one can plot the result directly as frequency lines.
Parameters
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo_samplePeriod | samplePeriod | Sample period of component | Scalar | |
mo_startTime | startTime | First sample time instant | Scalar | |
mo_f_max | f_max | Maximum frequency of interest | Scalar | |
mo_f_res | f_res | Frequency resolution | Scalar | |
mo_ns | ns | Number of samples | Scalar | |
mo_nf | nf | Number of frequency points | Scalar | |
mo_resultFileName | resultFileName | Result file: f, abs, arg | String | |
mo_firstTrigger | firstTrigger | firstTrigger | Structure | |
mo_firstTrigger/fixed | fixed | Cell of scalars | true | |
mo_firstTrigger/start | start | Cell of scalars | true | |
mo_info | info | info | Structure | |
mo_info/fixed | fixed | Cell of scalars | true | |
mo_info/start | start | Cell of scalars | ||
mo_buf | buf | buf | Structure | |
mo_buf/fixed | fixed | Cell of vectors | true | |
mo_buf/start | start | Cell of vectors | ||
mo_abs | abs | abs | Structure | |
mo_abs/fixed | fixed | Cell of vectors | true | |
mo_abs/start | start | Cell of vectors | ||
mo_arg | arg | arg | Structure | |
mo_arg/fixed | fixed | Cell of vectors | true | |
mo_arg/start | start | Cell of vectors | ||
mo_iTick | iTick | iTick | Structure | |
mo_iTick/fixed | fixed | Cell of scalars | true | |
mo_iTick/start | start | Cell of scalars |
Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|
mo__nmodifiers | Number of Modifiers | Specifies the number of modifiers | Number | |
mo__modifiers | Modifiers | Add new modifier | Structure | |
mo__modifiers/varname | Variable name | Cell of strings | 'sampleTrigger' | |
mo__modifiers/attribute | Attribute | Cell of strings | 'start' | |
mo__modifiers/value | Value |
Ports
Name | Type | Description | IO Type | Number |
---|---|---|---|---|
u | implicit | input | 1 |