Tags, Assets and Templates

In Action.NET and throughout this guide, the term “tag” refers to any real-time variable or its associated historical data. Tags usually map to devices, such as PLC registers or other physical equipment in the production process. A tag can also be connected to entries on SQL databases, external data sources, or an internally calculated value.

The following sections describe how to configure tags:

n        Creating and Editing Tags

n        Creating Tag Templates

n        Creating Assets

n        Tag Runtime Objects


Creating and Editing Tags

Tags are the process variables for your application. Use tags and their properties to set up the data model for your process. You can extend the types of tags available and create new types to fit your application needs, such as machine data, equipment status, vessels, or the representa­tion of any asset attributes in your plant.

To create and edit tags:

1.      Go to Edit > Tags > Objects.

n        You can also create a tag from anywhere in Action.NET by clicking New Tag in the toolbar.


Like any other configuration table, you can also import CSV files or copy/paste contents directly from an Excel spreadsheet or other applications. Verify the chapter about the Workspace Overview and Action.NET for information about the DataGrid functionality.

2.      Enter or select information, as needed, at the Insertion Row.

 

Column

Description

Name

Enter a name for the tag. The system lets you know if the name is not valid.

Note: If you edit the name of an existing tag, the system automatically updates the name throughout the project.

Type

Select one of Built-in Tag Types or for user defined type, see Creating Tag Templates.

Parameters

If available, configure the parameters. The parameters vary based on the tag type.

Array

When not defined (blank) the Tag is not an Array.

When defining an Array with value N an Array is created from position 0 to N.

For example, when creating a Tag array of size "5", the Array is created from Tag[0] to Tag[5], this means that 6 elements are created.

Two programming styles are accommodated by this method; count from 0 to less than five and the style that interacts on the Array counting from 1 to 5.

Description

Enter a description for this tag.

3.      To add or remove a column, right-click the column heading area and check or uncheck the columns that will be visible.

Column

Description

Units

Enter the engineering units of measure that you want to use as a label for this tag.

StartValue

Enter a starting value for this tag. This is the value the tag will be initialized with when Action.NET starts.

Format

Enter a default format for displaying the data. For example:

l      N0—Number with no decimal places.

l      N3—Number with three decimal places.

l      X—Hexadecimal (supported only for integral types).

l      C—Currency.

l      When configuring output on the Displays, it is possible to define the format to each output field individually, but in most scenarios it is easier to attach the default formatting to the tag itself

For more information, see Tag Formats.

Retentive

Select an option to save the value of the tag and its internal properties to the database every time the value changes. This retains the value when the application shuts down and makes the value available when the application next starts.

l      None—Does not retain the value or properties.

l      ValueOnly—Retains only the value.

l      Properties—Retains all properties, including the value.

l      PropertiesOnly—Retains all properties, except the value.

Min

Enter the minimum value that is valid for the object.

Max

Enter the maximum value that is valid for the object.

Visibility

Select the value visibility on the OPC server for remote projects:

l      Private—Tag is visible only to the local project and redundant pair.

l      Protected—Read-only tag that is visible on the OPC server to remote projects and OPC clients.

l      Public—Tag is visible on the OPC server to remote projects and OPC clients.

Domain

Tag value for the entire project or value specific to each client display.

l      ServerTag value is consistent across the entire project and all remote client displays. Most tags in a project should be Server tags.

l      ClientTag value is local to each remote computer running a client display (web or visualizer displays).

l        Use Local tags to denote temporary data specific to individual client computers. The most common use of Local tags is when temporary data is needed to manage the user interface on the displays. Local tags allow different values on each client computer.

ReadSecurity

Allows you to define what permissions the user must have to read the contents of this tag. Leaving empty all users are allowed

WriteSecurity

Lets you define what permissions the user must have to be able to write to this tag. Leaving empty all users are allowed.

ScaleMax

Maximum scale value

ScaleMin

Minimum scale value

Comment

Enter any comments about this tag.

[Other columns]

For definitions of other columns that are available in many tables, see Common Column Definitions.

4.      Continue adding as many tags as you need.


