OPC UA and Node-Red

It's hard to tell the difference for me as well because these are public contributions submitted. Even you can make your own and name it like

node-red-contrib-digs-opcua

Node-RED is open so anyone can contribute by using the convention

node-red-contrib-xxxxx

As long as you're able to solve your problem you can use anyone of them. Sometimes both of them in one flow but the flow should logically make sense because in Node-RED the flow is the data flow so we're dealing with data as in msg object which has different parameters e.g. topic, payload etc. As long as you understand these parameters, you know the inputs and outputs of each node.

1 Like

kindly have a look at the flow sir!

I have seen it. You're showing the flow but not the output. You can get the output from the debug menu located on top left or from the command prompt from where you're running Node-RED.

Its blank..the debug window is blank. no response.

From where are you getting the data? is it a simulation server or a real server?
Have you injected the data?
Try to inject the data by clicking on the left button on inject node.

Its a real server.
Following are the the details of node value.
also you can see that there is no display in output window even after deploying.

and yes i have injected the data

Basically we're a team at IIT Delhi doing a research on Smart manufacturing, and we are stuck on Node-Red for a while. It would be great if you could help us.

1 Like

Set the payload to timestamp

We've already tried that sir. Still nothingHere is the node ID:-

ns=6;s=::AsGlobalPV:OPC_Pallet_Entry

@sajidb we are using UAExpert to check the validity of data by client software.

@sajidb i tried using ns=6;s=OPC_Pallet_Entry as you suggested. but it didn't work.
here is the screenshot
we tried changing the node id

@sajid yes it was ns=6 earlier
we updated it to ns=7 and made the necessary changes everywhere.
also, this site is not allowing me to reply anymore, thats why i am making edits and replying to you. is there anywhere else we can talk over? like mail?
here is my id: parthiitdelhi@gmail.com
.
.
.
@sajid i am not able to reply in their connectivity as well....

If possible please revert through mail and we can discuss further communication methods thereafter.

The same settings are working for me.

This inject node may confuse you with multiple options.

When you use a new tool, try to keep it simple in the start.You can try it with the simple inject node in input module. This one:
image

Also, tell me how are you getting your nodeid?

Please share your nodeid.

The current status is that you're connected to the server but not being able to get the data from there.
You can check the validity of data by a client software like UAExpert or Prosys OPC UA Client. Both are free to use. You can also get teh nodeid from there. Just copy and paste it from there to your inject node.

I am not an expert in OPC UA Server but I think you need to change this. Try to check it with a client software if the nodeid and its format is correct. Try using
ns=6;s=OPC_Pallet_Entry

Can you show screenshot of the node in UAExpert?

@Digs_10
This should be your nodeid

ns=7;s=::AsGlobalPV:OPC_Pallet_Entry

You were using ns=6 before. Right?

@Digs_10, I have sent you an email. Please check

@Digs_10,
Here is how mine is setup.

inject node with just a timestamp, an OPC UA Item node with the address, all fed to one OPC UA Client node that is linked to the server.

image
image
image

2 Likes

Good afternoon I'm also using an industrial B & R pc and would like to read a variable With the actual client, could you send me an example of how to read this not B & R opc server?

Further to this topic, I am trying to find the endpoint in my application. Here is a picture of my configuration, including the Matrikon Explorer window. How do I first, copy the path, and second where do I paste it? Above is a picture showing what I tried using for an endpoint in the OPC UA connector node. I tried many other variations, nothing worked. Anyone with some ideas, much appreciated.

You have forward slash and back slash in the address. Why would you expect that work?

Try this:
opc.tcp://localhost:4840

Hello seth350,

sorry for the late reply to the topic and get it back from the graveyard.
I got a similiar setup as your shown in the screenshot but I can't get past the "OPCUAClient"-Node. Could you provide information on how you configured the "join"-Node and the "switch"-Node after the client? I can't manage to merge it properly.

Thanks in advance!

@rkm,

I have since reconfigured how I read the values.
I created a subflow to contain the actual, high limit, low limit, setpoint nodes. I can then just specify which tank number to read and pass that to the OPC UA Client node. I then join it all up and store it to a global context where I can just query the context in another section and send it where ever I need it.
I am including the flow here for you.

