The math behind the model
Every formula below is exactly what the simulation runs — the "live" line substitutes your current slider/preset values so you can check the model against your own numbers. Values update continuously while this tab is open.
1 · Respiratory mechanics
Respiratory-system compliance, lung and chest wall treated as two compliances in series:
Crs = (CL · Ccw) / (CL + Ccw)
Spontaneous mode — Ppl is generated by respiratory effort, not "transmitted": elastic component from lung compliance alone, plus a resistive component present only while flow occurs (zero at end-inspiration/end-expiration). resGain scales resistance only (bronchospasm, e.g. asthma); autoPeep is a constant offset from incomplete exhalation/dynamic hyperinflation (e.g. COPD):
Ppl = −5 − V/CL − resGain·resistive(t) + autoPeep
Ventilator mode — airway pressure from tidal volume against Crs, plus a resGain-scaled resistive bump during flow; Kenny's fraction is applied to the entire Paw signal (not just the swing above PEEP), so PEEP itself — not only the tidal excursion — reaches the pleura:
Paw(plateau) = PEEP + Vt/Crs
Ppl = −5 + fPpl·Paw + autoPeep
2 · Kenny's transmission fraction & transpulmonary pressure
Kenny, "An Approach to Mechanical Heart-Lung Interaction," Eq. 12 — the fraction of an applied ΔPaw that reaches the pleural surface. A stiffer chest wall (lower Ccw) transmits more; a stiffer lung (lower CL) transmits less:
Transpulmonary pressure — the lung's own distending pressure, algebraically independent of chest-wall compliance at plateau in a passive patient:
3 · Cardiovascular pressure transmission — dynamic vs. chronic
Every respiratory pressure now splits into a dynamic term (dPpl/dPL, the breath-to-breath swing, deviation from the cycle's own mean — zero on average) and a chronic term (chronicPpl/chronicPL, the sustained shift caused specifically by titrating PEEP and/or auto-PEEP — the mean's deviation from what it would be at PEEP=0, autoPeep=0). This is what lets titrating the vent move a baseline, not just a swing:
chronicPpl = meanPpl(current settings) − meanPpl(PEEP=0, autoPeep=0, otherwise unchanged)
chronicPpl alone is blind to one thing: it's relative to this mode's own zero-PEEP baseline, and spontaneous vs. passive-ventilator breathing don't share the same zero-PEEP baseline — a passive chest at ZEEP has no diaphragmatic effort pulling mean Ppl very negative, so it sits less negative than a spontaneously-breathing one even at the same rate/tidal volume/compliance. itpMode captures that mode-driven offset (spontaneous breathing, at the same rr/Vt/compliance, is the reference — so itpMode is 0 there by construction), and totalChronicPpl is the two summed — the full sustained deviation from a spontaneous-breathing baseline, from PEEP titration and from the mode switch itself:
itpMode = meanPpl(this mode, PEEP=0, autoPeep=0) − meanPpl(spontaneous, same rr/Vt/compliance, ZEEP) totalChronicPpl = chronicPpl + itpMode
CVP = CVP0 + 0.55·(dPpl + totalChronicPpl) (floored at the Starling-resistor collapse pressure, see §4)
PA = 15 + 0.16·(dPpl+totalChronicPpl) + 0.55·(dPL+chronicPL) + 3.7·hpvGain
PCWP = 9 + 0.65·(dPpl + totalChronicPpl) − 1.0·hpvGain
Arterial pressure keeps the dynamic term's sign (a positive-pressure breath transiently squeezes pulmonary venous blood into the LV, briefly raising SBP — the SPV mechanism) but the chronic term is negative — sustained elevation of mean intrathoracic pressure (PEEP, auto-PEEP, or the mode switch) impedes venous return over many breaths, lowering mean SBP/pulse pressure ("stroke volume"). preloadGain amplifies both as CVP0 approaches the Starling floor (hypovolemia); ventricular-interdependence septal shift (§5) subtracts on top when active, and hpvGain adds a flat sympathetic-activation bump (only at high altitude). A second, opposing, smaller term — kAfterloadRelief — is added back on top: the same rise in mean intrathoracic pressure that impedes venous return also lowers true LV transmural pressure (afterload) for a given intraventricular pressure, since transmural = intraventricular − pleural. These are shown as two separate terms, not netted into one, because which one dominates clinically depends on whether the heart is preload-limited (normal heart — the preload term wins here) or afterload-limited (a failing heart, where relief could dominate instead):
preloadGain = clamp(0.7 + 3.6·e−(CVP₀−floor)/1.8, 0.7, 5.5)
SBP = 118 + 0.85·preloadGain·dPpl − 0.85·preloadGain·totalChronicPpl + 0.35·totalChronicPpl − septalShift + 4·hpvGain
(bold term = preload limitation from impeded venous return; red term = LV transmural-afterload relief — opposing, smaller)
hpvGain (0 unless the High altitude preset is active) is a categorically different mechanism from every other term on this page: it's hypoxic pulmonary vasoconstriction — global alveolar hypoxia constricting the pulmonary arterioles directly, raising vascular tone rather than being transmitted through pleural/transpulmonary pressure — so it's modeled as a flat offset, not something scaling with dPpl/dPL. Magnitudes (PA +3.7, PCWP −1.0, SBP +4/DBP +8 mmHg) are from an echocardiographic cohort of 99 healthy adults measured at 500 m and again ~15 h after ascent to 4100 m. According to PubMed, Yang F, et al. Front Physiol 2021 — DOI: 10.3389/fphys.2021.639761. This model's cardiac output is a preload/afterload (Guyton) crossing, not a heart-rate-driven quantity, so it will not reproduce that cohort's compensatory CO rise — only the pressure and HR readouts are calibrated to it.
4 · Venous return, cardiac output & the Guyton diagram
Classic Guyton venous-return curve: flow driven by the gradient from mean systemic filling pressure (Pmsf) to RA pressure, capped by great-vein (Starling-resistor) collapse near the thoracic inlet — Kenny places this floor "about atmospheric," ≈0–1.5 mmHg:
Pmsf = CVP0 + 6 Rvr = (Pmsf − CVP0) / 5
VR(RA) = clamp((Pmsf − RA)/Rvr, 0, plateau) for RA > 0 mmHg floor
Frank-Starling cardiac function curve — held fixed in shape; what moves each breath (and chronically, with PEEP titration) is its position along the RA axis. Both dynamic and chronic Ppl elevation shift it the SAME direction here — elevated surrounding pressure, however sustained, always reduces the heart's true transmural filling pressure. Ventricular interdependence (§5) is different: a fixed pericardial/thoracic volume restricts diastolic filling itself, so it depresses the curve's whole plateau rather than sliding it:
shiftAmt = −0.65·(dPpl + totalChronicPpl) dynSeptalFrac = clamp(0.12·interdep·rvFillProxy, 0, 0.85)
COmax = 6.66·(1 − 0.45·interdep)·(1 − dynSeptalFrac) COplotted(RA) = max(0, COmax·(1 − e−(RA+shiftAmt+4)/7.2))
dynSeptalFrac (§5, rvFillProxy defined there) is a direct, momentary CUT to the ceiling itself, not a further RA-axis shift — a deliberate choice, because at the high CVP tamponade runs, RA already sits deep in the curve's saturated region where a shift barely moves CO. Septal encroachment is mechanically a direct volume theft from the LV, so it should cut achievable output regardless of how "full" venous return already made RA look. It's why tamponade's cardiac output visibly dips during the same inspiration that produces its pulsus paradoxus, rather than only the arterial trace showing it. Repeated, unrelieved, this is the mechanism by which tamponade progresses toward pulseless electrical activity (PEA) arrest — forward flow falls with every breath until it can no longer sustain a perfusing rhythm.
Venous return and cardiac output are the same flow — the only physically consistent point is the crossing, found numerically since VR(RA) is piecewise. This crossing is the model's cardiac-output readout (Live readouts panel):
operating point = { RA : VR(RA) = COplotted(RA) } (bisection, 40 iterations)
5 · Ventricular interdependence (septal shift)
Only active when a preset sets an interdependence gain > 0 (currently: Tamponade / interdependence). Layers on top of the transmural SBP effect above — a distinct mechanism (RV volume directly stealing LV volume via septal bowing) rather than a loading-pressure effect. It also feeds back into §4's cardiac-function curve (COmax depressed at baseline, plus this dynamic shiftAmt term), which is why both mean CO and pulse pressure fall in tamponade — the hemodynamic path toward PEA arrest:
rvFillProxy = clamp(−dPpl, 0, 30)
septalShift = interdep · rvFillProxy · 3.2 (mmHg, subtracted from SBP/DBP)
Kenny ch.5–6, citing Jardin's status-asthmaticus study; also seen in cardiac tamponade and severe gas-trapping/hyperinflation (COPD).