Hi, I am sending array of 50 elements to a node every 10 mins.
0th Min: a[0],a[1],a[2],.......a[49]
10th Min: b [0],b[1],b[2],.........b[49]
20th Min: c[0],c[1],c[3],............c[49]
I want the max of a[0],b[0] and c[0] in Array max[0]
I want max of a[1],b[1] and c[1] in Array max[1]
Can i use the Smooth function for this. can any one help me please. Below is my code.
[{"id":"ad6c767c.c1c8c8","type":"function","z":"e8c788d.eb2c978","name":"Motor curr var","func":"var valuesnew = new Int16Array(msg.payload);\nvar ui16=new Array(0);\n//adding a number to the first element and shifting the rest\nui16[0]=33000;\nfor (var i=1;i<1+valuesnew.length;i=i+1){\n ui16[i]=valuesnew[i-1];\n}\nvar i=1;\n\n\nmsg.payload={ui16};\n\n\n//var msg ={payload:i,'max':context.global.max,'min':context.global.min,'avg':context.global.avg};\n//var msg2= { payload:b,'max':b,'min':c,'avg':d };\nreturn [msg];","outputs":"1","noerr":0,"x":1250.9355239868164,"y":1330.2640323638916,"wires":[["c738e86c.8858c8","59460816.95e988"]]},{"id":"59460816.95e988","type":"debug","z":"e8c788d.eb2c978","name":"","active":true,"console":"false","complete":"false","x":1458.0089416503906,"y":1436.250108242035,"wires":[]},{"id":"c7d155a9.046eb8","type":"debug","z":"e8c788d.eb2c978","name":"","active":true,"console":"false","complete":"true","x":1583.2973747253418,"y":1313.2503566741943,"wires":[]},{"id":"c738e86c.8858c8","type":"function","z":"e8c788d.eb2c978","name":"","func":"var valuesnew = new Int16Array(msg.payload.ui16);\nvar msg1;\n\nvar j=context.global.qtyofspc;\n\n\n context.global.max[i]=Math.max(valuesnew[i],context.global.max[i]);\n context.global.min[i]=Math.min(valuesnew[i],context.global.min[i]);\n context.global.avg[i]= (valuesnew[i]+context.global.avg[i])/2;\n\nmsg.payload={'max':context.global.max[0],'ui16':valuesnew,'min':context.global.min,'avg':context.global.avg};\n\nmsg1 = { payload:valuesnew };\n\nreturn [msg];","outputs":1,"noerr":0,"x":1430.433708190918,"y":1313.5336933135986,"wires":[["c7d155a9.046eb8"]]}]