opcua
OPC UA
Connection String Options
Name | Value | Description |
---|---|---|
Code |
||
Name |
OPC UA |
|
Maven Dependency |
<dependency> <groupId>org.apache.plc4x</groupId> <artifactId>plc4j-driver-opcua</artifactId> <version>{current-last-released-version}</version> </dependency> |
|
Default Transport: |
|
|
Compatible Transports: |
|
|
Supported Operations |
||
|
The read interface allows for reading the full range of supported PLC4X data types in single and bulk requests |
|
|
The write interface allows for writing the full range of supported PLC4X data types in single and bulk requests |
|
|
Subscriptions are possible with events on event- and cyclic-basis |
|
Options |
||
|
Controls the feature of the discovery endpoint of an OPC UA server which every server
will propagate over an '<address>/discovery' endpoint. The most common issue here is that most servers are not correctly
configured and propagate the wrong external IP or URL address. If that is the case you can disable the discovery by
configuring it with a |
|
|
A username to authenticate to the OPCUA server with. |
|
|
A password to authenticate to the OPCUA server with. |
Connection String
The OPC UA drivers uses the connection string
opcua:{transport}://{ip-address}:{port}?{options}
An example of this connection string would be:-
opcua:tcp://127.0.0.1:12686?discovery=true&username=admin&password=password
Note the transport, port and options fields are optional.
Address Format
To read, write and subscribe to data, the OPC UA driver uses the variable declaration string of the OPC UA server it is
connecting to.
It includes the namespace(ns
) of the hierarchy tree followed by the type of identifier string(s
), numeric(i
),
binary(b
) or guid(g
) and its address. The Data Type is an optional field, if it is not included a default data type
is selected based on the datatype of the returned value. For Unsigned data types it needs to be included otherwise.
ns={namespace-index};[s|i|g|b]={Identifier};{Data Type}
Data Types
The following data types are supported
-
BOOL (boolean)
-
SINT (int 8)
-
USINT (uint 8)
-
BYTE (uint 8)
-
INT (int 16)
-
UINT (uint 16)
-
WORD (uint 16)
-
DINT (int 32)
-
UDINT (uint 32)
-
DWORD (uint 32)
-
LINT (int 64)
-
ULINT (uint 64)
-
LWORD (uint 64)
-
REAL (float)
-
LREAL (double)
-
CHAR (char)
-
WCHAR (2 byte char)
-
STRING (utf-8)
-
WSTRING (utf-16)
Example of a valid OPC UA address:
The following are examples of valid addresses
String address:
ns=2;s=HelloWorld/ScalarTypes/Boolean ns=2;s=HelloWorld/ScalarTypes/Boolean;BOOL
Numeric address
ns=1;i=1337 ns=1;i=1337;DINT
GUID address:
ns=2;g=09087e75-8e5e-499b-954f-f2a8624db28a ns=2;g=09087e75-8e5e-499b-954f-f2a8624db28a;REAL
Note the Identifiers s
,i
,b
and g
specify the format of the address not the data type of the returned value.
Some useful tips
The namespace (e.g. ns=2
) within the address is specific to the server you are connecting to.
More details on OPC UA
OPC UA The OPC Unified Architecture (UA), released in 2008, is a platform independent service-oriented architecture that integrates all the functionality of the individual OPC Classic specifications into one extensible framework.
This multi-layered approach accomplishes the original design specification goals of:
-
Functional equivalence: all COM OPC Classic specifications are mapped to UA
-
Platform independence: from an embedded micro-controller to cloud-based infrastructure
-
Secure: encryption, authentication, and auditing
-
Extensible: ability to add new features without affecting existing applications
-
Comprehensive information modeling: for defining complex information