Sum of 3 different values

For each mqtt msg that comes in you will get the sum of it and the prior two mqtt readings depending on how fast the msgs arrive.

For example lets say a msg arrives from Phase 0 Power, it will set flow.var1 then try to add it to the prior flow.var2 and flow.var3. Until all three flow variables are initilized, you won't get any output (possible bug?? I'll look into this - I'd think it would throw an error)

let's say that all three flow variables are initilized to 0 and msgs start arriving

  • msg1 arrives from Phase 0 Power, value 20 - the sum will be 20 v1=20 v2=0 v3=0
  • msg1 arrives from Phase 1 Power, value 35 - the sum will be 55 v1=20 v2=35 v3=0
  • msg2 arrives from Phase 0 Power, value 5 - the sum will be 40 v1=5 v2=35 v3=0
  • msg1 arrives from Phase 2 Power, value 40 - the sum will be 80 v1=5 v2=35 v3=40
  • msg3 arrives from Phase 0 Power, value 25 - the sum will be 100 v1=25 v2=35 v3=40
  • msg2 arrives from Phase 2 Power, value 20 - the sum will be 80 v1=25 v2=35 v3=20

If you were using a join, you could set it up so it would not pass on the data untill a msg from each mqtt-in node arrived.

Hope this doesn't confuse you.

As you can see