When running the battery simulator it caused the Pi to crash. Having eaten all of the memory and caused various things to die!
My data goes from May 2016 - hence the process starts 31,449,986 data points behind!
I've looked at the code and added a new method in common.php, this will cause the existing buffered data to be written out
and the buffer cleared - so that it doesn't consume all the memory - it also makes the process significantly faster.