Estimate daily energy costs taking into account given conditions

Hi,

first of all: thanks to the creators of this wonderful project and to the great community around it.

I'm running a couple of EmonTx v3 with the 3 Phase sketch (emonTxV3_3Phase_Voltage.ino). As a base station I use the Raspberry Pi (low write image) and additionally I'm sending the data to emoncms.org.

My question is: how could I estimate daily energy costs taking into account some conditions:

- energy costs depend on things like day/night time, weekday (and so on)

My approach would be:

- create a dedicated Wh Accumulator feed (containing the actual/approx. power usage sum of all 3 phases)

- on a daily base get the accumulator feed value (through the API) for example at 10pm and subtract the feed value at 8am.

This should give me the amount of consumed energy during that time frame (8am - 10pm). Am I right?

What would your solution look like?

Thank you in advance

Mik

pb66's picture

Re: Estimate daily energy costs taking into account given conditions

Wh accumulator is specifically for use with wh counting on board a emonTx and requires a ever increasing total to function.

If you are only transmitting power and totalling within emoncms a normal power to kwh will do the trick.

I am tracking costs across a multi rate tarriff (Economy 7) using cron to switch tariffs at the respective times.

ie when peak kicks in the "current rate = £hi" and "peak = 1" offpeak=0"

and when off peak kicks in "current rate = £lo" and "peak =0" offpeak = 1"

processing for "peak tarriff" is Kwh's x peak (1 or 0) for peak kwhs and x currentrate for cost

similarly for "offpeak tarriff" Kwh's x offpeak (1 or 0) for off peak kwhs and x currentrate for cost

I have found this very accurate except for the fact I have a PV diverter and if that is working well then the to and fro'ing within the "sweet zone" or "energy bucket" adds to the recorded energy totals in both directions but that has nothing to do with the tarriff split as they always match the total when summed.

The script I use with cron and emonhub is available on github and called cronnode

There is also a "EmonCMS multi rate scheduler" in development which looks more powerful but won't be able to be used with emoncms.org as it's a separate module. 

Paul

 

mik.open's picture

Re: Estimate daily energy costs taking into account given conditions

Thank you Paul for sharing your approach.

I sure got that accumulator thing totally wrong :) If would have been really nice if that was the case (accumulate the kWh and query the value for a given time). I'm wondering how I could achieve that. It would be great to get only the data (kWh) for the various time frames I'm interested in and do the math outside of emoncms.

I would need that, because on my bill I have different prices for the first X kWh per month, a price for the next Y and after surpassing a defined threshold I will pay another price.

Mik

pb66's picture

Re: Estimate daily energy costs taking into account given conditions

Its totally possible to track the usage in a way that's more suited to your needs for starters if you new the month to date kwh's the rest would be easy to do maually outside emoncms and could be the basis of automating the process.

If you start with the normal tracking and to that add a second power to kwh feed called something like "month2date" this would just follow the normal every increasing tally of energy used. But if you then add an input using the input api for example http://emoncms.org/input/post.json?node=1&apikey=xxxxx&json{mtd=0} and you add one process "log to feed" and select the "month2date" feed previouslcreated. When ever that api url is used it will reset the month to date to 0.

Then set up a cron to run that url request at midnight the 1st of each month (or whenever your billing cycle starts) this will give you a actual amount used this month throughout the month. to simplify your calcs.

You could include a second value to that api url with your 1st band price per unit so that you can also calculate a rolling cost for both the month and the total kwhs.eg http://emoncms.org/input/post.json?node=1&apikey=xxxxx&json{mtd=0,ppu=25}  (as in 25 PencePerUnit)

To that you add a simple script that polls the month to date feed and if that value is greater than your 1st break point it sends  http://emoncms.org/input/post.json?node=1&apikey=xxxxx&json{ppu=15}  (2nd band price) and when the returned value reaches the next break point http://emoncms.org/input/post.json?node=1&apikey=xxxxx&json{ppu=5}  (3rd band price) 

At which point your dash board can display not only the accurate month to date units used but accurate cost for the month too.

It sounds complex but that's probally just the long winded explanation.

Basically a cron and a send if greater than script and your there.

Paul

 

mik.open's picture

Re: Estimate daily energy costs taking into account given conditions

Thanks Paul, but as mentioned in the previous post there is an additional variable (the time of the day and the week day). I can't see how I can handle that in your last suggestion.

Mik

pb66's picture

Re: Estimate daily energy costs taking into account given conditions

I'm not sure I understand your tariff but the bottom line is once you know the equation it should be achievable as cron can cope with any schedule and you can fetch the "total since whenever" from emoncms into a simple script to act on "unit counts since" the combination of the 2 can set a "tariff node" of control data prices etc that you can manipulate to effect the collected data, so the units get added to the right tarrif feeds and those feeds multiplied by price per unit give you cost to date or month to date.

If you layout the full terms of your tariff (the exact prices/times and quantities etc can be altered for privacy) I'll give it a whirl for you

Paul

mik.open's picture

Re: Estimate daily energy costs taking into account given conditions

Hi Paul, I've looked at my bill and I've noticed that taking into account only the time/day variable should work out just fine.

Now I will try to wrap up the information you gave me. I still have a couple of questions:

- do I have to create a "Power to kWh"-feed?

- with which URL/method should I query the value for the start and end of a tariff timeframe?

Thanks

Mik

mik.open's picture

Re: Estimate daily energy costs taking into account given conditions

Hi,

I've decided to do all the math outside of Emoncms. Now I've the relevant data in multiple feeds.

Is there an API call to get the feed value on a given unixtimestamp?

I've seen the data.json call, but I wasn't able to get proper data from it.

 

Thanks

Mik

mik.open's picture

Re: Estimate daily energy costs taking into account given conditions

I've solved this issue doing something like this (quick and dirty):

        endTS = startTS + 10000
        requestUrl = "http://emoncms.org/feed/data.json?" +
 "id=%s&start=%s&end=%s&apikey=%s&dp=1" % (feedid, startTS, endTS, apikey)

        import urllib2
        response   = urllib2.urlopen(requestUrl)
        responseJs = json.loads(response.read())
        # get first value
        feedTS    = responseJs[0][0]
        feedValue = responseJs[0][1]

 

Edit - wrapped long line - BT

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.