Photovoltaic battery charging and discharging circuit