# [rrd-users] need help with figuring out how many minutes furnace is on

Haroon Rafique haroon.rafique at utoronto.ca
Tue Nov 6 20:48:06 CET 2012

```On 2012-11-06, at 12:55 PM, Brent Barr <b.barr at f5.com> wrote:

> Hello Haroon-  I do something similar, so maybe this might help.  This is my graph generator for one of my building AC units (in a Python system call):
>
> [..snip..]
>
> The interesting part are these lines:
>                                    DEF:linee=lsr_ac_rt-19_1m.rrd:p8:AVERAGE:start=-%sh\    # Cooling Y1
>                                    DEF:linef=lsr_ac_rt-19_1m.rrd:p9:AVERAGE:start=-%sh\     # Cooling Y2
>                                    CDEF:cd7=linee,linef,+,5,*\
>                                    CDEF:vd2=cd7,10,*\
>                                    VDEF:vd1=vd2,AVERAGE\
>                                    COMMENT:"Average cooling in window\:"\
>                                    GPRINT:vd1:"%%2.1lf"\
>

Solved thanks to your response. Here's what I ended up using (keeping in mind, mode=0 means idle, 1 means heating, 2 means cooling):

# automatically round up or down
CDEF:mode_rounded=mode,1,%,0.5,GE,mode,CEIL,mode,FLOOR,IF
CDEF:heating=mode_rounded,1,GE,temp,UNKN,IF
CDEF:cooling=mode_rounded,2,GE,temp,UNKN,IF
CDEF:heating_percent=mode_rounded,1,GE,100,*
CDEF:cooling_percent=mode_rounded,2,GE,100,*
VDEF:heating_percent_vdef=heating_percent,AVERAGE
VDEF:cooling_percent_vdef=cooling_percent,AVERAGE

Cheers,
--
Haroon Rafique   <haroon.rafique at utoronto.ca>
Information Security & Enterprise Architecture, University of Toronto

```