In many areas of the world they have replaced human and animal power by providing energy for transportation and for driving all kinds of machines. The chemical energy of a fuel can be converted by combustion into thermal, or heat, energy in a heat engine. The engine in turn converts the thermal energy into mechanical energy, as in engines that drive shafts. When the combustion occurs within the same unit that produces the mechanical energy, the device is called an internal-combustion engine.
Electric motors convert electrical energy into mechanical energy.
The most widely used heat engines are internal-combustion engines, particularly gasoline engines. Gasoline engines run on a mixture of air and gasoline vapor, which is usually drawn into a piston-cylinder arrangement and compressed by a piston. As the volume of the chamber decreases, the pressure and temperature within it increase. Near the point of maximum compression, the fuel vapor is ignited by a spark. The hot gases expand and force the piston down in what is called the power stroke, delivering work through the piston rod to the crankshaft.