Learn to use InTouch 9.0's IOSetRemoteReferences() Function

 

InTouch 9.0’s IOSetRemoteReferences() function allows the developer to change Remote Referenced Tags globally across any window that is open when the script is executed.  While this seems like a small functionality change that would affect a limited scope of InTouch users, it actually allows the user to create faceplates and common pop-up windows without having to create indirect tags and assignment scripts as in previous versions of the product. 

Before going into how IOSetRemoteReferences() works, Remote Tag Referencing, for those who are unfamiliar with the term, is a way to reference items from an access name without creating a specific I/O tag for the item.  For example, take the following tag:

By looking at the tag properties, the access name is “PLC1”, and the Item Name is “S:42”. At this point, we can now reference this item in the animation script two ways.  The first, or more common, is to reference the tag simply by its tagname, “PLCSeconds”  The second is to use remote tag referencing.  The syntax of remote tag referencing is as follows:

<ACCESS NAME>:”<ITEM NAME>”

So, in the above example, the Remote Tag Reference would be PLC1:”S:42”. Note that the quotes, while optional, are required in places where an operator or illegal character is present.  Hence, PLC1:N14:1/0 would actually return an error, as the system would be trying to divide by zero instead of taking the value as an address. Thus, it is normally good practice to use the quotations around the item.

Now, For the purposes of this tutorial, consider the following faceplate, a window named “Analog Faceplate”:

This faceplate has 13 I/O points that need to be referenced:

-PV

-HiHi Alarm Limit, Alarm State, and HiHi Alarm Enable

-High Alarm Limit, Alarm State, and High Alarm Enable

-Low Alarm Limit, Alarm State, and Low Alarm Enable

-LoLo Alarm Limit, Alarm State, and LoLo Alarm Enable

Now, in traditional InTouch, if there were 40 analog alarms that needed to use this template, that would mean 13 indirect tags, and 40 assignment scripts that would take the base name, tack on the correct suffix, and store it into the corresponding indirect tag’s .Name field.  If a change was needed, for example, a Deviation alarm was to be added, that would require the developer to go through each one of the 40 assignment scripts, add the extra indirect and its corresponding reference, and then add the alarm and its animation to the faceplate.

This is where IOSetRemoteReferences() comes into play and saves the developer a great deal of time.  The first step is to determine whether the application requires the use of the tagname dictionary or not.  Many of the advanced PLC systems, (ControlLogix, Siemens S7) have a tagname based structure which allows for a common naming convention. By utilizing this within the PLC, the developer can then simply use Remote Tag Referencing directly to the PLC access name without having to create tags. However, working with register based systems, like a Modicon or an Allen Bradley SLC-500, requires a common naming convention to be created.  Hence, the developer would want to create tags in the tagname database to create this convention.

Now, if the developer creates tags, doesn’t that mean he/she cannot use Remote Tag Referencing?  Actually, it is very easy to utilize Remote Tag Referencing in this case.  To do this, create an access name that looks to the InTouch Tag Dictionary to get its data.  In the following example, the access name “LOCALTAGS” has been created, leaving the nodename blank, the application name “VIEW”, and the topic name “TAGNAME”.  Because this access name will be local to the application, DDE is selected as the protocol, and advise only Active I/O has been selected.

After hammering out the naming conventions, the next step is to set the faceplate up to use Remote Tag Referencing.   While this tutorial is not going to go through assigning each point, upon selecting the whole faceplate and selecting “Substitute Tags,” the screen will look something like this:

Now that the faceplate has been created, the next step is to start using IOSetRemoteReferences().  The syntax for the command is:

IOSetRemoteReferences(BaseAccessName, NewAccessName, MatchString, SubstituteString, Mode)

Where each argument is as follows:

  • BaseAccessName: This string parameter specifies the original configured Access Name to match to in the reference(s).
  • NewAccessName: The new Access Name. This is applied to all references for which the original Access Name matches the string provided in BaseAccess and for which the original Item Name matches the MatchString (if one is specified).
  • MatchString: The string to match in the original configured Item Name in the reference(s). If this is an empty string, it is treated as a match for any Item Name.
  • SubstituteString: The string to substitute into the original configured Item Name, replacing the MatchString, to produce the active Item Name for the reference(s). If this is an empty string, no substitution is made.
  • Mode: Determines the way in which the MatchString must match the original configured Item Name. Matching is always from the beginning of the Item Name, never in the middle. 0 denotes that the match must be for the entire Item Name or up to a "." 1 denotes that a partial match is allowed, even if the next character is not a "."

A couple things of note:

1)      The BaseAccessName MUST have a value in it, even if you are not changing Access Names.  This is the only argument that cannot be left blank.

2)      All of the values, save the Mode, are string values.  Thus, to leave them blank, you would use an empty set of quotations (“”).

So, in the faceplate example, if we wanted to “TIC101” with “TIC202”, we would use the following entries for our command:

IOSetRemoteReferences(“LOCALTAGS”,””,”TIC101”,”TIC202”,1)

For the purposes of this tutorial, create a second screen with two buttons, one for TIC101 and one for TIC202.  The next step is to create the scripting that will initiate the remote reference change.  First, on each button, create an “On Key Down” action script that contains the following code:

                        BaseName = “TIC202”;

                        Show “Analog Faceplate”;

The BaseName should be a memory message tag.  Now, in the Window/On Show script of the “Analog Faceplate” Window, write the following line of code:

                        IOSetRemoteReferences(“LOCALTAGS”,””,”TIC101”,BaseName,1);

And that’s it!  No need for indirects or lengthy scripts to assign names to indirects.  Now, for the purpose of example, the end user has requested that the deviation alarms also be shown on the faceplate.  Using this method, all the developer needs to do (as long as the naming convention remains constant) is to add the remote referenced addresses for the deviation alarm I/O to the faceplate.  From all of the other screens or action scripts, no additional configuration is required.

Using the IOSetRemoteReferences() method, faceplates can be made and maintained in a much easier fashion than the traditional indirect assignment method.  This also removes room for error, as the developer does not need to manually build the strings to be inserted in the indirect tag names. Thus, developers should find this addition to the InTouch script library to be a valuable asset.

To Download a zipped version of the sample application used in this tutorial, click here.

 

 

©2003 Q-mation, Inc. All rights reserved. All trademarks are the property of their respective owners.