








|
OPC Gateway - Data Transforms
Overview
The engine provides run-time data management features that make the
integration of data in different formats easier and in most cases,
transparent.
 |
Data type conversion The engine
automatically performs data type conversions, including support for
arrays. So, for example, mapping a PLC register integer value to a
DCS point real value is transparent.
|
 |
Data transforms The engine implements user-specified data
transforms. Evaluate a mathematical or logical expression based on
the source item value and write the result to a target item.
Transforms are configured using the Configuration Tools expression
editor and expression tester.
|
The diagram below illustrates two transforms: an
integer to string conversion for mapping mode values and a
simple engineering unit conversion. Click here
for more examples.
Use the data management features to:
 |
Reduce your OPC server-to-server integration
implementation time. |
 |
Create a central location and consistent
framework for managing data transfers between your OPC servers. |
 |
Provide an efficient integration solution. Data
is transformed only as required, when transferred between OPC
servers. |
Data Transform Configuration Screens
Data transforms are configured using mathematic
expressions that you type, import, or construct using the
expression editor. You can define one
expression for each mapping between a source and target point
(called an Item Mapping).
The screen shot below shows the expression editor
with a quadratic expression defined for an Item Mapping. When the source point
changes and/or is polled, the quadratic
equation is executed, substituting the X with the current source
point value. The result is written to the target point.

After entering your expression, click on the Test
Expression tab to validate the expression syntax and execute the
expression using sample data you provide. The screen shot below
illustrates the Test Expression tab.

Data Transform Examples
For a comprehensive list of sample transformations,
download and install the OPC Gateway demonstration software and read the on-line
help topic Gateway Configuration Tool > Reference > Data
Transforms > Data Transform Examples.
| |
|
Engineering Unit
Conversion Example
|
|
To convert a value to/from engineering units, use the following
expression:
( ( (X Xlow) * (Yhigh Ylow) ) / (Xhigh Xlow) ) + Ylow
Where:
Xhigh = high range limit for the source item value
Xlow = low range limit for the source item value
Yhigh = high range limit for the target item value
Ylow = low range limit for the target item value
|
Click
to return to List of Examples. |
| |
|
String to Integer Conversion
Example
|
|
To convert a string to an integer value, use the
following expression as an example:
if ( X = 'AUTO', 0, if ( X = 'RSP', 1, if ( X = 'CASC', 2, if ( X =
'MAN', 3, -1 ) ) ) )
This example uses a sequence of nested If statements to convert the
mode of the loop from the string label to the equivalent integer
value. If a match is not found, the function returns the value -1.
|
Click
to return to List of Examples. |
| |
|
Bit Masking to Retrieve a
Logical State Example
|
|
To extract the value of an individual bit in an integer value, use the following expression as an example:
X & @20
This example extracts a single bit (6th bit from the LSB) from the input value. If the bit is set, the function returns a non-zero value. If the bit is not set, the function returns zero (0). The resultant value can then be coerced and written to a target item with a boolean data type.
|
Click
to return to List of Examples. |
| |
|
Square Root Extraction Example |
|
To linearize an exponential value, use the following expression as an example:
sqrt( X / 32000 ) * 90 + 10
This example converts the raw input value from a range of 0..32000 to a range of 0..1. The square root of the value is then calculated. Finally, the value is converted to engineering units with a range of 10..100.
|
Click
to return to List of Examples. |
|
|