0

Ive got a graph that displays the temperature from my wood pellets stove, what I would like is to get the time the temperature is rising vs cooling down.

Anyone know how to get something like the slope of the curve in RRDTool or something similar?

Balroq
  • 487
  • 3
  • 6
  • 17

1 Answers1

1

You can do this in two different ways.

First of all, you could use a "DERIVE" data type. This will log the derivative -- IE, the slope -- of the data instead of the actual data. However, this will not store the actual temperatures, which is probably not what you want.

The next way to do it is to calculate the slope on the fly from the actual data, as we build the graph. You've already stored your temperature using a GAUGE data type. Now, you can use a calculated value to work out the slope.

DEF:temp=myrrdfile.rrd:ds0:AVERAGE
CDEF:slope=temp,PREV(temp),-,STEPWIDTH,/

This calculates slope to be the difference between the current and previous value, divided by the time interval.

However, since all you seem to be interested in is if the temperature is going up or down, you could instead use something like:

CDEF:cooling=temp,PREV(temp),LT,INF,0,IF
CDEF:warming=temp,PREV(temp),GT,INF,0,IF
AREA:cooling#0000cc::skipscale
AREA:warming#cc0000::skipscale
LINE:temp#00cc00:Temperature

This will graph the temperature as a green line, with a background of red if warming, and blue if cooling.

Steve Shipway
  • 3,754
  • 3
  • 22
  • 39
  • Not sure whats wrong but my rrdtool doesn't seem to like PREV(). I get this: syntax error near unexpected token `(' `CDEF:cooling=pannrum,PREV(pannrum),LT,INF,0,IF \'. Any idea what is going on? Tried to upgrade to the latest rrdtool too but to no avail. – Balroq May 16 '18 at 15:03
  • This works: CDEF:cooling=pannrum,PREV,LT, pannrum,0,IF. Not sure why it doesnt understand PREV(). – Balroq May 17 '18 at 06:36
  • Arghh, found the problem, Ive got the rrdtool command in a bash script and of course I have to escape the ( and ). Stupid mistake. – Balroq May 17 '18 at 07:24