Calculate difference on begin and end of batch manufacturing process

We’re using Grafana v8.x and InfluxDB v1.8 and we’re monitoring manufacturing processes. We have a batch process where we log energy-counters (gas and electricity use) and we want to know the energy-usage for each batch. Process-status is logged with a field with 0 (= on) and 1 (= off), so the question is, how can we calculate the difference of a certain counter between a possitive edge (start of batch) and a negative edge (end of batch)?

Welcome to the forum.

I do not think you can accomplish this purely in Grafana. I believe you will have to create a query in Influx that basically does what you wrote. That would calculate a new field in Influx, but it would not be a time-series based value anymore, right? You could then display this amount in Grafana in a table or bar graph or something that is not time-series based.

Another idea would be to use a Gantt chart that does show the start time and end time of each job, and then somehow find a way to include in each “brick” the energy usage. I have no idea if / how that could be done, but then you’d definitely be able to “see” the orders on a time graph.

Thanks for your reply. We could give this value the rising or falling edge time, so then we can display it in Grafana. Where can I find information on how to create such a query in Influx?

I presume you are using InfluxQL (not Flux). If so, here is the documentation.

Once you have made some attempts at the query, you can post a question on the Influx forum. It is always helpful to show snapshots of your data and the query you wrote which produced the data.