The OPC UA is a key part of the future of interoperability in the automation world, however, the reality is most systems today are built to use the OPC COM specifications. For this reason, the OPC Foundation is making the OPC UA COM Interoperability Components available to OPC members with existing COM based products. These components allow vendors to quickly add UA support to their products without any programming.
The COM Interoperability Components consist of 2 executables: an OPC COM Server which uses UA to communicate with UA Servers (the Proxy) and a UA Server which uses COM to communicate with OPC COM Servers (the Wrapper).
The UA Proxy for OPC COM Clients is shown in the figure below:
The UA Wrapper for OPC COM Servers is shown in the figure below:
The IOP Components can be deployed in a way that uses DCOM or UA across the network. The mode depends on which vendor is distributing the components. For example, COM DA Client vendor would bundle the UA proxy with their products and install it on the Client machine. This means that local DCOM is used to communicate with the UA proxy and UA is used across the network. The following table lists all of the combinations:
|
Vendor Type |
Bundled IOP Component |
Local Protocol |
Network Protocol |
|
OPC COM Client |
UA Proxy |
DCOM |
UA |
|
OPC COM Server |
UA Wrapper |
DCOM |
UA |
|
UA Client |
UA Wrapper |
UA |
DCOM |
|
UA Server |
UA Proxy |
UA |
DCOM |
The COM Interoperability Components can be downloaded from here.
The UA Proxy for OPC COM Clients is a DCOM EXE Server written in C++/CLI. Once it is installed and registered in a machine it can be configured to connect to many different UA servers by creating COM Pseudo-servers. A COM Pseudo-server is a CLSID/ProgID combination that has a UA endpoint associated with it. When a COM Client creates a instance of a COM Pseudo-server, the UA Proxy is launched and it looks for the UA endpoint associated with the CLSID. It then connects to the UA Server. The UA Proxy is designed to deal with network failures and will reconnect automatically to the UA Server if it can.
The UA endpoint associated with a pseudo-server is stored a well known directory on each machine. Applications can update this file directly or use the UA Configuration Tool which is described below.
The UA Configuration Tool can be run as GUI application from the Start Menu after installing the COM Interoperability Components on a machine. The tool can be found in the Programs Menu | OPC Foundation | UA SDK 1.01 folder.
After launching the UA Configuration Tool the default tab displayed is the Wizard tab with several buttons. Clicking the 'New COM Server' button will bring up this dialog:
The URL for the UA Server endpoint can be typed directly into the dialog or the 'Discover' button can be used to find a UA Server on the network. Clicking OK will bring up this dialog:
The Protocol specifies the type of COM DA server that will be created. The CLSID and ProgID are automatically generated, however, they can be changed. Clicking OK will create the COM Server that any OPC COM client can connect to.
The UA Configuration Tool can be command line tool by passing arguments. The command line parameters used to create or delete COM Pseudo Servers are shown in the following table:
|
Flag |
Argument |
Description |
|
-rp |
Path to Endpoint Configuration File |
Installs the COM Pseudo-server |
|
-up |
Path to Endpoint Configuration File |
Uninstalls the COM Pseudo-server |
The Endpoint Configuration file is an instance of the ConfiguredEndpoint class serialized as an XML document. The root element is a ConfiguredEndpoint which is defined by the XML Schema with namespace 'http://opcfoundation.org/UA/SDK/Configuration.xsd'. A complete description of the syntax can be found in the SDK documentation. The following table highlights the most important elements:
|
Parameter |
DataType |
Description |
|
Endpoint |
EndpointDescription |
The description of the Endpoint returned by the GetEndpoints service. If UpdateBeforeConnect is set to True this information is updated each time the UA Proxy connects to the UA Server. This element also specifies the security settings to use with the connection. |
|
Configuration |
EndpointConfiguration |
Additional configuration information passed to the stack when a secure channel is created. It specifies the encoding to use (Binary or XML), the network timeout and the serialization quotas. |
|
UpdateBeforeConnect |
Boolean |
If True the Endpoint information is updated before connecting to the UA Server. |
|
UserIdentity |
UserIdentityToken |
The user identity that the UA Proxy provides to the UA Server. Note that passwords stored in this file are not protected. |
|
ComIdentity |
EndpointComIdentity |
Specifies the CLSID and ProgID for the COM Pseudo-server. This information is used to create the registry entries when the UA Configuration Tool installs the endpoint configuration on a machine. |
|
Extensions |
XmlElement[] |
Stores additional configuration information used by the UA Proxy. The ComProxyConfiguration element is described in a separate table below. |
When the Endpoint Configuration file is installed the CLSID is used as the filename (e.g. 4876eb13-f7a6-4cee-ab2d-9b145c5ea74a.xml) and placed a subdirectory of the directory pointed to by the 'ALLUSERSPROFILE' environment variables. The subdirectory is 'OPC Foundation\ComPseudoServers'. This file is updated by the UA Proxy at runtime which means all users permitted to access the UA proxy should be granted write access to this file. If a user does not have access to this file it will still be able to access the UA server, however, the ItemIDs returned by the UA Proxy may change each time the OPC COM Client connects.
The pseudo-server configuration files can be copied to any machine with the UA Proxy installed. The UA Configuration Tool can be used to create the necessary registry entries and place the file in the correct location after it is copied. COM DA Clients that are pre-configured to work with a particular UA Server should copy this file along with any vendor specification configuration file when they want to replicate the configuration on another machine.
The UA Wrapper for OPC COM Servers is a NodeManager that can be incorporated into any UA Server built with the UA SDK. The UA COM Data Access Quickstart Server can both be configured to wrap OPC COM Servers, however, vendors are expected to create and distribute their own UA Server which has been tested with their COM Server.
The UA Configuration Tool can be run as GUI application from the Start Menu after installing the COM Interoperability Components on a machine. The tool can be found in the Programs Menu | OPC Foundation | UA SDK 1.01 folder.
This tool can be used to add COM server the configuration file for a UA Server built with the UA SDK provided the Server supports the COM IOP NodeManager. The UA COM Data Access Quickstart Server is an example of a UA Server with the required code.
After launching the UA Configuration Tool the default tab displayed is the Wizard tab with several buttons. Clicking the 'Wrap COM Server' button will bring up an open file dialog. Use this to select the configuration file for the server to modify. If the Quickstarts are installed on a machine the configuration file for the COM Data Access Quickstart can be found here:
%ProgramFiles%\OPC Foundation\UA SDK\v1.1\Quickstarts\Bin\ComDataAccessServer.Config.xml
After opening the file the following dialog will appear and show all of the COM servers on the local machine:
Changing the Hostname and clicking the Refresh button will browse for COM servers on other machines.
Selecting a COM server and clicking OK will update the configuration file. The 'Unwrap COM Server' button will bring up a dialog that will delete a wrapped COM Server from the UA Sever configuration file.
COM Servers can be wrapped by updating the configuration file directly. The Extension array is used to store the configuration for one or more wrapped servers. A sample COM configuration element is shown here:
<d2p1:XmlElement>
<ComWrapperServerConfiguration>
<WrappedServers>
<ComClientConfiguration i:type="ComDaClientConfiguration">
<ServerUrl>opc.com://localhost/OPCSample.OpcDaServer/625c49a1-be1c-45d7-9a8a-14bedcf5ce6c</ServerUrl>
<ServerName>OPCSample.OpcDaServer</ServerName>
<SeperatorChars i:nil="true" />
</ComClientConfiguration>
</WrappedServers>
</ComWrapperServerConfiguration>
</d2p1:XmlElement>
The parameters are described in the following table:
|
Parameter |
DataType |
Description |
|
ServerUrl |
String |
The COM server information expressed as a URL with the form: opc.com://<machine name>/<prog id>/<clsid> The CLSID is optional if OPCEnum is installed on the server machine. |
|
ServerName |
String |
The name of the server that appears in the UA server address space. |
|
SeperatorChars |
String |
A list of characters used to separate path elements within an item id. This is used to efficiently extract the BrowseName from an item id. The wrapper starts from the end of the item id and looks for the first occurrence of a separator character. All text to the right of the separator is assumed to be the browse name. It is strongly recommended that vendors set this field. If the item ids for the server make it impossible to specified appropriate separators then the vendors should add code to the server that has knowledge of the server's item id syntax. |