[rrd-users] Question about averaging daily ; but with 5 min. steps

Jean-Yves Avenard jyavenard at gmail.com
Tue Dec 15 13:41:54 CET 2009


Hi

2009/12/15 Alex van den Bogaerdt <alex at vandenbogaerdt.nl>:
> Then, when you subtract your usage from your generated power, with a minimum
> of zero, you end up with the amount of Joules you did generate but not use
> yourself.  The remainder is fed to the net. You want to know how much that
> amount is. Correct?

correct, but that value *must* be calculated on 5 minutes average ; at
all time, no matter the resolution requested.

> Assuming that "ctotal" is the amount of power used, and "csolar" is the
> amount of power generated:
> I think you wrote this summary backwards, or else this is where your problem
> is. It should be
> CDEF:cexport=csolar,ctotal,-,0,MAX

I don't have it backward. If  you look at the graph I'm generating,
you'll see that I put it underneath the individual power output ; with
the feed-in tarif shown underneath.

So I made the calculation in that order to provide a negative result.

It looks nicer that way :)

>
> The average of that amount of Joules during a certain time frame (such as
> 86400 seconds), multiplied by the number of seconds, is the amount of
> Joules.  And converting that to Wh or kWh is just a matter of multiplying
> (using CDEF) before letting RRDtool compute its average.

but then the average isn't done on the 5 minutes interval but on
86400s intervals..
Look at my example I posted this morning. You'll see that doing the
calculation on daily interval gives an entirely different result than
if performed on daily average.

>
> You could, for instance, let RRDtool generate a report without graphing. Use
> PRINT (not: GPRINT) to write the average.
>
> rrdtool graph nothing --start $midnight1 --end start+24h DEF:ctotal=....
> DEF:csolar=... CDEF:cexport=csolar,ctotal,-,0,MAX,86400,*,3600,/
> PRINT:cexport:AVERAGE:%6.2lf
>
> (you need to add several lines, for instance make sure there are no
> unknowns)
>
> For every 5-minute slot: if you produced more than you used, it turns up as
> a positive number. If you produced less than you used, it turns up as zero.
> A smaller example (one day would be too much): 0, 0, 10, 20, 50, 40, 0, 0,
> 0, 0
> During 6 intervals you used less than you produced. 10+20+50+40=120. When
> RRDtool is averaging this, it would compute 120/12=10. When multiplied with
> the amount of time, 12 in my example, you end up with 120 which is, not
> surprisingly, the same as 10+20+50+40.
> In this example I used unnamed units. The result is the same if I work in
> kWh, Wh, time slots of 300 seconds, etc.

But then, how do you feed back that info back to RRD?

that's not very elegant..

Obviously, I could run a cron every 5 minutes that calculate the
average of both the usage and the solar output, then store it in a RRD
database ... This would do the job, but where is the fun in that ? :P



More information about the rrd-users mailing list