ChannelOPCUA.ChannelOPCUA
- Last UpdatedNov 19, 2024
- 3 minute read
The ChannelOPCUA.ChannelOPCUA channel enables connection to OPC-UA servers and exchange data.
It supports Opc.tcp and HTTPS connections.
Code example
This is a code example for ChannelOPCUA.ChannelOPCUA.
<channel name=“OPCUAServer” class=“ChannelOPCUA.ChannelOPCUA” url=“opc.tcp://inhydl4370:62640/ServerSimulator” configPath=“OpcUaClientConfig.xml” securityMode=“Sign” securityPolicy=“Basic256” authenticationMode=“username” />
Parameters
These are parameters for the channel connection.
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
Mandatory |
The name of the channel. |
|
class |
SQL |
Must be ChannelOPCUA.ChannelOPCUA. |
|
url |
Mandatory |
The OPC UA connection URL, including protocol schema. |
|
configPath |
Optional |
OPC UA Config file path.The defaults is OpcUaClientConfig.xml. |
|
securityMode |
Mandatory |
The mode of security such as None, Sign, SignAndEncrypt, which are provided in the server configuraton. |
|
securityPolicy |
Mandatory |
Hash and encryption algorithms such as Basic256, Basic256Sha256 used for security in transit, which are provided in the server configuration. |
|
authenticationMode |
Mandatory |
Authentication mode provided by the server such as: Anonymous, UserName, Certificate. |
Connect through Username Authentication mode
You will need to setup credentials for the channel using credentials window.
-
Select a channel and right-click to show context menu.

-
Click Set Credentials. Depending on the selected authenticationMode, a Credentials window opens.

-
Set the credentials. These credentials will be encrypted and saved.
Certificates of client and server will be placed in XrBridge exe folder in OpcUa\pki\XXXX folders. Connection will fail for the first time if the server certificate is not trusted. You will need to copy server certificate from rejected folder to trusted folder for one time as an initial setup process.
When the certificates are in place, communication between client and server succeeds.
Security Note: Credentials persisted in this way are protected through Windows DPAPI and can be considered as secure as the Windows user account that performed the action is. It is crucial that Bridge runs as an authenticated user in Windows and that you consider this credentials as secure as the Windows password of that user.
Security Note: Make sure to restrict UAC on OpcUa\pki\trusted folder to Read & Execute for the users, so that rogue certificates cannot be installed by malicious actors.
Simulation
OPC UA has no specific simulation related parameter. All the OPC UA variables are defined as <item/>.
Code example
This is a code example for OPCUAServer.
<OPCUAServer>
<item name="Tag1" nodeid="ns=2;s=Tag1" type="Int16"/>
</OPCUAServer>
Item parameter
An exchanged OPC UA variable. The nodeid is an identifier for a node in an OPC UA server’s address space.
The following data types are available:
-
Boolean – A two state logical value (true or false).
-
Byte – An integer value between 0 and 255 inclusive.
-
SByte - An integer value between -128 and 127 inclusive.
-
Int16 - An integer value between -32768 and 32767 inclusive.
-
UInt16 - An integer value between 0 and 65535 inclusive.
-
Int32 - An integer value between -2147483648 and 2147483647 inclusive.
-
Uint32 - An integer value between 0 and 4294967295 inclusive.
-
Int64 - An integer value between -9223372036854775808 and 9223372036854775807 inclusive.
-
UInt64 - An integer value between 0 and 18446744073709551615 inclusive.
-
Float – An IEEE single precision (32 bit) floating point value.
-
Double – An IEEE double precision (64 bit) floating point value.
-
String – a sequence of Unicode characters.
-
DateTime – An instance of time.
-
Guid - A 16-byte value that can be used as a globally unique identifier.
-
ByteString - A sequence of octets.
Code example
This is a code example for Item parameter.
<item name="Tag1" nodeid="ns=2;s=Tag1" type="Int16"/>
Simulations
The Simulations node contains a <simulation> node for every supported simulation (currently only 1). For every supported simulation, you must include the channels that the simulation involves with correct configurations and variables, then you must set up rules for the simulation.