You're currently browsing the Ignition 8.0 docs. Click here to view the latest docs.


OPC Tags

By default, there is one Internal Tag Provider created for you when Ignition is installed. Because of this, you can get started right away with creating Tags. 

Tags are created in the Designer, either manual by right-clicking in the Tag Browser and selecting New Tag, or if you already have a device set up, by opening the OPC Browser and dragging tags or folders in.

There are two ways to create OPC Tags.

  • From OPC Browser
    Use the OPC Browser to browse and find the Tag and then drag it to the Tag Browser to create the Tag. This method is the easiest and most common way to create Tags.

  • From Tag Editor 
    When the Tag is not available for browsing from the OPC Browser, you create the Tag manually in the Tag Editor window.

Both of these methods require that you first have a device connection made.

On this page ...


Browsing for OPC Tags

The easiest and most common way to create Tags in Ignition is by dragging the tags from the OPC Browser into the Tag Browser window in the Designer. With this method you can bring in large numbers of Tags quickly. 

In order to have any OPC tags available in the browser, you must have first added a device connection.

Browse for Tags

  1. In the Tag Browser, click the Browse OPC Servers icon. The OPC Browser is displayed and you can browse all of your OPC connections. By default, you've got a connection to the internal Ignition OPC-UA Server, which has any devices that may be connected. Browse the devices and find some tags that you're interested in.



  2. From the OPC Browser, highlight the tags that you want to create OPC tags from. You can also select a folder containing many tags.
  3. Drag the folders onto the Tags folder in the Tag Browser. You can drag individual tags or folders. When you drag folders, Ignition keeps the same hierarchy as the PLC. 



  4. As soon as you drag the tags into Tag Browser, you can see their values being updated in the Tag Browser. You can see their values come in and start updating automatically. By default, they update at a rate of 1 per second.



IULocgo


Browsing for OPC Tags



Creating OPC Tags Manually

The above method works for OPC Tags, but only for browsable Tags. For OPC Tags that cannot be obtained through browsing, you can create Tags manually in the Tag Browser.

For manually created tags to work, you must have first added a device connection.

Manually Create an OPC Tag

  1. To start, click on the New Tag icon or right-click on the provider node and select New Tag > New Standard Tag > OPC Tag.



  2. In the Tag Editor, as an example, you can set the following values:

    Name: Temperature
    Data Type:Integer



  3. Next set the OPC Server and Item Path as follows:

    1. OPC Server: Click on the Edit  icon and choose the OPC server you want to use. Alternately, selecting an Item Path will automatically fill in the appropriate OPC Server.
    2. OPC Item Path: Click on the Edit  icon then navigate to the path you want.



  4. Click Commit
  5. Click OK to exit the Tag Editor. Now you can see the Temperature Tag in the Tag Browser.

IULocgo


Creating OPC Tags Manually



Creating Memory Tags

Memory Tags are simple tags that do not automatically change value. You can use them as setpoints (that are not stored in the PLC) or just for storing extra information. The value is specified during configuration and is stored globally in the Gateway when written.

Create a Memory Tag

  1. From Tag Browser, click on the New Tag icon or right click on a folder and select New Tag > New Standard Tag > MemoryTag.


     
  2. In the Tag Editor, type a Name (for example, Memory Tag), initial Value, and Data Type.

     
     
  3. Click OK. You now have a Memory Tag that you can read from or write to. This is just like having a global variable for your project.

IULocgo


Memory Tags


Creating Query Tags

Query Tags execute a SQL Query, whose result provides the value for the Tag. Like SQL binding in Vision, SQL Query Tags can reference other Tags to build dynamic queries. Query Tags cannot be written to. The value of a Query Tag comes from the database through a SQL query.

Create a Query Tag

In this example, we'll create an query tag that selects the current timestamp.

  1. From Tag Browser, click on the New Tag icon or right click on a folder and select New Standard Tag > Query Tag.
  2. In the Tag Editor, enter:

    Name: Current Time
    Data Type: DateTime
    Datasource: MySQL




  3. Next to the Query property, click on the Edit  icon.
  4. Copy in the following query:

    SELECT CURRENT_TIMESTAMP

    Query Type

    In certain circumstances you may want to update the database instead of querying it for data. The Query Tag will accept an update query and update the target data source. The value attribute of the Tag becomes the number of rows affected by the update query.

    The data source refers to the default data source of the Tag provider as opposed to the default data source of the project.

    In the Gateway Configure Section, go to Tags > Realtime and edit the appropriate Tag provider. Set the default database connection that this Tag provider will use for its Query Tags.

  5. Click Commit then click OK. You will see the value from your SQL query on the Current Time Tag.

IULocgo


Query Tags



Creating Expression and Derived Tags

Expression Tags are driven by an expression. The expression syntax is the same as for property bindings and allows mathematical operations, references to other Tags, and logic operations. Expression Tags cannot be written to.

With Expression Tags you can do a calculation based on certain values, other Tags, or any one of the built-in functions. In this way, you can do the calculation one time and view it on any window in your project. For information on Ignition's Expression language, see Expression Overview and Syntax.

A Derived Tag is an abstracted Tag that refers to another Tag. They are similar conceptually to Expressions Tags that reference another Tag, but Derived Tags have some additional functionality. Namely, they can write back to the referenced Tag. 

For information on Ignition's Expression language, see Expression Overview and Syntax.


IULocgo


Expression Tags

IULocgo


Derived Tags

Create an Expression Tag

