Tag References (IEC 61131-3)

Help Contents

Introduction

A Tag Reference is reference to a Database Tag.

You can use a Tag Reference to read from, or write to, a tag in the Fernhill SCADA Server.

Syntax

A Tag Reference starts with the percent (%) character immediately followed by a double quote character ("). A second double quote character (") marks the end of the tag reference.

%"Tag Reference"

In the Tag Reference part, the full stop (.) character marks the boundary between:

A Tag Reference that starts with a full stop (.) character is a relative tag reference. The actual tag reference is worked out relative to the tag that contains the tag reference.

A Tag Reference starting with multiple full stop (.) characters is a backward reference. Each additional full stop moves one place up the folder tree in the tag database.

Examples

  1. A reference to the canonical value of the tag 'Pump1' in the folder 'Pump Control':
    %"Pump Control.Pump1"
  2. A reference to the 'Quality' property of the tag 'Pump1' in the folder 'Pump Control':
    %"Pump Control.Pump1.Quality"
  3. A relative tag reference:
    %".Pump1.Quality"
    If this reference was made from a tag called Pump Control.Graphic, the actual reference would be Pump Control.Pump1.Quality.
  4. A backward relative tag reference:
    %"..Overview"
    If this reference was made from a tag called Pump Control.Pump1.Graphic, the actual reference would be Pump Control.Overview.

Indirect Tag References

An indirect tag reference uses the value of one tag to define the target of the tag reference.

To create an indirect tag reference enclose a tag reference inside less than (<) and greater than (>) characters. For example:

%"<Display Phase>.Value"

The actual tag reference is the value of the Display Phase appended with the text string .Value. If the value of Display Phase is "Phase 1", the resulting tag reference is Phase 1.Value.

The tag reference enclosed inside the less than (<) and greater than (>) characters must be an absolute tag reference.

Data Type

The data type associated with an indirect tag reference is always STRING. Use a Type Cast to convert the indirect tag reference to the type you require. For example:

TO_REAL( %"<Display Phase>.Value" )

An indirect tag reference returns an empty string if there are any errors. For example:

Performance Considerations

Using indirect tag references may result in slower performance compared to using direct tag references.

The target of a direct tag reference is located when the direct tag reference is created. This results in efficient operation because the value can be retrieved by a simple lookup operation.

The target of an indirect tag reference cannot be worked out in advance. The following steps are required to read a indirect tag reference:

  1. Read the value of the tag reference inside the less than (<) and greater than (>) characters.
  2. Create the target tag name.
  3. Locate the target tag.
  4. Read the value of the target tag.

Standards Compliance

Tag References are an extension to the IEC 61131-3 standard.

Further Information

Common Elements

To learn about other IEC 61131-3 Common Elements.

Glossary

For the meaning of terms used in Fernhill SCADA.