I have a time series of kW where each sample is measured at regular intervals (10 seconds). Could anyone explain to me how could I calculate the total power consumed (kWh) over an hour?


  • $\begingroup$ The total kWh is $\frac{1}{360}\sum_{n=1}^{360}p_n$, where the $p_n$ are the kW power measurements for each 10 second increment (assuming you are looking at a 1-hour interval). $\endgroup$ – DumpsterDoofus Apr 20 '14 at 23:54
  • $\begingroup$ @DumpsterDoofus would this formula work if this is continuous data? $\endgroup$ – Martynas Apr 20 '14 at 23:59
  • $\begingroup$ What does "continuous data" mean? In your question you said that it is being sampled at 10-second intervals, which is discrete, not continuous. $\endgroup$ – DumpsterDoofus Apr 21 '14 at 0:01
  • 1
    $\begingroup$ @DumpsterDoofus I think it would really be better if you post your answer as an answer, not as a comment. $\endgroup$ – David Z Apr 21 '14 at 0:06
  • 2
    $\begingroup$ @DumpsterDoofus well, what makes something an answer vs. a comment is not whether it's simple or not. It's a matter of whether it answers the question or not. There are many times when a valid answer is simple enough to be written in a comment and yet should still be posted as an answer. Another good rule of thumb: comments are temporary. Anything that is useful in the long term should be either edited into the question or posted as an answer. (BTW I will come back and clean up the comments here after the discussion is over.) $\endgroup$ – David Z Apr 21 '14 at 0:12

In general, if you have a list of datapoints $p_n$ for $n\in\{1,2,3,...,N\}$ sampled with timestep $\Delta t$, the integrated total $E$ is $$E=\Delta t\sum_{n=1}^{N}p_n.$$

For example, with data spaced 10 seconds apart, $\Delta t$ becomes $\frac{10\text{ sec}}{3600\text{ sec/hour}}\approx 0.0028$ hours. If you take 20 measurements (ie, 200 seconds recording), the integrated power in kWh becomes $$E=\frac{1}{360\text{ samples/hour}}\sum_{n=1}^{20}p_n$$ where $p_n$ are the instantaneous powers in kW.

This is an example of numerical integration using a Riemann Sum.

  • $\begingroup$ My edit message got squashed. It was: it's good numerical practice to use integer ratios when possible, rather than introducing floating-point approximations like 0.0027778 $\endgroup$ – rob Apr 21 '14 at 2:24
  • $\begingroup$ @rob: Seems fine, although the "samples" unit seems sort of redundant. $\endgroup$ – DumpsterDoofus Apr 21 '14 at 2:30
  • $\begingroup$ So can we consider them to be for 10 seconds interval, the sum of all datapoints (Watt points) multiplied by 10/3600 giving the wh, and then the wh divided by 1000 giving the kwh? $\endgroup$ – Philippe Gachoud Sep 4 '19 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.