It's a well-known problem: After a longer trip or some time at anchor in a quiet bay, on-board batteries are run down and have to be recharged. In this case, you can either run the engine or a power generator, unless you are in the lucky position of having additional energy sources, such as a wind generator.