With Action.NET you can replace names at any time, so an easy way to create a tag is to click with the mouse on the Name column of insertion row, then press space and enter repetitive times, the system will create a Tag from the same type of last one created. You can use the mouse on the insertion row to select the Type, can click with the mouse in the header or any other of that grid, that will also create a tag with a default name.


Built-in Tag Types

The following table shows the default data types in Action.NET, their corresponding dot Net, and the range of values ​​each type is able to take.

 

Standard data type

Tag Type

.Net Type

Value Range

Digital

System.Int32

0 through 1

Integer

System.Int32

2,147,483,648 through 2,147,483,647

Long

System.Int64

2,147,483,648 through 2,147,483,647

Double

System.Double

-1.79769313486231570E+308 through -4.94065645841246544E-324 for negative values; 4.94065645841246544E-324 through 1.79769313486231570E+308 for positive values

Decimal

System.Decimal

0 through +/-79,228,162,514,264,337,593,543,950,335 with no decimal point; 0 through +/-7.9228162514264337593543950335 with 28 places to the right of the decimal; smallest nonzero number is +/-0.000

Text

System.String

0 to approximately 2 billion Unicode characters

Timer

System.Int32

Same range of the Integer, but with Built-in Parameters to create timers

DateTime

System.DateTimeOffset

from 12:00:00 midnight, January 1, 0001 to 11:59:59 P.M., December 31, 9999

TimeSpan

TimeSpan

Data Interval, in Days, Hours, Minutes, Seconds and Milliseconds, where each of those properties can hold a Double value

Guid

Guid

Standard GUID unique identifier

DataTable

System.Data.DataTable

Holds a in-memory DataTable

Image

System.Byte[]

Can hold an Image file contents or any binary contents. Maximum size of the contents is the long value


The Decimal type was created in .NET to allow calculation with more precision than the double, 24 four digits against 14, what is necessary when dealing with high numbers and no rounding allowed, such as Money calculation and some very large and precise engineering metrics, however the math operations on a Decimal can be 40 times slower then the Double. So, use the Decimal type only in the context that the Double precision is not enough.

Timer

Built-In integer value that is generated automatically by the system to implement various timer models:

n        SquareWave:

inset_0.jpg

the value toggles between 0 and 1.

n        Pulse: the the tag changes to 0, then changes immediately to 1.

inset_1.jpg

n        DelayOff: the tag behaves as a PLC Timer Off . During the runtime, if you set the tag with some value other than the StartValue, the tag will hold that value for the period specified in the Interval. The tag goes back to its StartValue after the period of time (Interval)

inset_2.jpg

n        Comparer: the tag is set to 1 after the specified comparer Interval, and then goes back to zero at midnight .

inset_3.jpg

For the SquareWave, Pulse and Comparer, If you set the tag StartValue, the tag toggles between 0 and StartValue (instead of 0 and 1) .

Reference Tags

Reference Tags allows dynamic addressing of the variables.

The concept is closer to the concept of References in .NET programming, more than the old C++ pointers. The reason is that a Reference tag, like the .NET references, are TYPED; that means that when creating a Reference Tag, you need to define to which tag type or tag templates the referent will be pointing to. Like the .NET References and unlike the C++ pointers a Reference Tag cannot be defined to point to invalid memory areas that would cause errors in the applica­tion.

The target Type for Reference types is defined at the Parameters columns at Objects table.

The fact that it is a typed reference brings advantages both in Engineering and Runtime. In Engi­neering it allows Intellisense to directly browse the members of the template, when the reference it pointing to a template; In the runtime it allows string data validation.

All Reference Tags have an additional runtime attribute that is the link, which specifies the tag, during the runtime execution that the reference will be lined.

Essentially the Link property is a string property that should receive the target tag name before using the reference tag. You can assign a string directly or by using a string expression, but the best way to set the Link property is to use the Method GetName(), which will create the string based on the current tag name. This way, you can rename the tag without having to search the strings. It also shows the tag names linked on the cross-reference utility.

An example project (ReferenceTags) ships with Action.NET.

