# [rrd-users] Calculation that is a bit over my head.

Steve Shipway s.shipway at auckland.ac.nz
Mon Nov 18 01:55:29 CET 2013

```If you have a 0 and a 1 logged, and your graph is for one day, then you could get your total energy use by

DEF:onoff=myfile.rrd:myds:AVERAGE

(This is now a dataset of 1 or 0)

CDEF:powerinwatts=onoff,3000,*

(This is now a dataset of Watts)

CDEF:powertmp=powerinwatts,86400,*

(This is an intermediate dataset holding 86400xWatts.  This is necessary because you cannot do arithmetic in a VDEF)

VDEF:totalenergy=powertmp,AVERAGE

(This is a single value of  (average power over a day, multiplied by 86400).  Since 86400 is the number of seconds in a day, this value is therefore the total energy consumption for the day in Joules.)

Of course the above can be simplified.  If you want in kWh rather than J you can divide by 3600000 …

Steve

_____

Steve Shipway

University of Auckland, New Zealand

Floor 1, 58 Symonds Street, Auckland

Phone: +64 (0)9 3737599 ext 86487

DDI: +64 (0)9 923 6487

Mobile: +64 (0)21 753 189

Email:  <mailto:s.shipway at auckland.ac.nz> s.shipway at auckland.ac.nz

P Please consider the environment before printing this e-mail : 打印本邮件，将减少一棵树存活的机会

From: rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch [mailto:rrd-users-bounces+s.shipway=auckland.ac.nz at lists.oetiker.ch] On Behalf Of Jan Johansson
Sent: Monday, 18 November 2013 12:35 p.m.
Cc: rrd-users at lists.oetiker.ch
Subject: Re: [rrd-users] Calculation that is a bit over my head.

>I would suggest to set the DS to GAUGE

>

>and then log 3000 when your heater is on and 0 when it is off

>

>cheers

>tobi

Hello!

The  DS is set to gauge, but I cannot really change the value, as the controller in use actually talks to RRD directly, so I only have  control over the “read side” of things.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20131118/fe461de6/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5900 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20131118/fe461de6/attachment.bin
```