How a Submarine Holds Its Depth
Surface ships float at the waterline. Submarines are different — they must hold position not at the surface or the bottom, but at any arbitrary depth. How do you stay precisely at 100 meters? The answer is actively regulating buoyancy.
▶ Simulation footage — a UUV navigating underwater (chase camera view). The interplay of buoyancy and depth control produces this stable dive.
Neutral Buoyancy — The Balance Between Rising and Sinking
The key concept is neutral buoyancy. When buoyancy (upward) and gravity (downward) are exactly equal, the submarine hovers at that depth — it goes neither up nor down.
Rendering diagram…
Submarines use ballast tanks — flooding them with water increases mass and causes descent, blowing them with air reduces mass and causes ascent. Fine-tuning this balance achieves neutral buoyancy at the target depth.
The Depth-Control Loop
Reaching the target depth is a feedback control problem.
Rendering diagram…
If the sub is shallower than the target, it gets heavier; if deeper, lighter — driving z toward the setpoint. The structure is the same as a ground robot's control loop, but the controlled quantity is buoyancy rather than wheel torque.
The Simulation Trap — z=NaN Produces False Successes
There is a subtle bug we encountered here. When the dynamic dive path (active depth changes) is not wired up correctly, the depth z can become NaN (not a number) during computation.
⚠️ NaN passes comparisons and creates false successes — In a check like
z < target_depth, if z is NaN, the comparison always returns False or silently falls through, and "depth reached" can be reported as success. The mission registers as complete even though the depth is physically meaningless. This is the underwater variant of a silent fail. NaN must be detected explicitly and surfaced as a loud failure.
Another issue: even after reaching the target depth, small oscillations (depth-hold residual) persist. Too much control gain causes hunting; too little causes steady-state error — the same stability vs. damping trade-off seen in roll and pitch, now playing out on the vertical axis.
In a nutshell
📌 A submarine adjusts buoyancy via ballast tanks to achieve neutral buoyancy (buoyancy = gravity) and hold any desired depth. Depth control is a feedback loop with buoyancy as the actuated quantity. In simulation, an unwired dynamic dive path can produce z=NaN, which generates false mission successes — NaN must be explicitly detected and fail-loud.
See standard test results with videos and verdict evidence on the imSim Portal.
View public results →