Power Spectrum
Calculation of the power spectrum of a real-valued input signal, and optional decibel scaling.
The documentation of the corresponding PLC function block can be found here: FB_CMA_PowerSpectrum
The documentation of the TwinCAT 3 Condition Monitoring PLC library can be found here: Overview.
Configuration options
- FFT Length: is the length of the FFT. It must be greater than one and an integral power of two.
- Window Length: is the length of the analysis window in samples. The length must be greater than one and an even number.
- WindowType: Defines the used window function (of the type E_CM_WindowType). A good default value is the window type
eCM_HannWindow
. - Scaling Type: Enables the selection of the scaling (of the type E_CM_ScalingType) to be used, in case absolute scaling is required. The default value is
eCM_DiracScaling
. When selecting the scaling the type of signal should be considered: either deterministic signals or wide-band signals with stochastic portion. Both types require different scalings. - Transform to Decibel: is a Boolean value that indicates whether the result of the FFT is to be transformed to the decibel scale, according to transformation x -> 20 * log10(x).
- Number of Channels: defines the number of independent channels. This must be greater than zero.
- Window Overlap: defines the number of overlapping samples. This must be greater than or equal to zero.
- Decibel Threshold: is a very small floating point value greater than zero. Values that are less than this number are replaced with this value before any transformation to the decibel scale. (The purpose is the avoidance of value range errors. The logarithm of zero is not defined and strives infinitely towards minus for the limit value of small arguments. The same applies to the argument of the number zero, arg(0). The smallest possible value is 2.3e-308)
- Use Recommended Overlap: if selected, a recommended overlap is calculated internally (see F_CM_CalculateRecommendedOverlap).
- Window Parameters: contains the free parameters of selected window functions. When using
eCM_KaiserWindow
, the first entry defines the parameter beta; ifeCM_FlatTopWindow
is used, all parameters are used. See section Window functions.
Output values
- Output: output array of length
N / 2 + 1
(for FFT lengthN
), which contains the calculated spectral lines of the magnitude spectrum. - Cnt Results: specifies the number of output arrays calculated.
- New Result: is a Boolean value that indicates whether a new result was obtained in the current cycle.