Design of photovoltaic batteries