problem calculating the difference between MAX and MIN

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

problem calculating the difference between MAX and MIN

stefan

Hello list,
I have a problem calculating thte difference between a MAX and a MIN value
this is my GRAPH:

rrdtool graph VSM.png --start end-24h --end now ^
--title "Aktueller Stromverbrauch" --width 600 --height 330 --alt-y-grid --slope-mode ^
--upper-limit 5000 --lower-limit 0 --rigid ^
--color BACK#A9F5F288 --vertical-label "Verbauch in kW" ^
DEF:Watt=VSM.rrd:Watt_cur:MAX LINE1:Watt#FF0000:"Verbrauchskurve" ^
VDEF:Wavg=Watt,AVERAGE ^
VDEF:Wmin=Watt,MINIMUM ^
VDEF:Wmax=Watt,MAXIMUM ^
VDEF:Wact=Watt,LAST ^
DEF:kwhx=VSM.rrd:Watt_tot:MAX ^
DEF:kwhn=VSM.rrd:Watt_tot:MIN ^
VDEF:kwhmax=kwhx,MAXIMUM ^
VDEF:kwhmin=kwhn,MINIMUM ^
CDEF:delta=kwhx,kwhn,- ^
VDEF:dd=delta,MINIMUM ^
COMMENT:"\l" ^
COMMENT:"Verbrauch max      " GPRINT:Wmax:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch min      " GPRINT:Wmin:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch          " GPRINT:Wavg:"%%6.2lf [W]\l" ^
COMMENT:"Zaehlerstand max   " GPRINT:kwhmax:"%%6.2lf [kW]\l" ^
COMMENT:"Zaehlerstand min   " GPRINT:kwhmin:"%%6.2lf [kW]\l" ^
COMMENT:"                   " GPRINT:dd:"%%6.2lf [kW]\l" ^
COMMENT:"Verbrauch aktuell  " GPRINT:Wact:"%%6.2lf [W]\l"


I get this error:
ERROR: the RRD does not contain an RRA matching the chosen CF

I just want to display the diff from the MAX and MIN Value of Watt_tot in VSM.rrd
 

kind regards
Stefan


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

Re: problem calculating the difference between MAX and MIN

ITCsoft54
Hello

I believe you're are using a rrd file without  RRA MINIMUM or MAXIMUM or both.

Can you post the "rrdtool create" command you used to create WSM.rrd ?

To use :

DEF:kwhx=VSM.rrd:Watt_tot:MAX ^
DEF:kwhn=VSM.rrd:Watt_tot:MIN ^

you need a leat on RRA:MAX:xff:steps:rows and one RRA:MIN:xff:steps:rows

if you juste compute delta between MININUM and MAXIMUM of your average RRA, this is the wrong way to process.

Yannick Marquet

Le 27/06/2013 09:50, Stefan Bruder a écrit :

Hello list,
I have a problem calculating thte difference between a MAX and a MIN value
this is my GRAPH:

rrdtool graph VSM.png --start end-24h --end now ^
--title "Aktueller Stromverbrauch" --width 600 --height 330 --alt-y-grid --slope-mode ^
--upper-limit 5000 --lower-limit 0 --rigid ^
--color BACK#A9F5F288 --vertical-label "Verbauch in kW" ^
DEF:Watt=VSM.rrd:Watt_cur:MAX LINE1:Watt#FF0000:"Verbrauchskurve" ^
VDEF:Wavg=Watt,AVERAGE ^
VDEF:Wmin=Watt,MINIMUM ^
VDEF:Wmax=Watt,MAXIMUM ^
VDEF:Wact=Watt,LAST ^
DEF:kwhx=VSM.rrd:Watt_tot:MAX ^
DEF:kwhn=VSM.rrd:Watt_tot:MIN ^
VDEF:kwhmax=kwhx,MAXIMUM ^
VDEF:kwhmin=kwhn,MINIMUM ^
CDEF:delta=kwhx,kwhn,- ^
VDEF:dd=delta,MINIMUM ^
COMMENT:"\l" ^
COMMENT:"Verbrauch max      " GPRINT:Wmax:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch min      " GPRINT:Wmin:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch          " GPRINT:Wavg:"%%6.2lf [W]\l" ^
COMMENT:"Zaehlerstand max   " GPRINT:kwhmax:"%%6.2lf [kW]\l" ^
COMMENT:"Zaehlerstand min   " GPRINT:kwhmin:"%%6.2lf [kW]\l" ^
COMMENT:"                   " GPRINT:dd:"%%6.2lf [kW]\l" ^
COMMENT:"Verbrauch aktuell  " GPRINT:Wact:"%%6.2lf [W]\l"


