Connecting to OPC Classic (COM)
This section provides a brief walk-through of how to set-up a new Local or Remote OPC-DA server connection using the COM module. Due to the complications that Windows DCOM security settings can cause, this set-up guide is followed by the Troubleshooting OPC-COM Connections section that deals with an overview of how to deal with a faulted server connection due to DCOM security settings as well as other possibilities.
Install OPC Core Components
- Register at www.opcfoundation.org.
The OPC-COM module relies on a .dll package provided by the OPC Foundation (www.opcfoundation.org) called the OPC Core Components. You can download the OPC Core Components Redistributable from the OPC Foundation's website under the downloads section. Registration with the OPC Foundation is required before you can download the package, but the registration process is free and painless.
- Download appropriate OPC Core Components Redistributable package.
There are two packages to choose from, the 32-bit (x86) and the 64-bit (x64), make sure you get the correct one for the version of Java and Ignition you are running. 64-bit Java and Ignition needs the 64-bit Core Components package and likewise 32-bit installations needs the 32-bit package. You may have to look around a bit for the redistributable. At last update of this page (2019), the download was listed under Resources → Samples and Tools → classic.
- Install Core Components on Ignition server.
It should be noted that if you are going to connect to an OPC server on a remote machine, you must also install the appropriate version of the Core Components on that server as well. The version type, 64-bit or 32-bit, does not need to be the same across the two servers. Just be sure to install the version that is appropriate for the OPC Server and Windows architecture.
- (Remote) Install Core Components on remote machine running the OPC-DA server.
Once you have the correct package downloaded you can extract the contents of the .zip file and then run the installer. With the core components installed you can now proceed to setting up your OPC-DA server connection in Ignition.
Connecting to OPC-DA Server
With the OPC Core Components now installed the next step is creating/configuring a new OPC-DA server connection.
Install OPC-DA Server Connection
- Go to the Ignition Gateway Config section (http://localhost:8088/main/web/config).
- Go to OPC Connections > Servers and then select Create new OPC Server Connection....
- Choose the OPC-DA COM Connection and then select whether you want to make a Localconnection or if the OPC server resides on a Remote machine. For the most part, setting up a local or remote connection to an OPC-DA server is the same. There are only a couple of differences for a remote connection that will be highlighted along the way.
Local - Selecting a local connection takes you to a screen that contains a list of the available and running OPC servers located on the local machine.
Remote - For a remote connection you first have to specify the host name or IP address of the machine the the OPC server resides on and then (as of Ignition 7.4) you are redirected to the available servers list.
- Select the OPC server that you wish to connect to from the list. In the case where your server is not listed, see the OPC server is not listed... the Troubleshooting OPC-COM Connection section.
Unique Remote Connection Settings - Remote connections have a few unique settings that you can specify. You can get to these settings by selecting the Show advanced properties check box. As of Ignition 7.4 these should all be set for you (except for the CLSID which should no longer be necessary but is still available for you to set if you wish).
Remote Server - Specifies that the server is remote and that a DCOM connection will be used.
Host Machine - The computer name or IP address of the machine on which the remote server is running.
CLSID - This is no longer required as of Ignition 7.4, but it is still made available for you. It can be used in place of the ProgId because the ProgId is really just used to lookup the CLSID in the registry. This id can be found in the registry of the machine hosting the server under:
- All of the settings for the server connection are rather straight forward and each property has a description of its functionality. Most of these settings should be fine when left at their default values. The only setting that could possibly give you some trouble is the ProgId. If you selected your OPC server from the list on the Choose OPC-DA Server page, this will be filled in for you. However, if for whatever reason your server wasn't listed and you choose the Other Server option, you will have to know the ProgId for your server and specify it here. The ProgId is used to look up the CLSID of the OPC Server in the Windows Registry and without this a connection cannot be made.
- When you are finished fine tuning these settings click Create new OPC Server Connection. You will be redirected to the OPC Server Connections page and your new server connection should be listed. The status of your connection will read Connected if Ignition was able to successfully connect to the third-party OPC server.
Connection Is Faulted
In the case where your connection status is reporting Faulted, the troubleshooting process begins. As previously stated, configuring the DCOM settings on your machine can be a headache. The Troubleshooting OPC-COM Connections section next is an attempt to ease the process of determining why your connection is faulted and how to go about fixing the issue. If after exhausting the options presented to you, you are still having issues getting you server connection up, give our Inductive Automation tech support line a call and one of our representatives will be happy to assist you.
Troubleshooting OPC-COM Connections
This section provides you with a list of common OPC-COM connection problems with their possible solutions. It would be impossible to give an exhaustive list of everything that can go wrong but this should give you a good start on the troubleshooting process. If you do not see your problem listed and your connection status is faulted, try following the steps outlined in the Ignition Server DCOM Settings and OPC Server DCOM Settings sections.
OPC Server Is not Listed in Choose OPC-DA Server List when First Creating a Connection
There are some cases in which an OPC Server that is installed will not show up in the generated list. This list is generated by the OPC Server Enumerator which is part of the OPC Core Components, so when a server you have installed on the machine does not appear in this list it is likely due to the OPC Core Components not being installed correctly.
Try reinstalling the Core Components and going through the process of creating a new server connection in Ignition again. If the server still does not appear and you have the ProgId (or the CLSID for a remote connection) for the OPC server, you can just select the Other Server option and then click Next. In this situation you will have to enter the ProgId manually on the New OPC-DA Server page.
With all the correct information about the OPC server we can sometimes still make a valid connection to the OPC Server even when it is not detected automatically. This however is rare. Most of the time when the server is not detected, any connection attempts Ignition makes will fail.
Connection Status Is Connected but Data Quality Is Bad or the Connection Goes Faulted after Trying to Read Tag Data
Usually this occurs when the DCOM settings for the machine on which Ignition is running are not correctly configured. DCOM connections go in both directions. Ignition must be able to send requests to the OPC server and the OPC server must also be able to callback to Ignition. If the DCOM settings on the Ignition server are not configured correctly those callbacks will fail and the server connection that initially had a status of “Connected” will either fault or all the Tags that you have configured will come back with bad quality.
This is a problem that can affect both local and remote server connections.
Follow the steps outlined in the “Ignition Server DCOM Settings” section to ensure that you have correctly configured the DCOM security settings on the Ignition server machine.
Ignition Launches Second Instance of an Already Running OPC Server and Is Unable to See Any Data
It is important to note that Ignition runs as a service under the Windows System account. This can cause some issues with OPC servers that are meant to run interactively, meaning they run under the user account that is currently logged on. When Ignition attempts to make a connection to the OPC server, it will attempt to find an instance running under the same account and if it doesn't find one it will launch its own instance under the System account. Even if there are other instances running, Ignition will choose the one that was launched under the System account for its connection.
Many OPC servers maintain an instance running under the interactive user account that has been configured by the user and maintains all of the device connection information. When Ignition launches a new instance, this configuration information is lacking and none of the desired data can be seen or accessed. To get around this problem, you must specify in the DCOM settings for the OPC server that it always identify itself with the interactive user. Essentially this will force Ignition to use the currently running instance of the OPC server.
Set the OPC Server to Run as Interactive User
- The DCOM settings are found in the Component Services manager. Right-click the entry for your OPC server under the DCOM Config folder and select properties from the popup menu.
- Select the Identity tab. Select the option that reads The interactive user, and click OK.
- Close out of component services and kill any extra instances of the OPC server you see running in the Task Manager.
- Go edit and save the OPC server connection in the Ignition Gateway.
Faulted Status with E_CLASSNOTREG Error Reported on OPC Connections Status Page
This is almost always caused by the OPC Core Components not being installed correctly. Download and install the correct version(s) for your system(s) from the OPC Foundation (www.opcfoundation.org). Remember, if you are making a remote connection you must install these components on both the Ignition server as well as the machine on which the OPC server is running.
Ignition Server DCOM Settings
Follow these steps to open up the DCOM security settings on the machine that is running Ignition:
- Open the Windows Component Services, located in the Administrative Tools section of the Control Panel.
- Browse down through the Component Services tree until you see My Computer, right-click and select Properties.
- We want to focus on the COM Security tab. There are two sections, Access Permissions and Launch and Activation Permissions. Each section has an Edit Limits... and Edit Defaults... button. You must add the ANONYMOUS and Everyone accounts under each of the four areas making sure that the Allow option is checked for each of the permission settings. If you skip adding both of these to either the limits or defaults areas under either of the two sections there is a good chance your connection will not be successful.
- You can also try setting the Default Authentication Level to None and the Default Impersonation Level to Identify on the Default Properties tab. This isn't always necessary but it can sometimes help.
OPC Server DCOM Settings
Follow these steps to open up the DCOM security settings on the machine that is running the OPC server:
- Open up Windows Component Services, located in the Administrative Tools section of the Control Panel.
- Browse down through the Component Services tree until get to the DCOM Config folder.
- Locate the entry for your OPC server that you wish to make a connection to, right-click and select properties.
- Click the Security tab and you will see three sections: Launch and Activation Permissions, Access Permissions, and Configuration Permissions. There are two options to choose from for each section. If you already added the ANONYMOUS and Everyone accounts to the COM Security section from the Ignition Server DCOM Settings section then you can go ahead and just select the Use Default option for each of the three areas. The second option is to edit each of the groups that have Customize selected. You will have to add both the ANONYMOUS and Everyone accounts with all privileges.
- Now select the Identity tab. You will notice that you can choose which account you want to run the OPC server under. Select the Interactive User option. This ensures that if Ignition launches an instance of the OPC server, it will run under whichever user is currently logged into the system.
Creating an OPC-HDA Connection
The process of connecting to an OPC HDA server is similar to that of a DA server. Instead of going to the "OPC Connections" section, however, you define the server as a Tag History Provider.
- Navigate to the Gateway Config Webpage, as outlined above.
- Under Tags, History, select Create new Historical Tag Provider...
- Select OPC HDA Provider and click Next.
- Follow the step outlined above, for DA connections.
- Once complete, the status on the Tags>History screen will show the state of the connection. If Connected, you should now be able to browse and query the server through the Ignition designer.
Provides a connection to an OPC-HDA server.
|Provider Name||Name of the Tag History Provider.|
|Enabled||If the check box is selected (enabled), the provider is turned on and will expose historical data|
|Description||A description of the provider.|
|ProgId||A description of the provider.|
|Use Flat Browsing||Flat browsing returns all items at once. This is less efficient than normal browsing, but if a server only supports flat browsing, then this needs to be checked.|
|Remote Server||If selected, DCOM will be used to connect to the server on the specified Host with the given ProgId or CLSID.|
|Host Machine||The name or IP address of the machine hosting the server. Leave empty for local machine.|
|CLSID||The CLSID of the server. If not specified, will be obtained using the ProgId.|
Example - Adding OPC-HDA data to a chart
- Open the Designer, and create or open a project.
- Create a window, and add an Easy Chart component.
- Double-click on the chart, or right click and select Customizers>Easy Chart Customizer to bring up the chart customization window.
- Next to the "Tag History Pens" table, select the first button, Browse for Tags. This will display a tree for browsing all historical Tags.
- Browse through your defined HDA server. Once you find a Tag, select "ok" to add it to the chart.
- You may edit the Tag to alter its aggregation mode, though the HDA provider will select a supported mode automatically if the specified mode does not exist in the server.
- Once you save the configuration, the chart should update with the requested data.
A similar procedure can be used anywhere Tag History can be bound or used.