Home FAQPricesIOServer Users
🔎

OPC Gateway Configuration Guide

The OPC Gateway (Protocol converter, Data Manager) transfers data between any brand of OPC Servers or between our protocols. It functions similarly to ladder logic, except that the Gateway is event-driven and runs asynchronously. The source and trigger expression can be any arithmetic or logical expression with any number of variables.

Group Definition

images/gatech.gifimages/gategr.gif

Group Name User-supplied group name
Update Rate The acquisition rate of all items in this group in milliseconds.
Write Delay Put a delay between each write.
Dead Band Only items whose value is changed by greater than the specified dead band will be transferred. Applies only to items in which the raw low and high values are defined. See addtags for information on how to set the raw low and high values in IOServer. Each brand of OPC Server has its method of setting the low and high values.
Active Set to 0 to stop this group.
Force Initial Update Normally IOServer does not perform any polling to read values. The source OPC Server is responsible for sending all changes (including the initial read value) to IOServer. Some third-party OPC Servers do not send the initial read value to IOServer. When set to true, an async refresh is issued once at the beginning to force the OPC Server to send the initial read value.
Write on Good Quality Only Copy to the destination only if the quality of the source is good.
OPC 2 Force the use of OPC 2.0 even if the OPC 1.0 interface is published by the OPC Server.
Sync Read and Write Force the use of synchronous read and write. For use with OPC Servers that do not support async or exception reporting. Sync read and write will reduce performance.
Allow spaces in OPC Tag Tags must be bracketed by parenthesis when this option is enabled.
Copy timestamp to destination If enabled the value, quality, and timestamp of the source is copied to the destination using IOPCAsyncIO3::WriteVQT instead of IOPCAsyncIO::Write
Reads Total number of reads
Writes Total number of writes
Items Number of items

Item Definition

Each item defines the sources and destination of the data with an optional trigger expression.

images/gategr2.gif
Source Expression When reading from IOServer the OPC Server Name may be omitted. The OPC Server name is anything before the '\' character. Any error detected is appended to this field. \App1\IOServer\Device1.40001 will access itemdID "Device1.40001" in the OPC Server "IOServer" on the remote computer "App1". The source expression cannot be a constant unless a non-constant trigger is specified.
Destination ItemIDs Write to Destination ItemID whenever the value at Source is changed. Any error detected is appended to this field. Any number of destinations may be specified. Each is space-comma separated.
Trigger Expression Copy Source to Destination only when the trigger is true or if the trigger is not specified. The trigger cannot be a constant value. Any error detected is appended to this field
Browse Browse OPC Servers items.

images/gatebrowse.gif

Item ID Current Item ID
Done Use this Item ID
Test Test if Item ID is valid
Cancel Don't use this item ID
Error Result of test
Available Item ID: Click on the text to first expand the tree
Active Set to 0 to stop this item.
Force Write Force writes to the destination even if the value of source or trigger is not changed.
Write Delay Delay the write by this number of milliseconds.
Write Enable Time Writes to the destination is enabled after the configured number of milliseconds since gateway group creation. To stop writing to the destination on startup, Set the "Write Enable Time" to say 1000 ms.
Write Data Type Convert data to this type before writing to the destination. If EMPTY is specified, then the data is converted to the destination data type.
Value The last value read.
Time Stamp The last time data was read. If the destination OPC Server supports IOPCAsyncIO3::WriteVQT, then the Timestamp information of the source is also copied. IOServer supports IOPCAsyncIO3::WriteVQT. If the source consists of more than one item, then the newest timestamp is used.
Quality The last quality of this item. If the destination is a DNP Slave, the .Online of that object will be set to 0/1 if the source quality is bad/good.
Reads Total number of reads
Writes Total number of writes

Source and Trigger Expression

The Trigger and source expression can be any combination of comparison, logical, or arithmetic operation on OPC items from any OPC Server. ItemID must be space-separated. Boolean is internally represented as a 16-bit integer with -1 (0b1111111111111111) for true and 0 for false. All operators and functions can operate on multidimensional arrays.

Priority of operators (from the highest priority)

() Use to override priority
- not unary operator, negation and logical not
mdiv y Matrix inverse of y
x mdiv y Solution to systems of equations yr = x
* / div mod multiply, divide, integer divide and modulus
- + plus and minus
<< >> left and right shift
< <= > >= comparison
= <> equality and non equality
bitand bitwise and
bitxor bitwise xor
bitor bitwise or
and logical and
or logical or

Functions supported:

