A diesel generator is a mechanical-electrical machine that produces electrical energy from diesel fuel. It is a combination of a diesel engine and an electric generator that converts mechanical energy into electrical power. Diesel generators are used in places without connection to a power grid or as an emergency power supply if the grid fails, as well as for more complex applications such as peak-lopping, grid support, and export to the power grid. The major components of a diesel generator include a diesel engine, an alternator, a fuel system, a voltage regulator, a cooling and exhaust system, a lubrication system, a battery charger, a control panel, and a main assembly frame. Diesel generators are widely used in rural areas where they are connected to a power grid and can be used as the main power source or for a backup system. They can also be used to offset the peaking power needs on the grid because they can quickly be turned on and off without inducing any lag time.