Examples

   @Tag.Reference1.Link = @Tag.TagName.GetName()     (VB)

   @Tag.Reference1.Link = @Tag.TagName.GetName();    (C#)

@Tag.Reference1.Link = “Tag.TagName”              (C#)

@Tag.Reference1.Link = “Tag.TagNa” + “me”;        (C#)

 


      The reason to use the methods GetName() instead of using directly the strings “”, is even it is an allowed syntax, when using the method GetName() you retain the benefits of Cross-Reference and Refactoring, that would be possible if you string assignments or expressions.

Tag Formats

For valid numeric formats, refer to Standard Numeric Format Strings (http://msdn.microsoft.com/en-us/library/dwhawy9k%28v=VS.90%29.aspx). For example: N1 (number with 1 decimal place).

For valid date and time formats, refer to Standard Date and Time Format Strings (http://msdn.microsoft.com/en-us/library/az4se3k1%28v=VS.90%29.aspx). For example: d (short date).

For a more in-depth discussion of format strings, refer to Formatting Types (http://msdn.micro­soft.com/en-us/library/fbxft59x%28v=VS.90%29.aspx).

See Table 1 for numeric format examples.

Table 1: Numeric format examples

Specifier

Description

N0

Number with no decimal places

N3

Number with 3 decimal places

X

Hexadecimal (supported only for integral types)

C

Currency

See Table 2 for date/time format examples.

Table 2: Date/time format examples

Specifier

Description

T (only)

Long time pattern (equivalent to HH:mm:ss).

d (only)

Short date pattern (equivalent to M/d/yyyy (month/day/year) for en-us).

dd

Show the day of the month as a number from 01 through 31.

ddd

Show the abbreviated name of the day of the week.

dddd

Show the full name of the day of the week.

MM

Show the month as a number from 01 through 12.

MMM

Show the abbreviated name of the month.

yy

Show the year as a two-digit number.

yyyy

Show the year as a four-digit number.

hh

Show the hour as a number from 01 through 12.

HH

Show the hour as a number from 00 through 23.

mm

Show the minute as a number from 00 through 59.

ss

Show the seconds as a number from 00 through 59.

fff

Show the milliseconds as a number from 000 through 999.

tt

Show the A.M./P.M. designator.


Creating Tag Templates

In addition to simple built-in types, you can have other user-defined types to implement more complex data models. These user-created types are called Templates, as prototypes to be used in the application.

For example, you can create groupings of tags of simple types, in order to create tags that corre­spond not only to a monitored point but to groups of points that constitute the data of a real object, such as a circuit breaker, or a "bay" of a substation, such as a feeder.

For this definition the Templates tab is used in the Tags workspace.

Tag templates let you create new tag types that can have multiple attributes.

To create a tag template:

1.      Go to Edit > Tags > Templates.

2.      Click New.

n        The Create New Tag Template dialog shows.

3.      In the New Type Name field, enter a name for the tag type. In the Description, enter a description of the tag. Click OK.

n        The Templates tab displays with the name of the new template at the top of the tab.

4.      Click the insertion row to create a new attribute for this tag template.

5.      Enter or select information, as needed.

Column

Description

Name

Enter a name for the attribute. The system lets you know if the name is not valid.

Type

Select the type of variable. Select one of Built-in Tag Types or one of the previously defined tag templates,

Parameters

If available, configure the parameters. The parameters vary based on the tag type.

Array

If you need an array, set last array index. For example, if you enter 5, the system creates a tag with six elements (0 to 5).

Description

Enter a description of the attribute.

[Other columns]

The Columns on Template Members have the same usage of the columns at EditTagsObjects.

n        To delete a tag type, select it from the User Custom Type drop-down list, then click Del.

n        On the Objects tab, for new tags or existing ones, you can now use this new template in the Type column


Using Templates

See the following example: A Custom Type or Template named AN_Current is shown in figure.It is used to group the three phases of the current plus the maximum percentage of phase unbal­ance into a single object. Also a digital tag that will be used to indicate alarm if the calculated unbalance is greater than maximum allowed.

inset_4.jpg

 

 

See below other Type example: In this case the tags required for monitoring and control a circuit breaker, named AN_Breaker:

n        It includes a simple POS tag Integer, which will contain the encoding of the possible states of the breaker (of two contacts);

n        Two tags that will have as attributes the addresses for sending commands to open and close the circuit breaker (CML and CMD)

n        The PCOND tag used as a precondition to allow commands;

inset_5.jpg

 

n        On POS tag is defined as Parameters a Enumeration Set used to show texts for each one of Breaker POS states.

Compound Types

One user defined type can also be used to be a type of an another template member.

Now see this next example of Type: In this case is defined a Feeder object, named AN_Feeder,  with includes its measurement and a circuit breaker. It was created using the AN_Current and AN_Breaker types already shown above. Therefore a new Template has been created, which consists of a grouping of points that can be used to monitor a real Feeder object, which uses other Templates as attributes.

inset_6.jpg

 

Now to create a Feeder object, go to Objects, and insert a new tag,

n        For example: Name it SE_DEMO_FEED_01

n        And choose AN_Feeder as its type, in the list of types.

With this procedure all tags for the circuit breaker and measurement will be created automati­cally. The names of the tags will have the names of the constituent objects such as:

SE_DEMO_FEED_01.MEA.AMP_A

SE_DEMO_FEED_01.MEA.AMP_B

SE_DEMO_FEED_01.STA.POS

SE_DEMO_FEED_01.STA.CML

 


In the Objects and Templates tables, clicking on the Type column, displays a menu like the one shown in the figure below. It allows operations on the rows of the objects and also the navigation for the definition of the template in case of customized types

inset_7.jpg

 


Creating Assets

If you have the Enterprise version of Action.NET, Assets let you configure additional metadata for your project. For example, you can organize objects in your project, such as tags, devices, and alarms, into a hierarchy. This lets you group tags that are related to each other. The hierar­chy may reflect such things as, areas of your manufacturing floor or the location of your machin­ery.

To create assets:

1.      Go to Edit > Tags > Assets.

2.      Right-click the project name and select New Level.

3.      Enter a name for the level.

4.      Right-click the new level and select Insert Asset.

n        The Select Object window displays, with all objects, by type, on the left side.

5.      Select the object type from the left side and the object you want from the right side.

6.      Click OK.

n        The object becomes a child of the selected level.

7.      Continue adding child or sibling levels and inserting assets, as needed.

n        If needed, right-click a level to rename or delete, or right-click an asset to delete it.

8.      On the Objects tab, for new or existing tags, select the new level in the Level column.

Using Assets Sample

In the example of the figure below there are, as the first level, the HPPs (Hydro Power Plants) AGV, ILS, COS, etc. which belong to the DEMO project, and as the second level of ILS the ILS_UHE machine sector. When registering the tags, in the field level (Level) must be filled with one of these levels to which the tag belongs.

inset_8.jpg

 

Once created, the Level (or Asset) will be available in the list of Levels (Assets) in the Level col­umn of the Object tab, for creating Tags.


Tag Runtime Objects

Tag Namespace

All project real-time variables, or project tags as they usually are referred to in process automa­tion context, created at the Creating and Editing Tags, are available to the runtime modules as .NET objects at the Tag Namespace.

All Built-in Tag Types share a common set of properties and methods defined in the base class TagObj. The Tags created from user defined templates, see Creating Tag Templates, are implemented by the base class UserType.

Class Type

Description.

 TagObj

Base classes to all Tag objects.

 Digital

Runtime properties for tags of Type Digital.

 Analog

Runtime properties for all Analog Tag Types.

 AnalogInt

Runtime properties for tags of Type Integer.

 AnalogLong

Runtime properties for tags of Type Long.

 AnalogDecimal

Runtime properties for tags of Type Decimal.

 AnalogDouble

Runtime properties for tags of Type Double.

 Text

Runtime properties for tags of Type Text.

 TDateTime

Runtime properties for tags of Type DateTime.

 Timer

Runtime properties for tags of Type Timer.

 TTimeSpan

Runtime properties for tags of Type TimeSpan.

 Reference

Runtime properties for tags of Type Reference.

 TDataTable

Runtime properties for tags of Type DataTable.

 UserType

Runtime Properties for tags from Templates.

See http://www.spinengenharia.com.br/help/an-2016/runtime/index.html for the complete pro­gramming reference on runtime objects.