Skip to content
  • There are no suggestions because the search field is empty.

Tutorial: Static Templating

What Does This Tutorial Cover?

This tutorial will walk you through the basics of working with Templating. Templating is supported for Inputs, Instances, and Flows. Templating offers an efficient method for generating hundreds of configuration objects, with only minor variations between them. For example, if an OPC UA Server has 100 machines and the address of each machine only differs by a unique machineID, a single Input can represent all 100 machines. In this tutorial, we'll start by templating an OPC UA Branch connection. After that, using the same branch data, we'll create and template an instance.

  • Tutorial Prerequisites
  • Tutorial Preparation
  • Tutorial Instructions - Static Templating
  • Tutorial Summary

Tutorial Prerequisites

  • You have completed the initial Installation of the Intelligence Hub
  • You have applied your Intelligence Hub license to your environment
  • It is recommended to read the Getting Started Series before completing this tutorial exercise
  • It is recommended to complete "Tutorial: Connections" and "Tutorial: Models and Instances"

Tutorial Preparation

  1. 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 being utilized on your Intelligence Hub server, update to ports of your choosing, otherwise accept the defaults and click save
  2. Import the required Components

    • 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
    • Change the Import Type to JSON and paste in the following with the Project box
    • Configuration Download
  3. Update the imported Connections as required

    • Navigate to Configure and click Connections, Click Tutorial_MQTT and Update the MQTT settings as required based on the prior preparation step #1
    • Navigate to Configure and click Connections, Click "Tutorial_CMMS_servicelogs", type the following within the password field and click Save.
      • password

         

         

  4. Setup UNS Client

    • In the left-hand navigation panel, navigate to Tools and right click UNS client and open Link in New Tab
    • Enter login information
    • For Connection select Tutorial_MQTT
    • For Subscribed Topics remove the default wildcard entry # and Subscribe to Topic Tutorial/#
    • Click Add
    • Click Connect and confirm UNS client says "Connected to Tutorial_MQTT"
    • Return to the previous tab

    Tutorial Instructions

    1. Login to your Intelligence Hub environment

    2. Review source data

      • Navigate to Connections

      • Select "Tutorial_OPC_UA"

      • Navigate to Inputs

      • Select "Templated_Tutorial_CNC_Fanuc_Branch"

        • NOTE: This is a Branch OPC_UA input, with the Branch type we specify a Max Branch Depth to read under the base Identifier.
      • Test Input and review the data

    3. Update Templated_Tutorial_CNC_Fanuc_Branch to a Templated object using Static Parameters - This will take the configuration component from 1 asset input, to many asset inputs.

      • Within the Templated_Tutorial_CNC_Fanuc_Branch Input, enable the Use Template flag at the bottom of the page

      • Ensure Type is set to "Static" - we'll review "Dynamic" in another lesson

      • Click Add Value

      • Enter "InputAssetID" as the Value Name

      • Enter "1001-1003" as the pattern, note another valid pattern would be "1001,1002,1003"

      • To utilize the InputAssetID parameter, we will use the syntax of "{{this.InputAssetID}}", enter this as the "Template Name" value

      • We will now utilize this parameter within Identifier field, replace 1001 with {{this.InputAssetID}}

        • Note: Keep the leading underscore
      • Click save and Test Input to review the results

      • Before:
      • After:

         

    4. Review the Output target

      • Navigate to Connections
      • Select Tutorial_MQTT
      • Navigate to Outputs
      • Select Tutorial_CNC_Templated_Branch_Output
      • Take note of the topic "Tutorial/Templating/TemplatedConnection/{{this.AssetID}}" - we need to ensure we have a dynamic reference ({{this.AssetID}} to iterate through the templated source
    5. Create a flow to send Templated Branch to UNS
      • Navigate to Flows
      • Click New Flow
      • Within the New Flow details view, enter "CNC_Branch_Templated_Flow" as the name
      • Click Next
      • Within the new Sources & Targets view, set the references panel to type: Input
      • Set Connection to Tutorial_OPC_UA
      • Map Templated_Tutorial_CNC_Fanuc_Branch to the Sources panel
      • Change reference panel to type: Output
      • Set Connection to Tutorial_MQTT
      • Map Tutorial_CNC_Templated_Branch_Output to the targets panel
      • Click next
      • Set the interval to 10 seconds
      • Click the enabled flag
      • Click Submit
      • Navigate to UNS client and review the result
    6. Build a new Instance from an existing Model

      • Navigate to Models

      • Select CNC_Asset_Info

      • Click actions, create Instance

      • Within the New Instance Details view, enter "CNC_Asset_Info_Instance_Templated" as the name

      • Click next

      • Within the New Instance Model view, accept the default and click next

      • Within the New Instance Attributes view, set your reference panel to Type: Input

      • In the References Panel, set Connection to Tutorial_OPC_UA

      • In the References Panel, expand Tutorial_Branch - NOTE this is a different input then what we just templated in the previous steps

      • In the References Panel, expand CNC_Fanuc_1001 and map the following attributes to the corresponding expressions:

        • AssetID - {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.AssetID
          Temperature - {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.MachineTemperature
          CuttingSpeed - {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.CuttingSpeed
          PowerCurrent - {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.PowerCurrent
          FeedRate - {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.FeedRate
          

           

      • For attribute Temperature_UOM, enter "F" as the Default value - leave the Instance values LastServiceDate and LasteServiceNotes blank as they will not be utilized for this exercise for the sake of simplicity.

      • Click submit

      • Click Test Instance and review the results

    7. Template CNC_Asset_Info_Instance_Templated

      • Within CNC_Asset_Info_Instance_Templated, enable the Use Template flag

      • Ensure Type is set to "Static"

      • Click Add Value

      • Enter "InstanceAssetID" as the Value Name

      • Enter "1001-1003" as the pattern

        • Note: another valid pattern would be "1001,1002,1003"

      • To utilize the InstanceAssetID parameter, we will use the syntax of {{this.InstanceAssetID}}, enter this as the Template Name value

      • Starting with the AssetID attribute expression, replace 1001 with {{this.InstanceAssetID}}

        Before
        {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.AssetID
        
        After
        {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_{{this.InstanceAssetID}}.AssetID
        
      • Repeat with the remaining attribute expressions
        Before
        {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.MachineTemperature {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.CuttingSpeed {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.PowerCurrent {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_1001.FeedRate After {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_{{this.InstanceAssetID}}.MachineTemperature {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_{{this.InstanceAssetID}}.CuttingSpeed {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_{{this.InstanceAssetID}}.PowerCurrent {{Connection.Tutorial_OPC_UA.Tutorial_Branch}}.CNC_Fanuc_{{this.InstanceAssetID}}.FeedRate
      • Click save
      • Click Test Instance to review the results

    8. Review the Output target

      • Navigate to Connections

      • Select Tutorial_MQTT

      • Navigate to Outputs

      • Select Tutorial_CNC_Templated_Instance_Output

        • Take note of the topic "Tutorial/Templating/TemplatedInstance/{{this.AssetID}}" - we need to ensure we have a dynamic reference ({{this.AssetID}} to iterate through the templated source
    9. Output the templated Instance to the UNS
      • Navigate to Flows

      • Click New Flow

      • Enter "Tutorial_Template_Flow" for the name

      • Click next

      • Set the References type to Instance and map the CNC_Asset_Info_Instance_Templated to the Sources panel

      • Set the References type to Output, set Connections to Tutorial_MQTT and map Tutorial_CNC_Templated_Instance_Output to the Targets panel

      • Click next

      • Change the Interval to 10 seconds

      • Click the enabled flag

      • Click submit

      • Review the results within the UNS Client

    Take note that the template source payload was broken up into individual topics based on the {{this.AssetID}} syntax within our output. We are seeing Dynamic Referencing in action here; we can manage one output, allow the system to dynamically reference each individual AssetID and build the organized output for us.

    Tutorial Summary

    This tutorial covered how to utilize templating within Intelligence Hub components to assist in scaling successful use cases from one configuration object to many. Templating can happen within Inputs, Instances and Flows. We covered how to connect multiple templated objects together to ensure consistency with our use cases.

    Next Page