Assume a JSON like
where it is easy to build a sum by
msg = {"payload" : msg.payload["AC Out L1"]
+ msg.payload["AC Out L2"]
+ msg.payload["AC Out L3"]};
return msg;
Now I like to calculate the difference between greatest and smallest value. Like any real measurements, values might change to any size. For 3 elements I need to have 5 if instructions in 3 ident levels for 6 cases:
case1 = L1-L2
case2 = L1-L3
case3 = L2-L3
case4 = L2-L1
case5 = L3-L2
case6 = L3-L1
For more elements, probably anything like a bubblesort loop is required. Is there anything on NodeReds default palette what can solve this matter? Application is my 3 phase Diesel genset what ideally should generate power for symmetric loads.