ST_PMA_PowerValues_InitPars
Function block-specific structure with initialization parameters which are evaluated when the function blocks FB_PMA_PowerValues_1Ph and FB_PMA_PowerValues_3Ph are initialized.
Syntax
Definition:
TYPE ST_PMA_PowerValues_InitPars :
STRUCT
fSampleRate : LREAL := 1000; // in Hz
fBaseFreq : LREAL := 50.0; // in HZ
nFFT_Length : UDINT := 512; // Length of FFT
nWindowLength : UDINT := 400; // Length of FFT window
nNumBands : UDINT := 10, // Number of bands
fBandwidth : LREAL := 4.0 // Whole bandwidth of each frequency band
eWindowType : E_PMA_WindowType := E_PMA_WindowType.HannWindow; // Window function used
fMinInputCurrent : LREAL := 0.0; // Minimal input of current (RMS) to calculate outputs
uTimeLagCurrentTransformer : U_PMA_Timelag := (fTimeLag := 0); // Timelag caused by inductivity of current transformer ( in s )
END_STRUCT
END_TYPE
Parameters
Name | Type | Parameters |
---|---|---|
fSampleRate | LREAL | Indicates the sampling rate (samples per second) of the input signal. |
fFreq | LREAL | Frequency of the first harmonic (fundamental) |
nFFT | 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. |
nNumBands | UDINT | Indicates the number of bands for which the RMS is calculated. |
fBandwidth | LREAL | Total bandwidth of a single RMS band |
eWindowType | 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. | |
fMinInputCurrent | LREAL | Minimum input value (RMS) of the current. This prevents the calculation of input values that are too small. |
uTimeLagCurrentTransformer | U_PMA_Timelag | Here, the possible delay due to the inductance of the current transformer can be specified in seconds. U_PMA_Timelag.fTimeLag: Identical for all phases U_PMA_Timelag.aTimeLag: Individual per phase |
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 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 |