Skip to main content

OPC UA Client

Device Production Ethernet

OPC UA via the Site Runtime opcua (None/Sign/Sign&Encrypt Read/Write/Subscribe/Browse; conditions LAB).

PropertyValue
Console protocol idopc-ua-client
Site Runtime pluginopcua
TransportEthernet (TCP/UDP)
Readyes
Writeyes — through approved writes
Subscribe—
Device familiesOPC UA Server
Default group interval100 ms
MaturityProduction: complete driver (connection handling, address forms, batching, read and write)

Create the device​

  1. Open Connectivity → Devices and click Add device.
  2. Pick OPC UA Client in the protocol list.
  3. Choose the Site Runtime that can reach the device, fill the connection parameters below and click Create & connect.
  4. Add a group (poll interval) and tags with the address formats below. See Devices and Groups and tags for the full walk-through.

Connection parameters​

Every field the Console shows for this protocol. Required fields must be set before the device can be saved.

ParameterTypeDefaultRange / optionsRequiredDescription
Endpoint URL
url
stringopc.tcp://127.0.0.1:4840/max 256 charsyesOPCUA server endpoint url
Username
username
string—max 30 charsno
Password
password
string—max 30 charsno
Certificate file
cert
file—max 81960 charsno
Key file
key
file—max 81960 charsno
Security Mode
security_mode
mapNoneNone, Sign, Sign & Encryptno
Update Mode
update_mode
mapReadRead, Subscribe, Read & Subscribeno
Publish Interval (ms)
publish-interval
int500100 – 65535no
Event Root Node
event-root-node
string0!2253max 256 charsnoOPC UA event root node for condition subscription (default: 0!2253 for Server node)

Tag addresses and data types​

Supported data types: INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, BIT, BOOL, STRING, DATE_AND_TIME, ARRAY_CHAR, ARRAY_INT8, ARRAY_UINT8, ARRAY_INT16, ARRAY_UINT16, ARRAY_INT32, ARRAY_UINT32, ARRAY_INT64, ARRAY_UINT64, ARRAY_FLOAT, ARRAY_DOUBLE, ARRAY_BOOL, ARRAY_STRING, CUSTOM. The Console validates each tag address against the pattern for its data type before it is saved:

Data typesAddress pattern (regular expression)
INT8 UINT8 INT16 UINT16 INT32 UINT32 INT64 UINT64 FLOAT DOUBLE BIT BOOL STRING^[0-9]+(\[\d{1,3}(,\d{1,3}){0,2}\])?!*
DATE_AND_TIME ARRAY_CHAR ARRAY_INT8 ARRAY_UINT8 ARRAY_INT16 ARRAY_UINT16 ARRAY_INT32 ARRAY_UINT32 ARRAY_INT64 ARRAY_UINT64 ARRAY_FLOAT ARRAY_DOUBLE ARRAY_BOOL ARRAY_STRING^[0-9]+!*
CUSTOM^cond:|alarm:|event:|method:[0-9]+!*

Addressing and notes​

Address syntax and examples​

namespace!identifier

The OPC UA node id ns=2;s=Filler.Temperature is written 2!Filler.Temperature.

AddressMeaning
2!Filler.TemperatureString identifier in namespace 2 (the demo plant)
2!s=Filler.TemperatureThe same, with the explicit s=
0!2253Numeric identifier 2253 in namespace 0 (the Server object)
3!i=1001Numeric identifier with the explicit i=
2!g=09087e75-8e5e-499b-954f-f2a9603db28aGUID identifier
2[0]!Pump.ValuesElement 0 of an array (up to three indexes: 2[1,2]!Matrix)
method:2!Pump.ResetCall a method
alarm:Listen to alarms. A bare prefix means any. Also cond: and event:.

Rules:

  • The namespace index is the position in the server's namespace array. It can change between servers, and after a server restart on some servers. Read it from the server, for example with UaExpert. The demo plant uses 2.
  • Numeric ids and string ids are told apart by the form: digits only means numeric, anything else is a string.
  • All numeric types, BOOL and STRING are available. Choose the type that matches the node's data type. The demo plant serves every value as DOUBLE.
  • The Console has no node browser. Copy the node id from your server's tool.

Endianness​

Not applicable. OPC UA delivers typed values and the byte order is part of the protocol.

Typical settings​

SettingTypicalNote
Endpoint URLopc.tcp://demo-sim:4840/demo-plant/Host name, port and path of the server.
Security ModeNone (1), Sign (2), Sign & Encrypt (3)Default None. Use Sign & Encrypt in production.
Username, PasswordemptyFor servers with user authentication.
Certificate file, Key fileemptyThe client certificate and key for Sign and Sign & Encrypt.
Update ModeRead (default), Subscribe, Read & SubscribeSubscribe uses monitored items and is the lightest on the server.
Publish Interval (ms)500100 to 65535. The sampling and publish rate of subscriptions.
Event Root Node0!2253Where event and alarm listeners start.

Poll group interval: 100 ms is the schema default. With Read the group interval is the read period. With Subscribe the server pushes changes, and the Subscribe attribute on a tag makes it report on change.

The quality of a value follows the OPC UA status code: good is good, uncertain is uncertain, anything else is bad.

Common errors​

SymptomCauseFix
Test succeeds, status stays ConnectingThe test is only a TCP connect. The session fails (security, user).Check Security Mode, user and certificates.
Session refused, certificate rejectedThe server does not trust the client certificate.Trust the client certificate in the server's certificate store.
Tag bad, "node not found"Wrong namespace index or identifier.Read the node id from the server.
Namespace index changed after a restartThe server re-numbers its namespaces.Fix the index, or use a server that keeps them stable.
Type mismatchThe tag type does not match the node.Use the node's data type, or DOUBLE.
Values do not updateUpdate Mode Subscribe with a server that does not send changes.Use Read or Read & Subscribe.
Write refusedThe node is not writable, or the user has no right.Check the node's access level.