Solar statistics fixes
Yesterday, I started thinking about how I could track the self-consumption of our house. On the surface, it’s pretty obvious: the delta between what we generate on the PV side and what we sell must be our self consumption. So if I have the model correct in my head it should be as simple as:
PV_total + grid_in = consumption
The idea being that if grid_in is negative, let’s say we’re selling 1kW, and we’re generating 3kW, we must be self-consuming 2kW right? Likewise if it’s night time and we’re consuming 2kW and generating 0kW it must also be 2kW.
But doing this with
rrdtool means first solving another problem: the annoying time skew between the stats for the new PV arrays and the old one. For some reason there’s a delay of about 6 minutes on the data from the old inverter, fed to collectd by my piece of shit script. It’s slightly visible on that graph, but being that it’s a 24-hour graph with each pixel being about 5 minutes it’s very hard to see… it was much clearer on the 1-hour graph, but unfortunately I didn’t save any of them.
These were extremely obvious when a dark cloud would briefly block the sun. PV output for arrays 2+3 would tank, followed some minutes later by an equivalent on PV array 1. You didn’t have to be an expert to know something wasn’t right there!
I spent ages trying to think why that might be… a buffer on the network module perhaps? My script doing something wrong? Finally tonight I shelled into the APU the script is running on to take a look and I missed the most obvious cause ever: my clock is out by six minutes. That’s really bloody unfortunate, because that machine is also my time server… Chrony is syncing itself to the GPS time beautifully, and serving accurate time to my UPS and other devices on the network and never saw fit to update it’s own RTC.
After trying for a few minutes to get chrony to adjust the local clock (no idea how to work it, and honestly I may just replace it with good ol’ ntpd anyway) I just manually adjusted it myself, and got it to within a few seconds which is close enough for my purposes.
This fixed everything, but left a bloody great hole in my data. Since it’s no longer pristine anyway, I took the opportunity to destroy all the .rrd files for the solar graphs and start again, after adjusting
collectd to use a 15-second interval for the new array also. This means we have full resolution now, and I can see the spikes of the new fridge kicking on among others, but I have lost all historical data. Oh well.
I still haven’t solved for graphing self-consumption (well, I have sort-of, I can’t get the min/max/avg/last stats) but it’s looking a lot nicer now.