abs, acos, acosh, asin, asinh, atan, atanh, ceil, cos, cosh, erf, erfc, exp, factorial, floor, gamma, j0, j1, log, log10, sin, sinh, sqrt, tan, tanh, y0, y1,
atan2(y,x), jn(n,x), max(x,y), min(x,y), pow(x,y), yn(n,x), rand()
changed(itemID , percentDeadband, low, high) return 1 if itemID have exceeded the percentDeadband, otherwise it returns 0. If percentDeadband is 0, then the
timestamp of itemID must be within 3x the group update rate. If low is equal to high, then percentDeadband is the absolute deadband.
date(itemID , type) convert the timeID timestamp to VT_DATE format. Type 0 is convert to UTC time, otherwise convert to local time
delta(itemID) return the difference between the current value and the last value. For arrays, the sum of the absolute difference is returned.
if(cond , x , y) return x if cond is true otherwise return y
lookup(source , table , index , options) Table lookup returns a changed copy of the source. Replace values in the source that matches values in the table with the corresponding value in the index. If the index is omitted, it is generated based on the number of items in the table. Options "2x" means the width of each element in the source is 2 and to use hex. If the largest value in the table is greater than the values in the index, then the most significant bit of the source is replaced with "-" then ".". e.g. lookup(QM1538.QM.Value , "7D,05,5b,1f,27,3e,7e,15,7f,3f", "", "2x") will return -014.2 for "fd0527db"
lowpass(itemID , unitPerSecond) apply lowpass filtering. Reject values that changes faster than unitPerSecond
quality(itemID) returns the quality of itemID.
replace(string , pattern , replace) replace the first occurrence of pattern in string with replace. Use \t,\r or \n for the tab, carriage return or new line character. It uses pattern matching and replacement algorithms as documented in the user definable protocol.
e.g. replace(ioserver\modbus.40001[20],bstr , "(%u)-(%u)-(%u)", "$1") will return the string "2012" if the input string is "2012-12-1"
e.g. replace(ioserver\modbus.40001[20],bstr , "(%u)-(%u)-(%u)", "$3") will return the string "1" if the input string is "2012-12-1"
scale(itemID , percentDeadband, rawLow, rawHigh, engLow, engHigh) scales itemID and clamp the value to [engLow, engHigh] within the percentDeadband.
settime(value , type) set the system time
type Value
0 Seconds since January 1, 1970
1 Milliseconds since midnight
stradd(string1 , string2) return the concatenation of string1 and string2.
strcmp(str1 , str2) return zero if strings are equal, -1 if str1 < str2 or 1 if str1 > str2. Comparison is case insensitive.
strfmt(fmt , n) return a string of real value n formatted according to fmt. Use formatting convention of printf. eg. stradd(strftime((DNPM.1.2.0.State),"%Y-%m-%dT%H:%M:%S."), strfmt("%03.0fZ",time((DNPM.1.2.0.State),8))) to convert the timestamp to a string value.
strftime(itemID , fmt) return a string formatted according to fmt using the strftime function with itemID timestamp.
strftimeUTC(seconds , fmt) return a string formatted according to fmt using the strftime function with integer seconds. Seconds is the number of seconds since January 1, 1970.
time(itemID , type) return the time information from timeID timestamp.
type Time Information returned
0 Seconds since January 1, 1970
1 Year
2 Month: January is 1
3 Day of Week: Sunday is 0
4 Day: 1 to 31
5 Hour: 0 to 23
6 Minute: 0 to 59
7 Second: 0 to 59
8 Millisecond: 0 to 999
9 Milliseconds since midnight

Read Item History

The last 16 changes of the read items are displayed.

images/gateitem.gif
Time Time the read value was acquired.
Delta (ms) Time difference from previous read.
Read Value and itemID of read
Quality Quality of read value.
Time Stamp Time stamp of read value.
Write Value and status of write
Reserved Not used.

FAQ for OPC Gateway

Q: In the OPC Gateway, tags from some non-IOServer OPC Servers have very long names, is there a way of having shortcuts to reference these tags?

A: You can define your structured tags by using the user-defined tag list as described in addtags to reference these tags in the OPC Gateway. The prefix "tags." can be omitted.

Q: Can we set a deadband on the DNP3 point or only in the OPC gateway group?

A: The %deadband of an OPC Group specifies the deadband of each source item in that group. The deadband will only work for items that have specified their low limit and high limit. In IOServer the low and high limits are specified in the item name.
e.g in "Device1.30.5.1,,0,2000"
The low limit is 0 and the high limit 2000. See addtags for more information. For source items from OPC Servers that do not define their low and high limit. You can use the Changed function in the OPC Gateway.
e.g.
Source Expression: TestTag1
Destination: Device1.20.5.1
Trigger: Changed(TestTag1 ,1,0,2000)
Note that the space character before the comma stops IOServer from interpreting ",1,0,2000" as part of TestTag1

Q: How do I set a tag(TagIsAlive) to false when the tag (TagMonitored) has not changed for 60 seconds?

A: Set the Gateway group update time for TagMonitored tag to 20 seconds.
Source Expression: Changed(tagMonitored , 0, 0, 0)
Destination: TagIsAlive
Trigger Expression: ChangingTag
ChangingTag is a value that changes every say 10 seconds to make sure that the Changed function is evaluated periodically. Use the OPC Explorer.PLC Simulator to write to ChangingTag every 10 seconds.

© Copyright IOServer Pty Ltd. All rights reserved.
+61 2 9805 0356 (Australia)

Last updated: Thu, 16 Jun 2022 08:04:01 GMT