Skip to main content

Attribute: monitoring

The effect of this pragma is that you can monitor values of properties or function calls in the online view of the IEC editor or in a watch list. There are two possible attribute values for this: 'variable' and 'call'

Syntax

{attribute 'monitoring' := 'variable'}

{attribute 'monitoring' := 'call'}

Monitoring of programming objects and their properties

Important

When you insert the pragma {attribute 'monitoring':='call'} for monitoring, you have to pay attention to possible side effects. These kinds of side effects can occur if additional operations are implemented in the property.

Important

The pragma {attribute 'monitoring'} is also evaluated for the symbol configuration. Only read access is possible for the value 'variable'.

In the online view of a function block or program, you can monitor the subordinate properties in addition to the local variables. This allows you to monitor the values of the Get and Set methods.

Insert either the pragma {attribute 'monitoring' := 'variable'} or {attribute 'monitoring' := 'call'} in the declaration of the property block. The current values of the property are then displayed automatically in the IEC editor or in a watch list.

Example 278. Example

In online mode, the PLC_PRG object shows the value of the Minutes property at the call location inline in the ST editor. This is because the pragma {attribute 'monitoring' := 'variable'} is located in the declaration of the Minutes property.

_cds_img_attribute_monitoring_example.png


Check carefully for each application which attribute pragma is suitable for displaying the desired value. This depends on whether further operations with the variables are implemented within the property.

  1. Pragma: {attribute 'monitoring':='variable'}:

    An implicit variable is created for the property, which is then always given the current property value when the application calls the Set or Get method. The value stored last in this variable is displayed in the monitoring.

  2. Pragma: {attribute 'monitoring':='call'}

    You can use this attribute only for properties that return simple data types or pointers, but not for structured types.

    The value to be monitored is read or written by calling the property directly. This means that the monitoring service of the runtime executes the Get or Set method of the property.

Tip

With the context menu command Add Watch, a variable on which the cursor is currently positioned is applied directly into the monitoring list in online mode.

Tip

The forcing or writing of functions is not supported. However, you can implicitly implement forcing by adding an additional input parameter for the respective function, which serves as an internal force flag.

Tip

Function monitoring is not possible in the compact runtime.