An Otto engine is a four-stroke engine that uses a mixture of gasoline and air as the working fuel. The fuel is injected into the cylinder, and the piston is moved completely down so that the cylinder is at maximum volume. By moving the piston up, adiabatic compression takes place. The spark plug ignites the gasoline-air mixture, and the burning fuel adds heat to the system at a constant volume. The heated mixture expands adiabatically and gets further cooled by exhausting heat, and this cyclic process continues.
The thermal efficiency in this ideal cycle is given in terms of the compression ratio and the ratio of specific heat capacities. This efficiency is always less than 100%. The compression ratio for typical Otto engines ranges from 8–10, and for premium gasoline, up to 13. By increasing the compression ratio, the efficiency can be improved. However, this increases the temperature significantly at the end of the adiabatic compression, which could lead to fuel explosion through pre-ignition. The theoretical efficiency is about 56%, assuming the gasoline-air mixture to be an ideal gas, neglecting friction and heat loss. However, the actual efficiency for a non-ideal gas is around 35%.
A diesel engine is also a four-stroke engine with one significant difference from the Otto engine; the diesel engine works on a self-ignition mechanism and hence does not have a spark plug. In this, the fuel is injected at a constant pressure into the cylinder just before the power stroke, and the high temperature developed ignites the fuel as it is injected. This is a major advantage of a diesel engine, as it prevents pre-ignition. Hence, the compression ratio can go as high as 20, improving the theoretical efficiency for an ideal gas to 65%–70%.