A diesel generator works on the principal of Faraday's law
of electromagnetic effect. Mechanical power of the rotor is
converted into electrical power. As the rotor rotates
(because of the external voltage given to it through the
battery), EMF and hence current is generated, which is
collected by collectors connected on the stator.