[rrd-users] CDEF effects entire timeline

SolarMan hans at vega.demon.nl
Tue Feb 14 19:31:43 CET 2017

I have a simple application to determine the power generated by a water
heater. One sensor (TEMPIN) measures the in-flowing cold water temperature
while a second sensor (TEMPOUT) does the same for the hot water exiting the
heater. The flow rate is constant and samples are stored in an rrd database.
Using rrdgraph I want to display the time series of the temperatures plus
the generated power in Watt. I planned to use a CDEF to calculate the power
by multiplying the temperature difference by the flowrate and a constant and
divide that by the time between two successive samples. A python script does
it all for me. Samples come in nominally - but not exactly - at a one-second
interval, therefore the CDEF does the division using a value calculated in
python using rrdtool.last() just before every rrdtool.update() call and NOW
in the CDEF as you might guess. Seems not all too complex you would say....
BUT: I noticed that the entire Power graph (PWR) jumps up and down over the
entire time range when the time-interval (hence the division) changes and
that is clearly not what I want.
Here is the CDEF (as a python snippet):           
 "CDEF:PWR=TMPOUT,TMPIN,-," + str(flowrate) + ",*,0.06978,*,NOW," +
str(prevtime) + ",-,/",
I spent many hours reading all the available material on CDEF, VDEF etc. but
this fenomenon apparently has never come up - or this is a feature "by
How can I accomplish that the power is calculated and displayed truly
momentary per step even when the measuring interval varies?
Thanks everyone!

View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/CDEF-effects-entire-timeline-tp7583504.html
Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.

More information about the rrd-users mailing list