I’ll take that to be case 2 above.

So grid power, whether consumption or production, is what is going through you mains i.e. the sum of your three mains. As I understand it you want to break that down on whether it’s positive (consumption) or negative (production).

So the the mains total is:

`(Grid_3B + Grid_4C + Grid_5A)`

To get only the positive values (grid consumption):

`(Grid_3B + Grid_4C + Grid_5A) max 0`

To get the negative values (grid production)

`(Grid_3B + Grid_4C + Grid_5A) min 0`

To prove this out, you can create a couple of outputs and look at them with the local graph.