Tutorial: Transform Pipeline

What Does This Article Cover?

This tutorial will walk you through building a Pipeline to facilitate use cases that require transformations to the data structure. This Tutorial will feature Flatten, Breakup and Write New stages.

  • Tutorial Prerequisites
  • Tutorial Preparation
  • Tutorial Instructions
  • Tutorial Summary

Tutorial Prerequisites

  1. You have completed the initial Installation of the Intelligence Hub
  2. You have applied your Intelligence Hub license to your environment
  3. It is recommended to read the Getting Started Series before completing this tutorial exercise
  4. It is recommended to complete “Tutorial: Connections”, “Tutorial: Models and Instances” and “Tutorial: Templating”

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 Connections

    • 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 the following code block into the Project box and click the import button
    {
    	"productInfo": {
    		"company": "HighByte",
    		"product": "IntelligenceHub",
    		"version": "3.2.0",
    		"build": "2023.8.24.982",
    		"stage": "Alpha"
    	},
    	"project": {
    		"version": 5,
    		"connections": [
    			{
    				"name": "Tutorial_CMMS_servicelogs",
    				"uri": "jdbc.sqlserver://52.10.6.4:1433",
    				"tags": [
    					"Share",
    					"Share2"
    				],
    				"writes": {
    					"flattenModeledValues": false
    				},
    				"storeForward": {
    					"enabled": false,
    					"maxEntries": 100,
    					"waitOnFailureInterval": {
    						"duration": 1,
    						"units": "Seconds"
    					}
    				},
    				"settings": {
    					"database": "serviceinfo",
    					"username": "highbyte"
    				}
    			},
    			{
    				"name": "Tutorial_File",
    				"uri": "file://Tutorial_File",
    				"tags": [],
    				"writes": {
    					"flattenModeledValues": false
    				},
    				"storeForward": {
    					"enabled": false,
    					"maxEntries": 100,
    					"waitOnFailureInterval": {
    						"duration": 1,
    						"units": "Seconds"
    					}
    				},
    				"settings": {
    					"communicationProtocol": {
    						"type": "FILE_PROTOCOL"
    					},
    					"directory": "/files",
    					"processedDirectory": "/files/processed",
    					"errorDirectory": "files/error"
    				}
    			},
    			{
    				"name": "Tutorial_MQTT",
    				"uri": "mqtt://0.0.0.0:1885",
    				"tags": [
    					"Share",
    					"Share2"
    				],
    				"writes": {
    					"flattenModeledValues": false
    				},
    				"storeForward": {
    					"enabled": false,
    					"maxEntries": 100,
    					"waitOnFailureInterval": {
    						"duration": 1,
    						"units": "Seconds"
    					}
    				},
    				"settings": {
    					"connectionTimeoutSeconds": 10,
    					"keepAliveSeconds": 60,
    					"requestTimeoutMS": 5000,
    					"cleanSession": true,
    					"ssl": false,
    					"redundantBrokers": [],
    					"inputDiscovery": ""
    				}
    			},
    			{
    				"name": "Tutorial_OPC_UA",
    				"uri": "opc.tcp://52.10.6.4:49320",
    				"tags": [
    					"Share",
    					"Share2"
    				],
    				"writes": {
    					"flattenModeledValues": false
    				},
    				"subscriptions": {
    					"subscriptionRate": {
    						"duration": 1,
    						"units": "Seconds"
    					}
    				},
    				"storeForward": {
    					"enabled": false,
    					"maxEntries": 100,
    					"waitOnFailureInterval": {
    						"duration": 1,
    						"units": "Seconds"
    					}
    				},
    				"settings": {
    					"security": "None",
    					"authentication": {
    						"type": "Anonymous"
    					},
    					"connectTimeoutSeconds": 5,
    					"requestTimeoutMS": 5000,
    					"maxItemsPerRead": 512,
    					"maxItemsPerWrite": 256,
    					"certificateKeyPair": "app-certificate-private-key",
    					"sessionName": ""
    				}
    			}
    		],
    		"inputs": [
    			{
    				"name": "Tutorial_All_Assets",
    				"connection": "Tutorial_CMMS_servicelogs",
    				"type": "jdbc.sqlserver",
    				"qualifier": {
    					"query": "select * from [dbo].[cmms_servicelogs]"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_All_Assets_CNC",
    				"connection": "Tutorial_CMMS_servicelogs",
    				"type": "jdbc.sqlserver",
    				"qualifier": {
    					"query": "select * from [dbo].[cmms_servicelogs] where [dbo].[cmms_servicelogs].[asset_type] = 'CNC'"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_AssetIDs",
    				"connection": "Tutorial_CMMS_servicelogs",
    				"type": "jdbc.sqlserver",
    				"qualifier": {
    					"query": "select  [dbo].[cmms_servicelogs].[asset_id] from [dbo].[cmms_servicelogs] where [dbo].[cmms_servicelogs].[asset_type] = 'CNC'"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "CNC_Asset_Collection",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"type": "Collection",
    					"samplingInterval": {
    						"duration": 0,
    						"units": "Seconds"
    					},
    					"ignoreBadQuality": false,
    					"collection": [
    						{
    							"name": "Tutorial_CNC_Fanuc_1001_AssetID",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_1001.AssetID",
    							"type": "Tag",
    							"dataType": "String"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_1001_CuttingSpeed",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_1001.CuttingSpeed",
    							"type": "Tag",
    							"dataType": "Real32"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_1001_MachineTemperature",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_1001.MachineTemperature",
    							"type": "Tag",
    							"dataType": "Real32"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_1001_PowerCurrent",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrent",
    							"type": "Tag",
    							"dataType": "Real32"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_1001_FeedRate",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_1001.FeedRate",
    							"type": "Tag",
    							"dataType": "Real32"
    						}
    					]
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "CNC_Asset_Collection_Templated",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"type": "Collection",
    					"samplingInterval": {
    						"duration": 0,
    						"units": "Seconds"
    					},
    					"ignoreBadQuality": false,
    					"collection": [
    						{
    							"name": "Tutorial_CNC_Fanuc_AssetID",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_{{this.InputAssetID}}.AssetID",
    							"type": "Tag",
    							"dataType": "String"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_CuttingSpeed",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_{{this.InputAssetID}}.CuttingSpeed",
    							"type": "Tag",
    							"dataType": "Real32"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_MachineTemperature",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_{{this.InputAssetID}}.MachineTemperature",
    							"type": "Tag",
    							"dataType": "Real32"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_PowerCurrent",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_{{this.InputAssetID}}.PowerCurrent",
    							"type": "Tag",
    							"dataType": "Real32"
    						},
    						{
    							"name": "Tutorial_CNC_Fanuc_FeedRate",
    							"namespaceIndex": 2,
    							"identifierType": "String",
    							"identifier": "Tutorial.CNC_Fanuc_{{this.InputAssetID}}.FeedRate",
    							"type": "Tag",
    							"dataType": "Real32"
    						}
    					]
    				},
    				"cacheLifetime": {
    					"enabled": false
    				},
    				"template": {
    					"name": "{{this.InputAssetID}}",
    					"type": "Static",
    					"params": {
    						"InputAssetID": "1001-1003"
    					}
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_AirPressure",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.AirPressure",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_AssetID",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.AssetID",
    					"type": "Tag",
    					"dataType": "String"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_AxisPositionX",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.AxisPositionX",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_AxisPositionY",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.AxisPositionY",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_AxisPositionZ",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.AxisPositionZ",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_CoolantpH",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.CoolantpH",
    					"type": "Tag",
    					"dataType": "Int16"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_CuttingSpeed",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.CuttingSpeed",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_FaultCode",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.FaultCode",
    					"type": "Tag",
    					"dataType": "Int16"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_FeedRate",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.FeedRate",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_MachineState",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.MachineState",
    					"type": "Tag",
    					"dataType": "Int16"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_MachineTemperature",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.MachineTemperature",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_PartProgramID",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.PartProgramID",
    					"type": "Tag",
    					"dataType": "String"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_PowerCurrent",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrent",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_PowerCurrentXAxis",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrentXAxis",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_PowerCurrentYAxis",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrentYAxis",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_PowerCurrentZAxis",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrentZAxis",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_ProductionCount",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.ProductionCount",
    					"type": "Tag",
    					"dataType": "Int16"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_RejectCount",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.RejectCount",
    					"type": "Tag",
    					"dataType": "Int16"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_SpindleLoad",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.SpindleLoad",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_SpindleSpeed",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.SpindleSpeed",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_SpindleTemperature",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.SpindleTemperature",
    					"type": "Tag",
    					"dataType": "Real32"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_StateDescription",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.StateDescription",
    					"type": "Tag",
    					"dataType": "String"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_1001_ToolID",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.ToolID",
    					"type": "Tag",
    					"dataType": "String"
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_Templated_AssetID",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_{{this.AssetID}}.AssetID",
    					"type": "Tag",
    					"dataType": "String",
    					"samplingInterval": {
    						"units": "Seconds",
    						"duration": 1
    					}
    				},
    				"cacheLifetime": {
    					"enabled": false
    				},
    				"template": {
    					"name": "",
    					"type": "Static",
    					"params": {
    						"AssetID": "1001-1003"
    					}
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Fanuc_Templated_CuttingSpeed",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_{{this.AssetID}}.CuttingSpeed",
    					"type": "Tag",
    					"dataType": "Real32",
    					"samplingInterval": {
    						"units": "Seconds",
    						"duration": 1
    					}
    				},
    				"cacheLifetime": {
    					"enabled": false
    				},
    				"template": {
    					"name": "",
    					"type": "Static",
    					"params": {
    						"InputAssetID": "1001-1003"
    					}
    				}
    			},
    			{
    				"name": "_DynamicSource_Tutorial_CNC_Fanuc_MachineState",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.MachineState",
    					"type": "Tag",
    					"dataType": "Int16",
    					"samplingInterval": {
    						"units": "Seconds",
    						"duration": 1
    					}
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "_DynamicSource_Tutorial_CNC_Fanuc_PartProgramID",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.PartProgramID",
    					"type": "Tag",
    					"dataType": "String",
    					"samplingInterval": {
    						"units": "Seconds",
    						"duration": 1
    					}
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "_DynamicSource_Tutorial_CNC_Fanuc_RejectCount",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.RejectCount",
    					"type": "Tag",
    					"dataType": "Int16",
    					"samplingInterval": {
    						"units": "Seconds",
    						"duration": 1
    					}
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			},
    			{
    				"name": "_DynamicSource_Tutorial_CNC_Fanuc_ToolID",
    				"connection": "Tutorial_OPC_UA",
    				"type": "opc.tcp",
    				"qualifier": {
    					"namespaceIndex": 2,
    					"identifierType": "String",
    					"identifier": "Tutorial.CNC_Fanuc_1001.ToolID",
    					"type": "Tag",
    					"dataType": "String",
    					"samplingInterval": {
    						"units": "Seconds",
    						"duration": 1
    					}
    				},
    				"cacheLifetime": {
    					"enabled": false
    				}
    			}
    		],
    		"outputs": [
    			{
    				"name": "Tutorial_CNC_Output",
    				"connection": "Tutorial_MQTT",
    				"type": "mqtt",
    				"qualifier": {
    					"qos": 0,
    					"namedRoot": false,
    					"breakupArrays": true,
    					"topic": "Tutorial/Templating/{{this.AssetID}}",
    					"retained": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Output_DynamicTemplate",
    				"connection": "Tutorial_MQTT",
    				"type": "mqtt",
    				"qualifier": {
    					"qos": 0,
    					"namedRoot": false,
    					"breakupArrays": true,
    					"topic": "Tutorial/Templating/DynamicFlow/{{this.AssetID}}",
    					"retained": false
    				}
    			},
    			{
    				"name": "Tutorial_CNC_Templated_Flow",
    				"connection": "Tutorial_MQTT",
    				"type": "mqtt",
    				"qualifier": {
    					"qos": 0,
    					"namedRoot": false,
    					"breakupArrays": true,
    					"topic": "Tutorial/TemplatedFlow/{{this._name}}",
    					"retained": true
    				}
    			},
    			{
    				"name": "Tutorial_Model_Complex",
    				"connection": "Tutorial_MQTT",
    				"type": "mqtt",
    				"qualifier": {
    					"qos": 0,
    					"namedRoot": false,
    					"breakupArrays": false,
    					"topic": "Tutorial/Model/Complex",
    					"retained": false
    				}
    			},
    			{
    				"name": "Tutorial_Model_Simple",
    				"connection": "Tutorial_MQTT",
    				"type": "mqtt",
    				"qualifier": {
    					"qos": 0,
    					"namedRoot": false,
    					"breakupArrays": false,
    					"topic": "Tutorial/Model/Simple",
    					"retained": false
    				}
    			}
    		],
    		"modeling": {
    			"models": [
    				{
    					"name": "CNC_Asset_Info",
    					"tags": [
    						"Share",
    						"Share2"
    					],
    					"attributes": [
    						{
    							"name": "AssetID",
    							"type": "String",
    							"array": false,
    							"required": true
    						},
    						{
    							"name": "Temperature",
    							"type": "Any",
    							"array": false,
    							"required": true
    						},
    						{
    							"name": "Temperature_UOM",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "CuttingSpeed",
    							"type": "Any",
    							"array": false,
    							"required": true
    						},
    						{
    							"name": "PowerCurrent",
    							"type": "Any",
    							"array": false,
    							"required": true
    						},
    						{
    							"name": "FeedRate",
    							"type": "Any",
    							"array": false,
    							"required": true
    						},
    						{
    							"name": "LastServiceDate",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "LastServiceNotes",
    							"type": "Any",
    							"array": false,
    							"required": false
    						}
    					]
    				},
    				{
    					"name": "CNC_Asset_ServiceInfo",
    					"tags": [
    						"Share"
    					],
    					"attributes": [
    						{
    							"name": "AssetID",
    							"type": "String",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "LastServiceDate",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "LastServiceNotes",
    							"type": "Any",
    							"array": false,
    							"required": false
    						}
    					]
    				},
    				{
    					"name": "Enterprise_CNC_Model",
    					"tags": [],
    					"attributes": [
    						{
    							"name": "Enterprise",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "Site",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "Area",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "Line",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "Values",
    							"type": "CNC_Asset_Info",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "ProgramInfo",
    							"type": "ProgramInfo_Model",
    							"array": false,
    							"required": false
    						}
    					]
    				},
    				{
    					"name": "ProgramInfo_Model",
    					"tags": [],
    					"attributes": [
    						{
    							"name": "ProgramID",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "ToolID",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "MachineState",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "RejectCount",
    							"type": "Any",
    							"array": false,
    							"required": false
    						}
    					]
    				},
    				{
    					"name": "Tutorial_Pipeline_Read",
    					"tags": [],
    					"attributes": [
    						{
    							"name": "Parameter",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "Value",
    							"type": "Any",
    							"array": false,
    							"required": false
    						},
    						{
    							"name": "Value2",
    							"type": "Any",
    							"array": false,
    							"required": false
    						}
    					]
    				}
    			],
    			"instances": [
    				{
    					"name": "CNC_Asset_Info_Instance",
    					"tags": [
    						"Share",
    						"Share2"
    					],
    					"model": "CNC_Asset_Info",
    					"rootValueAs": "Object",
    					"attributes": [
    						{
    							"name": "AssetID",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_AssetID}}"
    						},
    						{
    							"name": "Temperature",
    							"expression": "({{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_MachineTemperature}}-32)*.5556"
    						},
    						{
    							"name": "Temperature_UOM"
    						},
    						{
    							"name": "CuttingSpeed",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_CuttingSpeed}}"
    						},
    						{
    							"name": "PowerCurrent",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_PowerCurrent}}"
    						},
    						{
    							"name": "FeedRate",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_FeedRate}}"
    						},
    						{
    							"name": "LastServiceDate",
    							"expression": "{{Connection.Tutorial_CMMS_servicelogs.Tutorial_All_Assets_CNC}}[0].date"
    						},
    						{
    							"name": "LastServiceNotes",
    							"expression": "{{Connection.Tutorial_CMMS_servicelogs.Tutorial_All_Assets_CNC}}[0].notes"
    						}
    					]
    				},
    				{
    					"name": "CNC_Asset_Info_Instance_Collection",
    					"tags": [],
    					"model": "CNC_Asset_Info",
    					"rootValueAs": "Object",
    					"attributes": [
    						{
    							"name": "AssetID",
    							"expression": "{{Connection.Tutorial_OPC_UA.CNC_Asset_Collection_Templated(InputAssetID={{this.InstanceAssetID}})}}.Tutorial_CNC_Fanuc_AssetID"
    						},
    						{
    							"name": "Temperature",
    							"expression": "{{Connection.Tutorial_OPC_UA.CNC_Asset_Collection_Templated(InputAssetID={{this.InstanceAssetID}})}}.Tutorial_CNC_Fanuc_MachineTemperature"
    						},
    						{
    							"name": "Temperature_UOM",
    							"default": "F"
    						},
    						{
    							"name": "CuttingSpeed",
    							"expression": "{{Connection.Tutorial_OPC_UA.CNC_Asset_Collection_Templated(InputAssetID={{this.InstanceAssetID}})}}.Tutorial_CNC_Fanuc_CuttingSpeed"
    						},
    						{
    							"name": "PowerCurrent",
    							"expression": "{{Connection.Tutorial_OPC_UA.CNC_Asset_Collection_Templated(InputAssetID={{this.InstanceAssetID}})}}.Tutorial_CNC_Fanuc_PowerCurrent"
    						},
    						{
    							"name": "FeedRate",
    							"expression": "{{Connection.Tutorial_OPC_UA.CNC_Asset_Collection_Templated(InputAssetID={{this.InstanceAssetID}})}}.Tutorial_CNC_Fanuc_FeedRate"
    						},
    						{
    							"name": "LastServiceDate"
    						},
    						{
    							"name": "LastServiceNotes"
    						}
    					],
    					"template": {
    						"name": "{{this.InstanceAssetID}}",
    						"type": "Static",
    						"params": {
    							"InstanceAssetID": "1001-1003"
    						}
    					}
    				},
    				{
    					"name": "Enterprise_CNC_Model_Instance",
    					"tags": [],
    					"model": "Enterprise_CNC_Model",
    					"rootValueAs": "Object",
    					"attributes": [
    						{
    							"name": "Enterprise",
    							"default": "Tutorial"
    						},
    						{
    							"name": "Site",
    							"default": "Site1"
    						},
    						{
    							"name": "Area",
    							"default": "Area1"
    						},
    						{
    							"name": "Line",
    							"default": "Line1"
    						},
    						{
    							"name": "Values",
    							"expression": "{{Instance.CNC_Asset_Info_Instance}}"
    						},
    						{
    							"name": "ProgramInfo",
    							"expression": "{{Instance.Enterprise_CNC_Model_Instance_ProgramInfo}}"
    						}
    					]
    				},
    				{
    					"name": "Enterprise_CNC_Model_Instance_ProgramInfo",
    					"tags": [],
    					"model": "ProgramInfo_Model",
    					"rootValueAs": "Object",
    					"attributes": [
    						{
    							"name": "ProgramID",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_PartProgramID}}"
    						},
    						{
    							"name": "ToolID",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_ToolID}}"
    						},
    						{
    							"name": "MachineState",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_MachineState}}"
    						},
    						{
    							"name": "RejectCount",
    							"expression": "{{Connection.Tutorial_OPC_UA.Tutorial_CNC_Fanuc_1001_RejectCount}}"
    						}
    					]
    				}
    			]
    		},
    		"flows": [],
    		"conditions": [],
    		"functions": [],
    		"tags": [
    			{
    				"name": "Share"
    			}
    		],
    		"pipelines": []
    	},
    	"network": {
    		"groups": [],
    		"hubs": []
    	}
    }
  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” and 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. Review the source data

    • Navigate to Instances

    • Open Enterprise_CNC_Model_Instance

    • Click Test Instance to review the source data

      • Take note we have a complex payload as a result of the parent - child model configuration
  2. Build a new Pipeline

    • Navigate to Pipelines
    • Click New Pipeline in the upper right corner
    • Within the Pipeline Start stage, specify “Tutorial_Transform_Pipeline” for the Name
  3. Add a WriteNew Stage to the Pipeline to write out original payload

    • Within the Stages panel, add a WriteNew stage by dragging it to the working space
    • Enter WriteNew_Original as the WriteNew stage name
    • Connect the Pipeline start with the WriteNew stage
    • Update the WriteNew stage name to WriteNew_Original
    • Using the References panel, map Tutorial_MQTT to the Use Connection field within the Write New stage
    • Within the new Write New stage, enter “Tutorial/Transform/Original” as the Topic
    • Enable the retain flag
    • Click submit

  1. Create a Flow to the Buffer Pipeline

    • Navigate to Flows
    • Click new Flow
    • Within the New Flow details view, enter “Tutorial_Transform_Pipeline_Flow”
    • Click next
    • Within the New Flow Sources & Targets view, use the reference panel and set the Type to Instance
    • Map Enterprise_CNC_Model_Instance to the Sources panel
    • From the References panel, set type to Pipeline
    • Map Tutorial_Transform_Pipeline to the Targets panel
    • Click next
    • Set the interval to 5 seconds, enable the flow and click submit
    • Review the results within your UNS client
  2. Add an additional transform to the Pipeline

    • Navigate to Pipelines

    • Click Tutorial_Transform_Pipeline

    • Add a Flatten stage by dragging it to the working space

    • Connect the Pipeline start with the Flatten stage

    • Within the Stages panel, add a WriteNew stage by dragging it to the working space

    • Update the WriteNew stage name to WriteNew_Flatten

    • Using the References panel, map Tutorial_MQTT to the Use Connection field within the Write New stage

    • Within the new Write New stage, enter “Tutorial/Transform/Flattened” as the Topic

    • Enable the retain flag

    • Click Save

    • Review the results within your UNS client

      • Take note the child instance attributes “Values” and “ProgramInfo” have been flatten into a single JSON object

  1. Add an additional transform to the Pipeline

    • Navigate to Pipelines

    • Click Tutorial_Transform_Pipeline

    • Add a Breakup stage by dragging it to the working space

    • Connect Flatten stage with the Breakup stage

    • Within the Breakup Stage, set the Breakup Type to All

    • Within the Stages panel, add a WriteNew stage by dragging it to the working space

    • Update the WriteNew stage to name WriteNew_Breakup

    • Connect the Pipeline start with the WriteNew_Breakup Stage

    • Using the References panel, map Tutorial_MQTT to the Use Connection field within the Write New stage

    • Within the new Write New stage, enter “Tutorial/Transform/Breakup/{{event.metadata.breakupName}}” as the Topic

    • Enable the retain flag

    • Review the results within your UNS client

      • NOTE: We can see the values are now broken up into individual MQTT topics using the {{event.metadata.breakupName}} value in our topic, this includes our flattened child attributes

Tutorial Summary

In this tutorial you built a Pipeline composed on Flatten, Breakup and Write New stages. These stages are commonly utilized in use cases requiring data structure change. By utilizing Pipelines, Data Engineers can ensure the data is outputted to target system(s) in the required or expected format.