A general battery model for PV system simulation