Skip to main content
Version: Next

Connections

This page is for whoever adds the first connection to a plant and for whoever has to change one later. A connection is a configured device or broker: an OPC UA server, an MQTT broker, a database. The practices below come from S7_VN_NIRO (one real S7-1500) and from the three connections AllWaves was moved with.

One connection per server, named for it​

  • Name the connection for the device people talk about. NIRO's is S7_VN_NIRO, the PLC's name in the TIA project; AllWaves kept the three names its old datasources had (S7_AW_Demo, S7_AW_StressTest, S7_AW_Scale). A name that matches the engineering project means an alarm text, a log line and a PLC program all point at the same thing.
  • Use letters, digits, dots, hyphens and underscores, no spaces. Tags, status tags and types refer to the connection by its name, and a space or dot becomes _ in the status tag path ([system]connection.opcua.<name>).
  • Do not split one server into several connections to sort its tags. Each connection is a session and a subscription of its own. Sort tags into folders and providers instead.
  • Pick the name once. Status tags live under it, and a tag whose connection is deleted is bad with "The connection was deleted."

Let types name the connection by parameter​

A type's members say {OPCUA}, not S7_VN_NIRO, and each instance picks its connection (or takes the type's default). Then:

  • a second PLC of the same kind is the same types with another value of OPCUA;
  • moving a plant to a new PLC address is an edit of one connection, not of every tag;
  • the AllWaves types have an empty default for OPCUA and the import sets it per instance, so a type is never tied to one controller.

The parameter type OPC-UA Server lets whoever creates an instance pick a connection. See Parameters.

Switch it on when the address is right​

An import that creates a connection should create it off and leave the switch to a person: the NIRO importer's apply makes S7_VN_NIRO off unless --enable is given, and the AllWaves connections are created off because their PLCs' addresses (10.32.1.x) are not reachable from the new gateway. A disabled connection keeps its tags with their last value and a bad quality ("The connection is disabled."), so screens show what is missing instead of nothing.

  1. Set Endpoint URL to the address the gateway reaches, not the one an engineer's laptop reaches.
  2. Press Test connection. It opens a throwaway session and reports the round trip, so it does not disturb a running link.
  3. Turn Enabled on, then read Tags with a problem now on the connection's page.

An enabled connection to a host that does not answer keeps retrying every 5 seconds and marks every bound tag bad. So do not leave a connection enabled for a PLC that is not there yet: its tags show bad quality, not the last good value you expect.

Watch it with its own tags​

Every connection publishes status tags under [system]connection.opcua.<name> every two seconds: state, connected, tags, error, since, and rates. The numeric and boolean ones keep history. Use them like any tag:

  • an alarm on connected going false, with an on-delay of a few seconds so a reconnect does not page anyone (see Alarms);
  • a trend of tags and the value rates, to see a PLC that gets slower;
  • error on a screen next to the device, so an operator can read why a tag is bad.

See Connect a Siemens S7-1500 over OPC UA.

Security​

Trust a server's certificate deliberately. With Security secure the driver takes the most secure endpoint and refuses to fall back to an unsecured one. A connection that stops with a certificate that was not accepted shows a Trust this server's certificate button; use it for a server on your own network after you checked it is yours, and not for an address you do not know. Keep credentials in the connection's Username and Password (stored encrypted, never returned by the API), never in the URL.