OPC DA

A client for classic OPC Data Access servers over COM/DCOM, running in a 32-bit helper process, with item id addressing and a scan of the servers of a machine.

View as Markdown

The OPC DA driver is a client for classic OPC Data Access servers (versions 1.0, 2.05a and 3.0), the COM servers that older PLC gateways, SCADA systems and simulators still publish their data through. A server is named by the machine it runs on and its ProgID, for example Matrikon.OPC.Simulation.1, and every tag by the server's item id. Add the driver and its devices on the Connector page.

Device

Field Meaning Default
Host The name or address of the computer the OPC DA server runs on. Empty means this computer, where most classic servers run. empty: this computer
Server / Key The server's ProgID, as its vendor registers it in Windows, for example Matrikon.OPC.Simulation.1. OPC.Server.1
Poll interval (ms) How often the station reads the device's tags, unless a tag sets its own interval. 1000

The device's address is assembled from the two, for example opc.da://localhost/Matrikon.OPC.Simulation.1. There is no port: COM finds the server through Windows' own registration.

Tag addressing

A tag is addressed by its Item id, typed as free text and sent to the server exactly as written, for example Random.Real8 or Channel1.Device1.Tag1. The item ids are the server's own; the server's documentation or a scan lists them. The station adds each item to one group of the device the first time a tag reads it, and reads it from the device, not from the server's cache.

Data types

The Data type picker offers the types an OPC DA item holds: Boolean, SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float, Double, String and DateTime. Every read is converted to the tag's type, so pick the type the server declares for the item, the one a scan proposes: a 64-bit real item read as Float loses precision, and read as Double keeps it. A value the tag's type cannot hold, such as text that is not a number or an array, leaves the tag without a value. A date carries no time zone in OPC DA, and the station reads and writes it as UTC.

Every value the server answers with carries its quality. A Good value reaches the tag. An Uncertain or Bad one leaves the tag without a value, and the journal line of the failed read names the quality in the words of the OPC DA specification, for example Bad: not connected (0x0008) or Uncertain: last usable value (0x0044). An item whose read fails leaves its tag without a value, and the device's other tags keep reading.

Discovery

Discover lists the OPC DA servers registered on a computer: type its name or address in the scan's target, or leave it empty for this computer. Each server is offered as a device, and its address space is browsed: every item it holds is offered as a read-only tag, with the type the server declares for it: a 64-bit real as Double, a 16-bit unsigned integer as UInt16, and so on for every type above, with a currency value as Double. An item that declares no type is offered as String, which reads any value; an item of a type no tag reads, such as an array, is not offered, and the scan counts it among what it left out. See Discovery for how candidates are chosen and added.

The scan asks the OPC server enumerator (OpcEnum) for the servers, through the OPC DA proxy and stub libraries registered on this computer. While one of them is missing, the scan lists nothing and says what is missing instead, with the steps of Installing the OPC Core Components.

Writes

