Skip to content

Commit

Permalink
fix: invalid depth on deco simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
KG32 committed Jun 21, 2024
1 parent b2a408c commit 19929cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 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 = "1.3.0"
version = "1.3.1"
edition = "2021"
license = "MIT"
description = "A dive decompression models library (Buehlmann ZH-L 16C)"
Expand Down
5 changes: 4 additions & 1 deletion src/buehlmann/buehlmann_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ impl BuehlmannModel {
let sim_gas = sim_model.state.gas;
let mut target_depth = sim_model.state.depth;
while target_depth > 0. {
let sim_step_depth = target_depth - 1.;
let mut sim_step_depth = target_depth - 1.;
if sim_step_depth < 0. {
sim_step_depth = 0.;
}
sim_model.step(&sim_step_depth, &0, &sim_gas);
let Supersaturation { gf_99, .. } = sim_model.supersaturation();
if gf_99 >= gf_low.into() {
Expand Down
4 changes: 2 additions & 2 deletions tests/deco_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fn deco_multi_gas() {

let mut model = fixtures::model_default();

model.step(&40., &(20 * 60), &air);
model.step(&40.0001, &(20 * 60), &air);

let Deco {
deco_stages,
Expand All @@ -87,7 +87,7 @@ fn deco_multi_gas() {
let expected_deco_stages = vec![
DecoStage {
stage_type: DecoStageType::Ascent,
start_depth: 40.0,
start_depth: 40.0001,
end_depth: 22.,
duration: 120,
gas: air
Expand Down

0 comments on commit 19929cf

Please sign in to comment.