All,
New-ish to node red but have been using it in many applications and it has helped significantly reduce time to create a program with a simple UI that can be used in a lab environment. hopeing someone can help me on my latest project.
I am trying to heat a water bath. Currently in our lab we do this open loop with constant current but need more accuracy. I would like the user to be able to select temperature set points at given time(in seconds).
I'm looking for something similar to https://flows.nodered.org/node/node-red-contrib-ramp-thermostat .
What i have done so far.
using the https://github.com/node-red/node-red-dashboard/blob/master/Charts.md#stored-data I have been storing data in arrays to plot the user defined ramp. how would I then overlay the thermocouple data onto that chart in "real time"?
I like the https://flows.nodered.org/node/node-red-contrib-pid and would like use it if possible.
Below it the the flow I have been working on. hopefully someone can help me work through the logic.
[{"id":"5cd95dcc.6f0834","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"548d5a70.00e424","type":"ui_chart","z":"5cd95dcc.6f0834","name":"","group":"e0aac8c4.bb9548","order":0,"width":"5","height":"5","label":"test 2","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"250","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#ff0000","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1550,"y":200,"wires":[[]]},{"id":"53938e72.6d4b","type":"inject","z":"5cd95dcc.6f0834","name":"delete graph","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[]","payloadType":"json","x":1010,"y":80,"wires":[["548d5a70.00e424"]]},{"id":"e873657e.634c28","type":"ui_numeric","z":"5cd95dcc.6f0834","name":"","label":"Start temp T-0 Seconds","tooltip":"","group":"e0aac8c4.bb9548","order":0,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"200","step":1,"x":350,"y":120,"wires":[["76d1a2ff.bfcacc"]]},{"id":"87fc8f27.4353f","type":"ui_numeric","z":"5cd95dcc.6f0834","name":"","label":"Temp T-60 Seconds","tooltip":"","group":"e0aac8c4.bb9548","order":0,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"200","step":1,"x":340,"y":160,"wires":[["c2878509.137488"]]},{"id":"96df0ac6.c71f28","type":"ui_numeric","z":"5cd95dcc.6f0834","name":"","label":"Temp T-120Seconds","tooltip":"","group":"e0aac8c4.bb9548","order":0,"width":0,"height":0,"wrap":false,"passthru":true,"topic":"","format":"{{value}}","min":0,"max":"200","step":1,"x":340,"y":200,"wires":[["d0518674.9d2278"]]},{"id":"7672d8e3.0f7b18","type":"function","z":"5cd95dcc.6f0834","name":"","func":"\nvar a = global.get('t0');\nvar b = global.get('t60');\nvar c = global.get('t120');\n\n\nvar m={};\nm.labels = [0,60,120];\nm.series = ['Programmed Value'];\nm.data = [\n [a, b, c]\n ];\nreturn {payload:[m]};","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1240,"y":240,"wires":[["a9238c18.3fdec","548d5a70.00e424"]]},{"id":"76d1a2ff.bfcacc","type":"function","z":"5cd95dcc.6f0834","name":"global.set(\"t0\",msg.payload);","func":"global.set(\"t0\",msg.payload);","outputs":1,"noerr":0,"initialize":"","finalize":"","x":680,"y":120,"wires":[[]]},{"id":"c2878509.137488","type":"function","z":"5cd95dcc.6f0834","name":"global.set(\"t60\",msg.payload);","func":"global.set(\"t60\",msg.payload);","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":160,"wires":[[]]},{"id":"d0518674.9d2278","type":"function","z":"5cd95dcc.6f0834","name":"global.set(\"t120\",msg.payload);","func":"global.set(\"t120\",msg.payload);","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":200,"wires":[[]]},{"id":"c62a0121.f0bc7","type":"PID","z":"5cd95dcc.6f0834","name":"","setpoint":21,"pb":1,"ti":"0","td":0,"integral_default":0.5,"smooth_factor":3,"max_interval":600,"enable":1,"disabled_op":0,"x":1190,"y":320,"wires":[["885d58bc.192628"]]},{"id":"81a06ad0.57c588","type":"inject","z":"5cd95dcc.6f0834","name":"enable","repeat":"","crontab":"","once":false,"topic":"enable","payload":"true","payloadType":"bool","x":1030,"y":220,"wires":[["c62a0121.f0bc7"]]},{"id":"27bfeb99.489604","type":"inject","z":"5cd95dcc.6f0834","name":"disable","repeat":"","crontab":"","once":false,"topic":"enable","payload":"false","payloadType":"bool","x":1030.5,"y":270,"wires":[["c62a0121.f0bc7"]]},{"id":"a9238c18.3fdec","type":"debug","z":"5cd95dcc.6f0834","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1450,"y":100,"wires":[]},{"id":"885d58bc.192628","type":"range","z":"5cd95dcc.6f0834","minin":"0","maxin":"1","minout":"0","maxout":"100","action":"scale","round":false,"property":"payload","name":"","x":1460,"y":320,"wires":[[]]},{"id":"d774cecc.13a73","type":"inject","z":"5cd95dcc.6f0834","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1000,"y":180,"wires":[["7672d8e3.0f7b18"]]},{"id":"4b71556.63176ac","type":"function","z":"5cd95dcc.6f0834","name":"RampTimer","func":"var count= 0;\n\nvar counter=setInterval(timer, 1000); //1000 will run it every 1 second\n\n function timer()\n{\n count=count+1;\n if (count >= (120))\n {\n clearInterval(counter);\n //counter ended, do something here\n return;\n }\n \n msg.payload=count.toFixed(1);\n node.send(msg);\n global.set(\"RampTimer\",msg.payload);\n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":630,"y":240,"wires":[["f8cc254d.a07358"]]},{"id":"afb27665.fac4f8","type":"ui_button","z":"5cd95dcc.6f0834","name":"","group":"e0aac8c4.bb9548","order":5,"width":0,"height":0,"passthru":false,"label":"Start Ramp","tooltip":"","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":310,"y":240,"wires":[["4b71556.63176ac"]]},{"id":"fb81b1a2.790ff","type":"ui_slider","z":"5cd95dcc.6f0834","name":"","label":"slider","tooltip":"","group":"e0aac8c4.bb9548","order":4,"width":0,"height":0,"passthru":true,"outs":"all","topic":"","min":0,"max":"50","step":1,"x":290,"y":280,"wires":[["9b39874b.d25d48"]]},{"id":"9b39874b.d25d48","type":"function","z":"5cd95dcc.6f0834","name":"global.set(\"Sim_Temp\",msg.payload);","func":"global.set(\"Sim_Temp\",msg.payload);","outputs":1,"noerr":0,"initialize":"","finalize":"","x":690,"y":280,"wires":[[]]},{"id":"f8cc254d.a07358","type":"function","z":"5cd95dcc.6f0834","name":"","func":"if(global.get(\"RampTimer\")<120){\n msg.payload=global.get(\"Sim_Temp\");\n node.send(msg); \n}\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1020,"y":360,"wires":[["c62a0121.f0bc7"]]},{"id":"a9569f37.e7006","type":"function","z":"5cd95dcc.6f0834","name":"","func":"\nvar yearStart = 0;\nvar yearEnd = 120;\nvar counter = 0;\nvar a = global.get('Sim_Temp');\n\nvar Sim = {};\n\nif(yearEnd > counter+1){\n Sim.lables = [global.get('RampTimer')];\n Sim.series = ['Sim Value'];\n Sim.data = [\n [a]\n ];\n counter++;\n}\n\nreturn {payload:[Sim]};\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1220,"y":200,"wires":[["a9238c18.3fdec","548d5a70.00e424"]]},{"id":"f8584912.7c7cd8","type":"inject","z":"5cd95dcc.6f0834","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1000,"y":140,"wires":[[]]},{"id":"e0aac8c4.bb9548","type":"ui_group","z":"","name":"uColumn Ramp","tab":"ae7a5799.808858","order":1,"disp":true,"width":"6","collapse":false},{"id":"ae7a5799.808858","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]