-
Notifications
You must be signed in to change notification settings - Fork 0
Model 04 M Values
An M-value is the maximum tolerated inert-gas tissue pressure at a given ambient pressure, per compartment. Above M = supersaturation that the algorithm treats as unsafe. Workman (1965) introduced the concept (see References); Bühlmann recast it as a linear function of ambient with two tabulated coefficients (see References).
// js/decoModel.js:145-147
export function getMValue(ambientPressure, a, b) {
return a + ambientPressure / b;
}Where
On a P-P diagram (tissue pressure
-
$y$ -intercept:$a$ - slope:
$1/b$
Above the line = M-value violation. The M-value chart in js/mvalues.js draws 16 of these lines in parallel (one per compartment) and plots the tissue state as 16 markers. The widely-used visual intuition: "how high above the ambient line, and how close to the M-value line, is each tissue right now?"
Rearranging
// js/decoModel.js:361-366
export function getCompartmentCeiling(tissuePressure, a, b, gf) {
// P_ceiling = b × (P_tissue - GF × a) / (b × (1 - GF) + GF)
const numerator = b * (tissuePressure - gf * a);
const denominator = b * (1 - gf) + gf;
return numerator / denominator;
}At the ceiling, the tissue sits exactly at the GF-adjusted limit — the linear blend between
Substitute
Collect
Solve for
Sanity check: at
This is the central equation for deco-stop depths. DecoJS evaluates it for each of the 16 compartments and takes the deepest (highest
// js/decoModel.js:377-401 (body)
export function getDiveCeiling(tissuePressures, gf) {
let maxCeiling = -Infinity;
let controllingComp = null;
for (const comp of COMPARTMENTS) {
const tissueP = tissuePressures[comp.id];
const ceiling = getCompartmentCeiling(tissueP, comp.aN2, comp.bN2, gf);
if (ceiling > maxCeiling) {
maxCeiling = ceiling;
controllingComp = comp.id;
}
}
const finalCeiling = Math.max(SURFACE_PRESSURE, maxCeiling);
// ...
}The compartment winning maxCeiling is the controlling (leading) compartment at that moment.
At GF = 1.0 (100%), the raw Bühlmann limit stands. At lower GF, only a fraction of the supersaturation budget is spent:
// js/decoModel.js:160-163
export function getAdjustedMValue(ambientPressure, a, b, gf) {
const mValue = getMValue(ambientPressure, a, b);
return ambientPressure + gf * (mValue - ambientPressure);
}At GF = 0.5, the allowed tissue pressure sits exactly halfway between ambient and the raw M-value. At GF = 0,
See Model-05-Gradient-Factors for how
Given a current tissue and ambient state, compute the fraction of the supersaturation budget already used:
// js/decoModel.js:185-195
export function calculateInstantGF(tissuePressure, ambientPressure, compartment) {
const mValue = getMValue(ambientPressure, compartment.aN2, compartment.bN2);
const denominator = mValue - ambientPressure;
if (Math.abs(denominator) < 1e-10) {
return tissuePressure > ambientPressure ? Infinity : -Infinity;
}
return (tissuePressure - ambientPressure) / denominator;
}-
$GF_{inst} = 0$ : tissue at ambient (no supersaturation) -
$GF_{inst} = 1$ : tissue exactly at the raw M-value -
$GF_{inst} > 1$ : violation - Negative: undersaturated (still on-gassing)
Used by the GFChart (js/charts/GFChart.js) to render real-time saturation fraction per compartment. See also calculateMaxGF() at js/decoModel.js:212 which finds the leading tissue.
TC1 under variant C:
A tissue sitting at
At GF = 0.70:
During an ascent the controlling compartment typically shifts:
- Early in a deep ascent: fast compartments (TC1–4) dominate — they took on the most gas and are closest to their M-value.
- Later / shallower: slow compartments (TC10+) take over — they're still loading while fast tissues have already off-gassed.
getDiveCeiling() re-evaluates every step, so the controlling compartment can and does change mid-dive.
-
Model-01-Compartments — where
$a$ and$b$ come from. -
Model-05-Gradient-Factors — how GF is varied with depth via
pAnchor. - Algo-06-Ceiling-Time-Series — the ceiling sampled at every dive-time point, for chart overlay.
- Sandbox: M-Values — interactive playground for the M-value formula and where its coefficients come from.