OPC UA
The OPC UA connection reads and writes nodes of any OPC UA server: built into a PLC (S7-1500, Beckhoff, CODESYS, B&R), gateways (Kepware, Matrikon, InSAT MasterOPC) and other systems. Scadora is an OPC UA client.
Quick start
Section titled “Quick start”- In the editor: Connection → OPC UA.
- Server address, for example
opc.tcp://192.168.0.30:4840. Check the port in the server settings; PLCs usually use 4840. - Create a tag. The address is the node’s NodeId, for example
ns=2;s=Line1.Speed. It is easy to copy from UaExpert: select the node in the tree and find NodeId in the attributes panel. - Start the project. On the first secure connection the server may not trust Scadora yet: see Certificates.
Connection settings
Section titled “Connection settings”| Setting | Default | Meaning |
|---|---|---|
| Server address | — | opc.tcp://address:port, sometimes with a path: opc.tcp://host:4840/server |
| Security mode | Best | Best — the most secure policy the server offers (signing and encryption). None — no encryption, for a test bench only |
| User, Password | empty | Empty — anonymous sign-in |
| Trust the server certificate | off | Accept any server certificate. Unsafe: for commissioning only |
| Certificate folder | empty | Empty — %ProgramData%\Scadora\pki |
| Timeout, ms | 5000 | Wait for a reply. The whole connection is limited to two timeouts |
| Session timeout, ms | 60000 | How long the server keeps an idle session |
| Nodes per Read request | 1000 | How many nodes one request reads |
Addresses (NodeId)
Section titled “Addresses (NodeId)”
A NodeId consists of a namespace and an identifier: ns=<index>;<type>=<identifier>.
| Type | Example | Where you meet it |
|---|---|---|
s — string |
ns=2;s=Channel1.Device1.Tag1 |
Kepware, most gateways |
s — string |
ns=3;s="DB_Line"."Speed" |
S7-1500 OPC UA server, data block variables |
i — number |
ns=3;i=1001 |
Nodes with numeric identifiers |
g — GUID |
ns=2;g=… |
Rare |
b — bytes |
ns=2;b=… |
Rare |
The namespace index differs between servers and sometimes changes after a server restart or a project download to the PLC. Take it from the node attributes in UaExpert.
Pick the Scadora tag type by the node type: Boolean — Bool, Int16 — Int16, Float — Float32, Double — Float64, String — String. An array or structure node cannot be read into one tag.
Certificates
Section titled “Certificates”In secure mode the server and the client exchange certificates, and each must trust the other.
The Scadora certificate is created on the first connection in %ProgramData%\Scadora\pki\own. A server usually rejects an unknown certificate and puts it in its rejected list. In the server settings, move the Scadora certificate to trusted. On an S7-1500 this is done in TIA Portal: Protection & Security → Certificate manager or in the OPC UA server settings. Then the connection succeeds.
The server certificate. Scadora puts an unknown server certificate in pki\rejected. Move that file to pki\trusted\certs, and the connection succeeds. During commissioning you can turn on Trust the server certificate. Turn it off in production: otherwise Scadora trusts any server at that address.
Browsing the server
Section titled “Browsing the server”Project → Import tags from OPC UA server… reads the server’s address space using the selected connection’s settings: folders and objects on the left, variables on the right with their OPC UA type, tag type and write access. Check the ones you need and click Import: tags appear in the table with the NodeId as the address, the tag type follows the node type, and read-only variables get no write access. Arrays and structures are not imported. Importing again updates the tags already created instead of duplicating them.
Reading and writing
Section titled “Reading and writing”Reading. By default the driver subscribes to the nodes (MonitoredItems): the server sends changes itself at the Subscription interval, and fast changes between scans are not lost. Nodes the server has not sent anything for yet, and servers without subscriptions, are read with a batched Read request using the source timestamp. Clear Subscriptions to read all nodes with Read on every scan. OPC UA quality becomes tag quality: Bad stays Bad, Uncertain stays Uncertain. A node whose type does not fit the tag type gets a configuration error.
Writing. The value is converted to the tag type and written to the Value attribute. The server requires the exact node type: the tag type must match the node type, otherwise the write is rejected with BadTypeMismatch.
Testing and troubleshooting
Section titled “Testing and troubleshooting”| Symptom | Cause and what to do |
|---|---|
| “The server did not respond”, timeout | Wrong address or port, the server is down, or the port is blocked by a firewall |
| “The server offered no suitable way to connect” | The server does not support the chosen Security mode: try None on a test bench or enable policies on the server |
BadCertificateUntrusted, BadSecurityChecksFailed |
The server does not trust the Scadora certificate, or Scadora does not trust the server. See Certificates |
BadIdentityTokenRejected, BadUserAccessDenied |
Wrong user or password, or anonymous sign-in is not allowed on the server |
| All tags show “configuration error” | Wrong ns index: it changed after a server restart |
Tag Bad, BadNodeIdUnknown |
No such node: check the identifier; case and quotes matter in strings |
Write BadTypeMismatch |
The tag type does not match the node type |
Write BadNotWritable, BadUserAccessDenied |
The node is read-only, or the user has no rights |
Limitations
Section titled “Limitations”- Arrays, structures and methods are not supported.
- Sign-in with a user certificate is not supported: anonymous or user name and password only.