Photovoltaic energy storage charging and discharging