Skip to content

Latest commit

 

History

History
59 lines (42 loc) · 2.11 KB

File metadata and controls

59 lines (42 loc) · 2.11 KB

EngineSim

A Python-based thermodynamic simulation of a 6-cylinder internal combustion engine, modeling the full P-V cycle and visualizing power output as a 3D surface across environmental conditions.

What it does

EngineSim numerically models the pressure-volume (P-V) cycle of a 6-cylinder engine across a full 720° crankshaft rotation. Given environmental pressure and combustion temperature as inputs, it calculates net work output by integrating the pressure-volume curve, then computes shaft power output.

The simulation sweeps a grid of input conditions (ambient pressure 80–130 kPa, combustion temperature 2000–3500 K) and renders the results as an interactive 3D surface plot.

Two model versions are included:

engine1.py — Baseline Model

  • Polytropic compression and expansion (nc = 1.3)
  • Peak pressure ratio scaling with combustion temperature
  • Mass flow scaling relative to standard reference conditions

engine2.py — Enhanced Model

Adds three physical correction factors on top of the baseline:

  • Temperature-dependent gamma — specific heat ratio adjusts with combustion temperature
  • Heat loss factor — exponential Newtonian cooling model based on cylinder wall temperature (470 K)
  • Combustion phasing efficiency — Gaussian efficiency curve peaking at optimal combustion temperature (2800 K), modeling the effect of ignition timing on work output

Output

Both scripts generate a 3D surface plot:

  • X-axis: Environmental pressure (Pa)
  • Y-axis: Combustion temperature (K)
  • Z-axis: Engine power output (W)

Tech Stack

  • Python
  • NumPy — numerical integration and array operations
  • Matplotlib — 3D surface visualization

Getting Started

pip install numpy matplotlib
python engine2.py

Engine Parameters

Parameter Value
Cylinders 6
Engine speed 15,000 RPM
Displacement per cylinder 2.66 × 10⁻⁴ m³
Compression ratio 18
Polytropic index 1.3
Peak pressure ratio 6.5

Author

Dexter (Yulin) Peng Computer Science, University of Minnesota Twin Cities GitHub