[rrd-users] how to calculate the sum of a DS

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Mon Jul 8 10:29:08 CEST 2013

----- Original Message ----- 
From: "stefan" <Stefan.Bruder at gmx.net>
To: <rrd-users at lists.oetiker.ch>
Sent: Monday, July 08, 2013 9:12 AM
Subject: Re: [rrd-users] how to calculate the sum of a DS

>I called the manufacturer of the controller,
> he told me that the controller reports the power in Watt  and so I have to
> multiply it with the time, and the power is the average within 10 seconds.

Remember where you wrote:

> so I have 400W/10s.

That is a division, which is indeed wrong, confirmed now by the 

For this example number, the average rate at which energy is delivered by 
your solar panel is 400. That average was valid during the past 10 seconds. 
This means that (on average) every second 400 joules have been delivered 
(J/s, also known as W) during 10 seconds, for a total of 4000 (not 40) 

After one full day (86400 seconds) this average would result in 34560000 
joules, which is 9.6 kWh.

Please make very sure you understand the difference between Wh and W/h. It 
is very significant...

Anyway, your device reports Watts. As stated before: Watt means joules per 
Second.  RRDtool really likes things per second, so you're good.

Your measured number is already something per second, so "GAUGE" is the 
correct counter type to use.  If you use that, RRDtool will automatically do 
the right thing, store joules per second.  Similar to your device, RRDtool 
will hold the rate at which energy is delivered or used (joules) during an 
amount of time (your step size, multiplied by the number of steps per RRA 
row). The rate at which energy is moved is called power.

The next thing to determine is what you want to be able to monitor.  Do you 
want to know the amount of joules (perhaps converted to another unit), or do 
you want to know peaks. This is not mutually exclusive.  If you want to be 
able to count, use AVERAGE.  If you want to remember peaks, use MAX.  If you 
want both, use both.

After a while, your database will contain many time ranges, each filled with 
the average (or max, or both) number of joules per second. If you are 
carefully setting the start and end times, as well as the width of the 
graph, then you can know exactly how much time this graph spans.  If you 
compute the average number of joules per second on that graph, then you 
know, for instance, that this average is 400 J/s, also known as 400W. If 
your graph spans exactly 86400 seconds (one full day) then the amount of 
joules during that day will be 34560000, which can be converted to 9.6 kWh.

This is what I think you want to have as an answer, eventhough your original 
question was different.

I think maybe you were adding up 400+360+430+560 and so on, which then 
results in a number much lower (by a factor 10) than the real number.

More information about the rrd-users mailing list