I get this error:
ERROR: the RRD does not contain an RRA matching the chosen CF

I just want to display the diff from the MAX and MIN Value of Watt_tot in VSM.rrd
 

kind regards
Stefan



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


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

Re: problem calculating the difference between MAX and MIN

stefan
In reply to this post by stefan
Hello Yannik,
thank youz for your quick response,
I am new to RRDTOOL
but this is a great tool...
 
this is my create command:
rrdtool create c:/rrdtool/VSM.rrd --start $epoch_start --step 10     DS:Watt_cur:GAUGE:60:U:U RRA:MAX:0.5:1:60480 DS:Watt_tot:GAUGE:60:U:U RRA:MAX:0.5:1:60480
you are right, I have no RRA:MIN
 
Could you point me to the right create command?
I want to store two values
1. the current energy  in WATT ( this is a value from 0 to maybe >10000)
2. the current power in kWh ( this is a value which increases each time period)
I want to show power and  delta energy in the graph ( which should be about 10kWh / 24h)

 I want to show a second curevewith the delta of "Zaehlerstand max" and "Zaehlerstand min"
and I want to "GPRINT" this value
do I need to recreate the database?
 
 


Reply | Threaded
Open this post in threaded view
|

Re: problem calculating the difference between MAX and MIN

S Shipway
> this is my create command:
> rrdtool create c:/rrdtool/VSM.rrd --start $epoch_start --step 10
> DS:Watt_cur:GAUGE:60:U:U RRA:MAX:0.5:1:60480 DS:Watt_tot:GAUGE:60:U:U
> RRA:MAX:0.5:1:60480
> you are right, I have no RRA:MIN

Also, you have the same MAX RRA specified twice.  The RRAs apply to ALL defined DSs, no matter what order you specify them.

This is what you used (reorganised for clarity)

rrdtool create c:/rrdtool/VSM.rrd --start $epoch_start --step 10
 DS:Watt_cur:GAUGE:60:U:U DS:Watt_tot:GAUGE:60:U:U
 RRA:MAX:0.5:1:60480 RRA:MAX:0.5:1:60480

This is likely what you SHOULD use:

rrdtool create c:/rrdtool/VSM.rrd --start $epoch_start --step 10
 DS:Watt_cur:GAUGE:60:U:U DS:Watt_tot:GAUGE:60:U:U
 RRA:MAX:0.5:1:60480 RRA:MIN:0.5:1:60480

Having MAX and MIN on a 1cdp=1pdp RRA is the same as AVERAGE and a bit redundant, but it's required for your graph command.  It is pointless, though, as the MAX, MIN and AVG for a single data point will be the datapoint itself!  

Note that you do not have any summary RRAs (IE, where 1cdp is more than 1pdp).  This might be intentional; however, if you want to efficiently create monthly or yearly graphs, you should probably add them (and then MAX or MIN would make more sense).  You may also want to add an AVG RRA.

The step is only 10 sec, so maybe you'd want a 5min summary RRA set to make a daily graph work faster.  So, add:

  RRA:AVG:0.5:30:2016 RRA:MIN:0.5:30:2016 RRA:MAX:0.5:30:2016

Finally - why do you have a 'watt_total' DS if you have a 'Watt current'?  I'm assuming the current holds the current rate (RRD loves rates) and the total is more the total Joules, IE sum(watt_current) over time.  In that case, you could calculate the total value in RRD as a VDEF of sum(current_average)*interval_length perhaps?

HTH

Steve


Steve Shipway
ITS Unix Services Design Lead
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: [hidden email]
 Please consider the environment before printing this e-mail : 打印本邮件,将减少一棵树存活的机会



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

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: problem calculating the difference between MAX and MIN

ITCsoft54
In reply to this post by stefan
Hello,

rrdtool is a tool to store normalized value, and aggregate data over
time. To understand how rrdtool can help you, read this link :
- http://www.vandenbogaerdt.nl/rrdtool/ Section "List of tutorials and
the like".

