Daily consumption

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Daily consumption

Guillaume Betous
Hi all !

I leave in France, and having a RPi and a very basic UART adapter, I can retrieve some data from my electricity Meter. I could create some basic RRDTool graphs, and I can now foolow my instantaneous consumption.

Here is my db creation :
rrdtool create edf \
               --start now \
               --step 60 \
               DS:cpt:COUNTER:60:0:U \
               RRA:AVERAGE:0.5:1:12 \
               RRA:AVERAGE:0.5:12:48 \
               RRA:AVERAGE:0.5:288:365 \

The "cpt" value is the electricity counter raw value (in Wh), meaning electric consumption since the beginning (a very big number, which can only increase). I update it every 10s.

What I want now is to have my daily consumption. I want a graph which clearly show what was my total consumption yesterday, and the day before, and the day before etc.

How can I do that ?

Thanks for your help !

gUI
--
Pour la santé de votre ordinateur, préférez les logiciels libres.
Lire son mail : http://www.mozilla-europe.org/fr/products/thunderbird/
Browser le web : http://www.mozilla-europe.org/fr/products/firefox/
Suite bureautique : http://www.libreoffice.org/download/

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Daily consumption

Bram
Guillaume,

Assuming you already created graphs, then creating one that shows daily numbers would work the same way - just set the intervals properly. I wonder though it the result will be as 'clear' as you hope it will be. I use the RRD-tool for my meter readings as well, including a couple of graphs showing a 1 and a 10 year period. They give me a good visual indication, but for full flexibility and data analysis (such as comparing same period year over year) I let the Raspberry Pi write the counter values once a day to a text file. Every so often I import the CSV data into MS-Excel, allowing any data comparison you want.
Bram

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Daily consumption

Simon Hobson
Bram Langen <[hidden email]> wrote:

> ... but for full flexibility and data analysis (such as comparing same period year over year) I let the Raspberry Pi write the counter values once a day to a text file. Every so often I import the CSV data into MS-Excel, allowing any data comparison you want.

You can (AIUI) do time period comparisons by using the time offset functions.
I've not done it myself, but AIUI you can create two CDEFs and offset one of them by (say) 365 days, then plot them on the same graph.

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Daily consumption

Alex van den Bogaerdt-5
In reply to this post by Guillaume Betous
> Hi all !
>
> I leave in France, and having a RPi and a very basic UART adapter, I can
> retrieve some data from my electricity Meter. I could create some basic
> RRDTool graphs, and I can now foolow my instantaneous consumption.
>
> Here is my db creation :
> rrdtool create edf \
>                --start now \
>                --step 60 \
>                DS:cpt:COUNTER:60:0:U \
>                RRA:AVERAGE:0.5:1:12 \
>                RRA:AVERAGE:0.5:12:48 \
>                RRA:AVERAGE:0.5:288:365 \
>
> The "cpt" value is the electricity counter raw value (in Wh), meaning
> electric consumption since the beginning (a very big number, which can
> only
> increase). I update it every 10s.

It is not wrong, but I wonder if it is what you meant to do:
You have "--step 60" and update every 10 seconds. Your finest RRA will
still contain a composed number built from 6 updates.
Again: it is not wrong. However, combined with your actual question this
makes me wonder if you do fully understand what is happening and what you
are collecting.

It means your RRAs collect 12 minutes, 9.6 hours and 73 days. Rates older
than 73 days will not be available in your database.

That last RRA, ":288:365" contains slots of 288 minutes (4 hours 48
minutes) and has 365 of such slots. The numbers appear to be copied from
some example which collects "daily" data (288 times 5 minutes is exactly
one day, have 365 of those makes one year). Again an indicator that you
should study RRDtool a bit more.

> What I want now is to have my daily consumption. I want a graph which
> clearly show what was my total consumption yesterday, and the day before,
> and the day before etc.

If you mean: one vertical line / bar per day, then you need to be aware
that RRDtool works in UTC time. Your "days" are off by one hour during
winter, and by two hours during summer.

If you show units of 24 hours, and if you multiply the resulting average
rates by 86400 (use a CDEF for this), you will see consumption per 24
hours. Those units however will start and end at midnight UTC, so right
now in French local time they will start and end at time 01:00.

