# [rrd-users] help required to graph photovoltaic electricity savings

Simon Hobson linux at thehobsons.co.uk
Wed Nov 28 23:34:14 CET 2012

```Dossy Shiobara wrote:

>Ah, you're absolutely right -- you should be recording the data points
>as "U" unknown, not zero -- that's right.
>
>The trick is going to be getting rrdgraph to not plot anything where
>data points are unknown, instead of either treating unknown as zero OR
>most recent value.  You may need to define CDEF's to handle the unknown
>values properly and graph the CDEF's instead of the raw DEF/DS data.

Actually RRD graphs them just fine - if you plot unknown then nothing is drawn.

However, I would suggest an alternative of not splitting the
production - it'll complicate calculations if you split it.
You can create graphs with coloured blocks by splitting the data
later. You need some RPN like this :

DEF:prod=...
CDEF:prod_peak=<something>,prod,UNKN,IF
CDEF:prod_offp=<something>,UNKN,prod,IF
where <something> is an RPN expression that is true during the peak
time - though I can't remember the syntax for that offhand.

Then plot the two CDEFs in different colours.

As to cost, it might be a good idea to have separate DSs for the
costs (PV production and bought in). Have your script update these
DSs with the applicable rate. Then you can determine the actual
values by multiplying the rates with prices :
CDEF:income=prod,rate,*
VDEF:tot_income=income,TOTAL (I think)

Alternatively, if you are able to compute the value of units used at
the time of updating the RRD (with with ABSOLUTE rather than COUNTER
DS type), you could simply store the cash value and not have to
compute it later.

--
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

```