Physics
Heat engines
A gas piston runs Carnot, Otto and Stirling cycles on a live pV diagram: work per cycle, efficiency against Carnot's limit, and a refrigerator in reverse.

What happens
Nothing here is drawn - the cycle is earned. Four hundred molecules hammer the piston, every impact logged as work and pressure, every wall contact as heat, and the pV loop assembles itself from those micro-impulses right between the analytic isotherm rails. The insulated strokes ride PV^(5/3) = const (γ = 5/3) with ΔU = −W to the last digit, the loop area matches the collected work, and the measured efficiency of a slow Carnot cycle presses against 1 − Tc/Th from below - molecular chaos enforcing the second law. Switch to Otto or Stirling, watch the T–S rectangle shear, or tick the reverse box and run the same machine as a refrigerator pumping heat uphill.
Equations used in the module
Equations W = ∫ p dV around the loop (its area) η = W / Q_in, η_Carnot = 1 − T_c / T_h p V = n R T, p V^γ = const (adiabat) friction: W_shaft = W_gas − F·∫|dL|; η_shaft = W_shaft / Q_h; the pV loop is the gas's and does not change - the loss is the shaft's scale: p ≈ N T / V = 100…400, W_Carnot = N (T_h − T_c) ln 2 = 111, piston path ≈ 6.6 per cycle: F = 8 eats half the work


