MechSimulator

Four Stroke Engine Simulator

Otto & Diesel Cycles — Animate • Learn • Practice • Quiz

Mode
📖 User Guide
Fuel
RPM 10
Comp. Ratio 10
Stroke Intake
Crank Angle
Pressure 101 kPa
Temperature 300 K
Efficiency 0%
Cycle Otto
User Guide — Four Stroke Engine Simulator
1 Overview

The Four Stroke Engine Simulator brings the internal combustion engine to life with interactive animation of all four strokes: intake, compression, power, and exhaust. You can switch between the Otto cycle (petrol/spark ignition) and Diesel cycle (compression ignition), adjust compression ratio and RPM, and watch a live PV diagram trace the thermodynamic cycle in real time.

The simulator visualises piston motion, valve timing (intake and exhaust valves opening and closing), crankshaft rotation, and connecting rod kinematics. It calculates thermal efficiency, pressure, and temperature at each point in the cycle, helping you understand the relationship between compression ratio and engine performance.

2 Getting Started
  • Select Fuel type: Petrol (Otto cycle) or Diesel to switch between spark-ignition and compression-ignition cycles.
  • Adjust the RPM slider to control animation speed.
  • Change the Compression Ratio (6:1 to 22:1) and observe how thermal efficiency changes.
  • Click Play to start continuous animation or Step to advance one stroke at a time for detailed study.
  • The canvas shows the engine cross-section (left) and live PV diagram (right).
3 Simulate Mode

The left canvas renders a detailed engine cross-section with animated piston, connecting rod, crankshaft, intake valve, and exhaust valve. Gas colour changes show the charge state: fresh mixture (blue), compressed charge (orange), combustion products (red), and exhaust (grey). The right canvas traces the PV diagram in real time, with the enclosed area representing net work output.

For the Otto cycle, efficiency = 1 - 1/r^(γ-1), where r is compression ratio and γ = 1.4. For the Diesel cycle, the cutoff ratio ρ introduces additional complexity. Readout cards display current stroke, crank angle, pressure, temperature, thermal efficiency, and cycle type.

4 Explore Mode

Study concepts across four categories: Fundamentals (4-stroke cycle, TDC/BDC, valve timing), Thermodynamic Cycles (Otto, Diesel, dual cycle, air-standard assumptions), Engine Components (piston, connecting rod, crankshaft, valves, cam), and Performance (thermal efficiency, MEP, brake power, volumetric efficiency).

5 Practice & Quiz

Practice generates problems on thermal efficiency, compression ratio, pressure/temperature calculations, and PV diagram interpretation. Quiz tests your understanding with 5 randomised questions.

6 Tips & Best Practices
  • Use the Step button to advance one stroke at a time and carefully study valve timing, gas exchange, and PV diagram changes during each phase.
  • Compare Otto and Diesel at the same compression ratio to see the difference in PV diagram shape and efficiency.
  • Diesel engines use higher compression ratios (14-22) because they need to achieve auto-ignition temperature — increase the ratio and watch temperature rise.
  • The enclosed area on the PV diagram represents the net work per cycle — larger area means more work output.
  • A complete four-stroke cycle takes 720° of crankshaft rotation (two full revolutions).
  • Watch the valve timing carefully — intake valve opens before TDC and closes after BDC for better volumetric efficiency.

How a Four-Stroke Engine Works — Interactive Simulator

The four-stroke internal combustion engine is the most widely used power source in automobiles, motorcycles, generators, and industrial machinery. Each complete power cycle requires four distinct strokes of the piston—Intake, Compression, Power, and Exhaust—corresponding to two full revolutions (720°) of the crankshaft. This simulator lets you visualize every stroke in real time, switch between petrol (Otto cycle) and diesel (Diesel cycle) operation, and adjust parameters like compression ratio and RPM to observe their effects on pressure, temperature, and thermal efficiency.

Understanding the Otto and Diesel Cycles

In a petrol engine, the Otto cycle governs the thermodynamic process. The air-fuel mixture is compressed isentropically, then ignited by a spark plug at top dead center (TDC), producing a rapid constant-volume pressure rise. The thermal efficiency depends only on the compression ratio: η = 1 − 1/rγ−1, where r is the compression ratio and γ is 1.4 for air. Typical petrol engines operate at compression ratios of 8:1 to 12:1, yielding efficiencies of 56–63%.

The Diesel cycle differs in its heat addition process: air alone is compressed to a high temperature (600–900 K), and fuel is injected under pressure, igniting spontaneously. This constant-pressure combustion introduces the cutoff ratio ρ, making the efficiency formula more complex. Diesel engines use higher compression ratios (14:1 to 22:1) and achieve better fuel economy, though the Diesel cycle efficiency for the same compression ratio is slightly lower than Otto due to the cutoff ratio penalty.

Key Engine Parameters

