Set Up the DeviceHub Agent
The DeviceHub Agent acts as a proxy between an OPC Data Access (DA), also known as an OPC Classic server, and the Litmus Edge system. It allows you to search for available OPC DA Servers and provides a list of tags from the selected server. Multiple servers can be selected.
Review the following use case for connecting and configuring the DeviceHub Agent in Litmus Edge.
- To install DeviceHub Agent, your machine must support the following software versions:
- Windows 10.0.14393
- Windows SDK version 10.0.18362.0
- Visual Studio 16 2019
- The DeviceHub Agent must be run on the same host as the OPC DA Server, and DCOM must be configured. For more information, see Configure DCOM for OPC DA Connections.
- The DeviceHub Agent supports reading up to 5000 tags from the OPC DA server. It does not support parallel write.
- The DeviceHub Agent does not support OPC Classic Historical Data Access (HDA) or OPC Classic Alarms and Events (AE).
- It is possible to configure multiple connections to several DeviceHub Agent instances inside a Litmus Edge or multiple Litmus Edge instances using only one DeviceHub Agent application. You can create each connection using the Add (+) icon.
- The DeviceHub Agent includes options to export tags to a CSV file. The CSV file can then be used to import the tags to Litmus Edge. The status of the tags are checked periodically. Sending tags to DeviceHub is the preferred method.
Download the DeviceHub Agent EXE file from Litmus Edge by navigating to System > Support in the File Downloads section.
Setting up the DeviceHub Agent includes the following tasks:
- Step 1: Add DeviceHub Agent to DeviceHub
- Step 2: Create API Token
- Step 3: Install Matrikon OPC Explorer and Simulation and Testing Tool
- Step 4: Set up DeviceHub Agent
- Step 5: Connect the OPC DA Explorer
- Step 6: Send Tags to DeviceHub
- Step 7: View Tag Data
To add the DeviceHub Agent to DeviceHub:
- In Litmus Edge, navigate to DeviceHub > Devices.
Click the Connect a Device box. The Connect Device dialog box appears.
- In the Device Type drop-down list, select OPCUA.
- In the Driver Name drop-down list, select DeviceHub Agent.
- Enter a name for the device. The device name you configure is used for the Device name parameter in the DeviceHub Agent configuration.
- (Optional) Select the Enable alias topics check box. This allows you to name the Topic ID when creating a Tag.
- If you enable alias topics during device creation or modification, DeviceHub stops publishing to raw topics and publishes only to alias topics.
- Litmus Edge substitutes "." (period) in aliases with "/" (forward slash).
- Click Add Device. The device appears in the Devices pane.
Follow the steps to Create API Credentials. Copy the token and store it for later use.
Note: To install these files, you may have to enable the .NET Framework 3.5. See Microsoft documentation on this topic to learn more.
In this use case, Matrikon Server is used. You can also use Kepware Server or Prosys Server.
To download Matrikon OPC Explorer and Simulation and Testing Tool:
- From the Matrikon search bar, enter OPC Simulation Server Download, and click Search.
- Click the OPC Simulation Server Download link.
- From the download page, enter your first name, last name, and email address, and then click Download Now.
- From the registration form, enter your account information, and then click Download Now. An activation email is sent from Matrikon.
- Click the link provided in the email. Use your email address as your user name, and the password you provided in the form as your password for the http://www.matrikonopc.com/portal URL.
- Click Download Now. The MatrikonOPCSimulation.exe file downloads to your hard drive.
- Install the MatrikonOPCSimulation file.
- From the Matrikon search bar, enter MatrikonOPC Explorer Download, and click Search.
- Click the MatrikonOPC Explorer Download link.
- From the download page, click Download Now.
- Install the MatrikonOPCExplorer filie.
The server configuration is by default. You can add an alias configuration. Explorer is used to connect to the OPC DA server and browse the tags.
You can now set up the DeviceHub Agent by connecting to the OPCDA server and DeviceHub in Litmus Edge.
To set up the DeviceHub Agent:
- Open the DeviceHub Agent EXE file you downloaded.
From the Main tab, click the Add box. The Add connection dialog box appears.
Click the Detect icon. The servers are detected and appear in the OPCDA server drop-down list. The OPCDA host is localhost because the OPC DA server is installed on the same machine as Litmus Edge.
- Select an option from the OPCDA server drop-down list.
- Configure the Server settings section.
- Host: Enter the IP address for your Litmus Edge instance.
- Port: The port value should be the same one configured for the DeviceHub Agent device in LItmus Edge.
- Device name: Enter the device name you configured for the DeviceHub Agent device in Litmus Edge.
- API key: Paste the API key created in Step 2.
- Click OK. The OPC DA driver is added in the DeviceHub Agent in another tab, and the tags for the selected server are viewable in the tags box.
Click the Connect icon. The DeviceHub Agent connects to DeviceHub in Litmus Edge.
- Return to the Litmus Edge instance and navigate to DeviceHub.
Confirm that the DeviceHub Agent tile shows a Connected status.
If you need to remove a connection in the DeviceHub Agent application, select the tab for the connection you want to remove and go to Connections > Remove connection.
You will need to connect the OPC Explorer to the Simulation and Testing Tool.
To connect the OPC DA Explorer:
- Open the MatrikonOPC Explorer.
- Under the Localhost entry in the hierarchy, click the Matrikon.OPC.Simulation.1 entry. If you get the error message "Matrikon OPC explorer machine is not browsed", go to View > Options > General and select the Registry check box in the OPC Server Browsing section.
- Click the Connect button. Connection information appears in the Server Status section.
You can send tags from the DeviceHub Agent applicaiton directly to DeviceHub in Litmus Edge. This is the recommended method to add tags to the DeviceHub device.
To send tags to DeviceHub:
Make sure the DeviceHub agent is disconnected from DeviceHub.
Select the check box for tags you want to send. Alternatively, you can use the Select all tags and Unselect all tags icons.
Click the Connect icon to connect to DeviceHub in Litmus Edge.
Click the CSV icon and select Send Tags. A message displays that the tags were successfully sent.
You can also add tags to the DeviceHub device in the following ways:
- Use the Export CSV option in the DeviceHub Agent application. Then, follow Step 3: Upload Populated CSV File of Tags.
You can use the Flows Manager or Analytics in Litmus Edge to view the tag data.
To view tag data in the Flows Manager:
- In Litmus Edge, navigate to DeviceHub > Tags.
Select the DeviceHub Agent device.
Click the Copy icon for the tag you want to view.
Drag the DataHub Subscribe and Debug nodes to the canvas and wire them together.
- Double-click the DataHub Subscribe node.
- In the Topic field, paste the tag ID you copied earlier.
- If needed, configure the Datahub Subscribe connection. See the "Step 3: Configure Connector Nodes" section in Create a Flow to learn more.
- Click Done, and then Deploy.
Click the Debug icon.
Drag the message window up and review the messages. A "success": true message confirms the connections is successful.
To view tag data in Analytics:
- In Litmus Edge, navigate to Analytics.
- Click Add processor and select DataHub Subscribe.
- In the Topic field, paste the tag ID you copied earlier.
- Click Save.
Click the View icon.
Review the messages. A "success": true message confirms the connections is successful.