Tutorial: Connections
This step-by-step interactive tutorial provides an overview of Intelligence Hub Connections.
What Does This Tutorial Cover?
A Connection represents a pathway to either a data source or a target, serving as the starting point for all use cases.
- Tutorial Prerequisites
- Tutorial Preparation
- Tutorial Instructions
- Tutorial Summary
Tutorial Prerequisites
- You have completed the initial Installation of the Intelligence Hub.
- It is recommended to read the Getting Started Series before completing this tutorial exercise.
Tutorial Preparation
-
Enable Intelligence Hub MQTT broker
- In the left-hand navigation panel, navigate to Manage, and click Settings.
- Under the MQTT Broker section enable the broker, if ports 1885 and 1886 are in use on the server hosting your Intelligence Hub, update to ports of your choosing, otherwise accept the defaults and click the Save button.
-
Import the required content
- In the left-hand navigation panel, navigate to Manage, and click Project
- Within the Import screen, ensure Full Project is off (otherwise your existing project will be overwritten).
- Copy the JSON provided here. Project JSON
- Change the Import Type to JSON and paste the provided JSON into the Project box and click the Import button.
- Update the imported Connections as required
-
Navigate to Configure and click Connections, click "HB_Tutorial_MQTT" and Update the MQTT settings as required based on the prior preparation step #1.
-
Navigate to Configure and click Connections, click "HB_Tutorial_SQL_Server" and type the following in the password field.
password
-
Click the Save button.
-
-
Setup the UNS Client
-
In the left-hand navigation panel, navigate to Tools and right click UNS Client and select Open Link in New Tab.
-
Enter login information.
-
For Connection select "HB_Tutorial_MQTT".
-
For Subscribed Topics enter "Tutorial/#".
-
Click Add.
-
Click the "x" to remove topic "#".
-
Click the Connect button.
-
Confirm the UNS Client says "Connected to HB_Tutorial_MQTT".
-
Return to the previous web browser tab.
-
Instructions
-
Login to your Intelligence Hub environment.
-
Reviewing the first connection.
-
Navigate to Connections.
-
Select "HB_Tutorial_OPC_UA"
- Note: the status will be in "Not Connected" state until an Input or Output is executed.
-
The Connection should be operational as is, take note within the Overview Tab that there are several protocol specific settings.
- OPC UA subscription mode and rate (Reference User Guide for more information).
- Timeout and read settings. These are useful for tailoring read and write size and general performance optimization.
-
-
Add the first input.
-
Within the "HB_Tutorial_OPC_UA" Connection navigate to the Inputs Tab.
-
Take note of the three options of import (Browse, CSV Import and New Input), as a general best practice, using the Browse option is preferred to minimize the manual setting entries.
-
-
Click the Browse button.
-
Navigate to the identifier "Tutorial".
-
Click "CNC_Fanuc_1001"
- Take note you can select individual tags or select all.
-
Click "Select all 23 items".
-
Click the Import Selected button.
-
-
Review the first input.
-
Click the Return to Inputs button.
-
Open any tag
- Take note all settings were imported via the Browse option.
-
Click the Test Input button to confirm connectivity and view the current tag value.
-
Open the References Panel within the right panel.
- Take note that any configured objects within the Intelligence Hub are browsable from this panel.
-
Within the References panel, set type to Input.
-
Set Connections to "HB_Tutorial_OPC_UA".
-
Find the Input you opened and take note of the object’s shape and data type information.
-
-
Now we will change the shape of the object and explore additional input settings.
-
Within the Input Details click “Include Metadata”.
-
Click the Save button.
-
Click the Test Input button to review the results.
- Note Include Metadata is a common setting you can expect to find in many protocols, this enables you to easily utilize additional source metadata within the Intelligence Hub.
-
Within the References panel, take note of the object’s structure, you should notice it’s gone from a simple object of one value to a complex object of many values.
-
-
Add a second Input.
- Click on the Inputs Tab.
- Click the Browse button.
- Click the + sign next to the "Tutorial" branch.
- Click the Import Selected button.
-
Review the new Input
-
Open the Tutorial Input
- Take note this has imported as a different Input Type, Branch.
-
Review the two key branch settings:
- Max Branch Depth: how many levels under the specified identifier you want to read in.
- Cache Interval: how often the branch structure is refreshed (this is important for capturing changes to the branch or new additions under the branch).
-
Click Test Input button and review the results.
-
Within the References panel navigate to the "Tutorial" branch and review the branch’s structure.
- Note the branch has multiple assets under it, the base input has an array of multiple objects with individual tags under each object.
-
-
Output branch data to the UNS Client.
-
Navigate to Connections.
-
Select "HB_Tutorial_MQTT".
-
Click the Outputs Tab.
-
Click the New Output button.
-
Enter the following and click create
- Name: HB_Tutorial_MQTT_Output_OPC_UA_Branch
- Topic: Tutorial/OPC_UA_Branch
-
-
- Let’s utilize the test write and write a basic string to this topic, within the Expression to write, enter (“Test”) including the parenthesis and quotes and click the Write Output button.
-
Review the results in your UNS client.
-
Create a Pipeline to publish the source OPC UA data to MQTT.
- Navigate to Pipeline.
- Click New Pipeline.
- Enter “HB_Tutorial_OPC_UA_Branch_To_MQTT” for the Name.
- Select the Build Flow option to create a Pipeline with Sources, Targets, and a Trigger.
- Click the Next button.
- Within the Sources & Target view, use the References Panel and set Type to Input.
- Set Connections to "HB_Tutorial_OPC_UA".
- Drag the branch “Tutorial” to the Sources box.
- Change Type to Output.
- Set Connections to "HB_Tutorial_MQTT".
- Drag "HB_Tutorial_MQTT_Output_OPC_UA_Branch" to the Targets box.
- Click the Next button.
- Change the interval to 10 seconds.
- Click the Create button.
- Click on the Pipeline "Flow" stage and Enable the Pipeline.
- Click on the Save button.
- Review the results in the UNS client.
-
Work with our second connection
-
Navigate to Connections.
-
Open "HB_Tutorial_SQL_Server".
-
Review the Overview Tab and take note of the common settings with a Microsoft SQL Server Connection.
-
Navigate to the Inputs Tab.
-
Open "HB_Tutorial_SQL_Server_Input_Get_All_Assets".
- NOTE:
Typically, using select * statements is not recommended for performance reasons. This is because such statements retrieve all columns from a table, which can lead to inefficient data processing and increased load on the database server. By selecting only the necessary columns, you can optimize query performance and reduce resource consumption.
- NOTE:
-
Click the Test Input button and review the results from the Results and Reference Panels.
- NOTE: In the References panel you can see this input is returning an array of data.
-
-
Create a new input
- Within the "HB_Tutorial_SQL_Server_Input_Get_All_Assets" input, click the Copy Button in the upper right corner of the Input Tab.
- Enter “HB_Tutorial_SQL_Server_Input_Get_All_CNC_Assets” as the new Input’s name.
- Update your query from "select * from [dbo].[cmms_servicelogs]" to "select * from [dbo].[cmms_servicelogs] where "
- Click the Open Button next to the Object Explorer to browse the default database schema.
- Using the Object Explorer click "dbo" and then "cmms_servicelogs".
- Using the Object Explorer map “asset_type” to your query.
- Type [= 'CNC'] as the where clause and do not include the brackets.
- Click the Test Input button and review the results from the Results and Reference Panels
Utilize the Object Explorer and add additional configuration to the new input.
The answer to this tutorial can be found in the beginning of the next tutorial section. It is found in the Project JSON in the next tutorial. The Project JSON in each section is cumulative. It is built based on the previous tutorial sections as well as new components needed for the current section.
Tutorial Summary
This tutorial focused on the basics of working with Connections. You should be more familiar with navigation and interworking of Connections. We covered basic principles of building Inputs and Outputs. We covered how to use the Reference Panel and Test Inputs to see the common structures of inputs including single values, complex objects and arrays. The upcoming Tutorials will build upon these basic principles.