Contents

Deco engine

How the deco engine works

A plain-language tour of the Bühlmann ZH-L16C dissolved-gas model behind the Dive Kit deco planner: tissue compartments, on-gassing and off-gassing, M-values, and where stops come from.

Last updated June 3, 2026

On this page

What it is

The Deco Planner runs a decompression model called Bühlmann ZH-L16C. It is the same family of model used by Shearwater dive computers, Subsurface, and MultiDeco. This page explains, in plain terms, what that model does when you build a plan: how it tracks the gas in your body, why a ceiling appears, and why you end up holding stops on the way up.

You do not need any of this to use the planner. But if you want to understand the numbers it gives you, this is the foundation.

A dissolved-gas model

Bühlmann ZH-L16C is a dissolved-gas model, sometimes called a Haldane-type model after the physiologist who pioneered the idea a century ago. The core idea is simple. When you breathe gas under pressure, inert gas (nitrogen, and helium if you dive trimix) dissolves into your tissues. Ascend too fast and that dissolved gas comes out of solution as bubbles, which is what causes decompression sickness. The model’s job is to track how much inert gas you have taken on, and to tell you how fast you can come up without forming dangerous bubbles.

It cannot track every cell in your body, so it uses a stand-in.

16 tissue compartments

The model represents your body as 16 compartments. These are not real organs. They are mathematical buckets, each one standing in for tissues that absorb and release gas at a particular speed.

Each compartment has a fixed half-time, the time it takes to fill or empty halfway. The published ZH-L16C half-times run from about 4 minutes for the fastest compartment up to 635 minutes for the slowest. Fast compartments behave like blood and brain: they load up quickly and clear quickly. Slow compartments behave like joints and bone: they take hours to saturate and hours to let go.

Tracking 16 speeds at once is the whole point. A short, deep dive is driven by the fast compartments. A long dive loads the slow ones, and they are what keep you holding stops long after the fast tissues have cleared.

On-gassing and off-gassing

The amount of inert gas dissolved in a compartment is its tension, measured as a pressure in bar. Underwater, the surrounding pressure is high, so gas pushes into your tissues and tension rises. This is on-gassing. On ascent and at the surface the pressure drops, gas comes back out, and tension falls. This is off-gassing.

Dive Kit computes this with the standard Haldane equation, and it recomputes it in 1-second steps as your depth changes. That matters: your tissues are loading and unloading while you move, not just while you sit at a fixed depth. Modelling the descent and ascent second by second is where a lot of the realism comes from.

Helium is tracked separately from nitrogen in every compartment. Helium loads and unloads roughly 2.65 times faster than nitrogen, the ratio of the published ZH-L16C half-times. When a compartment holds both gases, the engine uses the correctly weighted blend of its nitrogen and helium coefficients, recomputed continuously as your gas mix changes. That is why a trimix dive produces a differently shaped deco profile, not just a scaled one.

Why a ceiling and stops appear

Here is the mental picture the whole model rests on. Imagine a graph of a compartment’s tension against the ambient pressure around you. Ambient pressure is the pressure squeezing you: the air at the surface plus the weight of the water overhead. Two lines matter.

  • The ambient-pressure line. This is where tension equals the pressure around you. Below it, deeper, you are safe. The moment you ascend past it, your tissue holds more gas than the surrounding pressure can keep dissolved. That state is supersaturation, the “fizzing” condition where bubbles can start to form.
  • The M-value line. This is the most supersaturation a compartment can tolerate before the risk is judged unacceptable. It is a hard ceiling. The relationship is a straight line, M = a + ambient pressure / b, with published a and b constants for each compartment.

The band between these two lines is the decompression zone. Decompression is the craft of climbing up into that band to off-gas as fast as possible, without ever punching through the M-value ceiling.

A ceiling is simply the shallowest depth your most-loaded compartment can tolerate right now without crossing its M-value. A stop is the planner holding you at a fixed depth until your tissues off-gas enough that the ceiling recedes and you can come up to the next stop. As you off-gas, the ceiling rises, and you follow it toward the surface.

Plain Bühlmann lets you ascend right up to the M-value line. Most technical divers want a margin below that ceiling. Dive Kit adds that margin with gradient factors, which are explained in full on the gradient factors page.

Any app or dive computer that runs the Bühlmann algorithm uses this same gradient-factor and ceiling approach, so a Dive Kit schedule lines up with theirs. Some of those tools, such as Shearwater computers, Subsurface, and MultiDeco, also let you switch to the VPM bubble model in their settings. VPM is a different algorithm with no gradient factors, so a VPM-only planner like V-Planner will not produce a matching schedule.

Two oxygen clocks: ambient vs inspired pO₂

The model above is about inert gas. Oxygen needs a separate accounting, and it involves a subtle but important distinction in which pO₂ (partial pressure of oxygen) the engine uses.

There are two pO₂ values for the same breath of gas:

  • Inspired pO₂ is the oxygen pressure once the gas reaches your alveoli. Your lungs saturate inhaled gas with water vapour at body temperature, and that water vapour displaces a small amount of every other gas. The correction is about 0.0627 bar.
  • Ambient pO₂ is the oxygen pressure of the gas as you breathe it, before the water-vapour correction.

Dive Kit uses these for two different things, on purpose:

  • Tissue gas loading uses inspired pO₂. Modelling how gas actually diffuses into tissue depends on the alveolar partial pressures, so the water-vapour correction belongs here.
  • CNS oxygen toxicity uses ambient pO₂. The CNS (central nervous system) clock tracks seizure risk. It comes from NOAA and US Navy exposure experiments that measured the breathing gas pO₂, not the alveolar value. Those published limits already bake in any physiological correction, so applying the water-vapour subtraction again would double-count it and understate your real exposure.

This is the same convention used by other Bühlmann implementations such as Shearwater, Garmin, Subsurface, and MultiDeco. It is not a quirk.

The difference is large where it matters most. On 100% oxygen at 6 m, ambient pO₂ is 1.60 bar while inspired pO₂ is about 1.54 bar. Both values land in the same steep band of the NOAA CNS table, but the rate within that band changes fast: the allowed exposure is roughly 45 minutes for the ambient value and roughly 92 minutes for the inspired value, about a 2x gap right at a critical boundary. Using ambient pO₂ keeps the CNS clock honest and slightly conservative.

Why the engine is native C++

Dive Kit’s deco engine is written in C++ and runs natively on your phone through a native module, rather than in JavaScript. There are two reasons.

  • Speed. The planner recomputes the entire schedule, second by second, every time you change a depth, a time, a gas, or a setting, and it does so for the base plan plus every contingency scenario at once. Native code does that fast enough to feel instant as you type.
  • Numerical accuracy. Decompression math is safety-critical and full of repeated exponential calculations. A native implementation gives consistent, well-defined floating-point behaviour across devices.

The engine is an independent implementation written from the published Bühlmann papers and Erik Baker’s equations. The open-source projects it is compared against, such as Subsurface, are cross-checks, not code it was derived from. See how Dive Kit compares to MultiDeco for how those checks are run.

Behaviour and limits

  • Bühlmann is a model fitted to data. Decompression sickness is probabilistic, so no schedule is a promise of safety.
  • The model assumes the gases, depths, rates, and settings you entered are exactly what you dive. Cold, hard work, and current all make you on-gas faster than the model predicts.
  • This is a planning tool used on the surface. It does not replace training, a dive computer, a sensible personal margin, or your own judgement.

Parts of this guide were drafted with AI assistance and may contain mistakes. It's educational, not a substitute for training. Always dive within your certification and verify with your instruments.