[rrd-users] Re: PREV-Function? SUM-CF ?

Alex van den Bogaerdt alex at ergens.op.het.net
Sun Sep 24 22:31:10 MEST 2006

On Sun, Sep 24, 2006 at 06:14:18PM +0200, Rene Fritzsche wrote:

> First of all, let me explain, what i'm planing to do:
> i've got some data of a lightsensor, measuring the
> irradiation. these values are measured in watt/m^2
> and are fed into a rrd-database every 60 seconds.

So you have a number measured over 60 seconds.  If you feed this
as a gauge to rrdtool, rrdtool is made to believe this is a value
per second (remember: everything is a rate).  So, what you really
have is a number that is 60 times too high but apart from that is
the amount of joules per second per meter squared.

> now i want to calculate the amount of energy in total
> which is collected by this sensor since a chosen time...
> measured in watt*s.

You say here you want a total, but from the context ...

> (i know the size of the surface area of that sensor.)
> and i dont want only one value for a day, i want to
> have the run of the curve of the energy.

... it seems you want this per time interval, not a grand total.

If you multiply the amount of (joule per second) by the amount of
seconds, you get the amount of joules.  This is what you want, right?

Remember to correct the error at input by dividing by 60, then
multiply by the step size and by the surface area.

If you also want the total amount of energy, then that is the
average rate multiplied by the total time.  Another CDEF perhaps,
and then combine with GPRINT.

Probably not important anymore:
Why does your PREV() not work:  you use PREV on something that
does not yet exist.  "CDEF:x=PREV(x)" cannot work because x does
not yet exist thus PREV(x) is an error.

Why did your PREV not work:  because the first one is referring
to something unknown, thus returns unknown.  The second time interval
looks back at your first unknown thus is unknown itself aswell.
"CDEF:x=PREV" results in all rates unknown for this time series.

You always need some "if (unknown) then this else that" logic in your
CDEFs when using prev or prev().

(n.b. the following examples will probably not work because they
don't use another CDEF or a DEF)

"CDEF:x=PREV,UN,0,PREV,1,+,IF" would look at the previous value. If this
is unknown, result is 0, else result is one more than the previous value.
Result for n intervals: 0,1,2,3,4,5,6,7,8,9,....,n-1

"CDEF:x=PREV,UN,0,UNKN,IF" would alternate between zero and unknown.

Alex van den Bogaerdt

Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi

More information about the rrd-users mailing list