commit db41af68eb462e8550fbab145dfb17ec758d5f79
parent b981fff57c1d599afdc5a3f0fba343fa2707fd28
Author: Jean Schurger <jean@schurger.org>
Date: Fri, 13 Nov 2026 15:28:57 -0500
Stops: the next stop must be tolerated before ascending (no more credit for the travel), tuned against the Shearwater
Three decompression dives of a Petrel 3: stop time -0.1 min on average (before -0.3 to -0.6), decompression
cleared 15 to 30 s before it (before 45 to 50 s), same stop depth on 226 of 239 common points.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K7deYGcjJYQu2t1EUEKgbs
Diffstat:
2 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/Packages/RemoraDeco/Sources/RemoraDeco/AscentPlanner.swift b/Packages/RemoraDeco/Sources/RemoraDeco/AscentPlanner.swift
@@ -112,7 +112,8 @@ public enum AscentPlanner {
while depth > 0 {
let next = nextStop(below: depth)
let trial = ascend(t, from: depth, to: next)
- if clear(trial, at: next) {
+ // Prudence : le palier suivant doit être toléré AVANT de monter (pas de crédit pour le trajet).
+ if clear(t, at: next) {
t = trial
tts += (depth - next) / settings.ascentRate
depth = next
@@ -124,7 +125,7 @@ public enum AscentPlanner {
repeat {
t.stay(atPressure: scale.pressure(atDepth: depth), gas: gas, minutes: 1)
waited += 1
- } while !clear(ascend(t, from: depth, to: next), at: next) && waited < 999
+ } while !clear(t, at: next) && waited < 999
stops.append(DecoStop(depth: depth, minutes: waited))
tts += Double(waited)
}
diff --git a/Packages/RemoraDeco/Tests/RemoraDecoTests/ShearwaterComparisonTests.swift b/Packages/RemoraDeco/Tests/RemoraDecoTests/ShearwaterComparisonTests.swift
@@ -64,6 +64,9 @@ struct ShearwaterComparisonTests {
var ndlDiffs: [Double] = []
var stopRows: [String] = []
var firstDeco: String?
+ var decoStats = (both: 0, sameDepth: 0, minuteDiffs: [Double](), ttsDiffs: [Double](), onlyTheirs: 0, onlyOurs: 0)
+ var enter: (theirs: Double?, ours: Double?) = (nil, nil)
+ var leave: (theirs: Double?, ours: Double?) = (nil, nil)
for (i, s) in dive.samples.enumerated() {
computer.update(time: Double(i + 1) * step, pressure: computer.scale.pressure(atDepth: s.depth))
let plan = computer.status.plan
@@ -77,6 +80,17 @@ struct ShearwaterComparisonTests {
print(" écart t=\(Int(Double(i + 1) * step / 60))' \(s.depth) m : Shearwater \(s.ndl_or_stop) min, Rémora \(Int(plan.noDecompressionLimit ?? 99)) min")
}
}
+ let minute = Double(i + 1) * step / 60
+ if s.stop_depth > 0 { if enter.theirs == nil { enter.theirs = minute }; leave.theirs = minute }
+ if plan.inDecompression { if enter.ours == nil { enter.ours = minute }; leave.ours = minute }
+ if s.stop_depth > 0, let stop = plan.stops.first {
+ decoStats.both += 1
+ if Int(stop.depth) == s.stop_depth {
+ decoStats.sameDepth += 1
+ decoStats.minuteDiffs.append(Double(stop.minutes - s.ndl_or_stop))
+ }
+ decoStats.ttsDiffs.append(plan.timeToSurface.rounded(.up) - Double(s.tts))
+ } else if s.stop_depth > 0 { decoStats.onlyTheirs += 1 } else if plan.inDecompression { decoStats.onlyOurs += 1 }
if s.stop_depth > 0 || plan.inDecompression {
let ours = plan.stops.first.map { "\(Int($0.depth)) m \($0.minutes) min, surface \(Int(plan.timeToSurface.rounded(.up)))" } ?? "aucun"
let theirs = s.stop_depth > 0 ? "\(s.stop_depth) m \(s.ndl_or_stop) min, surface \(s.tts)" : "aucun"
@@ -90,7 +104,16 @@ struct ShearwaterComparisonTests {
print("Plongée \(dive.number ?? "?") \(dive.site ?? "") GF \(dive.gf_low)/\(dive.gf_high) O2 \(dive.samples[0].o2) %"
+ (interval.map { " (intervalle \(Int($0)) min)" } ?? "")
+ String(format: " : sans palier, %d points, écart moyen %+.1f min, pire %.0f min", ndlDiffs.count, mean, worst))
- stopRows.forEach { print($0) }
+ if enter.theirs != nil || enter.ours != nil {
+ func f(_ v: Double?) -> String { v.map { String(format: "%.1f", $0) } ?? "jamais" }
+ let m = decoStats.minuteDiffs
+ let t = decoStats.ttsDiffs
+ print(" PALIERS : entrée Shearwater \(f(enter.theirs)) min, Rémora \(f(enter.ours)) min ; sortie \(f(leave.theirs)) / \(f(leave.ours)) min")
+ print(String(format: " PALIERS : %d points communs, même profondeur %d, durée du palier %+.2f min en moyenne (pire %+.0f), surface %+.1f min ; Shearwater seul %d points, Rémora seul %d points",
+ decoStats.both, decoStats.sameDepth, m.isEmpty ? 0 : m.reduce(0, +) / Double(m.count),
+ m.max(by: { abs($0) < abs($1) }) ?? 0, t.isEmpty ? 0 : t.reduce(0, +) / Double(t.count),
+ decoStats.onlyTheirs, decoStats.onlyOurs))
+ }
let duration = Double(dive.samples.count) * step
previous = (start.addingTimeInterval(duration), computer.tissues)