[{"id":"7d848b6a.1b85e4","type":"subflow","name":"Tank Interface","info":"","category":"","in":[{"x":290,"y":210,"wires":[{"id":"2c14c263.6ab86e"}]}],"out":[{"x":620,"y":210,"wires":[{"id":"2c14c263.6ab86e","port":0}]}],"env":[{"name":"Tank Number","type":"num","value":""}]},{"id":"2c14c263.6ab86e","type":"function","z":"7d848b6a.1b85e4","name":"","func":"\nvar n = env.get(\"Tank Number\")\n\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Temp.Actual\",\"datatype\":\"Int16\",\"browseName\":\"tactual\",\"tank\":n})\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Temp.High\",\"datatype\":\"Int16\",\"browseName\":\"thighlimit\",\"tank\":n})\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Temp.Low\",\"datatype\":\"Int16\",\"browseName\":\"tlowlimit\",\"tank\":n})\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Temp.Setpoint\",\"datatype\":\"Int16\",\"browseName\":\"tsetpoint\",\"tank\":n})\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Cond.Actual\",\"datatype\":\"Int16\",\"browseName\":\"cactual\",\"tank\":n})\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Cond.Setpoint\",\"datatype\":\"Int16\",\"browseName\":\"csetpoint\",\"tank\":n})\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Temp.Cp\",\"datatype\":\"Float\",\"browseName\":\"tcp\",\"tank\":n})\nnode.send({\"topic\":\"ns=6;s=::AsGlobalPV:PTank[\"+n+\"].Temp.Cpk\",\"datatype\":\"Float\",\"browseName\":\"tcpk\",\"tank\":n})\n\n","outputs":1,"noerr":0,"x":460,"y":210,"wires":[[]]},{"id":"8de8f5d3.784b58","type":"OpcUa-Client","z":"ce9dc471.30ead8","endpoint":"7d3a54f8.ae3efc","action":"read","deadbandvalue":"","time":"6","timeUnit":"s","localfile":"","name":"","x":550,"y":790,"wires":[["254b938e.f92c1c"]]},{"id":"136c067d.690e9a","type":"inject","z":"ce9dc471.30ead8","name":"Polling Interval","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":true,"onceDelay":"3","x":170,"y":790,"wires":[["e70c2c10.986f2","6bff9f84.be985","ee3c014.c5426","ebeb5c19.46ca6","67671995.afa778","a7445d1b.53b8d","d3b6b93f.34e628","31ca1d2a.f3d9f2","cf28aafb.904c58","e9f37ae5.5de368","3b951cdd.3c95c4","e7025aff.b966d8","3c8769.a4724898","8e2c5aff.a4b3b8","9ca5d8b1.3bf958","118f1365.5a8d2d","e51f5f4f.bf51e","b80a0c0b.47cf7","375c9479.83424c","acd3cf65.5282c","93d7e302.1ab57","60baa94c.ac9818","a2bb6a1e.b8bbf8","d1f47cb1.0f5ef","53b1ab2e.402514"]]},{"id":"254b938e.f92c1c","type":"join","z":"ce9dc471.30ead8","name":"Join values from inside each subflow","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"browseName","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"8","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":800,"y":790,"wires":[["e3393c50.8f8b7"]]},{"id":"c95b3c04.beed1","type":"change","z":"ce9dc471.30ead8","name":"Tank #3","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[3].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[3].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[3].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[3].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":950,"wires":[["eba077c6.e17358"]]},{"id":"df13524c.baa6b","type":"change","z":"ce9dc471.30ead8","name":"Tank #2","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[2].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[2].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[2].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[2].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":920,"wires":[["f5944b08.876de8"]]},{"id":"b80a0c0b.47cf7","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #23 ","env":[{"name":"Tank Number","type":"num","value":"23"}],"x":360,"y":1030,"wires":[["8de8f5d3.784b58"]]},{"id":"e70c2c10.986f2","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #1","env":[{"name":"Tank Number","type":"num","value":"1"}],"x":360,"y":350,"wires":[["8de8f5d3.784b58"]]},{"id":"6bff9f84.be985","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #2","env":[{"name":"Tank Number","type":"num","value":"2"}],"x":360,"y":390,"wires":[["8de8f5d3.784b58"]]},{"id":"ee3c014.c5426","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #3","env":[{"name":"Tank Number","type":"num","value":"3"}],"x":360,"y":430,"wires":[["8de8f5d3.784b58"]]},{"id":"ebeb5c19.46ca6","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #4","env":[{"name":"Tank Number","type":"num","value":"4"}],"x":360,"y":470,"wires":[["8de8f5d3.784b58"]]},{"id":"67671995.afa778","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #5","env":[{"name":"Tank Number","type":"num","value":"5"}],"x":360,"y":510,"wires":[["8de8f5d3.784b58"]]},{"id":"a7445d1b.53b8d","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #6","env":[{"name":"Tank Number","type":"num","value":"6"}],"x":360,"y":550,"wires":[["8de8f5d3.784b58"]]},{"id":"d3b6b93f.34e628","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #7","env":[{"name":"Tank Number","type":"num","value":"7"}],"x":360,"y":590,"wires":[["8de8f5d3.784b58"]]},{"id":"31ca1d2a.f3d9f2","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #8","env":[{"name":"Tank Number","type":"num","value":"8"}],"x":360,"y":630,"wires":[["8de8f5d3.784b58"]]},{"id":"cf28aafb.904c58","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #9","env":[{"name":"Tank Number","type":"num","value":"9"}],"x":360,"y":670,"wires":[["8de8f5d3.784b58"]]},{"id":"e9f37ae5.5de368","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #11","env":[{"name":"Tank Number","type":"num","value":"11"}],"x":360,"y":710,"wires":[["8de8f5d3.784b58"]]},{"id":"3b951cdd.3c95c4","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #12","env":[{"name":"Tank Number","type":"num","value":"12"}],"x":360,"y":750,"wires":[["8de8f5d3.784b58"]]},{"id":"e7025aff.b966d8","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #14","env":[{"name":"Tank Number","type":"num","value":"14"}],"x":360,"y":790,"wires":[["8de8f5d3.784b58"]]},{"id":"3c8769.a4724898","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #15","env":[{"name":"Tank Number","type":"num","value":"15"}],"x":360,"y":830,"wires":[["8de8f5d3.784b58"]]},{"id":"8e2c5aff.a4b3b8","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #16","env":[{"name":"Tank Number","type":"num","value":"16"}],"x":360,"y":870,"wires":[["8de8f5d3.784b58"]]},{"id":"9ca5d8b1.3bf958","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #19","env":[{"name":"Tank Number","type":"num","value":"19"}],"x":360,"y":910,"wires":[["8de8f5d3.784b58"]]},{"id":"118f1365.5a8d2d","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #21","env":[{"name":"Tank Number","type":"num","value":"21"}],"x":360,"y":950,"wires":[["8de8f5d3.784b58"]]},{"id":"e51f5f4f.bf51e","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #22","env":[{"name":"Tank Number","type":"num","value":"22"}],"x":360,"y":990,"wires":[["8de8f5d3.784b58"]]},{"id":"375c9479.83424c","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #30","env":[{"name":"Tank Number","type":"num","value":"30"}],"x":360,"y":1070,"wires":[["8de8f5d3.784b58"]]},{"id":"acd3cf65.5282c","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #31","env":[{"name":"Tank Number","type":"num","value":"31"}],"x":360,"y":1110,"wires":[["8de8f5d3.784b58"]]},{"id":"93d7e302.1ab57","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #33","env":[{"name":"Tank Number","type":"num","value":"33"}],"x":360,"y":1150,"wires":[["8de8f5d3.784b58"]]},{"id":"60baa94c.ac9818","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #34","env":[{"name":"Tank Number","type":"num","value":"34"}],"x":360,"y":1190,"wires":[["8de8f5d3.784b58"]]},{"id":"a2bb6a1e.b8bbf8","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #37","env":[{"name":"Tank Number","type":"num","value":"37"}],"x":360,"y":1230,"wires":[["8de8f5d3.784b58"]]},{"id":"d1f47cb1.0f5ef","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #39","env":[{"name":"Tank Number","type":"num","value":"39"}],"x":360,"y":1270,"wires":[["8de8f5d3.784b58"]]},{"id":"53b1ab2e.402514","type":"subflow:7d848b6a.1b85e4","z":"ce9dc471.30ead8","name":"Tank #41","env":[{"name":"Tank Number","type":"num","value":"41"}],"x":360,"y":1310,"wires":[["8de8f5d3.784b58"]]},{"id":"61b5bd41.9e9ea4","type":"change","z":"ce9dc471.30ead8","name":"Tank #5","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[5].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[5].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[5].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[5].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1010,"wires":[["e9af0069.d9e26"]]},{"id":"5a768804.ec9148","type":"change","z":"ce9dc471.30ead8","name":"Tank #7","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[7].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[7].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[7].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[7].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1070,"wires":[["dc4aa23a.a214b"]]},{"id":"93871203.f3be1","type":"change","z":"ce9dc471.30ead8","name":"Tank #8","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[8].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[8].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[8].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[8].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1100,"wires":[["1ce02e52.ee4d52"]]},{"id":"a4ce0b2a.bd6e38","type":"change","z":"ce9dc471.30ead8","name":"Tank #14","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[14].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[14].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[14].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[14].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1220,"wires":[["28daed7c.bb6c72"]]},{"id":"73022577.e705cc","type":"change","z":"ce9dc471.30ead8","name":"Tank #15","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[15].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[15].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[15].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[15].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1250,"wires":[["390362df.9dc0ae"]]},{"id":"b4768586.3e5128","type":"change","z":"ce9dc471.30ead8","name":"Tank #16","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[16].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[16].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[16].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[16].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1280,"wires":[["d407e52.ba0ba18"]]},{"id":"f7d680e3.621ae","type":"change","z":"ce9dc471.30ead8","name":"Tank #19","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[19].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[19].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[19].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[19].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1310,"wires":[["fa77cd52.b9b46"]]},{"id":"c63c59da.2d4d98","type":"change","z":"ce9dc471.30ead8","name":"Tank #21","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[21].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[21].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[21].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[21].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1340,"wires":[["7719abe5.ebd1e4","444d8f7c.c713"]]},{"id":"7217d03c.61856","type":"change","z":"ce9dc471.30ead8","name":"Tank #22","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[22].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[22].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[22].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[22].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1370,"wires":[["c9bd1e12.66273","4f5ee0c5.a6812"]]},{"id":"9c03370c.f3b9a8","type":"change","z":"ce9dc471.30ead8","name":"Tank #23","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[23].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[23].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[23].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[23].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1400,"wires":[["b0e6aacb.c6f978","4d12fea1.670c9"]]},{"id":"25279b2d.780c84","type":"change","z":"ce9dc471.30ead8","name":"Tank #30","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[30].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[30].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[30].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[30].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1430,"wires":[["37ed7de.7b06e82"]]},{"id":"71caca82.6542f4","type":"change","z":"ce9dc471.30ead8","name":"Tank #31","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[31].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[31].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[31].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[31].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1460,"wires":[["f2cc8917.3b3608"]]},{"id":"b56898d6.529f38","type":"change","z":"ce9dc471.30ead8","name":"Tank #33","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[33].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[33].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[33].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[33].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1490,"wires":[["1ca0a84e.9d6048"]]},{"id":"c63748d3.4d67d8","type":"change","z":"ce9dc471.30ead8","name":"Tank #34","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[34].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[34].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[34].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[34].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1520,"wires":[["b8d71ff6.4162e"]]},{"id":"dc5e240a.cf7b88","type":"change","z":"ce9dc471.30ead8","name":"Tank #37","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[37].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[37].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[37].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[37].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1550,"wires":[["5e6d8c9f.bc3754"]]},{"id":"a166d44b.724b58","type":"change","z":"ce9dc471.30ead8","name":"Tank #39","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[39].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[39].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[39].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[39].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1580,"wires":[["5516fc3e.c588f4"]]},{"id":"d9aa99fc.79f208","type":"change","z":"ce9dc471.30ead8","name":"Tank #41","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[41].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[41].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[41].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[41].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1610,"wires":[["7fdf51b8.0aa54"]]},{"id":"3ae5af5d.f1784","type":"inject","z":"ce9dc471.30ead8","name":"Polling Interval","topic":"","payload":"","payloadType":"date","repeat":"10","crontab":"","once":true,"onceDelay":"4","x":670,"y":1210,"wires":[["df13524c.baa6b","c95b3c04.beed1","61b5bd41.9e9ea4","5a768804.ec9148","93871203.f3be1","a4ce0b2a.bd6e38","73022577.e705cc","b4768586.3e5128","f7d680e3.621ae","c63c59da.2d4d98","7217d03c.61856","9c03370c.f3b9a8","25279b2d.780c84","71caca82.6542f4","b56898d6.529f38","c63748d3.4d67d8","dc5e240a.cf7b88","a166d44b.724b58","d9aa99fc.79f208","60388c46.b5fcb4","709def10.bb307","c56852b3.628c8","e43e8959.f707e8","4607ea0d.66b414","338092a8.7aa6ee","22ab9210.3f76be","8e0b5e46.6c793","37c6d3d4.ddedcc","67805e8e.e3bcb","5a65f91d.1b34e8","8badd721.db28b8","ca13acea.4b791","b55d3ff5.27a26","e361b785.284e38","3854ce5d.32e4b2","4cd9fd38.044034","9cb9a4ed.b341a8"]]},{"id":"709def10.bb307","type":"change","z":"ce9dc471.30ead8","name":"Tank #1","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[1].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[1].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[1].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[1].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":890,"wires":[[]]},{"id":"c56852b3.628c8","type":"change","z":"ce9dc471.30ead8","name":"Tank #4","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[4].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[4].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[4].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[4].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":980,"wires":[[]]},{"id":"22ab9210.3f76be","type":"change","z":"ce9dc471.30ead8","name":"Tank #6","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[6].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[6].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[6].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[6].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1040,"wires":[[]]},{"id":"e43e8959.f707e8","type":"change","z":"ce9dc471.30ead8","name":"Tank #9","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[9].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[9].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[9].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[9].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1130,"wires":[[]]},{"id":"4607ea0d.66b414","type":"change","z":"ce9dc471.30ead8","name":"Tank #11","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[11].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[11].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[11].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[11].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1160,"wires":[[]]},{"id":"338092a8.7aa6ee","type":"change","z":"ce9dc471.30ead8","name":"Tank #12","rules":[{"t":"set","p":"highlimit","pt":"msg","to":"Tank[12].temperature.highlimit","tot":"global"},{"t":"set","p":"lowlimit","pt":"msg","to":"Tank[12].temperature.lowlimit","tot":"global"},{"t":"set","p":"setpoint","pt":"msg","to":"Tank[12].temperature.setpoint","tot":"global"},{"t":"set","p":"payload","pt":"msg","to":"Tank[12].temperature.actual","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":860,"y":1190,"wires":[[]]},{"id":"411d96d1.627d28","type":"comment","z":"ce9dc471.30ead8","name":"Reading Tank Values From OPCUA","info":"### Polling Interval\nSets how often to read the values from OPCUA.\nI started with 10s.\n\n---\n\n\n### Tank Subflows\nEach subflow contains an enviroment variable to set which tank to read values from.\nThe subflow then creates a message to send to the OPCUA Client node with the addresses\nof values to read.\n\n---\n\n\n### OPC UA Client Node\nConfigured to point to the B&R PLC controlling the tanks.\n\n---\n\n\n### Join values from inside each subflow\nJoins each value received from an individual subflow. If a value to be read is added\nto the tank subflow, the number \"Send message after: Number of message parts\" must be updated to match.\nThe topic to join on should be set to \"msg.browseName\".\n\n---\n\n\n### Join Each Tank\nJoins each individual tank with it's values into an array.\nJust like the previous Join node, if more tanks are added to read, the number should be increased.\n\n---\n\n\n### Build Tank Store\nInitializes, Builds, & Updates the tank global context.\n","x":650,"y":700,"wires":[]},{"id":"c8688c1c.44853","type":"comment","z":"ce9dc471.30ead8","name":"Read Tank Context","info":"### Polling Interval\nSets how often to read the tank values from context.\n\n---\n\n### Switch Nodes\nSets each payload to the tank context that is to be read.\nFrom here, you can output to anything you want.","x":640,"y":1100,"wires":[]},{"id":"5d078c64.5197b4","type":"function","z":"ce9dc471.30ead8","name":"Build Tank Store, Add Tank Values, & Check For Alarms","func":"let tankStore = global.get(\"Tank\") || []; // get tank context\n\nif (tankStore.length === 0) { // check if tank store context is initialized\n    var tanks = [];\n    node.status({fill:\"yellow\",shape:\"dot\",text:\"Tank Store Not Initialized\"});\n\nfor(i=0; i < 46; i++){ // build local tank object to add values to later\n    \n    tanks.push({'id':i,'name':'Tank #'+i, 'temperature':{'setpoint':0, 'highlimit':0, 'lowlimit':0, 'actual':0, 'cp':0.00, 'cpk':0.00}, 'conductivity':{'setpoint':0, 'highlimit':0, 'lowlimit':0, 'actual':0},'alarm':{'active':false, 'message':'','occuredAt':''}})\n}\n\nglobal.set('Tank',tanks) // set context to local built tank store\n\n}\n\n\nlet activeTank = msg.payload; // payload is an object array containing all tanks that were submitted to the OPCUA client node\nlet activelen = msg.payload.length;\n\n\n    for (i=0; i<activelen; i++) {\n        \n        var n = Number(activeTank[i].topic.substring(activeTank[i].topic.indexOf(\"[\")+1,activeTank[i].topic.indexOf(\"]\"))); // get tank number from topic\n        \n        // compare if the current tank values are not equal to what is in the tank store\n        // on first run, the tank values in context will all be zero\n        // this will then fill the tank context with current values\n        if (JSON.stringify(activeTank[i]) !== JSON.stringify(tankStore[n])) {\n        \n            tankStore[n].temperature.setpoint = activeTank[i].payload.tsetpoint;\n            tankStore[n].temperature.highlimit = activeTank[i].payload.thighlimit;\n            tankStore[n].temperature.lowlimit = activeTank[i].payload.tlowlimit;\n            tankStore[n].temperature.actual = activeTank[i].payload.tactual;\n            tankStore[n].temperature.cp = activeTank[i].payload.tcp;\n            tankStore[n].temperature.cpk = activeTank[i].payload.tcpk;\n            tankStore[n].conductivity.actual = activeTank[i].payload.cactual\n            tankStore[n].conductivity.setpoint = activeTank[i].payload.csetpoint\n\n        \n        }\n        \n        // check for any alarms\n        if (tankStore[n].temperature.actual > tankStore[n].temperature.highlimit && (tankStore[n].alarm.active === false)) {\n            tankStore[n].alarm.active = true;\n            tankStore[n].alarm.message = \"Temperature High: Actual: \" + tankStore[n].temperature.actual + \"°, High Limit: \"+tankStore[n].temperature.highlimit + \"°\"\n            tankStore[n].alarm.occuredAt = new Date().toLocaleString();\n        } else if (tankStore[n].temperature.actual < tankStore[n].temperature.lowlimit && (tankStore[n].alarm.active === false)) {\n            tankStore[n].alarm.active = true;\n            tankStore[n].alarm.message = \"Temperature Low: Actual: \" + tankStore[n].temperature.actual + \"°, Low Limit: \"+tankStore[n].temperature.lowlimit + \"°\"\n            tankStore[n].alarm.occuredAt = new Date().toLocaleString();\n        //} else if ((tankStore[n].temperature.actual > tankStore[n].temperature.lowlimit) && (tankStore[n].temperature.actual < tankStore[n].temperature.highlimit)) {\n        //    tankStore[n].alarm.active = false;\n        }\n    }\n\nglobal.set(\"Tank\", tankStore) // set local tank store to context with updated values from OPCUA\nnode.status({fill:\"green\",shape:\"dot\",text:\"Tank Store Built\"});\n\nreturn msg;","outputs":1,"noerr":0,"x":1400,"y":790,"wires":[[]]},{"id":"18a93624.41deca","type":"debug","z":"ce9dc471.30ead8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1250,"y":840,"wires":[]},{"id":"e3393c50.8f8b7","type":"join","z":"ce9dc471.30ead8","name":"Join each tank","mode":"custom","build":"array","property":"","propertyType":"full","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"","count":"25","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"num","reduceFixup":"","x":1070,"y":790,"wires":[["5d078c64.5197b4","18a93624.41deca"]]},{"id":"7d3a54f8.ae3efc","type":"OpcUa-Endpoint","z":"","endpoint":"opc.tcp://192.168.16.97:4840","secpol":"None","secmode":"NONE","login":false}]
2 Likes

Hello, could you please post your complete case? I want to refer to it and learn from you

I was reading the chain and I certainly feel for you. And I apologize in advance for any contribution to confusion. Node-RED OPC-UA works. You need to not worry about connecting Node-RED nodes at first. First you should use a test client on the PC you have your OPC-UA server installed. You have to establish the criteria that your server will work. This is usually necessary to create certificates which allow you to connect anonymously and no security. I certainly hope your OPC-UA Server has good documentation. Once you get the test client to connect, its simply a matter of using the same information supplied there to use in Node-RED. Understanding is paramount. Please do not think that you can get this working by simply duplicating settings. Good luck.