ST_PMA_Spectrum_Quantiles_InitPars

Lefeld Function block-specific structure with initialization parameters which are evaluated when the function blocks FB_PMA_Spectrum_Quantiles_1Ph and FB_PMA_Spectrum_Quantiles_3Ph are initialized.

Syntax

Definition:

TYPE ST_PMA_Spectrum_Quantiles_InitPars :
STRUCT
    nFFT_Length         : UDINT := 512;      // Length of FFT
    nWindowLength       : UDINT := 400;      // Length of FFT window
    fSampleRate         : LREAL := 1000;     // in Hz
    eScalingType        : E_PMA_ScalingType := E_PMA_ScalingType.NoScaling; // Scaling type used
    eWindowType         : E_PMA_WindowType  := E_PMA_WindowType.HannWindow; // Window function used
    bTransformToDecibel : BOOL := TRUE;      // Transform result to decibel
    fDecibelThreshold   : LREAL := 1.3E-308; // Log threshold for decibel transformation
    fMinBinnedVoltage    : LREAL;             // Minimum binned voltage
    fMaxBinnedVoltage    : LREAL;             // Maximum binned voltage
    fMinBinnedCurrent    : LREAL;             // Minimum binned current
    fMaxBinnedCurrent    : LREAL;             // Maximum binned current
    nBins               : UDINT := 1;        // Number of bins in interval
    nNumQuantiles       : UDINT := 1;        // Maximum number of quantile values
    aQuantiles          : ARRAY[0..GVL_PMA.cMaxQuantiles-1] OF LREAL; // 0.0 < aQuantiles[x] <1.0
END_STRUCT
END_TYPE

Parameter

Name

Type

Parameter

nFFT_Length

UDINT

Length of the FFT. It must be greater than one and an integral power of two.

nWindowLength

UDINT

Length of the analysis window in samples. The length must be greater than one and an even number. It must be not greater than nFFT_Length.

fSampleRate

LREAL

Indicates the sampling rate (samples per second) of the input signal.

eScalingType

E_PMA_ScalingType

Enables the selection of the scaling to be used, in case absolute scaling is required.

eWindowType

E_PMA_WindowType

Defines the window function used. The window type „HannWindow" is a good default value. The windowing can be switched off by the use of the window type "RectangularWindow". Further explanations and the list of possible window functions can be found in the introductory section Window functions.

bTransformToDecibel

BOOL

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).

fDecibelThreshold

LREAL

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, since the logarithm of zero is not defined mathematically. The smallest possible value is 3.75e-324.

fMinBinnedVoltage

LREAL

Lower limit value for which the output data of the spectrum calculation of the voltage are counted in the regular histogram bins.

fMaxBinnedVoltage

LREAL

Upper limit value for which the output data of the spectrum calculation of the voltage are counted in the regular histogram bins. fMaxBinnedVoltage must be larger than fMinBinnedVoltage.

fMinBinnedCurrent

LREAL

Lower limit value for which the output data of the spectrum calculation of the current are counted in the regular histogram bins.

fMaxBinnedCurrent

LREAL

Upper limit value for which the output data of the spectrum calculation of the current are counted in the regular histogram bins. fMaxBinnedCurrent must be larger than fMinBinnedCurrent.

nBins

UDINT

number of bins in a histogram. The minimum number is 1. In many cases, values between ten and twenty are a sensible choice. The two special bins for values that lie below fMinBinned or above fMaxBinned are not included in this value.

nNumQuantiles

UDINT

Number of quantiles to calculate for each channel. This must be an integer greater than zero.

aQuantiles

ARRAY[0 - GVL_PMA.cMaxQuantiles-1] OF LREAL

Indicates the quantile limit. It must be between 0.0 and 1.0. For example, 0.2 corresponds to the 20% quantile.

ST_PMA_Spectrum_Quantiles_InitPars 1:

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 3/4 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 difference in the length is filled with zeros by the Fourier transformation. 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.4024.0

PC or CX (x86, x64)

Tc3_PowerMonitoring