You will also need to make sure the graph area fits the shown data, e.g.
to display 30 days in a row, make sure to display on a graph which is n*30
pixels wide + set start and end to n*86400 seconds.
1: find the latest midnight UTC, by taking the timestamp right now and
round down to the nearest multiple of 86400
2: use this as end time      ( --end {$var_containing_endtime} )
3: set start to be end-2592000   (which is 86400 times 30) ( --start
end-2592000 )
4: set graph width to be 450  (or another number n times 30) ( --width 450 )

For many this will be good enough.

I believe this is as close as RRDtool will get. If you need another job to
be done, you will need to use another tool.

HTH
Alex


_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Daily consumption

Guillaume Betous


You have "--step 60" and update every 10 seconds. Your finest RRA will
still contain a composed number built from 6 updates.

Update every 10 seconds is a little bit "aggressive" but it is not really needed, you're right. The reason is that when I run my tests, I only need 10s to have an update and check that everything works (graphs update is also every 10s)
But do you confirm that I can update with a higher freq than de DB ? Let's say update every 30 sec still have sense ?

this
makes me wonder if you do fully understand what is happening and what you
are collecting.

Mmmm... the next points will show that... no :(

It means your RRAs collect 12 minutes, 9.6 hours and 73 days. Rates older
than 73 days will not be available in your database.

arglll... I'm totally wrong !
 
If you mean: one vertical line / bar per day, then you need to be aware
that RRDtool works in UTC time. Your "days" are off by one hour during
winter, and by two hours during summer.

Thanks for the warning, but it is not a very big issue in my case (unless for the 23h and 25h days which will show abnormal low or high consumption).
Let's use UTC time.
 
If you show [...]
You will also need [...]

Great !!! Will try this !

Thanks a lot :)

gUI


--
Pour la santé de votre ordinateur, préférez les logiciels libres.
Lire son mail : http://www.mozilla-europe.org/fr/products/thunderbird/
Browser le web : http://www.mozilla-europe.org/fr/products/firefox/
Suite bureautique : http://www.libreoffice.org/download/

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Daily consumption

Simon Hobson
Guillaume Betous <[hidden email]> wrote:

> But do you confirm that I can update with a higher freq than de DB ? Let's say update every 30 sec still have sense ?

Yes, you can submit updates more or less as often as you want - all that happens is the intermediate data is collated until the end of the step.
Have you read Alex's excellent tutorials http://rrdtool.vandenbogaerdt.nl ? Rates, normalizing and consolidating is really essential reading.

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: Daily consumption

Alex van den Bogaerdt-5
In reply to this post by Guillaume Betous
> You have "--step 60" and update every 10 seconds. Your finest RRA will
>> still contain a composed number built from 6 updates.
>>
>
> Update every 10 seconds is a little bit "aggressive" but it is not really
> needed, you're right. The reason is that when I run my tests, I only need
> 10s to have an update and check that everything works (graphs update is
> also every 10s)
> But do you confirm that I can update with a higher freq than de DB ? Let's
> say update every 30 sec still have sense ?

At some point the timing error will be noticeable but yeah, you can.
Personally I would also have an RRA containing 10 seconds per interval, or
not update this often. But this is not required.

Unless memory / disk space is limited, I would probably want to store at
least one hour worth of 10-second data, so that I have time to switch on
some equipment and then can still view the graph. But that's just me. You
can do what you want, just as long as you remember that RRDtool will do
what you tell it to do, not what you want it to do :)

>> If you mean: one vertical line / bar per day, then you need to be aware
>> that RRDtool works in UTC time. Your "days" are off by one hour during
>> winter, and by two hours during summer.
>>
>
> Thanks for the warning, but it is not a very big issue in my case (unless
> for the 23h and 25h days which will show abnormal low or high
> consumption).

For RRDtool, these two Sundays are just 24 hours long (UTC time).
The one in March will start at 1am local time and end 2am local time,
the one in October will start at 2am local time and end at 1am local time.
Still, both days are 86400 seconds and contain power consumption during
those 86400 seconds. So, unless you always have a much larger amount of
power usage between 1am and 2am, I don't expect to see a big difference
when compared to the other 50 Sundays in a year.

My point was: don't expect to get midnight local time to midnight local
time. You won't.

cheers,
Alex


_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users