The compression ratio (r = V1/V2) is the ratio of cylinder volume at bottom dead center to top dead center. Higher compression ratios improve efficiency but increase mechanical stress and require higher octane fuel (petrol) or stronger construction (diesel). The mean effective pressure (MEP) represents the average pressure acting on the piston during the power stroke and directly relates to engine torque output. The simulator calculates these values in real time as you adjust the sliders.

Reading the PV Diagram

The pressure-volume (PV) diagram shows the thermodynamic state of the gas throughout the cycle. The enclosed area represents the net work output per cycle. In the Otto cycle, you’ll see two vertical lines (constant-volume processes) connected by two isentropic curves. In the Diesel cycle, the upper horizontal line represents the constant-pressure heat addition phase. Watch the PV diagram trace in real time as the piston completes each stroke.

Worked Otto-Cycle Efficiency — A Petrol Engine with Compression Ratio 10

Take a typical naturally-aspirated petrol engine: compression ratio r = 10, working fluid air (γ = 1.4 for the cold-air-standard analysis), intake conditions T1 = 300 K and P1 = 100 kPa, peak temperature T3 = 2000 K. Load the Otto preset and trace it through:

StepProcessWorkingResult
1→2Isentropic compression: T2 = T1·rγ−1300 × 100.4T2 = 754 K
2→3Constant-volume heat addition (combustion): qin = cv(T3−T2)0.718 × (2000 − 754)qin = 894 kJ/kg
3→4Isentropic expansion: T4 = T3·(1/r)γ−12000 × 0.10.4T4 = 796 K
4→1Constant-volume heat rejection: qout = cv(T4−T1)0.718 × (796 − 300)qout = 356 kJ/kg
cycleThermal efficiency η = 1 − qout/qin1 − 356/894η = 0.602 (60.2%)
shortcutOtto efficiency: η = 1 − 1/rγ−11 − 1/100.40.602 ✓

Three lessons drop out: (i) efficiency depends only on compression ratio and γ — not on peak temperature or pressure; (ii) real petrol engines achieve about 30%, not 60%, because of finite heat-release time, exhaust enthalpy loss, friction, and pumping losses; (iii) the only way to raise Otto efficiency is to raise r, which is limited by knock — the limit at which fuel auto-ignites before the spark. That is why high-octane fuel allows higher compression and therefore higher efficiency.

The Four Strokes — What Actually Happens Each 720° of Crankshaft

One full cycle of a four-stroke engine takes two crankshaft revolutions (720°). At 3000 rpm that is one cycle every 0.04 s. Drag the simulator’s rpm slider to step through the timing:

StrokePiston motionValvesWhat is happening
1. IntakeTDC → BDCIntake open, exhaust closedCylinder volume grows; atmospheric air-fuel mix is drawn in. Real engines open the intake valve ~10° before TDC for inertial scavenging.
2. CompressionBDC → TDCBoth closedMixture is squeezed by ratio r. Temperature rises adiabatically; just before TDC, the spark plug fires (typically 10–30° BTDC).
3. Power (expansion)TDC → BDCBoth closedCombustion is complete at ~10° ATDC; the high-pressure gas does work on the piston. This is the only stroke that produces useful torque.
4. ExhaustBDC → TDCIntake closed, exhaust openBurnt gas pushed out. Exhaust valve typically opens ~50° before BDC to let blowdown reduce pumping work.

The crank-to-cam ratio is 2:1 (the camshaft runs at half engine speed), which is why every other revolution one valve is open. The cam timing diagram is the engineering reality behind the simulator’s mode tabs.

125 cc Motorcycle vs 2 L Sedan — Same Cycle, Different Scale

Parameter125 cc motorcycle2.0 L sedan
Displacement (single-cycle volume)125 cm³2000 cm³ (typically 4 cylinders × 500 cm³)
Compression ratio9.5 : 110.5 : 1
Bore × stroke52.4 × 57.8 mm~84 × 90 mm per cylinder
Peak power~11 kW at 8500 rpm~110 kW at 6000 rpm
Peak torque~10 N·m at 6000 rpm~190 N·m at 4000 rpm
BSFC (brake specific fuel consumption)~340 g/kWh~250 g/kWh (more efficient combustion at lower rpm)

The motorcycle gets ten times the specific power per litre by spinning twice as fast — but it pays for it in fuel consumption. Small-engine high-rpm strategies are common where light weight matters more than absolute efficiency.

Otto vs Diesel — Why They Are Different Cycles, Not Just Different Fuels

Set the simulator to Diesel mode and compare the PV diagram. The compression and expansion strokes are essentially the same; the heat-addition (combustion) stroke is the key difference:

Selected References

Explore Related Simulators

If you found this four-stroke engine simulator helpful, explore our Two Stroke Engine Simulator, Thermodynamics Simulator, Heat Transfer Simulator, and Stress-Strain Diagram for more hands-on practice.