This is a 2D companion to the "Station Oxygen Generation Assembly" 3D sim, built around a genuinely different mechanic: instead of an instantaneous-rate readout with rising bubbles, it numerically integrates the cabin atmosphere's oxygen mole balance over simulated time and reports the resulting partial pressure via the ideal gas law — the actual quantity life-support engineers monitor and alarm on.
Faraday's law: n(O2)/dt = I*Ncells/(4F), n(H2)/dt = I*Ncells/(2F)
Mole balance: dn_O2/dt = production_rate − crew_consumption_rate
Ideal gas law: pO2(t) = n_O2(t)*R*T / V
Crew demand: 0.84 kg O2/person/day → mol/s via /M_O2/86400
Each frame advances simulated time by the time scale slider and integrates the O₂ mole balance with the explicit-Euler step n += (Ṗ − Ċ)·dt_sim, then re-derives partial pressure from the ideal gas law at cabin temperature (295 K). Because production and consumption are held constant between slider changes, this reduces to a linear drift you can check by hand: a positive net balance raises pO₂ at a constant rate; a negative one drains it. The shaded band marks the accepted operating range for crewed spacecraft (≈19.5–23.1 kPa) — drift outside it for long enough and the status readout flips to an alarm.
- Current / cells — same Faraday's-law electron flow as the 3D stack; sets the O₂ production rate feeding the balance.
- Crew size — each astronaut consumes ≈0.84 kg O₂/day; more crew steepens the negative slope if production doesn't keep pace.
- Cabin free volume — the same mole imbalance changes partial pressure faster in a smaller volume (pO2 = nRT/V) — a module leak-checked to 20 m³ swings far quicker than the full 400 m³ station.
- Time scale — how many simulated hours pass per real second, so a day-scale drift is visible without waiting a day.
The two mini-plots verify the model stays physically consistent: the stoichiometry panel confirms the H₂:O₂ molar production ratio is pinned at exactly 2.000 (from 2H2O → 2H2 + O2), and the balance panel shows production versus consumption as bars so you can see at a glance which side of the ledger is winning before the trend even shows up in the partial-pressure trace.