Numerical Integration / Area under the curve

I have an series of points of the phase current values from an ammeter I'm looking for node or code to integrate these values (area under the curve) in order to calculate the energy consumed (kWh).

Where are the data coming from? If from a database then you may be able to do it in the query.
If not, are the time intervals between samples fixed?

The data is coming from an influxdb database. I would like to integrate the data for the current day and also for the current month. Is there is a query that can continuously adjust the starting time, i.e. "now() - variableX"

What are the units of the data? Maybe kW or kWH or something similar.

Are the samples regularly spaced and will they all be present over the time range of interest?

There is also this node node-red-contrib-watt2kwh (node) - Node-RED that may help if you are looking at power... or it may give you some clues

The units are current data points. I think I would try integrate using the trapezoidal method (approximation). The time step are for most the same but there may at time a difference.

See influxdb INTEGRAL

The integral function of influxdb v2 works quite well indeed with flux language.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.