Energy monitoring

The described widget is suitable for displaying the energy data in the app. The different configuration options are described below. In the figure all available features of the widget are active. The values shown in the widget do not claim to be realistic. They are merely intended to show different possibilities of presentation.

Energy monitoring 1:

The widget is transferred as a substructure in the overall structure of the SendData() method. To build the widget, various PLC attributes are used when declaring the structure.

{attribute 'iot.ReadOnly' := 'false'}
{attribute 'iot.DisplayName' := 'Name for Widget'}
{attribute 'iot.WidgetType' := 'EnergyMonitoring'}
{attribute 'iot.EnergyMonitoringPhase2Visible' := 'true'}
{attribute 'iot.EnergyMonitoringPhase3Visible' := 'true'}
stEnergyMonitoringWidgetSample : ST_EnergyMonitoringWidgetSample;

Attribute

Data type

Description

iot.ReadOnly

BOOL

Determines whether the widget on the app side gets only read access (TRUE) or additionally also write access to the PLC (FALSE).

iot.DisplayName

STRING

The display name of the widget in the app. This will be overwritten by sDisplayName as soon as sDisplayName is not an empty string.

iot.WidgetType

STRING

Type specification for the widget, in this case: EnergyMonitoring.

ioT.EnergyMonitoringPhase2Visible

BOOL

Specifies whether the values of the second phase are displayed (TRUE) or not (FALSE).

ioT.EnergyMonitoringPhase3Visible

BOOL

Specifies whether the values of the third phase are displayed (TRUE) or not (FALSE).

TYPE ST_EnergyMonitoringWidgetSample :
STRUCT
    sDisplayName                 : STRING;
    sStatus                      : STRING;
    aThreePhaseMaxPower          : ARRAY[0..2] OF LREAL;
    aThreePhaseCurrentPower      : ARRAY[0..2] OF LREAL;
    aThreePhasePowerUnits        : ARRAY[0..2] OF STRING;
    aThreePhaseAmperage          : ARRAY[0..2] OF LREAL;
    aThreePhaseAmperageUnits     : ARRAY[0..2] OF STRING;
    aThreePhaseVoltage           : ARRAY[0..2] OF LREAL;
    aThreePhaseVoltageUnits      : ARRAY[0..2] OF STRING;
    nPowerQualityFactor          : LREAL;    
    nCurrentPower                : LREAL;
    sPowerUnit                   : STRING;
    nEnergy                      : LREAL;
    sEnergyUnit                  : STRING;
END_STRUCT
END_TYPE

Attribute

Data type

Description

Display in widget

sDisplayName

STRING

Determines the display name of the widget and overwrites the PLC attribute 'iot.DisplayName'.

Display text of the widget.

sStatus

STRING

Intended to indicate the status of energy monitoring.

Text under the display text of the widget.

aThreePhaseMaxPower

ARRAY [0..2] OF LREAL

The three maximum power values of the three phases.

Scaling of the three red-filled circles.

aThreePhaseCurrentPower

ARRAY [0..2] OF LREAL

The current power of the three phases.

Fill in the red circles and value above the circles.

aThreePhasePowerUnits

ARRAY [0..2] OF STRING

Intended to define the units of the three powers. You can find out more about processing the units later in this chapter.

Units behind the value above the circles.

aThreePhaseAmperage

ARRAY [0..2] OF LREAL

The three values of the amperages of the three phases.

Value of the upper number in the circles.

aThreePhaseAmperageUnits

ARRAY [0..2] OF STRING

Intended to define the units of the three amperages. You can find out more about processing the units later in this chapter.

Unit behind the upper value in the circles.

aThreePhaseVoltage

ARRAY [0..2] OF LREAL

The three values of the voltages of the three phases.

Value of the lower number in the circles.

aThreePhaseVoltageUnits

ARRAY [0..2] OF STRING

Intended to define the units of the three voltages. You can find out more about processing the units later in this chapter.

Unit behind the lower value in the circles.

nPowerQualityFactor

LREAL

The power quality factor.

Marked as "Power Quality Factor" in this figure.

nCurrentPower

LREAL

The current total power.

Marked as "Power" in this figure.

sPowerUnit

STRING

Unit of the current total power.

Behind the value for "Power".

nEnergy

LREAL

The energy charged so far during the current charging process.

Marked as “Energy” in this figure.

sEnergyUnit

STRING

Unit of the energy charged so far.

Behind the value for "Energy".

Automatic conversion of units

Starting from the base unit specified in the respective arrays, the current value is automatically converted in the range between nano (10^-9) and exa (10^18) to enable a meaningful display in the widget.

For example, if A is specified as the base unit, a value of 0.0001 A would be displayed as 100 µA. If the value is 10000 A, 10 kA would be displayed.