Skip to content

Commit

Permalink
Merge pull request #41 from KG32/fix/ndl-in-deco
Browse files Browse the repository at this point in the history
fix: ndl always 0 in deco
  • Loading branch information
KG32 authored Nov 17, 2024
2 parents 1fb469c + 37d90f6 commit 9816ea1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dive-deco"
version = "4.3.4"
version = "4.3.5"
edition = "2021"
license = "MIT"
description = "A dive decompression models library (Buehlmann ZH-L 16C)"
Expand Down
18 changes: 18 additions & 0 deletions src/buehlmann/buehlmann_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ impl DecoModel for BuehlmannModel {
fn ndl(&self) -> Minutes {
let mut ndl: Minutes = NDL_CUT_OFF_MINS;

if self.in_deco() {
return 0;
}

// create a simulation model based on current model's state
let mut sim_model = self.fork();

Expand Down Expand Up @@ -538,4 +542,18 @@ mod tests {
"invalid config update results in Err"
);
}

#[test]
fn test_ndl_0_if_in_deco() {
let mut model = BuehlmannModel::new(
BuehlmannConfig::default()
.with_gradient_factors(30, 70)
.with_ceiling_type(CeilingType::Actual),
);
let air = Gas::air();
model.record(40., 6 * 60, &air);
model.record(9., 0, &air);
let ndl = model.ndl();
assert_eq!(ndl, 0);
}
}

0 comments on commit 9816ea1

Please sign in to comment.