Samples of calculations based on the signal period
The samples show the highly dynamic analysis of electrical systems. For this purpose, we use the algorithms of the Power Monitoring library, whose calculations are based on the signal period.
Overview
An analysis chain is used in the samples. The function block IDs for linking the algorithms are defined in the structure E_AnalysisIDs. The analysis chain begins either with an input from a bus terminal, for example the EL3783, or with the signal generator. Switching is done with the variable eInputSelect.
The input signal is transferred to the source function block (fbSource), which subsequently forwards the signal to the analysis function blocks assigned to it. This includes the frequency calculation with the function block (fbFrequency), the calculation of basic values with the function block (fbBasicValues), the calculation of power values with the function block (fbPowerValues) and the calculation of harmonics with the function block (fbHarmonics).
Program parameters
The most important parameters for influencing the input signal are shown in the following table.
Variable | Description | Default value |
---|---|---|
eInputSelect | Selection of the input signal | E_InputSelect.SignalGenerator |
fFrequency | Base frequency of the generated signals | 50 Hz |
fAmplitudeVoltage | Amplitude of the generated voltage signal | 325.27 V |
fAmplitudeCurrent | Amplitude of the generated current signal | 1.414 A |
fPhaseDifferenceCurrent | Phase shift between the generated current and voltage signals | 5 ° |
bEnableHarmonics | Generation of harmonic components in the current and voltage signals | FALSE |
Global constants
The following global constants are defined:
Variable | Description | Default value |
---|---|---|
cOversamples | Number of oversamples of the input channels | 10 |
cSamplerate | Sample rate of the input channels in Hz | 10000 |
cNumHarmonics | Number of harmonics to be calculated | 20 |
Download
Single-phase sample program | |
Three-phase sample program |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v3.1.4024.0 | PC or CX (x86, x64) | Tc3_PowerMonitoring |