# OPC DA

Legacy SCADA tags from OPC DA servers right in the chat

Теги сервера OPC DA (Classic) старых SCADA через шлюз на Windows, только чтение

## How the agent works with OPC DA

The gateway runs as a service on a Windows computer, best on the same machine as the OPC DA server: local COM needs no DCOM rights and no firewall rules. The connection takes an address such as opcda://localhost/Kepware.KEPServerEX.V6, with the server ProgID or CLSID after the host. The connection is assigned to the gateway on the Gateways tab.

OPC DA runs on COM, whose calls have no timeout, so the gateway holds COM in a separate helper process and stops it if the server does not answer in time. The gateway creates one active group and reads the server cache, not the device: the PLC gets no extra requests however often the poll runs. Before every read the gateway asks the server status.

Tags come from browsing the server address space (DA 3, or DA 2 if the server does not support it) or from your list of lines of path, ItemID and type. Server branches such as Kepware's _System are skipped unless you name them. The gateway uses no callback subscription: it would need an inbound DCOM channel to the gateway computer.

The gateway only reads: the driver has no OPC DA write in its code. OPC DA itself keeps no history, so a tag's history builds up from the gateway polls, with the deadband and the repeat of a silent tag. While the cloud is unreachable, values wait on the gateway disk and arrive once the link is back.

## Integration scenarios

### What is on the line now
The agent finds tags by branch or ItemID and shows current values with the server time and quality.

### A shift history
The agent reads a tag's collected history for a shift or a day and works out the minimum, maximum and average.

### Tags with bad quality
The agent finds tags the server returns with bad or uncertain quality and shows since when.

### Comparing lines
The agent compares the same tags of different lines or stations over a period and shows where the values part.

### A threshold message
In an event task the agent tells you when a tag's value crosses a threshold and holds for the set time, and when it is back to normal.

### Link to the site
The agent tells you when the gateway went offline and came back, so a gap in the history is visible at once.

## How to connect

**Before you connect**

- A Windows computer for the gateway, best the OPC DA server machine
- The OPC Foundation's Core Components package on the gateway computer
- For a remote server: TCP 135 and the DCOM dynamic ports open
- A Windows account with launch and access rights to the server

### Install the gateway next to the OPC DA server
The gateway runs on Windows. On the server's own machine COM is called locally: no DCOM or firewall rules, and the gateway service account is usually enough.

### Install the OPC Core Components
The OPC interface proxies come with the OPC Foundation's Core Components package. Without it on the gateway computer calls to the server fail.

### For a remote server, open DCOM
Open TCP 135 and the DCOM dynamic port range, and give the account launch and access rights to the server. The OpcEnum service resolves the ProgID remotely.

### Enter the Windows account
Put the DOMAIN\user the server allows to read into the user field. An empty field means the gateway uses its own service account.

## FAQ

### How do I connect OPC DA?
Install the gateway on a Windows computer, best the server machine, and add it on the Gateways tab. In the connection enter opcda://localhost/ with the server ProgID, for example Kepware.KEPServerEX.V6. The login can stay empty: for a local server the gateway service account is usually enough.

### What does the agent see in OPC DA?
The tags the server browse shows, or those you listed as lines, with the current value, server time and quality, plus the history the gateway collected by polling. The branch a tag was found under is its caption, while the tag itself is identified by its ItemID.

### Does the agent change values?
No. The gateway only reads the cache of its active group on the server, and the driver has no write in its code. There are no callbacks from the server to the gateway either, so no inbound DCOM channel is opened to the gateway computer.

### REGDB_E_IIDNOTREG or E_NOINTERFACE. What is it?
The gateway computer lacks the OPC interface proxies, and without them a call between processes fails. Install the OPC Foundation's Core Components package on the computer where the gateway runs.
