Files
rotatingMachine/examples/integration.flow.json
2026-02-19 17:36:44 +01:00

760 lines
19 KiB
JSON

[
{
"id": "12f41a7b538c40db",
"type": "tab",
"label": "RotatingMachine Integration",
"disabled": false,
"info": "Manual integration-style scenario builder for rotatingMachine"
},
{
"id": "ui_base_rm_int",
"type": "ui-base",
"name": "EVOLV Demo",
"path": "/dashboard",
"includeClientData": true,
"acceptsClientConfig": [
"ui-notification",
"ui-control"
],
"showPathInSidebar": false,
"headerContent": "page",
"navigationStyle": "default",
"titleBarStyle": "default"
},
{
"id": "ui_theme_rm_int",
"type": "ui-theme",
"name": "EVOLV Integration Theme",
"colors": {
"surface": "#ffffff",
"primary": "#0094ce",
"bgPage": "#eeeeee",
"groupBg": "#ffffff",
"groupOutline": "#cccccc"
},
"sizes": {
"density": "default",
"pagePadding": "14px",
"groupGap": "14px",
"groupBorderRadius": "6px",
"widgetGap": "12px"
}
},
{
"id": "ui_page_rm_int",
"type": "ui-page",
"name": "RotatingMachine Integration",
"ui": "ui_base_rm_int",
"path": "/rotating-machine-integration",
"icon": "lan",
"layout": "grid",
"theme": "ui_theme_rm_int",
"breakpoints": [
{
"name": "Default",
"px": "0",
"cols": "12"
}
],
"order": 2,
"className": ""
},
{
"id": "ui_group_rm_int_ctrl",
"type": "ui-group",
"name": "Control Sequences",
"page": "ui_page_rm_int",
"width": "6",
"height": "1",
"order": 1,
"showTitle": true,
"className": ""
},
{
"id": "ui_group_rm_int_sim",
"type": "ui-group",
"name": "Process Simulation",
"page": "ui_page_rm_int",
"width": "6",
"height": "1",
"order": 2,
"showTitle": true,
"className": ""
},
{
"id": "ui_group_rm_int_vis",
"type": "ui-group",
"name": "Observed Behaviour",
"page": "ui_page_rm_int",
"width": "12",
"height": "24",
"order": 3,
"showTitle": true,
"className": ""
},
{
"id": "rm_node_int",
"type": "rotatingMachine",
"z": "12f41a7b538c40db",
"name": "RM Integration",
"speed": "1",
"startup": "3",
"warmup": "3",
"shutdown": "3",
"cooldown": "3",
"movementMode": "staticspeed",
"machineCurve": "",
"uuid": "",
"supplier": "hidrostal",
"category": "machine",
"assetType": "pump-centrifugal",
"model": "hidrostal-H05K-S03R",
"unit": "m3/h",
"enableLog": false,
"logLevel": "error",
"positionVsParent": "atEquipment",
"x": 1040,
"y": 360,
"wires": [
[
"rm_int_parse"
],
[
"rm_int_debug_influx"
],
[
"rm_int_debug_parent"
]
],
"hasDistance": false
},
{
"id": "rm_int_startup",
"type": "ui-button",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_ctrl",
"name": "Startup",
"label": "Startup",
"order": 1,
"width": "3",
"height": "1",
"icon": "play_arrow",
"payload": "startup",
"payloadType": "str",
"x": 190,
"y": 120,
"wires": [
[
"rm_int_exec_seq"
]
]
},
{
"id": "rm_int_shutdown",
"type": "ui-button",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_ctrl",
"name": "Shutdown",
"label": "Shutdown",
"order": 2,
"width": "3",
"height": "1",
"icon": "stop",
"payload": "shutdown",
"payloadType": "str",
"x": 190,
"y": 160,
"wires": [
[
"rm_int_exec_seq"
]
]
},
{
"id": "rm_int_maint",
"type": "ui-button",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_ctrl",
"name": "Maintenance",
"label": "Enter Maintenance",
"order": 3,
"width": "6",
"height": "1",
"icon": "build",
"payload": "entermaintenance",
"payloadType": "str",
"x": 220,
"y": 200,
"wires": [
[
"rm_int_exec_seq"
]
]
},
{
"id": "rm_int_exec_seq",
"type": "function",
"z": "12f41a7b538c40db",
"name": "Build execSequence",
"func": "msg.topic = 'execSequence';\nmsg.payload = {source:'GUI', action:'execSequence', parameter: msg.payload};\nreturn msg;",
"outputs": 1,
"x": 450,
"y": 160,
"wires": [
[
"rm_node_int"
]
]
},
{
"id": "rm_int_setpoint",
"type": "ui-number-input",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_ctrl",
"name": "Setpoint",
"label": "Setpoint %",
"order": 4,
"width": "6",
"height": "1",
"passthru": true,
"min": 0,
"max": 100,
"step": 1,
"x": 190,
"y": 260,
"wires": [
[
"rm_int_exec_movement",
"rm_int_ctrl_setpoint_for_chart"
]
]
},
{
"id": "rm_int_exec_movement",
"type": "function",
"z": "12f41a7b538c40db",
"name": "Build execMovement",
"func": "msg.topic='execMovement';\nmsg.payload={source:'GUI', action:'execMovement', setpoint:Number(msg.payload)};\nreturn msg;",
"outputs": 1,
"x": 460,
"y": 260,
"wires": [
[
"rm_node_int"
]
]
},
{
"id": "rm_int_flow_target",
"type": "ui-number-input",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_sim",
"name": "Flow target",
"label": "Flow target (m3/h)",
"order": 1,
"width": "6",
"height": "1",
"passthru": true,
"min": 0,
"max": 1000,
"step": 5,
"x": 200,
"y": 340,
"wires": [
[
"rm_int_flow_move",
"rm_int_flow_setpoint_for_chart"
]
]
},
{
"id": "rm_int_flow_move",
"type": "function",
"z": "12f41a7b538c40db",
"name": "Build flowMovement",
"func": "msg.topic='flowMovement';\nmsg.payload={source:'GUI', action:'flowMovement', setpoint:Number(msg.payload)};\nreturn msg;",
"outputs": 1,
"x": 450,
"y": 340,
"wires": [
[
"rm_node_int"
]
]
},
{
"id": "rm_int_pressure_up",
"type": "ui-number-input",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_sim",
"name": "Upstream Pressure",
"label": "Upstream pressure (mbar)",
"order": 2,
"width": "6",
"height": "1",
"passthru": true,
"min": 0,
"max": 3000,
"step": 10,
"x": 210,
"y": 390,
"wires": [
[
"rm_int_sim_up"
]
]
},
{
"id": "rm_int_pressure_down",
"type": "ui-number-input",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_sim",
"name": "Downstream Pressure",
"label": "Downstream pressure (mbar)",
"order": 3,
"width": "6",
"height": "1",
"passthru": true,
"min": 0,
"max": 3000,
"step": 10,
"x": 220,
"y": 430,
"wires": [
[
"rm_int_sim_down"
]
]
},
{
"id": "rm_int_sim_up",
"type": "function",
"z": "12f41a7b538c40db",
"name": "simulate upstream pressure",
"func": "msg.topic='simulateMeasurement';\nmsg.payload={type:'pressure', position:'upstream', value:Number(msg.payload), unit:'mbar'};\nreturn msg;",
"outputs": 1,
"x": 500,
"y": 390,
"wires": [
[
"rm_node_int"
]
]
},
{
"id": "rm_int_sim_down",
"type": "function",
"z": "12f41a7b538c40db",
"name": "simulate downstream pressure",
"func": "msg.topic='simulateMeasurement';\nmsg.payload={type:'pressure', position:'downstream', value:Number(msg.payload), unit:'mbar'};\nreturn msg;",
"outputs": 1,
"x": 510,
"y": 430,
"wires": [
[
"rm_node_int"
]
]
},
{
"id": "rm_int_parse",
"type": "function",
"z": "12f41a7b538c40db",
"name": "Parse RM output",
"func": "const incoming = (msg && msg.payload && typeof msg.payload === 'object') ? msg.payload : {};\nconst lastPayload = context.get('lastPayload') || {};\nconst merged = { ...lastPayload, ...incoming };\ncontext.set('lastPayload', merged);\n\nconst cache = context.get('metricCache') || {\n flow: 0,\n power: 0,\n ctrl: 0,\n nCog: 0,\n stateCode: 0,\n state: 'idle',\n mode: 'auto',\n runtime: 0,\n moveTimeleft: 0,\n maintenanceTime: 0,\n pressureUp: null,\n pressureDown: null,\n};\n\nconst pickNumber = (...keys) => {\n for (const key of keys) {\n const value = Number(merged[key]);\n if (Number.isFinite(value)) return value;\n }\n return null;\n};\n\nconst pickByPrefix = (...prefixes) => {\n const keys = Object.keys(merged);\n for (const prefix of prefixes) {\n const direct = Number(merged[prefix]);\n if (Number.isFinite(direct)) return direct;\n\n const dynamicKey = keys.find((k) => k === prefix || k.startsWith(prefix + '.'));\n if (!dynamicKey) continue;\n\n const value = Number(merged[dynamicKey]);\n if (Number.isFinite(value)) return value;\n }\n return null;\n};\n\nconst pickString = (key, fallback = null) => {\n const value = merged[key];\n if (value === undefined || value === null || value === '') return fallback;\n return String(value);\n};\n\nconst flowValue = pickByPrefix('flow.predicted.downstream');\nconst power = pickByPrefix('power.predicted.atequipment', 'power.predicted.atEquipment');\nconst ctrl = pickNumber('ctrl') ?? pickByPrefix('ctrl.predicted.atequipment', 'ctrl.predicted.atEquipment');\nconst nCog = pickNumber('NCogPercent', 'NCog');\nconst runtime = pickNumber('runtime');\nconst moveTimeleft = pickNumber('moveTimeleft');\nconst maintenanceTime = pickNumber('maintenanceTime');\nconst pressureDownIncoming = pickByPrefix('pressure.measured.downstream');\nconst pressureUpIncoming = pickByPrefix('pressure.measured.upstream');\nconst state = pickString('state', cache.state);\nconst mode = pickString('mode', cache.mode);\n\nconst stateCodeMap = { off: 0, idle: 1, starting: 2, warmingup: 3, operational: 4, accelerating: 5, decelerating: 6, stopping: 7, coolingdown: 8, maintenance: 9 };\nconst stateCode = stateCodeMap[state] ?? cache.stateCode;\n\nif (flowValue !== null) cache.flow = flowValue;\nif (power !== null) cache.power = power;\nif (ctrl !== null) cache.ctrl = ctrl;\nif (nCog !== null) cache.nCog = nCog;\nif (runtime !== null) cache.runtime = runtime;\nif (moveTimeleft !== null) cache.moveTimeleft = moveTimeleft;\nif (maintenanceTime !== null) cache.maintenanceTime = maintenanceTime;\nif (pressureUpIncoming !== null) cache.pressureUp = pressureUpIncoming;\nif (pressureDownIncoming !== null) cache.pressureDown = pressureDownIncoming;\ncache.state = state;\ncache.mode = mode;\ncache.stateCode = stateCode;\ncontext.set('metricCache', cache);\n\nconst pressureUp = Number.isFinite(cache.pressureUp) ? cache.pressureUp : null;\nconst pressureDown = Number.isFinite(cache.pressureDown) ? cache.pressureDown : null;\nconst pressureDelta = (pressureDown !== null && pressureUp !== null) ? (pressureDown - pressureUp) : null;\n\nconst now = Date.now();\nreturn [\n { topic: 'actual_flow', payload: cache.flow, timestamp: now },\n { topic: 'predicted_power', payload: cache.power, timestamp: now },\n { topic: 'nCog', payload: cache.nCog, timestamp: now },\n { topic: 'actual_ctrl', payload: cache.ctrl, timestamp: now },\n { topic: 'stateCode', payload: cache.stateCode, timestamp: now },\n { payload: JSON.stringify({ state: cache.state, mode: cache.mode, ctrl: cache.ctrl, runtime: cache.runtime, moveTimeleft: cache.moveTimeleft, maintenanceTime: cache.maintenanceTime, pressureUp, pressureDown, pressureDelta }) }\n];",
"outputs": 6,
"x": 1260,
"y": 360,
"wires": [
[
"rm_int_chart_flow"
],
[
"rm_int_chart_power"
],
[
"rm_int_chart_nCog"
],
[
"rm_int_chart_ctrl"
],
[
"rm_int_chart_statecode"
],
[
"rm_int_state_text"
]
]
},
{
"id": "rm_int_chart_flow",
"type": "ui-chart",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_vis",
"name": "Flow",
"label": "Flow (m3/h)",
"order": 1,
"width": 6,
"height": 4,
"chartType": "line",
"xAxisType": "time",
"yAxisLabel": "m3/h",
"removeOlder": "1",
"removeOlderUnit": "3600",
"x": 1510,
"y": 280,
"wires": [],
"showLegend": true,
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "timestamp",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"xmin": "",
"xmax": "",
"ymin": "",
"ymax": "",
"bins": 10,
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"interpolation": "linear",
"className": "",
"colors": [
"#0095FF",
"#FF0000",
"#FF7F0E",
"#2CA02C",
"#A347E1",
"#D62728",
"#FF9896",
"#9467BD",
"#C5B0D5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true
},
{
"id": "rm_int_chart_power",
"type": "ui-chart",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_vis",
"name": "Power",
"label": "Power (kW)",
"order": 2,
"width": 6,
"height": 4,
"chartType": "line",
"xAxisType": "time",
"yAxisLabel": "kW",
"removeOlder": "1",
"removeOlderUnit": "3600",
"x": 1510,
"y": 340,
"wires": [],
"showLegend": true,
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "timestamp",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"xmin": "",
"xmax": "",
"ymin": "",
"ymax": "",
"bins": 10,
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"interpolation": "linear",
"className": "",
"colors": [
"#0095FF",
"#FF0000",
"#FF7F0E",
"#2CA02C",
"#A347E1",
"#D62728",
"#FF9896",
"#9467BD",
"#C5B0D5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true
},
{
"id": "rm_int_chart_nCog",
"type": "ui-chart",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_vis",
"name": "NCog",
"label": "NCog (%)",
"order": 3,
"width": 6,
"height": 4,
"chartType": "line",
"xAxisType": "time",
"yAxisLabel": "%",
"removeOlder": "1",
"removeOlderUnit": "3600",
"x": 1510,
"y": 400,
"wires": [],
"showLegend": true,
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "timestamp",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"xmin": "",
"xmax": "",
"ymin": "",
"ymax": "",
"bins": 10,
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"interpolation": "linear",
"className": "",
"colors": [
"#0095FF",
"#FF0000",
"#FF7F0E",
"#2CA02C",
"#A347E1",
"#D62728",
"#FF9896",
"#9467BD",
"#C5B0D5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true
},
{
"id": "rm_int_state_text",
"type": "ui-text",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_vis",
"name": "State",
"label": "State Snapshot",
"order": 6,
"width": 12,
"height": 1,
"format": "{{msg.payload}}",
"layout": "row-spread",
"x": 1510,
"y": 460,
"wires": []
},
{
"id": "rm_int_debug_influx",
"type": "debug",
"z": "12f41a7b538c40db",
"name": "Influx",
"active": true,
"tosidebar": true,
"complete": "true",
"targetType": "full",
"x": 1250,
"y": 520,
"wires": []
},
{
"id": "rm_int_debug_parent",
"type": "debug",
"z": "12f41a7b538c40db",
"name": "Parent",
"active": true,
"tosidebar": true,
"complete": "true",
"targetType": "full",
"x": 1240,
"y": 560,
"wires": []
},
{
"id": "rm_int_chart_ctrl",
"type": "ui-chart",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_vis",
"name": "Ctrl",
"label": "Ctrl (%)",
"order": 4,
"width": 6,
"height": 4,
"chartType": "line",
"xAxisType": "time",
"yAxisLabel": "%",
"removeOlder": "1",
"removeOlderUnit": "3600",
"x": 1510,
"y": 460,
"wires": [],
"showLegend": true,
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "timestamp",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"xmin": "",
"xmax": "",
"ymin": "",
"ymax": "",
"bins": 10,
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"interpolation": "linear",
"className": "",
"colors": [
"#0095FF",
"#FF0000",
"#FF7F0E",
"#2CA02C",
"#A347E1",
"#D62728",
"#FF9896",
"#9467BD",
"#C5B0D5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true
},
{
"id": "rm_int_chart_statecode",
"type": "ui-chart",
"z": "12f41a7b538c40db",
"group": "ui_group_rm_int_vis",
"name": "State Code",
"label": "State Code (off=0 .. maint=9)",
"order": 5,
"width": 6,
"height": 4,
"chartType": "line",
"xAxisType": "time",
"yAxisLabel": "state",
"removeOlder": "1",
"removeOlderUnit": "3600",
"x": 1510,
"y": 520,
"wires": [],
"showLegend": true,
"category": "topic",
"categoryType": "msg",
"xAxisProperty": "",
"xAxisPropertyType": "timestamp",
"xAxisFormat": "",
"xAxisFormatType": "auto",
"yAxisProperty": "payload",
"yAxisPropertyType": "msg",
"xmin": "",
"xmax": "",
"ymin": "",
"ymax": "",
"bins": 10,
"action": "append",
"stackSeries": false,
"pointShape": "circle",
"pointRadius": 4,
"interpolation": "linear",
"className": "",
"colors": [
"#0095FF",
"#FF0000",
"#FF7F0E",
"#2CA02C",
"#A347E1",
"#D62728",
"#FF9896",
"#9467BD",
"#C5B0D5"
],
"textColor": [
"#666666"
],
"textColorDefault": true,
"gridColor": [
"#e5e5e5"
],
"gridColorDefault": true
},
{
"id": "rm_int_ctrl_setpoint_for_chart",
"type": "function",
"z": "12f41a7b538c40db",
"name": "ctrl setpoint series",
"func": "msg.topic = 'setpoint_ctrl';\nmsg.payload = Number(msg.payload);\nreturn Number.isFinite(msg.payload) ? msg : null;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 560,
"y": 220,
"wires": [
[
"rm_int_chart_ctrl"
]
]
},
{
"id": "rm_int_flow_setpoint_for_chart",
"type": "function",
"z": "12f41a7b538c40db",
"name": "flow setpoint series",
"func": "msg.topic = 'setpoint_flow';\nmsg.payload = Number(msg.payload);\nreturn Number.isFinite(msg.payload) ? msg : null;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 570,
"y": 330,
"wires": [
[
"rm_int_chart_flow"
]
]
}
]