Hi,
After reading a lot of forums I still can’t figure this out…
I have two irregular series. The first one reads data from my power cabinet ([kW], one sample every ~2nd second). The second one is the price ([local currency / kWh]), 2-3 samples every hour.
My intention is to calulate the total cost / price for a given time range (multiplying consumption and price, and probably integrate under that curve/graph?).
from(bucket: "amsdata")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "consumption")
|> filter(fn: (r) => r["_field"] == "kW")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
from(bucket: "amsdata")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "spotprice")
|> filter(fn: (r) => r["_field"] == "price")
|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
|> yield(name: "mean")
Power consumption and price
I will appreciate your help