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

stefan Stefan.Bruder at gmx.net
Thu Jul 4 08:51:19 CEST 2013

```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.

```