a generator is an electrical device