hi,

i have solar energy and want to calculate the power that i consumed myself.

the following information are available:

- power i exported to the grid (summed total)
- power my solar energy produced (summed total)
- current power production
- current power from or to the grid (export to grid: negative value, import from grid: positive value).

what is the easiest way to get what i want with a flexible v.windowPeriod?

in my overview dashboard i take the first two values, “aggregateWindow” them over a fixed duration and calculate kWh of it, which i can then substract from each other (aggregateWindow with duration of (e.g.) 60m for produced solar power, select last value, get the difference and i have the kWh for one dataseries; from this result i substract with the same function the exported power and get the power i consumed on my own).

that is fine for a fixed known timeperiod.

but with changing v.windowPeriod I can’t calculate the kWh for that period. I expected to get my desired value by

|> aggregateWindow(every: v.windowPeriod, fn: last,timeSrc: “_start”)

and

|> map(fn: (r) => ({_value:r._value/v.windowPeriod*60.0, _time:r._time, _field:“kWh”}))

but that doesn’t work because calculation is not possible with a duration.

Any ideas? Can anyone understand what i try to explain?

kind regards,

andre