In this example, we'll create an expression tag that converts Fahrenheit to Celsius.

  1. From Tag Browser, click on the New Tag icon or right click on a folder and select New Standard Tag > Expression Tag.



  2. In the Tag Editor, enter:

    Name: FtoC Expression 
    Data Type: Float

    Next to the Expression property, click on the Edit icon.



  3. In the New Tag > Expression window, type in any expression using Ignition’s Expression Language. See Expression Functions in the Appendix for information on all expression operations and functions.
    Copy in the following expression:

    (5/9) * ({[~]Refrigeration/ambientTemp} - 32)




  4. If you want to use a different Tag, replace the {[~]Refrigeration/ambientTemp} Tag path with any Tag of your choice. Instead of typing the referenced tag path, you can use the Tag icon on the right side of the Tag Editor > Expression window to select the Tag path. In the example we chose a temperature Tag from a tower.




  5. Click OK to accept the Tag you've highlighted.
  6. Click Commit in the New Tag > Expression window.
  7. Click OK to save the Tag . You will see the value from your calculation on the Tag. Note that the Expression Tags are evaluated at the rate the Tag Group is set to. 



Create a Derived Tag

Creating a Derived Tag is nearly identical to creating an Expression tag, with the exception that you can provide both a Read Expression and a Write Expression for the tag. Follow the same steps as for an Expression tag.

  1. From Tag Browser, click on the New Tag icon  or right click on a folder and select New Standard Tag > Derived Tag.

  2. Once in the Tag editor, click on the Edit  icon next to the Read Expression property.
  3. In the New Tag > Read Expression window, type in any expression using Ignition’s Expression Language. Click Commit.
  4. Back in the Tag editor, click on the Edit  icon next to the Write Expression property.
  5. In the New Tag > Write Expression window, type in any expression using Ignition’s Expression Language. Click Commit.
  6. In the Tag Editor, click OK.

See Expression Functions in the Appendix for information on all expression operations and functions.


See Expression Functions in the Appendix for information on all expression operations and functions.


Creating Reference Tags

A Referenced Tag is a Tag that refers to another Tag. It can be used to create an alias for the Tag. The Referenced Tag can write back to the original Tag.


IULocgo


Reference Tags

Create a Referenced Tag

In this example, we'll create an Referenced Tag that is scaled.

  1. From Tag Browser, click on the New Tag icon or right click on a folder and select New Standard Tag > Reference Tag.
  2. In the Tag Editor, enter:

    Name: ScaledRef 
    Source Tag Path: [default]_Sim_New_Programmable_/Random/RandomInteger1 (or any Tag you want to reference)
    Scale Mode: Linear
    Raw Low: 4.0
    Raw High: 20.0
    Scaled Low: 0.0
    Scaled High: 10.0



  3. Click OK. The Reference Tag is created and shows up in the Tag Browser. Note that the Scaled icon appears indicating that scaling has been applied to the Tag.



Editing Tags

The Tag Editor is a powerful tool used when creating Tags and it can also be used for editing them. The properties displayed in the Tag Editor are custom to the type of Tag you've selected. You can find additional information on Understanding Tags and the Tag right click menu here.

IULocgo


The Tag Editor

Edit a Tag

  1. To edit an existing Tag, right-click on the Tag, and select the Edit Tag  icon.



  2. Once in the Tag Editor, you can change the properties as you wish. 
    For example, if you want to change the Tag to a different type – such as from OPC to Expression – go to the Value Source property, click the Expand  icon, and choose the type of Tag (Simulation, Memory, Expression, Query, Reference, or Derived) that you want. 

Rename a Tag

Tags names are flexible. For naming conventions, see Understanding Tags.

  1. To rename an existing Tag, right click on the Tag in the Tag Browser and select the Rename option. 

     

  2. The cursor will now blink inside the Tag name and you can type the new name.

Cut, Paste, or Copy a Tag

You can also cut, paste, and copy tags within the Tag Browser. Right click on the Tag in the Tag Browser. Choose the command you want. 

  • Delete: Completely removes the Tag.
  • Cut: Delete the Tag from the current location, but leave it in the clipboard to be pasted elsewhere in the browser.
  • Copy: Make a copy of the Tag and leaves it in the clipboard to be pasted elsewhere in the browser.
  • Paste: Pastes the Tag you've cut or copied into the currently selected location in the Tag Browser. 



Addressing Bits

In order to address individual bits in Ignition, you must create a separate OPC Tag pointing directly to the specific bit in the PLC. 

When the integer values that come from the OPC Tags are a series of binary bits, it is then possible to address each bit. For example, an integer value can have a 16-bit binary representation as shown here: 

Integer

Bit level representation

How it works

40960,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0212 = 4096
10251,0,0,0,0,0,0,0,0,0,1,0,0,0,0,020 + 210 = 1025

Address an Individual Bit

In this example, a MicroLogix PLC is connected to a Gateway. To address an individual bit, do the following:

  1. From the Tag Editor window, create an OPC Tag to have:
    Data Type: Integer with a value of 1025
    OPC Item Path: [MLX]B3:0
     
  2. Then create a new OPC Tag with a Boolean value to the first bit of this Tag as follows:
    Data Type: Boolean

    OPC Item Path: [MLX]B3:0/0 (for Micrologic, you can specify the bit as: 0/0 or 0.0. That is, with a slash/ or a period.) [MLX]B3:0/0 has a value of "1" or a Boolean value of "True" because the integer value is odd.

  3. You can create a tag for any of the other individual bits. For example, create a new OPC Tag with a Boolean value to the second bit of the original Tag as follows:

    Data Type: Boolean
    OPC Item Path: [MLX]B3:0/1 
    [MLX]B3:0/1 has a value of "0" or a Boolean value of "False". 


Addressing bits may work differently depending on the type of device you are addressing. Most commonly you will either use /<bit> like /0 or /1, or [<bit>] like [0] or [1].

IULocgo


Addressing Bits



  • No labels