What are the functions of batteries and generators