Gas: MOD, END, best mix
What it's for
Breathing-gas basics: oxygen partial pressure, maximum operating depth (MOD), equivalent narcotic depth (END), equivalent air depth (EAD) and the best mix for a depth.
Formulas
Best mix for a depth:
, , : gas fractions, 0 to 1 (never percent). : absolute pressure at the depth, ata. : surface pressure, ata. : metres per bar. : oxygen partial pressure, ata. : the limit you choose, ata. : the absolute pressure at the target END depth, ata. is the nitrogen fraction of AIR.
The two END models
'o2-narcotic'(default): oxygen and nitrogen are narcotic, helium is not. Only the helium share is discounted, so the narcotic pressure is. 'n2-only': only nitrogen counts, compared against the nitrogen in air. This is the classic equivalent air depth, soead()isend()with this model.
bestMix and bestFhe size helium using the O₂-narcotic model. The result never exceeds 1 in total, so helium is capped at
Floor at surface and negative values
END can come out negative for a helium-rich mix at shallow depth, meaning it is less narcotic than air at the surface. Pass floorAtSurface: true to clamp the result at the surface (0 m by default).
A negative MOD means the mix is not breathable even at the surface, because
Assumptions and limits
- Fractions are validated: each in 0..1 and
fo2 + fhe <= 1. Nitrogen is derived. AIRis 20.9% oxygen with the remainder nitrogen (argon lumped in).- Narcosis is modelled as a simple equivalence, not a physiological prediction.
Sources
AIRcomposition: NOAA Diving Manual.
Examples
ts
import { AIR, gas, mod, end, ead, bestMix } from 'dive-math/gas'
mod(gas(0.32), 1.4) // => 33.75
end(gas(0.18, 0.45), 60, { model: 'n2-only' }) // => 22.74
ead(gas(0.32), 30) // => 24.39
end(gas(0.21, 0.35), 5, { floorAtSurface: true }) // => 0
bestMix({ depthM: 30, maxPpo2: 1.4 }).fo2 // => 0.35
mod(AIR, 1.4) // => 56.99API
See the gas API reference.