Project

General

Profile

Feature #27

Calculate energy cost over time

Added by Anonymous almost 9 years ago. Updated about 5 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:

Description

Just putting this out there so that it can be thought about. Here's my take on this:

For devices which monitor power, a new tab should be added called "Cost|Power cost|Energy Cost". On this tab, one can select a checkbos to activate cost measurements. On the same tab one can specify power cost per kWh. There should be a way to specify different amounts for single or dual tariffs, and the start/end times for the dual tariff time period if applicable.

As for measurement, there's two approaches: log power usage costs, or log actual power usage.

Advantages of measuring power usage:

- allows more flexibility with changing tariffs; one can calculate hypothetical costs when playing with single or dual tariff etc.
- gives a very exact method of showing used power history, far more precise than RRDTool

Disadvantages of measuring power:

- If the tariffs change in 2011, the historical data for 2010 would use those new values and give incorrect data. This could be circumvented by allowing the cost to be specified per year on the tab but it's not ideal.
- Calculating costs over a period of a year will involve a lot of calculations; not sure if this is a problem, but could be for embedded devices; there's ways to code around this though (use batches).

Advantages of measuring cost:

- Always accurate in its history because it will use the configured tariffs
- ?

Disadvantages of cost

- Not possible to calculate if different tariffs or dual vs single tariffs are cheaper
- ?

The actual measurement (power usage in this example) might look like:

- Take the average Watts between each measurement point
- Store this in a table with rows id, device_id, measurement start time, measurement stop time (start time + measurement period), average watts used, actual watts used in this measurement period (the magic bit), tariff_id (single or one of the dual tariffs)

Example:
At 15:30:00 TV uses 200W, 15:30:30 uses 400W. Average = 300 but that's by the hour, so what we'll do is:
(average_watts/(seconds_in_an_hour/measurement_interval)), e.g. (300/(3600/30)) == 300/120 = 2.5w.
In SQL: (better use unix timestamps but just for illustration)
insert $id,$device_id,2010-02-17-15-30-00,2010-02-17-15-30-30,300,2.5,1

One might say well, I measure every 5 seconds so I will get 17280 records per day and 6.3 million records per year. Two approaches to solve this:

1) Insert the daily data in an energy_daily table and sum up the entries at the end of each day, then insert the result in the main energy_cost table

2) Keep it all in one table and print a warning about the amount of records and the consequences of it (e.g. data size, slow calculation etc)

As for calculating the actual cost, that shouldn't be too difficult, and perhaps even fully doable in SQL. Single tariff:

- Select SUM from energy_cost where timestamp_start after $startdate and timestamp_start before $enddate and tariff_id = 1
- multiply result with tariff_value from tariff_id 1

Dual tariff:

- Select SUM from energy_cost where timestamp_start after $startdate and timestamp_start before $enddate and tariff_id = 1
- multiply result with tariff_value from tariff_id 1
- Select SUM from energy_cost where timestamp_start after $startdate and timestamp_start before $enddate and tariff_id = 2
- multiply result with tariff_value from tariff_id 2
etc

OK, out of time, I hope it's of some use so far :) Wish I could code BASIC better, otherwise I'd give it a go. But I'm more than happy to improve once the fundamentals are there :)

History

#1 Updated by Anonymous about 5 years ago

  • File 111.pdf added

#2 Updated by Alexie about 5 years ago

What is this attachment? Seems to be russian only …? Can you replace it with a "good" one?

#3 Updated by Alexie about 5 years ago

  • File deleted (111.pdf)

Also available in: Atom PDF