The function of an alternator in an automobile is to