Tags whose Access is Read and write or Write only can be written, to the same item the read uses. The value is sent in the type the server holds the item in (in the tag's own type when the server does not say), converted from the tag's value without passing through text, so a station in any language sends the same number. A whole number outside the range of the item's type is refused before anything is sent, never cut to the nearest value the type holds. A write the server refuses comes back refused, with the reason when it is one the station can say (an item that takes no write, a value the item does not take, an item the server does not know, access refused) and otherwise with the server's error code, for example OPC DA 0x80004005; the journal keeps the server's code in every case. OPC DA has no commands: a device of this driver offers none.

The 32-bit helper

OPC DA servers are reached through a 32-bit COM client, which the 64-bit station cannot load. The driver therefore runs in a helper process of its own, Lab.Desktop.DriverBridge.exe, which the station starts the first time an OPC DA device or scan needs it, or the station checks for the OPC Core Components, and closes when the Connector stops. Nothing changes in how the driver is used: its devices and tags are read, written, scanned and journalled like any other.

If the helper stops, its devices show the error "The 32-bit helper process of the OPC DA driver stopped. The station starts it again, and the device reconnects through it.", the Events page keeps its exit code, and their tags lose their values. The station starts the helper again, after a pause that grows while it keeps stopping, and the devices reconnect through it on their own. A write that was on its way when the helper stopped comes back failed, saying that whether the value reached the device is not known. No other driver and no other part of the station stops with it.

Before you start

  • The station installs no OPC component. The OPC server enumerator (OpcEnum) and the OPC DA proxy and stub libraries come with the OPC DA server, or with the OPC Core Components. The station checks by itself whether they are registered and, while one is missing, says how to install them: see Installing the OPC Core Components.
  • A server on another computer is reached over DCOM, which both computers have to allow for the Windows account the station runs under: DCOM permissions, firewall rules and the same account or a trusted domain. That setup is made in Windows, never in the station: see Prepare a remote server.
  • The driver runs on Windows only.

Installing the OPC Core Components

The station checks by itself, in the 32-bit helper, whether this computer has the OPC server enumerator (OpcEnum) and the OPC DA proxy and stub libraries registered for 32-bit programs: the first time the driver's page, the page of one of its devices or the agent asks, and again every 30 seconds while one is missing. Until the Connector has started, whether they are there is not known, and nothing is said about it. While one is missing:

Where What it says
The driver's page A caution notice, "The OPC Core Components are missing from this computer", with the steps below. Its link opens the OPC Foundation's page in the computer's browser.
The page of each device The same notice, unless the device is online.
A scan It lists nothing and says what is missing: the scan's closing line points to the notice, and the agent's device_discover gives the steps in English.
The last error of a device whose connection fails What is missing and the same steps, in English, as the driver's own causes are written.
The agent driver_capabilities gives them under prerequisite, with installed false.

To install them:

  1. Run the installer of your OPC DA server again: it usually installs them.
  2. Otherwise, open the OPC Foundation's page Core Components and download the OPC Core Components Redistributables. Only a registered user may download them: if the page says you do not have permission to download the file, sign in with "Login", or create an account with "Create Account" on the same page.
  3. Take opc-core-components-redistributable-<version>-x86-x64.msi on 64-bit Windows, which carries the 32-bit components too, and the one ending in -x86.msi only on 32-bit Windows.
  4. Run it as administrator, and restart the computer if the installer asks.

Within 30 seconds of the installation the notice goes away, the scan lists the OPC DA servers and the devices of this driver connect with the configuration they have, without restarting Ganter Lab.

Prepare a remote server

A server on this computer needs nothing more. A server on another computer is reached over DCOM, which lets nothing in from another computer until both are set up for it. The setup is made in Windows on both computers, by an administrator of each, never in the station:

  1. Use the same Windows account with the same password on both computers (the account the station runs under), or a domain account both computers know.
  2. On the server's computer, run dcomcnfg and open Component Services > Computers > My Computer > Properties > COM Security. Under Access Permissions and Launch and Activation Permissions, in both Edit Limits and Edit Default, allow that account every remote right. In the Edit Limits of Access Permissions, also allow Remote Access to ANONYMOUS LOGON, which the OPC server enumerator (OpcEnum) needs.
  3. Still there, under My Computer > DCOM Config, open the Properties of the OPC server and of OpcEnum, and on their Security tab customize the three permissions with the same account.
  4. On the station's computer, run dcomcnfg too and, in the Edit Limits of Access Permissions, allow Remote Access to the account the OPC server runs under: the server calls the station back.
  5. On the server's computer, in Windows Defender Firewall, allow inbound TCP port 135 and the programs of the OPC server and of OpcEnum (OpcEnum.exe), and check in Services that OpcEnum is running and starts automatically.

Edit Default changes nothing while Edit Limits refuses the right: set both. DCOM answers on port 135 and then carries the calls on a port Windows picks, so a firewall between the two computers that opens 135 alone still blocks the server.

What Windows answers What the device's page says
Access denied (0x80070005) "host refuses this station over DCOM", with the account the station runs under and steps 1 to 4
The RPC server is unavailable (0x800706BA) "host does not answer DCOM": the computer is off or out of reach, its firewall blocks DCOM, or OpcEnum does not run there, with step 5

Each notice stands in place of the device's error and goes away by itself once the server connects. The journal and the agent read the same steps in English. A server on this computer is never said this way.

Where the plant does not allow DCOM, a wrapper or tunnel that serves the OPC DA server over OPC UA, on the server's computer, avoids it altogether: the station then reads the server with the OPC UA driver.