How-To Guides

Set Up the DeviceHub Agent

12min

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.

Important

  • 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.

Before You Begin

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

Step 1: Add DeviceHub Agent to DeviceHub

To add the DeviceHub Agent to DeviceHub:

  1. In Litmus Edge, navigate to DeviceHub > Devices.
  2. Click the Connect a Device box. The Connect Device dialog box appears.

    Connect a Device box
    Connect a Device box
    
  3. In the Device Type drop-down list, select OPCUA.
  4. In the Driver Name drop-down list, select DeviceHub Agent.
  5. Enter a name for the device. The device name you configure is used for the Device name parameter in the DeviceHub Agent configuration.
  6. (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).
  7. Click Add Device. The device appears in the Devices pane.

Step 2: Create API Token

Follow the steps to Create API Credentials. Copy the token and store it for later use.

Step 3: Install Matrikon OPC Explorer and Simulation and Testing Tool

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:

  1. Visit the Matrikon website.
  2. From the Matrikon search bar, enter OPC Simulation Server Download, and click Search.
  3. Click the OPC Simulation Server Download link.
  4. From the download page, enter your first name, last name, and email address, and then click Download Now.
  5. From the registration form, enter your account information, and then click Download Now. An activation email is sent from Matrikon.
  6. 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.
  7. Click Download Now. The MatrikonOPCSimulation.exe file downloads to your hard drive.
  8. Install the MatrikonOPCSimulation file.
  9. From the Matrikon search bar, enter MatrikonOPC Explorer Download, and click Search.
  10. Click the MatrikonOPC Explorer Download link.
  11. From the download page, click Download Now.
  12. 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.

Step 4: Set Up DeviceHub Agent

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:

  1. Open the DeviceHub Agent EXE file you downloaded.
  2. From the Main tab, click the Add box. The Add connection dialog box appears.

    Add connection dialog box
    Add connection dialog box
    
  3. 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.

    Detect icon
    Detect icon
    
  4. Select an option from the OPCDA server drop-down list.
  5. 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.
  6. 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.
  7. Click the Connect icon. The DeviceHub Agent connects to DeviceHub in Litmus Edge.

    Document image
    
  8. Return to the Litmus Edge instance and navigate to DeviceHub.
  9. Confirm that the DeviceHub Agent tile shows a Connected status.

    The DeviceHub device displays a Connected status
    The DeviceHub device displays 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.

Step 5: Connect the OPC DA Explorer

You will need to connect the OPC Explorer to the Simulation and Testing Tool.

To connect the OPC DA Explorer:

  1. Open the MatrikonOPC Explorer.
  2. 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.
  3. Click the Connect button. Connection information appears in the Server Status section.
Server Status section
Server Status section


Step 6: Send Tags to DeviceHub

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:

  1. Make sure the DeviceHub agent is disconnected from DeviceHub.

    Document image
    
  2. Select the check box for tags you want to send. Alternatively, you can use the Select all tags and Unselect all tags icons.

    Document image
    
  3. Click the Connect icon to connect to DeviceHub in Litmus Edge.

    The Connect icon
    The Connect icon
    
  4. Click the CSV icon and select Send Tags. A message displays that the tags were successfully sent.

    The Send tags option
    The Send tags option
    

You can also add tags to the DeviceHub device in the following ways:

Step 7: View Tag Data

You can use the Flows Manager or Analytics in Litmus Edge to view the tag data.

To view tag data in the Flows Manager:

  1. In Litmus Edge, navigate to DeviceHub > Tags.
  2. Select the DeviceHub Agent device.

    Select the DeviceHub Agent device
    Select the DeviceHub Agent device
    
  3. Click the Copy icon for the tag you want to view.

    Document image
    
  4. Navigate to the Flows Manager and create a new flow. See Create a Flow to learn more.
  5. Drag the DataHub Subscribe and Debug nodes to the canvas and wire them together.

    The DataHub Subscribe and Debug nodes
    The DataHub Subscribe and Debug nodes
    
  6. 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.
  7. Click the Debug icon.

    The Debug icon
    The Debug icon
    
  8. Drag the message window up and review the messages. A "success": true message confirms the connections is successful.

    Document image
    

To view tag data in Analytics:

  1. In Litmus Edge, navigate to Analytics.
  2. Click Add processor and select DataHub Subscribe.
  3. In the Topic field, paste the tag ID you copied earlier.
  4. Click Save.
  5. Click the View icon.

    The View icon
    The View icon
    
  6. Review the messages. A "success": true message confirms the connections is successful.

    Instance Messages
    Instance Messages