-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38dcefb
commit b7e7151
Showing
24 changed files
with
213 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
config-cloud-gateway.json | ||
config-opcua.json | ||
config-simulator.json | ||
#if you need a specific settings.js remove this and change the script that creates the config.zip | ||
settings.js | ||
flows.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#use bash format. | ||
#ensure that 'source /config/env' is added to the container entry_point.sh file that needs it | ||
#export MYENVVAR=VALUE | ||
|
||
export HIGHHIGH="4" | ||
export HIGH="3.5" | ||
export LOW="2.5" | ||
export LOWLOW="2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"id":"b2e192e7.2ec24","type":"tab","label":"M+M+Demo+Flow","disabled":false,"info":""},{"id":"9e4f5511.a28c98","type":"subflow","name":"Subflow 2","info":"","in":[],"out":[]},{"id":"1b9b7e8f.439c61","type":"subflow","name":"Subflow 3","info":"1. Opens the OPC Adapter Config file\n2. Grabs the MQTT config info\n3. Sends it to the Debug Window\n","in":[],"out":[]},{"id":"490c44b7.a0bf0c","type":"mqtt-broker","z":"","name":"","broker":"mqtt-tcp://predix-edge-broker","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"5b0e890d.8c6228","type":"file in","z":"9e4f5511.a28c98","name":"ConfigIn","filename":"/config/config-cloud-gateway.json","format":"utf8","chunk":false,"sendError":false,"x":300,"y":60,"wires":[["718ccce4.faa1e4"]]},{"id":"58c0f78e.a320b8","type":"debug","z":"9e4f5511.a28c98","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":690,"y":60,"wires":[]},{"id":"718ccce4.faa1e4","type":"function","z":"9e4f5511.a28c98","name":"GetMQTTSection","func":"var config = JSON.parse(msg.payload);\nmsg.payload = config.blocks.time_series_sender.config.mqtt;\nreturn msg;\n","outputs":1,"noerr":0,"x":510,"y":60,"wires":[["58c0f78e.a320b8"]]},{"id":"dc44d76f.e9ce78","type":"inject","z":"9e4f5511.a28c98","name":"TriggerFlow","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":true,"onceDelay":0.1,"x":130,"y":60,"wires":[["5b0e890d.8c6228"]]},{"id":"40b61585.53378c","type":"debug","z":"1b9b7e8f.439c61","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":710,"y":40,"wires":[]},{"id":"f9ec0b4e.f7b878","type":"function","z":"1b9b7e8f.439c61","name":"GetMQTTSection","func":"var config = JSON.parse(msg.payload);\nmsg.payload = config.blocks.mqtt.config;\nreturn msg;\n","outputs":1,"noerr":0,"x":490,"y":40,"wires":[["40b61585.53378c"]]},{"id":"89c44c60.b489c","type":"file in","z":"1b9b7e8f.439c61","name":"ConfigIn","filename":"/config/config-opcua.json","format":"utf8","chunk":false,"sendError":false,"x":300,"y":40,"wires":[["f9ec0b4e.f7b878"]]},{"id":"3010433f.7353fc","type":"inject","z":"1b9b7e8f.439c61","name":"TriggerFlow","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":true,"onceDelay":0.1,"x":130,"y":40,"wires":[["89c44c60.b489c"]]},{"id":"c29d3e42.6f54d","type":"mqtt in","z":"b2e192e7.2ec24","name":"From OPCUA Adapter","topic":"app_data","qos":"2","broker":"490c44b7.a0bf0c","x":140,"y":180,"wires":[["321280bb.a13ec"]]},{"id":"a72237c7.469d38","type":"mqtt out","z":"b2e192e7.2ec24","name":"To Cloud Gateway","topic":"timeseries_data","qos":"","retain":"","broker":"490c44b7.a0bf0c","x":650,"y":180,"wires":[]},{"id":"1a04e44.042991c","type":"subflow:9e4f5511.a28c98","z":"b2e192e7.2ec24","name":"CloudGatewayConfig","x":120,"y":100,"wires":[]},{"id":"14aca965.485a97","type":"debug","z":"b2e192e7.2ec24","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":210,"y":280,"wires":[]},{"id":"7bd7b6de.3adf38","type":"subflow:1b9b7e8f.439c61","z":"b2e192e7.2ec24","name":"OPCUAAdapterConfig","x":120,"y":60,"wires":[]},{"id":"321280bb.a13ec","type":"function","z":"b2e192e7.2ec24","name":"Deadband Filter","func":"//read the message into a json object\n var item = JSON.parse(msg.payload);\n var HIGHHIGH = context.global.process.env.HIGHHIGH;\n var HIGH = context.global.process.env.HIGH;\n var LOW = context.global.process.env.LOW;\n var LOWLOW = context.global.process.env.LOWLOW;\n //scale up the value by 1000 and put it back on the broker topic to be sent to Predix Time Series\n for ( var i=0;i<item.body.length;i++)\n {\n var tagName = item.body[i].name;\n var value = item.body[i].datapoints[0][1];\n\n var scaled_item = JSON.stringify(item);\n msg.payload = scaled_item\n\n \n if ( value < HIGHHIGH && value > LOWLOW ) {\n return msg\n }\n else {\n return null; \n }\n\n //publish the tag back to the broker on the topic the cloud-gateway\n //container is subscribing to\n\n return msg;\n }\n","outputs":1,"noerr":0,"x":400,"y":180,"wires":[["a72237c7.469d38"]]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "node-red-project", | ||
"description": "A Node-RED Project", | ||
"version": "0.0.1", | ||
"private": true | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#use bash format. | ||
#ensure that 'source /config/env' is added to the container entry_point.sh file that needs it | ||
#export MYENVVAR=VALUE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"id":"b2e192e7.2ec24","type":"tab","label":"M+M+Demo+Flow","disabled":false,"info":""},{"id":"9e4f5511.a28c98","type":"subflow","name":"Subflow 2","info":"","in":[],"out":[]},{"id":"1b9b7e8f.439c61","type":"subflow","name":"Subflow 3","info":"1. Opens the OPC Adapter Config file\n2. Grabs the MQTT config info\n3. Sends it to the Debug Window\n","in":[],"out":[]},{"id":"490c44b7.a0bf0c","type":"mqtt-broker","z":"","name":"","broker":"mqtt-tcp://predix-edge-broker","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"5b0e890d.8c6228","type":"file in","z":"9e4f5511.a28c98","name":"ConfigIn","filename":"/config/config-cloud-gateway.json","format":"utf8","chunk":false,"sendError":false,"x":300,"y":60,"wires":[["718ccce4.faa1e4"]]},{"id":"58c0f78e.a320b8","type":"debug","z":"9e4f5511.a28c98","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":690,"y":60,"wires":[]},{"id":"718ccce4.faa1e4","type":"function","z":"9e4f5511.a28c98","name":"GetMQTTSection","func":"var config = JSON.parse(msg.payload);\nmsg.payload = config.blocks.time_series_sender.config.mqtt;\nreturn msg;\n","outputs":1,"noerr":0,"x":510,"y":60,"wires":[["58c0f78e.a320b8"]]},{"id":"dc44d76f.e9ce78","type":"inject","z":"9e4f5511.a28c98","name":"TriggerFlow","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":true,"onceDelay":0.1,"x":130,"y":60,"wires":[["5b0e890d.8c6228"]]},{"id":"40b61585.53378c","type":"debug","z":"1b9b7e8f.439c61","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":710,"y":40,"wires":[]},{"id":"f9ec0b4e.f7b878","type":"function","z":"1b9b7e8f.439c61","name":"GetMQTTSection","func":"var config = JSON.parse(msg.payload);\nmsg.payload = config.blocks.mqtt.config;\nreturn msg;\n","outputs":1,"noerr":0,"x":490,"y":40,"wires":[["40b61585.53378c"]]},{"id":"89c44c60.b489c","type":"file in","z":"1b9b7e8f.439c61","name":"ConfigIn","filename":"/config/config-opcua.json","format":"utf8","chunk":false,"sendError":false,"x":300,"y":40,"wires":[["f9ec0b4e.f7b878"]]},{"id":"3010433f.7353fc","type":"inject","z":"1b9b7e8f.439c61","name":"TriggerFlow","topic":"","payload":"","payloadType":"date","repeat":"15","crontab":"","once":true,"onceDelay":0.1,"x":130,"y":40,"wires":[["89c44c60.b489c"]]},{"id":"c29d3e42.6f54d","type":"mqtt in","z":"b2e192e7.2ec24","name":"From OPCUA Adapter","topic":"app_data","qos":"2","broker":"490c44b7.a0bf0c","x":140,"y":180,"wires":[["321280bb.a13ec"]]},{"id":"a72237c7.469d38","type":"mqtt out","z":"b2e192e7.2ec24","name":"To Cloud Gateway","topic":"timeseries_data","qos":"","retain":"","broker":"490c44b7.a0bf0c","x":650,"y":180,"wires":[]},{"id":"1a04e44.042991c","type":"subflow:9e4f5511.a28c98","z":"b2e192e7.2ec24","name":"CloudGatewayConfig","x":120,"y":100,"wires":[]},{"id":"14aca965.485a97","type":"debug","z":"b2e192e7.2ec24","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":210,"y":280,"wires":[]},{"id":"7bd7b6de.3adf38","type":"subflow:1b9b7e8f.439c61","z":"b2e192e7.2ec24","name":"OPCUAAdapterConfig","x":120,"y":60,"wires":[]},{"id":"321280bb.a13ec","type":"function","z":"b2e192e7.2ec24","name":"Deadband Filter","func":"//read the message into a json object\n var item = JSON.parse(msg.payload);\n var HIGHHIGH = context.global.process.env.HIGHHIGH;\n var HIGH = context.global.process.env.HIGH;\n var LOW = context.global.process.env.LOW;\n var LOWLOW = context.global.process.env.LOWLOW;\n //scale up the value by 1000 and put it back on the broker topic to be sent to Predix Time Series\n for ( var i=0;i<item.body.length;i++)\n {\n var tagName = item.body[i].name;\n var value = item.body[i].datapoints[0][1];\n\n var scaled_item = JSON.stringify(item);\n msg.payload = scaled_item\n\n \n if ( value < HIGHHIGH && value > LOWLOW ) {\n return msg\n }\n else {\n return null; \n }\n\n //publish the tag back to the broker on the topic the cloud-gateway\n //container is subscribing to\n\n return msg;\n }\n","outputs":1,"noerr":0,"x":400,"y":180,"wires":[["a72237c7.469d38"]]}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.