ST_CM_PowerSpectrum_InitPars

Function block-specific structure with initialization parameters, which are analyzed when the function block is initialized.

TYPE ST_CM_PowerSpectrum_InitPars EXTENDS ST_CM_Object_InitPars :
STRUCT
    nFFT_Length          : UDINT := 512;                              (* Length of FFT. *) 
    nWindowLength        : UDINT := 400;                              (* Length of analysis window. *)
    fDecibelThreshold    : LREAL := cCM_MinArgLog10;                  (* Minimum argument of decadic logarithm for 64- bit IEEE 754 arithmetic. *)
    bTransformToDecibel  : BOOL := TRUE;                              (* Transform to decibel. *)
    eWindowType          : E_CM_WindowType := eCM_HannWindow;         (* Window type. *)
    aWindowParameters    : T_CM_WindowParameters := [2.5,1,1,1,1];    (* Window parameters for specific windows, e.g. FlatTop. *)
    nOverlap             : UDINT := -1;                               (* Size of overlap in samples. *)
    eScalingType         : E_CM_ScalingType := eCM_DiracScaling;      (* Scaling type. *)
    nChannels            : UDINT := 1;                                (* Number of channels. *)
END_STRUCT
END_TYPE
ST_CM_PowerSpectrum_InitPars 1:

Note the window length

The value of nWindowLength must be less or equal the value of nFFT_Length. The length of the FFT can orient itself to the required frequency resolution. Typically a value of about 4/5 of the FFT-length is often used as the window length.

If nFFT_Length is greater than nWindowLength, the frequency resolution of the FFT (and therefore also the length of the return values vector) is increased. The length difference is filled with zeros before the Fourier transform. This can be useful for achieving a higher frequency resolution, or for avoiding circular aliasing in calculations with inverse transformation in the time domain. Despite the higher frequency resolution, however, the result contains no more information.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v3.1.4022.25

PC or CX (x86, x64)

Tc3_CM_Base