I'd appreciate some guidance on figuring out the reason behind the straight line for both the flow and level trend.
Thank you
I'd appreciate some guidance on figuring out the reason behind the straight line for both the flow and level trend.
Thank you
Note the timestamps are also wrong. How are you passing the data to the chart? Show us what that data looks like in a debug node.
I am using a csv file that contains a vector for both. Here is the flow I'm using.
[{"id":"52a2fb3a.d07424","type":"tab","label":"SISOARXRegression","disabled":false,"info":""},{"id":"4260ef3a.7713a","type":"inject","z":"52a2fb3a.d07424","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":180,"y":140,"wires":[["7707acd0.1459c4"]]},{"id":"7707acd0.1459c4","type":"exec","z":"52a2fb3a.d07424","command":"C:\\\\IMPL\\\\sisoarxdata.bat","addpay":false,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"","x":550,"y":140,"wires":[["2607b027.9bcb4"],["98a58393.b2ca6"],["f2e9f298.a452c"]]},{"id":"2607b027.9bcb4","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":60,"wires":[]},{"id":"98a58393.b2ca6","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":140,"wires":[]},{"id":"f2e9f298.a452c","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":true,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":200,"wires":[]},{"id":"b72f97bb.1077b8","type":"comment","z":"52a2fb3a.d07424","name":"Run the IML file in the background","info":"","x":560,"y":60,"wires":[]},{"id":"a7e7c3c4.9b209","type":"inject","z":"52a2fb3a.d07424","name":"","topic":"start","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":280,"wires":[["b61f5aba.d3d2d8"]]},{"id":"2c15419e.33997e","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":260,"wires":[]},{"id":"b61f5aba.d3d2d8","type":"file in","z":"52a2fb3a.d07424","name":"","filename":"C:\\IMPL\\SISOARXRegression\\sisoarxdata.csv","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":240,"y":220,"wires":[["e45f50fc.c5ae9"]]},{"id":"e45f50fc.c5ae9","type":"csv","z":"52a2fb3a.d07424","name":"","sep":",","hdrin":true,"hdrout":"","multi":"mult","ret":"\\n","temp":"","skip":"0","strings":true,"x":270,"y":280,"wires":[["e0afa165.fe54d","e5dbf006.7ddc4","fffb5321.38949","98a8b2ad.c74fc","7f03eac9.1f90f4","2bd02484.5aea8c"]]},{"id":"e0afa165.fe54d","type":"function","z":"52a2fb3a.d07424","name":"split data","func":"var payload=msg.payload;\nvar a=[\"\"];\nfor(i=0;i<payload.length;i++)\n{\n\nif (payload[i].col1==\"u\" || payload[i].col1==\"y\")\na.push(payload[i]);\n\n}\nmsg.payload=a;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":280,"wires":[["b5c6dfe1.4f056"]]},{"id":"be4a3575.b74318","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":400,"wires":[]},{"id":"58a06a0d.330214","type":"ui_chart","z":"52a2fb3a.d07424","name":"","group":"66be782c.1d8ab8","order":3,"width":0,"height":0,"label":"Auto-correlative residuals w1","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"1","removeOlderPoints":"500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#fca99a","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":880,"y":480,"wires":[[]]},{"id":"e5dbf006.7ddc4","type":"function","z":"52a2fb3a.d07424","name":"split data","func":"var payload=msg.payload;\nvar a=[];\nfor(i=0;i<payload.length;i++)\n{\n\nif (payload[i].col1==\"w1\")\na.push(payload[i]);\n\n}\nmsg.payload=a;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":440,"wires":[["9b51544c.b9d028"]]},{"id":"9b51544c.b9d028","type":"function","z":"52a2fb3a.d07424","name":"graph generate","func":"\nfunction toTimestamp(strDate){\n var datum = Date.parse(strDate);\n return datum/500;\n }\nvar payload=msg.payload;\n//var t =toTimestamp('02/13/2009 23:31:30')\n\nvar Data= \"2020-12-08\".split(\"-\");\nData=Data[1]+\"/\"+Data[1]+\"/\"+Data[0];\nnode.log(Data);\nt =toTimestamp(Data+\" 14:30:00\");\nvar data_out=[];\nvar a1=[];\nvar a2=[];\n//var a3=[];\n//var a4=[];\nfor(let i=0;i<payload.length;i++)\n{\n \n//var Data= payload[i].Data.split(\"-\");\n//var t=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\n//var timestamp=toTimestamp(t+\" \"+payload[i][\"Godzina\"]);\n\nif(payload[i].col1==\"w1\")\n{\nvar temp1={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\na1.push(temp1);\n}\n//if(payload[i].col1==\"y\")\n//{\n//var temp2={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\n//a2.push(temp2);\n//}\n\n}\n\ndata_out=[a1];\nmsg.payload=[{\n\"series\": [\"W1\"],\n\"data\":data_out,\n\"labels\": []\n}];\nmsg.t=t;\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":440,"wires":[["be4a3575.b74318","58a06a0d.330214"]]},{"id":"f4367715.85a1f8","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":540,"wires":[]},{"id":"fffb5321.38949","type":"function","z":"52a2fb3a.d07424","name":"split data","func":"var payload=msg.payload;\nvar a=[];\nfor(i=0;i<payload.length;i++)\n{\n\nif (payload[i].col1==\"w2\")\na.push(payload[i]);\n\n}\nmsg.payload=a;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":580,"wires":[["8f851b09.00f0a8"]]},{"id":"8f851b09.00f0a8","type":"function","z":"52a2fb3a.d07424","name":"graph generate","func":"\nfunction toTimestamp(strDate){\n var datum = Date.parse(strDate);\n return datum/500;\n }\nvar payload=msg.payload;\n//var t =toTimestamp('02/13/2009 23:31:30')\n\nvar Data= \"2020-12-08\".split(\"-\");\nData=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\nnode.log(Data);\nt =toTimestamp(Data+\" 14:30:00\");\nvar data_out=[];\nvar a1=[];\nvar a2=[];\n//var a3=[];\n//var a4=[];\nfor(let i=0;i<payload.length;i++)\n{\n \n//var Data= payload[i].Data.split(\"-\");\n//var t=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\n//var timestamp=toTimestamp(t+\" \"+payload[i][\"Godzina\"]);\n\nif(payload[i].col1==\"w2\")\n{\nvar temp1={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\na1.push(temp1);\n}\n//if(payload[i].col1==\"y\")\n//{\n//var temp2={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\n//a2.push(temp2);\n//}\n\n}\n\ndata_out=[a1];\nmsg.payload=[{\n\"series\": [\"W2\"],\n\"data\":data_out,\n//\"labels\": [\"utlet flow from vessel\",\"evel % in vessel\",]\n}];\nmsg.t=t;\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":580,"wires":[["f4367715.85a1f8","b00f2edd.79924"]]},{"id":"fded231b.28b93","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":680,"wires":[]},{"id":"33ea0a83.d02d26","type":"ui_chart","z":"52a2fb3a.d07424","name":"","group":"66be782c.1d8ab8","order":5,"width":0,"height":0,"label":"Auto-correlative residuals w3","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#fca99a","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":880,"y":760,"wires":[[]]},{"id":"98a8b2ad.c74fc","type":"function","z":"52a2fb3a.d07424","name":"split data","func":"var payload=msg.payload;\nvar a=[];\nfor(i=0;i<payload.length;i++)\n{\n\nif (payload[i].col1==\"w3\")\na.push(payload[i]);\n\n}\nmsg.payload=a;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":720,"wires":[["a502a61c.db94b8"]]},{"id":"a502a61c.db94b8","type":"function","z":"52a2fb3a.d07424","name":"graph generate","func":"\nfunction toTimestamp(strDate){\n var datum = Date.parse(strDate);\n return datum/500;\n }\nvar payload=msg.payload;\n//var t =toTimestamp('02/13/2009 23:31:30')\n\nvar Data= \"2020-12-08\".split(\"-\");\nData=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\nnode.log(Data);\nt =toTimestamp(Data+\" 14:30:00\");\nvar data_out=[];\nvar a1=[];\nvar a2=[];\n//var a3=[];\n//var a4=[];\nfor(let i=0;i<payload.length;i++)\n{\n \n//var Data= payload[i].Data.split(\"-\");\n//var t=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\n//var timestamp=toTimestamp(t+\" \"+payload[i][\"Godzina\"]);\n\nif(payload[i].col1==\"w3\")\n{\nvar temp1={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\na1.push(temp1);\n}\n//if(payload[i].col1==\"y\")\n//{\n//var temp2={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\n//a2.push(temp2);\n//}\n\n}\n\ndata_out=[a1];\nmsg.payload=[{\n\"series\": [\"W3\"],\n\"data\":data_out,\n//\"labels\": [\"utlet flow from vessel\",\"evel % in vessel\",]\n}];\nmsg.t=t;\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":720,"wires":[["fded231b.28b93","33ea0a83.d02d26"]]},{"id":"e20fa68.07bf558","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":820,"wires":[]},{"id":"156c577d.8750c9","type":"ui_chart","z":"52a2fb3a.d07424","name":"","group":"66be782c.1d8ab8","order":2,"width":0,"height":0,"label":"Auto-correlative residuals w4","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#fca99a","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":880,"y":900,"wires":[[]]},{"id":"7f03eac9.1f90f4","type":"function","z":"52a2fb3a.d07424","name":"split data","func":"var payload=msg.payload;\nvar a=[];\nfor(i=0;i<payload.length;i++)\n{\n\nif (payload[i].col1==\"w4\")\na.push(payload[i]);\n\n}\nmsg.payload=a;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":860,"wires":[["7afa4621.b0a328"]]},{"id":"7afa4621.b0a328","type":"function","z":"52a2fb3a.d07424","name":"graph generate","func":"\nfunction toTimestamp(strDate){\n var datum = Date.parse(strDate);\n return datum/500;\n }\nvar payload=msg.payload;\n//var t =toTimestamp('02/13/2009 23:31:30')\n\nvar Data= \"2020-12-08\".split(\"-\");\nData=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\nnode.log(Data);\nt =toTimestamp(Data+\" 14:30:00\");\nvar data_out=[];\nvar a1=[];\nvar a2=[];\n//var a3=[];\n//var a4=[];\nfor(let i=0;i<payload.length;i++)\n{\n \n//var Data= payload[i].Data.split(\"-\");\n//var t=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\n//var timestamp=toTimestamp(t+\" \"+payload[i][\"Godzina\"]);\n\nif(payload[i].col1==\"w4\")\n{\nvar temp1={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\na1.push(temp1);\n}\n//if(payload[i].col1==\"y\")\n//{\n//var temp2={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\n//a2.push(temp2);\n//}\n\n}\n\ndata_out=[a1];\nmsg.payload=[{\n\"series\": [\"W4\"],\n\"data\":data_out,\n//\"labels\": [\"utlet flow from vessel\",\"evel % in vessel\",]\n}];\nmsg.t=t;\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":860,"wires":[["e20fa68.07bf558","156c577d.8750c9"]]},{"id":"7f0e20f6.700fd","type":"debug","z":"52a2fb3a.d07424","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":810,"y":960,"wires":[]},{"id":"151d6c22.bcf2b4","type":"ui_chart","z":"52a2fb3a.d07424","name":"","group":"66be782c.1d8ab8","order":6,"width":0,"height":0,"label":"Auto-correlative residuals w5","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#fca99a","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":880,"y":1040,"wires":[[]]},{"id":"2bd02484.5aea8c","type":"function","z":"52a2fb3a.d07424","name":"split data","func":"var payload=msg.payload;\nvar a=[];\nfor(i=0;i<payload.length;i++)\n{\n\nif (payload[i].col1==\"w5\")\na.push(payload[i]);\n\n}\nmsg.payload=a;\nreturn msg;","outputs":1,"noerr":0,"x":420,"y":1000,"wires":[["f54bb597.1878f8"]]},{"id":"f54bb597.1878f8","type":"function","z":"52a2fb3a.d07424","name":"graph generate","func":"\nfunction toTimestamp(strDate){\n var datum = Date.parse(strDate);\n return datum/500;\n }\nvar payload=msg.payload;\n//var t =toTimestamp('02/13/2009 23:31:30')\n\nvar Data= \"2020-12-08\".split(\"-\");\nData=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\nnode.log(Data);\nt =toTimestamp(Data+\" 14:30:00\");\nvar data_out=[];\nvar a1=[];\nvar a2=[];\n//var a3=[];\n//var a4=[];\nfor(let i=0;i<payload.length;i++)\n{\n \n//var Data= payload[i].Data.split(\"-\");\n//var t=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\n//var timestamp=toTimestamp(t+\" \"+payload[i][\"Godzina\"]);\n\nif(payload[i].col1==\"w5\")\n{\nvar temp1={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\na1.push(temp1);\n}\n//if(payload[i].col1==\"y\")\n//{\n//var temp2={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\n//a2.push(temp2);\n//}\n\n}\n\ndata_out=[a1];\nmsg.payload=[{\n\"series\": [\"W5\"],\n\"data\":data_out,\n//\"labels\": [\"utlet flow from vessel\",\"evel % in vessel\",]\n}];\nmsg.t=t;\nreturn msg;","outputs":1,"noerr":0,"x":640,"y":1000,"wires":[["7f0e20f6.700fd","151d6c22.bcf2b4"]]},{"id":"b00f2edd.79924","type":"ui_chart","z":"52a2fb3a.d07424","name":"","group":"66be782c.1d8ab8","order":4,"width":0,"height":0,"label":"Auto-correlative residuals w2","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":true,"ymin":"","ymax":"","removeOlder":"1","removeOlderPoints":"500","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1eb357","#fca99a","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":880,"y":620,"wires":[[]]},{"id":"b5c6dfe1.4f056","type":"function","z":"52a2fb3a.d07424","name":"graph generate","func":"\nfunction toTimestamp(strDate){\n var datum = Date.parse(strDate);\n return datum/500;\n }\nvar payload=msg.payload;\n//var t =toTimestamp('02/13/2009 23:31:30')\n\nvar Data= \"2020-12-08\".split(\"-\");\nData=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\nnode.log(Data);\nt =toTimestamp(Data+\" 14:30:00\");\nvar data_out=[];\nvar a1=[];\nvar a2=[];\n//var a3=[];\n//var a4=[];\nfor(let i=0;i<payload.length;i++)\n{\n \n//var Data= payload[i].Data.split(\"-\");\n//var t=Data[2]+\"/\"+Data[1]+\"/\"+Data[0];\n//var timestamp=toTimestamp(t+\" \"+payload[i][\"Godzina\"]);\n\nif(payload[i].col1==\"u\")\n{\nvar temp1={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\na1.push(temp1);\n}\nif(payload[i].col1==\"y\")\n{\nvar temp2={ \"x\": payload[i].col2, \"y\":Number( payload[i].col3) };\na2.push(temp2);\n}\n\n}\n\ndata_out=[a1,a2];\nmsg.payload=[{\n\"series\": [\"outlet flow from vessel\",\"level % in vessel\",],\n\"data\":data_out,\n\"labels\": []\n}];\nmsg.t=t;\nreturn msg;","outputs":1,"noerr":0,"x":620,"y":280,"wires":[["2c15419e.33997e","57be20f7.c08ad"]]},{"id":"57be20f7.c08ad","type":"ui_chart","z":"52a2fb3a.d07424","name":"","group":"66be782c.1d8ab8","order":1,"width":0,"height":0,"label":"Outlet flow vs. level % in vessel, tank or drum.","chartType":"line","legend":"true","xformat":"HH:mm:ss","interpolate":"step","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"4000","removeOlderUnit":"60","cutout":0,"useOneColor":false,"colors":["#b31e35","#b3e9af","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":920,"y":320,"wires":[[]]},{"id":"66be782c.1d8ab8","type":"ui_group","z":"","name":"Digital PI Controllers","tab":"49ea4c52.655814","order":1,"disp":true,"width":"20","collapse":false},{"id":"49ea4c52.655814","type":"ui_tab","z":"","name":"Tuning Digital PI Controllers","icon":"dashboard","order":5,"disabled":false,"hidden":false}]
We don't need the flow, we need to see what the data you are passing in looks like. Send it to a debug node and screenshot and paste the image here. Make sure you expand the objects enough in the debug pane so that we can see the details. My guess is that the timestamps are wrong.
Here is it
FYI - I am able to generate the plot without that strange straight-line if only I include all the data points for the plot in the labels array - it looks like this:
but that isn't a generic way to do it.
You haven't expanded any of the data array values so we can't see what the timestamps are. I presume that you are plotting against time.
Yes, but that doesn't work I don't know what is the reason the arrays are 4320 for x and y has an assigned value from the csv
I said previously that I assumed that you were plotting against time? Is that correct? If so then the problem is clear. You can see that the first item in the array has x as a string containing " 1" whereas it should be the timestamp either in javascript ticks (msec) or as an ISO date string.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.