Difference between revisions of "Open Control Architecture"
Line 43: | Line 43: | ||
{{Block |Where a number of nodes sit on a Local Area Network (LAN) it is common to use a central local MQTT broker. }} | {{Block |Where a number of nodes sit on a Local Area Network (LAN) it is common to use a central local MQTT broker. }} | ||
[[File:Mqtt6a.png|center|frameless| | [[File:Mqtt6a.png|center|frameless|768x768px]] | ||
[[File:Handler3.png|center]] | [[File:Handler3.png|center]] | ||
{{Block |Traffic can be routed to a Cloud MQTT broker by the use of MQTT Bridges. These run on an MQTT broker, and can re-publish messages filtered by topic (''networkId'') to another broker. Bridges are managed outside of Node-RED.}} | {{Block |Traffic can be routed to a Cloud MQTT broker by the use of MQTT Bridges. These run on an MQTT broker, and can re-publish messages filtered by topic (''networkId'') to another broker. Bridges are managed outside of Node-RED.}} | ||
Line 50: | Line 50: | ||
[[File:Handler5.png|center]] | [[File:Handler5.png|center]] | ||
{{Block |On larger networks where data is shared between local nodes, '''''Reporting By Exception''''' can be centrally managed using a Node-RED instance, along with any additional MQTT broker functions such as providing backup routes.}} | {{Block |On larger networks where data is shared between local nodes, '''''Reporting By Exception''''' can be centrally managed using a Node-RED instance, along with any additional MQTT broker functions such as providing backup routes.}} | ||
[[File:Mqtt6a2.png|center|frameless| | [[File:Mqtt6a2.png|center|frameless|796x796px]] | ||
[[File:Handler6.png|center]] | [[File:Handler6.png|center]] | ||
[[File:Handler4.png|center]] | [[File:Handler4.png|center]] |
Revision as of 23:37, 4 June 2022
A node can be:
- a function block within Node-RED
- an instance of Node-RED
- any point (server or device) in the communications network
myNetwork/plantroomNode/plantroomNode/system/title= "Main Plantroom Controller"
block1/blk1node/blk1node/system/title= "Block 1 Controller"
Adding a prefix to sub-networks ensures networks remain unique on a higher level server. E.g. There may be two unconnected networks with sub-networks called "block1".
myNetwork-block1/blk1node/blk1node/system/title= "Block 1 Controller"
anotherNetwork-block1/blk1node/blk1node/system/title= "Block 1 Controller"
- The Node has two outputs - one for local traffic, and one for external traffic.
- Report by exception rules are applied to external traffic.
- The Node formats topics to the five level standard, adding group and device if missing.
- The Node stores data into global.readings, along with any attributes within the incoming message, as well as timestamps.
- Additional routing can be performed within Node-RED, including selection of retained vs fire & forget routes.
- dat (operational data)
- stat (statistics and status)
- settings (persistent settings)
- cmd (a command)
- set (command to change a setting)
- system (software and networking)
- meter (meter data)
- alarm (alarms and warnings)
- ana (analogue readings)
- pcdb (pcdb data)
- design (preloaded design data)
The current data can be viewed in the data explorer.
Settings have a type, may have maximum and minimum values, units and a title. Certain types require additional fields such as select from a list settings.
The snapshot below shows a variety of setting types including numeric/text values, html, or JSON objects and arrays.
e.g. a message with a topic myNetwork/node123/myDevice/dat/outputTemperature would be stored in (global).readings.myNetwork.myDevice.dat.outputTemperature.value
Internally, message topics can be truncated and the network and node will be filled in. The data group will be assumed to be "dat" if not supplied, representing operational data.
e.g. a message with a topic setpoint would be stored in (global).readings.local.myNode.dat.setpoint.value
The following code could be used to read data and its attributes for output.
var localNetworkId = global.get("localNetworkId"); var node = global.get("node"); var reading = global.get("readings." + localNetworkId + "." + node + ".dat.outputTemperature"); var output = "The value of " + reading.title + " is " + reading.value + reading.units; // "The value of Output Temperature is 35°C