Tutorial: Buffer Pipeline
What Does This Article Cover?
This tutorial will walk you through building a simple Pipeline to facilitate use cases that require buffering data for a time or window size. The tutorial also covers additional pipeline stages that are common with buffer use cases: Buffer, WriteNew, Transform and CSV. This tutorial includes the follow sections.
- Tutorial Prerequisites
- Tutorial Preparation
- Tutorial Instructions
- Tutorial Summary
Tutorial Prerequisites
- This tutorial assumes you have completed the initial Installation of the Intelligence Hub
- This tutorial assumes 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”, “Tutorial: Models and Instances” and “Tutorial: Templating”
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 being utilized on your Intelligence Hub server, update to ports of your choosing, otherwise accept the defaults and click save
-
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 } ] } ], "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": [] } }
-
-
Update the imported Connections as required
-
Navigate to Configure and click Connections, Click Tutorial_File and update the File Settings to an accessible directory from your environment - Note this is currently set to /files
-
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
-
-
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
-
Review the source data
- Navigate to Instances
- Open CNC_Asset_Info_Instance_Collection
- Click Test Instance to review the source data
-
Build a new Pipeline
- Navigate to Pipelines
- Click New Pipeline in the upper right corner
- Within the Pipeline Start stage, specify “Tutorial_Buffer_Pipeline” for the Name
-
Add Stages to the Pipeline
-
Within the Stages panel, add a Transform stage by dragging it to the working space
-
Enter the following and connect to the Pipeline Start
stage.setMetadata("AssetID", event.value.AssetID);
-
NOTE: This Stage utilizes the setMetadata stage to provide the Pipeline the source’s AssetID attribute. In this stage we are presenting the “AssetID” attribute value from the incoming source payload to the Pipeline as metadata. We’ll use the AssetID for our BufferKey. Having a specified BufferKey will ensure this Pipeline will treat each incoming payload uniquely by the AssetID.
-
-
Within the Stages panel, add a Time Buffer
-
Set the Window Interval to 10 seconds
-
Update your Window Expression to the following
-
NOTE: This expression we will ensure each incoming payload will be indexed by the AssetID
stage.setBufferKey(event.value.AssetID);
-
-
Connect the Transform Stage with the TimeBuffer Stage
-
Within the Stages panel, add a Write New Stage
-
For the new Write New Stage, enter “WriteNew_BufferMQTT” as the name
-
Using the References panel, map Tutorial_MQTT to the Write New Use Connection attribute
-
Within the Write New Stage, enter “Tutorial/PipelineBuffer/{{event.metadata.bufferKey}}” as the Topic
-
Within the Write New Stage, enable the Retain setting
-
Connect the TimeBuffer Stage stage with the WriteNew_BufferMQTT Stage
-
Click Submit
-
Create a Flow to the Buffer Pipeline
- Navigate to Flows
- Click new Flow
- Within the New Flow details view, enter “Tutorial_PipelineFlow” for the Flow name.
- Click next
- Within the New Flow Sources & Targets view, use the reference panel and set the Type to Instance
- Map CNC_Asset_Info_Instance_Collection to the Sources panel
- From the References panel, set type to Pipeline
- Map Tutorial_Buffer_Pipeline to the Targets panel
- Click next
- Set the interval to 2 seconds, enable the flow and click submit
- Review the results within your UNS client
-
Add additional Stages to the Pipeline
-
Navigate to Pipelines
-
Click Tutorial_Buffer_Pipeline
-
Within the Stages panel, add a CSV stage by dragging it to the working space
-
From the existing TimeBuffer stage, connect to the CSV file format stage
-
From the Stages panel map Write New to the working area
-
Within the new WriteNew stage, configure the name to WriteNew_File
-
Using the References Panel, map Tutorial_File to the WriteNew_File Use Connection setting
-
Within the WriteNew_File stage, configure the file name to “{{event.metadata.bufferKey}}.csv”, this will utilize the previously configured bufferkey as our file name and ensure each Asset’s payload are outputted independently
-
From the existing CSV stage, connect to the WriteNew_File stage
-
Click save
-
Navigate to the previously specified file directory and review the results
- NOTE: The specified buffer window will need to elapse before the files will be created
-
Tutorial Summary
This Tutorial covered several Pipeline stages: Transform, Buffer, File Format and Write New. You created a Pipeline that takes an incoming payload, stages the AssetID as the BufferKey and performs a Time Buffer to create an array of data over the specified buffer period. This Pipeline has two separate output destinations, the first being our UNS to view the Array data and the second being our File directory. This Pipeline was built in a way to accept many Asset sources, assuming each source contains an AssetID attribute.