RRDs::graph and DEF... MIN

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RRDs::graph and DEF... MIN

Joachim Hartmann
Hi,
I am monitoring my heating by a raspberry-pi using rrd data base:
- TMP_V = flow temperature
- TMP_R = return temperature
- WOHNZ = indoor temperature
- AUSEN = outdoor temperature
- PUMPE = circulating pump (running or not)

The graph wil be drawn by perl script using RRDs::graph
(librrds-perl 1.4.7-2+rpi1):

################################################################
RRDs::graph($tmpfile,
   @opts,
   "DEF:TMP_V=/home/pi/heizung.rrd:hzg_v:AVERAGE",
   "DEF:TMP_R=/home/pi/heizung.rrd:hzg_r:AVERAGE",
   "DEF:WOHNZ=/home/pi/heizung.rrd:wohnz:AVERAGE",
   "DEF:AUSEN=/home/pi/heizung.rrd:ausen:AVERAGE",
   "DEF:PUMPE=/home/pi/heizung.rrd:pumpe:AVERAGE",
   "CDEF:OnOff=PUMPE,FLOOR,80,*",
   "AREA:OnOff#F0EFEF:Umwaelzpumpe  ",
   "LINE1:OnOff#424242:",
   "LINE2:0#000000:",
   "GPRINT:PUMPE:LAST:akt.\\:%5.1lf",
   "GPRINT:PUMPE:MIN:min\\:%5.1lf",
   "GPRINT:PUMPE:MAX:max\\:%5.1lf",
   "GPRINT:PUMPE:AVERAGE:mittel\\:%5.1lf\\n",
   "LINE2:TMP_V#FF0000:Vorlauftemp.  ",
   "GPRINT:TMP_V:LAST:akt.\\:%5.1lf",
   "GPRINT:TMP_V:MIN:min\\:%5.1lf",
   "GPRINT:TMP_V:MAX:max\\:%5.1lf",
   "GPRINT:TMP_V:AVERAGE:mittel\\:%5.1lf\\n",
   "LINE2:TMP_R#0000FF:Ruecklauftemp.",
   "GPRINT:TMP_R:LAST:akt.\\:%5.1lf",
   "GPRINT:TMP_R:MIN:min\\:%5.1lf",
   "GPRINT:TMP_R:MAX:max\\:%5.1lf",
   "GPRINT:TMP_R:AVERAGE:mittel\\:%5.1lf\\n",
   "LINE2:WOHNZ#00FF00:Wohnzimmer    ",
   "GPRINT:WOHNZ:LAST:akt.\\:%5.1lf",
   "GPRINT:WOHNZ:MIN:min\\:%5.1lf",
   "GPRINT:WOHNZ:MAX:max\\:%5.1lf",
   "GPRINT:WOHNZ:AVERAGE:mittel\\:%5.1lf\\n",
   "LINE2:AUSEN#424242:Aussentemp.   ",
   "GPRINT:AUSEN:LAST:akt.\\:%5.1lf",
   "GPRINT:AUSEN:MIN:min\\:%5.1lf",
   "GPRINT:AUSEN:MAX:max\\:%5.1lf",
   "GPRINT:AUSEN:AVERAGE:mittel\\:%5.1lf\\n"
);
################################################################

All looks fine as lpng as the outdoor temperatrure is above 0 degree.
Otherwise the pump graph ends at the O line, it looks ugly!

My idea: drawing first something like this:
################################################################
   ...
   "DEF:Off=/home/pi/heizung.rrd:ausen:MIN",
   "AREA:Off#F0EFEF",
   "LINE1:Off#424242:",
   ...
################################################################

but - my - RRDs::graph does not exept the line
  "DEF:Off=/home/pi/heizung.rrd:ausen:MIN",
!!

Anyone an idea?

Sorry English is not my native language and school is long ago
--
Gruß aus der Stadt der CeBIT
Greeting from the city of CeBIT
Jochen

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: RRDs::graph and DEF... MIN

Alex van den Bogaerdt-5
> All looks fine as lpng as the outdoor temperatrure is above 0 degree.
> Otherwise the pump graph ends at the O line, it looks ugly!

In other words: you only have a problem with

>    CDEF:OnOff=PUMPE,FLOOR,80,*",
>    "AREA:OnOff#F0EFEF:Umwaelzpumpe  ",

