Maths question - calculating daily electricity usage in kWh

Discussion

Although I have a log file with the usage, I have no idea how to calculate the overall daily usage from this log file - how would I do this?

Sadly, my maths ability sucks.

My logfile looks like this:

The format is time,watts - there are 21599 entries each day.

I was wondering if I needed to change the log file writes to be on an hourly basis?

00:00:01,382.2

00:00:05,392.0

00:00:09,382.2

00:00:13,382.2

00:00:17,382.2

00:00:21,382.2

00:00:25,382.2

00:00:29,382.2

00:00:33,387.1

00:00:37,382.2

00:00:41,382.2

00:00:45,382.2

00:00:49,328.3

00:00:53,333.2

00:00:57,328.3

00:01:01,328.3

00:01:05,328.3

00:01:09,328.3

00:01:13,328.3

00:01:17,328.3

00:01:21,328.3

00:01:25,328.3

00:01:29,328.3

00:01:33,328.3

00:01:37,333.2

00:01:41,328.3

00:01:45,328.3

00:01:49,333.2

00:01:53,328.3

00:01:57,328.3

Thanks!

E(kWh) = P(W) × t(hr) / 1000

So E(kWh) = 382.2 x (4/60*60)/1000 = 0.0004247kWh

So pull your log file into Excel as a comma-delimited .csv, calculate the energy in each little period & sum the result.

I hope I've got that right

Mr Pointy said:

If those are just instantaneous values then I don't know if you can.

<snip>

Thanks for your suggestions.<snip>

They are indeed instantaneous values.

I can control the period at which log file writes occur - do you think it would be more practical to update the log file at larger intervals?

Say every 15 minutes or so?

TonyRPH said:

Thanks for your suggestions.

They are indeed instantaneous values.

I can control the period at which log file writes occur - do you think it would be more practical to update the log file at larger intervals?

Say every 15 minutes or so?

It's a trade off between log file size & accuracy really. 15 minutes is probably too long given that it takes a kettle only 3 minutes to boil & you'd probably miss it as an event. I'd say 30 seconds to a minute maybe?They are indeed instantaneous values.

I can control the period at which log file writes occur - do you think it would be more practical to update the log file at larger intervals?

Say every 15 minutes or so?

(This could 'fail' as a model if there are large fluctuations occurring between the data points, such as an industrial heater kicking in periodically for a few moments, but given the available data I don't see a way round this without getting into a very complex analysis, other than to set the recording system to capture as often as possible!)

Mr Pointy said:

15 minutes is probably too long given that it takes a kettle only 3 minutes to boil & you'd probably miss it as an event.

I'd say 30 seconds to a minute maybe?

That sounds feasible I think.I'd say 30 seconds to a minute maybe?

Ultuous said:

<snip>

(This could 'fail' as a model if there are large fluctuations occurring between the data points......

<snip>

I suspect it's always going to be a 'best guess' estimate - but that's all I need really.(This could 'fail' as a model if there are large fluctuations occurring between the data points......

<snip>

Mr Pointy said:

E(kWh) = P(W) × t(hr) / 1000

So E(kWh) = 382.2 x (4/60*60)/1000 = 0.0004247kWh

So pull your log file into Excel as a comma-delimited .csv, calculate the energy in each little period & sum the result.

I hope I've got that right

If the time interval is always the same, you can also do the summing first:

(1) sum all the p values in the day

(2) multiply the result by 4 (the number of seconds between readings)

(3) this gives you the number Joules per day

(4) divide this by 3.600.000 - this gives you the number of kWh in a day

This method makes the assumption that during each interval between readings the power is constant. It therefore follows that, if there are power fluctuations, the shorter the interval the more accurate it becomes.

Essentially, you choose the interval much shorter (say a factor 10) than the shortest duration event of any appliance that uses more power than (say) 100W.

The price you pay for accuracy is of course an increased number of readings, and more data

I would have thought that 4 seconds is probably quite reasonable, but maybe 1 second is better.

Now having thought about this - you can avoid long data files by increasing the time interval during night time (when no-one is boiling kettles or ironing shirts) to 10 seconds, or maybe a minute. In that case you'd have to apply my method above separately for each time span with different reading intervals, and add them all up to get the figure for the day.

There's a refinement to this - and that goes back to mr Pointy's post above: multiply each reading by the time that has lapsed since the previous reading (in Excel simply subtract the time value of the previous reading from the time value of the present reading), multiply by each corresponding power reading, then add all of these up, and divide the sum by 3.600.000.

Now you can have variable timing of the readings and you're still accurate in your calculations no matter how the time interval changes during the day and night. All you need is the time stamp, and the power reading at that time.

Toltec said:

Those readings are power not energy, being picky, as others have said you can numerically integrate to get the energy. Are you sure your meter does not have a cumulative energy readout?

I believe the meter does have a cumulative readout, but it's only accessible via the display panel, and not via software.It has a USB interface, and all one can do is poll that interface for the "amps" output as per in my OP.

TonyRPH said:

I believe the meter does have a cumulative readout, but it's only accessible via the display panel, and not via software.

It has a USB interface, and all one can do is poll that interface for the "amps" output as per in my OP.

That's a pity, you will have to integrate yourself then. If you use the average value between each pair of readings and compare the results with just using the readings themselves it can help to give you an idea how the variability affects the results. Do the same using half and a quarter of the dataset and you will get an idea how sample rate affects the results too. It has a USB interface, and all one can do is poll that interface for the "amps" output as per in my OP.

Toltec said:

That's a pity, you will have to integrate yourself then. If you use the average value between each pair of readings and compare the results with just using the readings themselves it can help to give you an idea how the variability affects the results. Do the same using half and a quarter of the dataset and you will get an idea how sample rate affects the results too.

Thanks - I've not advanced much with this since my OP as I've had actual work to do lol.Hoping to pick it up again soon.

A typical kettle takes 12 amps, ie is 12 x 240 = 2,880 Watts.(2.88 kW(

If it takes a minute (60 seconds) to boil, that's just 0.048 kWH.

By comparison, if you have a base load on your house of just, say, 100 watts, due to parasitic drains from things like TVs in standby, your boiler, digital clocks, etc, then that over a period of a day adds up to 2.4 kWh, the equivalent of boiling 50 kettles!!

Therefore, if your logging misses some of the short high load events, then it won't actually make that much difference to the overall accuracy of your data........

Max_Torque said:

By comparison, if you have a base load on your house of just, say, 100 watts, due to parasitic drains from things like TVs in standby, your boiler, digital clocks, etc, then that over a period of a day adds up to 2.4 kWh, the equivalent of boiling 50 kettles!!

I was idly plugging various household items into my power meter when I noticed that my (rather elderly) fridge freezer seemed to be running a large percentage of the day so I monitored it more closely. Even though it didn't actually take much current compared to a kettle or oven it turned out it was responsible for 25% of my total electricity usage. I bought a new one &, unsurprisingly, the electricty bill fell by a substantial amount.I finally got around to writing the various scripts this weekend - and it's now automated to send me a daily notification of energy usage which I hope will be accurate! (as accurate as can be expected of course).

I tried to post my two scripts here to show how it is being done - but PH just issues me with a "Forbidden" error.

EDIT: So to complete this post, I have created this entry on my knowledgebase website with the relevant scripts.

Edited by TonyRPH on Monday 5th October 11:49

Gassing Station | Science! | Top of Page | What's New | My Stuff