In an electric network I want to calculate the difference between in-flow and out-flow of energy using kapacitor.
Imagine A is a energy source and B and C are sinks, the difference D is A-(B+C). As only A,B and C are measured every minute I wrote the following TICK script to store D in a database:
dbrp "sensors_raw"."autogen" var A = stream | from() .measurement('A') | httpOut('A') var B = stream | from() .measurement('B') | httpOut('B') var C = stream | from() .measurement('C') | httpOut('C') A | join(B,C) .as('sensor_A', 'sensor_B', 'sensor_C') .tolerance(30s) .fill(0.0) | eval(lambda: "sensor_A.W" - ("sensor_B.W" + "sensor_C.W")) .as('D') | httpOut('D')
To test the TICK script above I tried to do
kapacitor replay-live query -task "test" -rec-time -query 'select * from "sensors_raw"."autogen"."A","sensors_raw"."autogen"."B","sensors_raw"."autogen"."C" where time > '2018-03-02T09:49:00Z''
running replay: could not determine database and retention policy. Is the query fully qualified?
Executing exactly same query in influx returns the data as expected. What is going on there and how can I test the script with historic data?
Btw: Any ideas on improving the script etc are welcome…
This text will be hidden