Not sure if it will work, but try this:

 CDEF:OnOff1=PUMPE,0.5,LT,UNKN,INF
 CDEF:OnOff2=PUMPE,0.5,LT,UNKN,NEGINF
 AREA:OnOff1#F0EFEF:Umwaelzpumpe
 AREA:OnOff2#F0EFEF

If you need to fix some error in my RPN, then here is what it is supposed
to do:

if PUMPE < 0.5 then return UNKN else return INF into OnOff1
if PUMPE < 0.5 then return UNKN else return -INF into OnOff2
Draw both OnOff as an area, just print one label.
INF will not modify the Y-axis, it will just fill the entire vertical
space available. If there are no negative rates, then I do not expect to
see anything from that second CDEF. But if there are negative rates, this
CDEF will show up, and it will look as if it is one big area from -inf to
+inf.

I assumed you enter 0 or 1 for pumpe, and I chose an arbitrary 0.5 as the
cutoff point. You can and should change this value if your situation is
different.

Do not test for being equal to 1 or not.  That won't work if there is any
normalization or consolidation happening.

HTH
Alex


_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: RRDs::graph and DEF... MIN

Simon Hobson
In reply to this post by Joachim Hartmann
Joachim Hartmann <[hidden email]> wrote:

> Hi,
> I am monitoring my heating by a raspberry-pi using rrd data base:
> - TMP_V = flow temperature
> - TMP_R = return temperature
> - WOHNZ = indoor temperature
> - AUSEN = outdoor temperature
> - PUMPE = circulating pump (running or not)
...

> All looks fine as lpng as the outdoor temperatrure is above 0 degree.
> Otherwise the pump graph ends at the O line, it looks ugly!
>
> My idea: drawing first something like this:
> ################################################################
>  ...
>  "DEF:Off=/home/pi/heizung.rrd:ausen:MIN",
>  "AREA:Off#F0EFEF",
>  "LINE1:Off#424242:",
>  ...
> ################################################################
>
> but - my - RRDs::graph does not exept the line
> "DEF:Off=/home/pi/heizung.rrd:ausen:MIN",
> !!
>
> Anyone an idea?

How about running through an RRD Graph once, but rather than drawing anything, use PRINT (NOT GPRINT) to get the minimum value of ausen and then you have a value (Perl variable) you can use as a constant in a second RRD Graph run.

So use VDEF to get the min value, then do some maths (further CDEFs) to draw the pumpe value between this min value and 1


> Sorry English is not my native language and school is long ago

No need to apologise, your English is a lot better than my German from school (also a lot of years ago) !

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: RRDs::graph and DEF... MIN

Joachim Hartmann
In reply to this post by Alex van den Bogaerdt-5
Hi Alex,

Am 02.12.2016 um 16:59 schrieb Alex van den Bogaerdt:
> Not sure if it will work, but try this:
>
>  CDEF:OnOff1=PUMPE,0.5,LT,UNKN,INF
>  CDEF:OnOff2=PUMPE,0.5,LT,UNKN,NEGINF
>  AREA:OnOff1#F0EFEF:Umwaelzpumpe
>  AREA:OnOff2#F0EFEF
>
>
> HTH

it works after modifying your idea a little bit:

   "CDEF:OnOff1=PUMPE,0.5,LT,0,80,IF",
   "CDEF:OnOff2=PUMPE,0.5,LT,0,NEGINF,IF",
   "AREA:OnOff1#F0EFEF:Umwaelzpumpe",
   "AREA:OnOff2#F0EFEF",
   "LINE1:OnOff1#424242:",
   "LINE1:OnOff2#424242:",
Is it allowed to add an attachment? If yes i will add two screenshots
zu my solved mail

--
Gruß aus der Stadt der CeBIT
Jochen

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
Reply | Threaded
Open this post in threaded view
|

Re: [solved ]RRDs::graph and DEF... MIN

Joachim Hartmann
For all who are interested of the effect of the code changing
may look for

- the ugly graph here:
   http://www.forum-raspberrypi.de/attachment.php?aid=11779

- the nice graph here:
   http://www.forum-raspberrypi.de/attachment.php?aid=11812

Or for all German speaking a link to the whole thread:
http://www.forum-raspberrypi.de/Thread-andere-rrdtool-perl-grafikoptimierung-mit-cdef-vdef

Thanks vor help!

--
Gruß aus der Stadt der CeBIT
Greeting from the home of CeBIT
Jochen

_______________________________________________
rrd-users mailing list
[hidden email]
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users