how does an onboard battery charger work