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

Johan Elmerfjord jelmerfj at adobe.com
Thu Jul 4 09:27:17 CEST 2013


Hi Stefan,

Without looking into it deeper, it sounds like you are trying to sum up
all different Power-readings (W) to get a Energy reading (Wh).

If you do readings every 60 seconds, - you will end up with 1440 values
during 24 hours.

Lets say that you constant usage of 1000W. Then all readings for the
whole 24 hours would be just 1000-readings.
This should result in that you used 24000Wh - or 24kWh - as you used
1kWh for 24 hours.

So you can't just summarize all your 1000W*1440values together, but you
also needs to divide them by 60 - as you have 60 readings per hour -
which is the new unit - I'm suppose you are looking for.

I would go with a AVG RRD when creating it to get a average of the
values collected when doing consolidations.
Using the max will result in higher readings than what you actually
have, as a very short high peak during reading can offset the values
quite a lot.

Hope that this give you some insight - and answered part of the
question.

/Johan

On Wed, 2013-07-03 at 23:51 -0700, stefan wrote:

> Hi,
> I am struggling on a problem calculating the sum of a DS for the given
> period.
> I have a rrd:
> rrdtool create PV.rrd --start now --step 10  DS:PVWatt:GAUGE:60:U:U
> RRA:MAX:0.5:1:60480
> 
> the PVWatt has values from 0 to 5000
> 
> I want to Print to total amount of PVWatt for the given time period (24h) 
> My Graph looks like this:
> c:/Programme/rrdtool/rrdtool.exe graph c:/wwwpics/PV.png --start noon-12h
> --end noon+12h ^
> --title Photovoltaikanlage --width=600 --height=300 --alt-y-grid ^
> --upper-limit 5000 --lower-limit 0 --rigid ^
> DEF:Watt=PV.rrd:PVWatt:MAX LINE1:Watt#00FF00:Watt_cur ^
> VDEF:Wmin=Watt,MINIMUM ^
> VDEF:Wmax=Watt,MAXIMUM ^
> VDEF:Wavg=Watt,AVERAGE ^
> CDEF:Wmod=Watt,POP,Wmax,Wmin,- ^
> VDEF:Wtt=Wmod,LAST ^
> VDEF:Wlast=Wmod,LAST ^
> VDEF:first=Watt,FIRST ^
> COMMENT:" \l" ^
> COMMENT:"MAX Leistung  \:" GPRINT:Wmax:"%%6.1lf Wp" ^
> COMMENT:" \l" ^
> COMMENT:"Start         \:" GPRINT:first:"%%6.1lf Wp"
> GPRINT:first:"%%c":strftime ^
> COMMENT:" \l" ^
> COMMENT:"Total Leistung\:" GPRINT:Wtt:"%%6.1lf Wh"
> GPRINT:Wlast:"%%c":strftime ^
> COMMENT:" \l" 
> 
> 
> I have tried several calculations for Wmod/Wtt but all results are wrong.
> I don't know how RRD is calculating the sum of PVWatt?
> can someone light me up?
> 
> Thanks
> Stefan
> 
> 
> 
> 
> --
> View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/how-to-calculate-the-sum-of-a-DS-tp7581099.html
> Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
> 
> _______________________________________________
> rrd-users mailing list
> rrd-users at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20130704/ff612922/attachment.htm 


More information about the rrd-users mailing list