Optimization of residential off-grid PV-battery systems