# [rrd-users] Handling solar inverter data in rrdtool ?

Steve Shipway s.shipway at auckland.ac.nz
Mon Jul 2 03:27:50 CEST 2012

```> My inverter (SMA) records every 5 minutes the instantaneous power and the
> overall yield (both in kW (resp kWh), float with 3 decimal places).

This sounds like excellent data for an RRD -- time-based, rate-based, and regular intervals.

Set up your RRD with a 300s interval, 600s heartbeat.  I'd suggest the standard RRAs of 1cdp=1pdp/6pdp/24pdp/288pdp (5min/30min/2hr/1day) in AVG and MAX to start with.

> If I store the values as GAUGE, I can draw daily production curves out of the
> instantaneous data, but I can't put them in a RRA - AVERAGE'ing or MAX'ing or
> LAST'ing instantaneous production makes no sense, only the sum

You should store them using GAUGE (as kW is already a rate).  In fact, multiply by 1000 and store, as then you're storing as Watt or Joules/sec, the SI unit, which is Best Practice.

You now use your RRD functions to turn your stored data (Watts) into daily kWh data.

You have a 1cdp=288pdp AVG RRA defined, so this will keep track of your Average Watts for the day.  Multiply this by 86400 (seconds in a day) to get Joules for the day.  If you want it in Watt Hours (Wh) then instead multiply by 24 (hours in a day).  The kilo- should take care of itself (keeping it all in SI units really helps here).  Remember 1 kWh == 1000 W x 1hr == 1000 J/s x 3600s == 3600000 J == 3.6 MJ.

> As far as I understand, I'll have to do either some pre-processing (before
> feeding into rrdtool), or some post-processing on the data (when plotting the
> pics). To use COUNTER I have anyway to multiply the data by 1000 to convert it
> to integer.

Don't do any pre-processing other than to convert to SI units, and store as a GAUGE because the data is already a rate (Watts is Joules/sec of course).  Converting to a non-SI such as kWh can be done at display time, when you generate your graph and totals.

EG

rrdtool create power.rrd DS:power:GAUGE:600:0:1000000 RRA:AVERAGE:0.5:1:800 RRA:AVERAGE:0.5:6:800 RRA:AVERAGE:0.5:24:800 RRA:AVERAGE:0.5:288:800

rrdtool update power.rrd N:\$powerinwatts

rrdtool graph -e 00:00 -s e-1day DEF:watts=power.rrd:power:AVERAGE VDEF:avguse=watts,AVERAGE CDEF:'tmp=watts,24,*' VDEF:wh=tmp,AVERAGE GPRINT:wh:'Power consumption: %.2lf %sWh\l' AREA:watts:'Power consumption'

(This is all from memory so there might be a few errors in there).

Basically, you get a graph for the 24 hours of the last day, showing power usage (in watts).  The average usage over the day, multiplied by 24, gives the Wh used, which (unless you have everything switched off) will be in thousands, so you get kWh.

Corrections welcome :)

Steve

Steve Shipway
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: s.shipway at auckland.ac.nz
 Please consider the environment before printing this e-mail

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6080 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/rrd-users/attachments/20120702/0a1800ac/attachment.bin
```