Event driven pipelines (Event Trigger Stage)
Setup event-driven data flows
Content:
- Summary
- Instructions
- Project file
Summary:
Example project for event driving a payload across multiple event-based attributes that need to be captured individually. Uses Components from the Advanced UNS project linked below.
Instructions:
- Import project file found at the bottom of this page.
- This project reuses the Components from the Advanced UNS Reference Solution.
- The Connector MQTT points to a server at 0.0.0.0:1885
- Ref: https://support.highbyte.com/kb/reference/solutions/advanced-unified-namespaces
- View the payload get published when one the various attributes has a new message:
Project File:
{
"productInfo": {
"company": "HighByte",
"product": "IntelligenceHub",
"version": "4.0.2",
"build": "2025.1.22.13",
"stage": "Release"
},
"project": {
"version": 9,
"connections": [
{
"name": "MQTT",
"uri": "mqtt://localhost:1885",
"tags": [
"Adv_UNS",
"eventBasedPipeline"
],
"writes": {
"flattenModeledValues": false
},
"subscriptions": {},
"storeForward": {
"enabled": false,
"maxEntries": 100,
"waitOnFailureInterval": {
"duration": 1,
"units": "Seconds"
}
},
"settings": {
"connectionTimeoutSeconds": 10,
"keepAliveSeconds": 60,
"requestTimeoutMS": 5000,
"cleanSession": true,
"ssl": false,
"redundantBrokers": [],
"inputDiscovery": ""
}
},
{
"name": "OPC_UA",
"uri": "opc.tcp://52.10.6.4:49320",
"tags": [
"Adv_UNS",
"eventBasedPipeline"
],
"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,
"sessionName": ""
}
},
{
"name": "SQL_CMMS",
"uri": "jdbc.sqlserver://52.10.6.4:1433",
"tags": [
"Adv_UNS",
"eventBasedPipeline"
],
"writes": {
"flattenModeledValues": false
},
"subscriptions": {},
"storeForward": {
"enabled": false,
"maxEntries": 100,
"waitOnFailureInterval": {
"duration": 1,
"units": "Seconds"
}
},
"settings": {
"database": "serviceinfo",
"username": "highbyte",
"password": "password"
}
}
],
"inputs": [
{
"name": "On_State_Change_Program",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"payloadType": "json",
"qos": 0,
"topic": "Enterprise/Site-1/Area-1/Line-1/On_State_Change/",
"includeTopic": false
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "On_State_Change_Program_",
"type": "Static",
"params": [
{
"name": "AssetID",
"pattern": "0"
}
]
}
},
{
"name": "UNS_Site01_Area01_Line01_Assets_Motor",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"includeTopic": false,
"payloadType": "any",
"topic": "UNS/Site01/Area01/Line01/Assets/Motor/#",
"qos": 0
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "UNS_Site1_Zone_1_Line_2_Assets_Motor",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"includeTopic": false,
"payloadType": "any",
"topic": "UNS/Site1/Zone-1/Line-2/Assets/Motor/#"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_All_Assets_Collection_Templated",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"type": "Collection",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
},
"ignoreBadQuality": false,
"collection": [
{
"identifierType": "String",
"name": "CNC__AssetID",
"namespaceIndex": "2",
"identifier": "Tutorial.CNC_.AssetID"
},
{
"identifierType": "String",
"name": "CNC__CuttingSpeed",
"namespaceIndex": "2",
"identifier": "Tutorial.CNC_.CuttingSpeed"
},
{
"identifierType": "String",
"name": "CNC__MachineTemperature",
"namespaceIndex": "2",
"identifier": "Tutorial.CNC_.MachineTemperature"
},
{
"identifierType": "String",
"name": "CNC__PowerCurrent",
"namespaceIndex": "2",
"identifier": "Tutorial.CNC_.PowerCurrent"
},
{
"identifierType": "String",
"identifier": "Tutorial.CNC_.FeedRate",
"name": "CNC__FeedRate",
"namespaceIndex": "2"
}
]
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Static",
"params": [
{
"name": "AssetID",
"pattern": "Fanuc_1001,Fanuc_1002"
}
]
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_AirPressure",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.AirPressure",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_AssetID",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.AssetID",
"type": "Tag",
"dataType": "String",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
},
"isComplex": false
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_AxisPositionX",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.AxisPositionX",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_AxisPositionY",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.AxisPositionY",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_AxisPositionZ",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.AxisPositionZ",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_CoolantpH",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.CoolantpH",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_CuttingSpeed",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.CuttingSpeed",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_FaultCode",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.FaultCode",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_FeedRate",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.FeedRate",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_MachineState",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.MachineState",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_MachineTemperature",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.MachineTemperature",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_PartProgramID",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.PartProgramID",
"type": "Tag",
"dataType": "String",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_PowerCurrent",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrent",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_PowerCurrentXAxis",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrentXAxis",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_PowerCurrentYAxis",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrentYAxis",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_PowerCurrentZAxis",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.PowerCurrentZAxis",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_ProductionCount",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.ProductionCount",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_RejectCount",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.RejectCount",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_SpindleLoad",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.SpindleLoad",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_SpindleSpeed",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.SpindleSpeed",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_SpindleTemperature",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.SpindleTemperature",
"type": "Tag",
"dataType": "Real32",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_StateDescription",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.StateDescription",
"type": "Tag",
"dataType": "String",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_1001_ToolID",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_Fanuc_1001.ToolID",
"type": "Tag",
"dataType": "String",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_CNC_MachineState_Templated",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_.MachineState",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Dynamic",
"reference": ""
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_CNC_MachineState_Templated_Copy",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_.MachineState",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Dynamic",
"reference": ""
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_CNC_Parameter_Templated",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_.",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Dynamic",
"reference": ""
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_CNC_PartProgramID_Templated",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_.PartProgramID",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Static",
"params": [
{
"name": "AssetID",
"pattern": "Fanuc_1001"
}
]
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_CNC_ProductionCount_Templated",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_.ProductionCount",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Static",
"params": [
{
"name": "AssetID",
"pattern": "Fanuc_1001"
}
]
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_CNC_RejectCount_Templated",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_.RejectCount",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Static",
"params": [
{
"name": "AssetID",
"pattern": "Fanuc_1001"
}
]
}
},
{
"name": "Connection_OPC_UA_Input_CNC_Solution_Fanuc_CNC_ToolID_Templated",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial.CNC_.ToolID",
"type": "Tag",
"dataType": "Int16",
"samplingInterval": {
"duration": 0,
"units": "Seconds"
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Static",
"params": [
{
"name": "AssetID",
"pattern": "Fanuc_1001"
}
]
}
},
{
"name": "Fanuc",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Fanuc",
"dataType": "Auto",
"type": "Branch"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "INJECT1",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "INJECT1",
"dataType": "Auto",
"type": "Branch"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Motor001",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Motor001",
"dataType": "Auto",
"type": "Branch",
"maxDepth": 1,
"cacheInterval": {
"duration": 1,
"units": "Hours"
},
"ignoreBadQuality": false,
"browseVariableNodes": false
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Motor001_PLC3",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Motor001.PLC",
"dataType": "Auto",
"type": "Branch",
"maxDepth": 1,
"cacheInterval": {
"duration": 1,
"units": "Hours"
},
"ignoreBadQuality": false,
"browseVariableNodes": false
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Motor001_param1",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Motor001..",
"dataType": "Auto",
"type": "Tag",
"maxDepth": 1,
"cacheInterval": {
"duration": 1,
"units": "Hours"
},
"ignoreBadQuality": false,
"browseVariableNodes": false,
"samplingInterval": {
"duration": 0,
"units": "Seconds"
},
"isComplex": true
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off",
"params": [
{
"name": "a",
"pattern": "PLC"
},
{
"name": "b",
"pattern": "Amps"
}
]
}
},
{
"name": "Packaging",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Packaging",
"dataType": "Auto",
"type": "Branch"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Tutorial",
"connection": "OPC_UA",
"type": "opc.tcp",
"qualifier": {
"namespaceIndex": 2,
"identifierType": "String",
"identifier": "Tutorial",
"dataType": "Auto",
"type": "Branch",
"maxDepth": 1
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "All_CNC_Machines_AssetIDs",
"connection": "SQL_CMMS",
"type": "jdbc.sqlserver",
"qualifier": {
"query": "SELECT \n [dbo].[cmms_servicelogs].[asset_id] AS 'AssetID', \n 'MachineState' AS 'eventType'\nFROM \n [dbo].[cmms_servicelogs] \nWHERE \n [dbo].[cmms_servicelogs].[asset_type] = 'CNC'",
"type": "query",
"index": {
"enabled": false,
"indexName": "",
"indexValue": ""
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "All_CNC_Machines_AssetIDs_Copy",
"connection": "SQL_CMMS",
"type": "jdbc.sqlserver",
"qualifier": {
"query": "SELECT \n*\nFROM \n [dbo].[cmms_servicelogs] \n--WHERE \n-- [dbo].[cmms_servicelogs].[asset_type] = 'CNC'",
"type": "query",
"index": {
"enabled": false,
"indexName": "",
"indexValue": ""
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_SQL_Server_Input_CNC_Solution_All_Service_Records",
"connection": "SQL_CMMS",
"type": "jdbc.sqlserver",
"qualifier": {
"query": "SELECT * FROM [dbo].[cmms_servicelogs]"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Connection_SQL_Server_Input_CNC_Solution_All_Service_Records_All_CNCs_Templated",
"connection": "SQL_CMMS",
"type": "jdbc.sqlserver",
"qualifier": {
"query": "SELECT * FROM [dbo].[cmms_servicelogs] WHERE [dbo].[cmms_servicelogs].[asset_id] = ''"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"name": "",
"type": "Static",
"params": [
{
"name": "AssetID",
"pattern": "Fanuc_1001"
}
]
}
},
{
"name": "Dynamic_Input_CNC",
"connection": "SQL_CMMS",
"type": "jdbc.sqlserver",
"qualifier": {
"query": "SELECT * FROM [dbo].[cmms_servicelogs] where [dbo].[cmms_servicelogs].[asset_id] = ''"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "Dynamic_Input_CNC_param",
"connection": "SQL_CMMS",
"type": "jdbc.sqlserver",
"qualifier": {
"query": "SELECT * FROM [dbo].[cmms_servicelogs] where [dbo].[cmms_servicelogs].[asset_id] = ''",
"type": "query",
"index": {
"enabled": false,
"indexName": "",
"indexValue": ""
}
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
},
{
"name": "test",
"connection": "SQL_CMMS",
"type": "jdbc.sqlserver",
"qualifier": {
"type": "query",
"query": "select * from [dbo].[lastservice]"
},
"cacheLifetime": {
"enabled": false
},
"template": {
"type": "Off"
}
}
],
"outputs": [
{
"name": "MQTT_CNC_Original",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"qos": 0,
"namedRoot": false,
"breakupArrays": true,
"topic": "Enterprise/Site-1/Area-1/Line-1/Assets///Original_Payload",
"retained": false
}
},
{
"name": "On_State_Change_Program",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"qos": 0,
"namedRoot": false,
"breakupArrays": true,
"topic": "Enterprise/Site-1/Area-1/Line-1/On_State_Change/",
"retained": false,
"filterList": []
}
},
{
"name": "SAP_Output",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"qos": 0,
"namedRoot": false,
"breakupArrays": true,
"topic": "Enterprise/Site-1/Area-1/Line-1/Maintenance//",
"retained": false
}
},
{
"name": "UNS_Assets",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"qos": 0,
"namedRoot": false,
"retained": false,
"breakupArrays": false,
"topic": "UNS////Assets//"
}
},
{
"name": "set",
"connection": "MQTT",
"type": "mqtt",
"qualifier": {
"qos": 0,
"namedRoot": false,
"breakupArrays": false,
"topic": "set"
}
}
],
"modeling": {
"models": [
{
"name": "CNC_Machine_Production_Data_Model",
"tags": [
"Adv_UNS",
"eventBasedPipeline"
],
"attributes": [
{
"attributeType": "Internal",
"name": "AssetID",
"nullable": false,
"required": false,
"array": false,
"defaultValue": "mdef",
"internalType": "Any"
},
{
"attributeType": "Internal",
"name": "ProgramID",
"nullable": false,
"required": false,
"array": false,
"defaultValue": "mdef",
"internalType": "Any"
},
{
"attributeType": "Internal",
"name": "ToolID",
"nullable": false,
"required": false,
"array": false,
"defaultValue": "mdef",
"internalType": "Any"
},
{
"attributeType": "Internal",
"name": "MachineState",
"nullable": true,
"required": false,
"array": false,
"defaultValue": "mdef",
"internalType": "Any"
},
{
"attributeType": "Internal",
"name": "ProductionCount",
"nullable": true,
"required": false,
"array": false,
"defaultValue": "mdef",
"internalType": "Any"
},
{
"attributeType": "Internal",
"name": "RejectCount",
"nullable": true,
"required": false,
"array": false,
"internalType": "Any"
}
]
}
],
"instances": [
{
"name": "CNC_Solution_CNC_Machine_Production_Data_Templated_Instance",
"tags": [
"Adv_UNS",
"eventBasedPipeline"
],
"model": "CNC_Machine_Production_Data_Model",
"rootValueAs": "Object",
"template": {
"name": "",
"type": "Dynamic",
"reference": ""
},
"executeMode": "V4",
"initExpression": "let fn = function xy(x){\r\n if (x.slice(2,-2) === \"this.AssetID1\") {\r\n return 123\r\n } else {\r\n return 234\r\n }\r\n}\r\n\r\nvariables.xy = fn;",
"attributes": [
{
"name": "AssetID",
"expression": {
"type": "JavaScript",
"expression": ""
},
"defaultValue": ""
},
{
"name": "ProgramID",
"expression": {
"type": "JavaScript",
"expression": "return )}};"
}
},
{
"name": "ToolID",
"expression": {
"type": "JavaScript",
"expression": "return )}};"
}
},
{
"name": "MachineState",
"expression": {
"type": "JavaScript",
"expression": "return )}};"
}
},
{
"name": "ProductionCount",
"expression": {
"type": "JavaScript",
"expression": "return )}};"
}
},
{
"name": "RejectCount",
"expression": {
"type": "JavaScript",
"expression": "return )}};"
}
}
]
}
]
},
"conditions": [],
"functions": [],
"tags": [
{
"name": "eventBasedPipeline"
}
],
"pipelines": [
{
"name": "CNC_Event_Based_Pipeline",
"uri": "pipeline",
"tags": [
"Adv_UNS",
"eventBasedPipeline"
],
"settings": {
"inputStages": [
"parseSourceParameters"
],
"trackActivity": true,
"triggers": [
{
"name": "EventTrigger",
"config": {
"type": ".TriggerEvent",
"enabled": true,
"reference": ""
},
"display": {
"position": {
"x": -450,
"y": 0
}
}
}
],
"stages": [
{
"name": "readInstance",
"outputs": [
"mergeObj"
],
"config": {
"type": ".ReadSourcesConfig",
"keyReferences": [
{
"location": "child",
"key": "Source1",
"reference": ")}}"
}
],
"inputValueLocation": "child",
"inputValueKey": "eventIn"
},
"display": {
"position": {
"x": 1590,
"y": 0
}
}
},
{
"name": "parseSourceParameters",
"outputs": [
"modelEventData"
],
"config": {
"type": ".TransformConfig",
"transformExpression": "const fullString = event.metadata.source;//\"Connection.OPC_UA.Fanuc_1003(eventSelect=\\\"event\\\",event=\\\"event\\\",AssetID=\\\"Fanuc_1003\\\")\";\r\nconst startIndex = fullString.indexOf(\"(\") + 1;\r\nconst endIndex = fullString.lastIndexOf(\")\");\r\nconst extractedString = fullString.substring(startIndex, endIndex);\r\nconst objString = '{' + extractedString.replace(/=/g, ':').replace(/(\\w+):/g, '\"$1\":') + '}';\r\nconst resultObject = JSON.parse(objString);\r\n\r\nstage.setMetadata(\"parameters\",resultObject)\r\n\r\n//const assetIdValue = event.metadata.source.match(/AssetID=\"([^\"]+)\"/)[1];\r\nstage.setValue(\"123\");//event.value);\r\nstage.setMetadata(\"eventType\",\"AssetID\");"
},
"display": {
"position": {
"x": 240,
"y": 0
}
}
},
{
"name": "modelEventData",
"outputs": [
"filterEventPair"
],
"config": {
"type": ".ModelConfig",
"model": "CNC_Machine_Production_Data_Model",
"objectName": "",
"initExpression": "",
"attributes": [
{
"name": "AssetID",
"expression": {
"type": "JavaScript",
"expression": "return event.metadata.parameters.AssetID;"
},
"defaultValue": ""
},
{
"name": "ProgramID",
"expression": {
"type": "JavaScript",
"expression": "return (event.metadata.parameters.ProgramID)? event.value : undefined;"
},
"defaultValue": ""
},
{
"name": "ToolID",
"expression": {
"type": "JavaScript",
"expression": "return (event.metadata.parameters.ToolID)? event.value : undefined;"
}
},
{
"name": "MachineState",
"expression": {
"type": "JavaScript",
"expression": "if (event.metadata.parameters.eventType === \"MachineState\") return event.value;"
}
},
{
"name": "ProductionCount",
"expression": {
"type": "JavaScript",
"expression": "return (event.metadata.parameters.ProductionCount)? event.value : null;"
},
"defaultValue": ""
},
{
"name": "RejectCount",
"expression": {
"type": "JavaScript",
"expression": "return (event.metadata.parameters.RejectCount)? event.value : undefined;"
}
}
]
},
"display": {
"position": {
"x": 690,
"y": 0
}
}
},
{
"name": "ModelValidation",
"outputs": [
"mqttPublishPayload"
],
"config": {
"type": ".ModelValidationConfig",
"failureOutputs": [],
"models": [
"CNC_Machine_Production_Data_Model"
],
"additionalProperties": "fail"
},
"display": {
"position": {
"x": 2490,
"y": 0
}
}
},
{
"name": "mqttPublishPayload",
"outputs": [],
"config": {
"type": ".DynamicWriteConfig",
"failureOutputs": [],
"connectionReference": "",
"qualifier": {
"topic": "modeledEvent",
"qos": 0,
"namedRoot": false,
"retained": false,
"breakupArrays": false
},
"qualifierExpression": "",
"ignoreResult": false,
"connectionType": "mqtt"
},
"display": {
"position": {
"x": 2940,
"y": 0
}
}
},
{
"name": "mergeObj",
"outputs": [
"ModelValidation"
],
"config": {
"type": ".TransformConfig",
"transformExpression": "//{...instance, ...event};\r\nstage.setValue({...event.value.Source1,...event.value.eventIn});\r\n//stage.setValue({...event.value.eventIn,...event.value.Source1});"
},
"display": {
"position": {
"x": 2040,
"y": 0
}
}
},
{
"name": "filterEventPair",
"outputs": [
"readInstance"
],
"config": {
"type": ".TransformConfig",
"transformExpression": "//stage.setValue(event.value[event.metadata.parameters.eventType]);\r\n\r\nconst filterByKey = (obj, key) => {\r\n return Object.fromEntries(\r\n Object.entries(obj).filter(([k]) => k === key)\r\n );\r\n};\r\n\r\n// Example usage:\r\nconst obj = event.value;//{ a: 1, b: 2, c: 3 };\r\nconst result = filterByKey(obj, event.metadata.parameters.eventType); //filterByKey(obj,'b')\r\nstage.setValue(result); //{ b: 2 }"
},
"display": {
"position": {
"x": 1140,
"y": 0
}
}
}
]
}
}
],
"namespace": []
},
"network": {
"groups": [],
"hubs": []
}
}