In your rra, you store only MAX values for each step, so data collected
is normalized using MAX function (see
http://www.vandenbogaerdt.nl/rrdtool/min-avg-max.php).
So you can only work with MAXIMUM of MAX, AVERAGE of MAX and MINIMUM of
MAX. Because you keep all collected step in you RRAs, using CF MAX,
AVERAGE or MIN get same data stored.

I understand you want to display MAX value in graphed curve, MIN in
graphed curve, AND MAX-MIN in graphed curve, independently of RRA CF
function used to stored data.

this other thread can help you :
http://oss.oetiker.ch/rrdtool/forum.en.html#nabble-td7580778

A Solution can be :

rrdtool graph VSM.png --start end-24h --end now ^
--title "Aktueller Stromverbrauch" --width 600 --height 330 --alt-y-grid
--slope-mode ^
--upper-limit 5000 --lower-limit 0 --rigid ^
--color BACK#A9F5F288 --vertical-label "Verbauch in kW" ^
DEF:Watt=VSM.rrd:Watt_cur:MAX ^
LINE1:Watt#FF0000:"Verbrauchskurve" ^
VDEF:Wavg=Watt,AVERAGE ^
VDEF:Wmin=Watt,MINIMUM ^
VDEF:Wmax=Watt,MAXIMUM ^
VDEF:Wact=Watt,LAST ^
DEF:kwhx=VSM.rrd:Watt_tot:MAX ^
VDEF:kwhmax=kwhx,MAXIMUM ^
VDEF:kwhmin=kwhx,MINIMUM ^
CDEF:delta=kwhx,POP,kwhmax,kwhmin,- VDEF:dd=delta,LAST ^
COMMENT:"\l" ^
COMMENT:"Verbrauch max      " GPRINT:Wmax:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch min      " GPRINT:Wmin:"%%6.2lf [W]\l" ^
COMMENT:"Verbrauch          " GPRINT:Wavg:"%%6.2lf [W]\l" ^
COMMENT:"Zaehlerstand max   " GPRINT:kwhmax:"%%6.2lf [kW]\l" ^
COMMENT:"Zaehlerstand min   " GPRINT:kwhmin:"%%6.2lf [kW]\l" ^
COMMENT:"                   " GPRINT:dd:"%%6.2lf [kW]\l" ^
COMMENT:"Verbrauch aktuell  " GPRINT:Wact:"%%6.2lf [W]\l"

Best regards,

Yannick


> Hello Yannik,
> thank youz for your quick response,
> I am new to RRDTOOL
> but this is a great tool...
>  
> this is my create command:
> rrdtool create c:/rrdtool/VSM.rrd --start $epoch_start --step 10
> DS:Watt_cur:GAUGE:60:U:U RRA:MAX:0.5:1:60480 DS:Watt_tot:GAUGE:60:U:U
> RRA:MAX:0.5:1:60480
> you are right, I have no RRA:MIN
>  
> Could you point me to the right create command?
> I want to store two values
> 1. the current energy  in WATT ( this is a value from 0 to maybe >10000)
> 2. the current power in kWh ( this is a value which increases each time
> period)
> I want to show power and  delta energy in the graph ( which should be about
> 10kWh / 24h)
>
>   I want to show a second curevewith the delta of "Zaehlerstand max" and
> "Zaehlerstand min"
> and I want to "GPRINT" this value
> do I need to recreate the database?
>  
>  
>
>
>
>
>
>
> --
> View this message in context: http://rrd-mailinglists.937164.n2.nabble.com/problem-calculating-the-difference-between-MAX-and-MIN-tp7581058p7581062.html
> Sent from the RRDtool Users Mailinglist mailing list archive at Nabble.com.
>
> _______________________________________________
> rrd-users mailing list
> [hidden email]
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
>

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

Re: problem calculating the difference between MAX and MIN

stefan
Thank you Steve and Yannick for your create help,
you gave me little more light on "rrdtool".
I think, I have to read the docu more than twice ;-)

Stefan
Reply | Threaded
Open this post in threaded view
|

Re: problem calculating the difference between MAX and MIN

stefan
Steve,
Steve wrote
Finally - why do you have a 'watt_total' DS if you have a 'Watt current'?  I'm assuming the current holds the current rate (RRD loves rates) and the total is more the total Joules, IE sum(watt_current) over time.  In that case, you could calculate the total value in RRD as a VDEF of sum(current_average)*interval_length perhaps?
this sounds interresting... but could you explain little more how should the VDEF look like,
I did not find an example in the docu for "sum(...)"
How do I get the interval_length? is it the heartbeat?
How do I get the time for a certain datapoint e.e. for the MAX or MIN?

Stefan