Predicting the state of charge and health of batteries