-
Notifications
You must be signed in to change notification settings - Fork 7
/
iotGateway-flow.json
1 lines (1 loc) · 2.51 KB
/
iotGateway-flow.json
1
[{"id":"9a3fe20a.8572d","type":"tab","label":"IoT Gateway","disabled":false,"info":""},{"id":"8e6be387.e0155","type":"mqtt out","z":"9a3fe20a.8572d","name":"","topic":"CloudConnector/toAWS","qos":"","retain":"","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"abbccb3f8ed3481b","x":870,"y":320,"wires":[]},{"id":"1e8ada84.8caca5","type":"comment","z":"9a3fe20a.8572d","name":"Before Deploying: \\n - Enter the username and password of the IE Databus user in the configuration of the mqtt nodes \\n - Verify whether the topics correspond to your OPC UA Connector and Databus configuration, change if necessary","info":"","x":420,"y":220,"wires":[]},{"id":"9f128c41.da1d1","type":"mqtt in","z":"9a3fe20a.8572d","name":"","topic":"CloudConnector/toAWS","qos":"2","datatype":"auto","broker":"abbccb3f8ed3481b","nl":false,"rap":false,"inputs":0,"x":540,"y":420,"wires":[["c126e086.d0451"]]},{"id":"c126e086.d0451","type":"debug","z":"9a3fe20a.8572d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":420,"wires":[]},{"id":"f32c79cb1a467d14","type":"mqtt in","z":"9a3fe20a.8572d","name":"","topic":"ie/d/j/simatic/v1/opcuac1/dp/r/plc1/default","qos":"2","datatype":"json","broker":"abbccb3f8ed3481b","nl":false,"rap":false,"inputs":0,"x":200,"y":320,"wires":[["2291f032d7050ee0"]]},{"id":"2291f032d7050ee0","type":"function","z":"9a3fe20a.8572d","name":"calculate flow [m3/min]","func":"\n//formula to calculate flowrate from discrete values: \n// flowrate = delta l / delta t\n\n// get previous level from context variable or 0 if it is not existing\nvar level1 = flow.get(\"level1\")||0;\n\n//get current level\nvar level2 = msg.payload.vals[0].val;\n//var level2 = tankLevel.vals[0].val;\n\n\n//calculate volume difference\nvar flowrate = (level2 -level1)\n\n//save current level to context variable\nflow.set(\"level1\",msg.payload.vals[0].val);\n\n//change l/s in m3/min\nmsg.payload=(flowrate*0.06);\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":540,"y":320,"wires":[["8e6be387.e0155"]]},{"id":"abbccb3f8ed3481b","type":"mqtt-broker","name":"","broker":"ie-databus","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""}]