How does a petrol engine work?
The animation below shows how a four stroke petrol engine works.
Stroke 1. The downward moving piston sucks a mixture of air and petrol vapour into the cylinder through the inlet valve.
Stroke 2. The piston then moves upwards, compressing the gas mixture.
Stroke 3. Just before the piston reaches the top of the cylinder a spark from the spark plug explodes the gas mixture. The pressure from the rapidly expanding gas pushes the piston down and causes a flywheel that it is connected to by the crankshaft to rotate. It is this rotation that is used to drive the wheels of the car.
Stroke 4. The piston moves upwards in the cylinder again to push out the gases through the exhaust valve into the exhaust system of the vehicle. As the piston moves down, it pulls more fuel/air mixture in to begin the cycle again.
The knocking problem
Some hydrocarbons that have the potential to be a component of petrol suffer from a problem called 'knocking'. When they are compressed by the upward moving piston in the cylinder, they tend to auto ignite rather than waiting to catch fire when the spark occurs. There are therefore two explosions, one caused by the compression and the other caused by the spark. This produces a knocking sound from the engine. It also reduces the engine performance and can damage the piston and cylinder.