diff options
author | Robert C. Helling <helling@atdotde.de> | 2016-08-30 11:33:16 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-09-17 13:41:12 -0700 |
commit | cd99bbe727e31222a0cfb127f0b5acc7464b9800 (patch) | |
tree | 1fd24f566aa99f533943c9926a35ffe6203042e4 /core | |
parent | 893bea700c982daacb0af2feec4b2ac98c96424f (diff) | |
download | subsurface-cd99bbe727e31222a0cfb127f0b5acc7464b9800.tar.gz |
Cosmetic changes to Buehlmann code
Change runtime table string from ZHL-16B to ZHL-16C to reflect he fact
that we use 5min as half-time for the fastest compartment rather than
4min.
Further more trade pow(2.0, ...) for exp().
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/deco.c | 7 | ||||
-rw-r--r-- | core/planner.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/core/deco.c b/core/deco.c index af3e06126..b86376cae 100644 --- a/core/deco.c +++ b/core/deco.c @@ -91,6 +91,7 @@ const double buehlmann_N2_t_halflife[] = { 5.0, 8.0, 12.5, 18.5, 109.0, 146.0, 187.0, 239.0, 305.0, 390.0, 498.0, 635.0 }; +// 1 - exp(-1 / (halflife * 60) * ln(2)) const double buehlmann_N2_factor_expositon_one_second[] = { 2.30782347297664E-003, 1.44301447809736E-003, 9.23769302935806E-004, 6.24261986779007E-004, 4.27777107246730E-004, 3.01585140931371E-004, 2.12729727268379E-004, 1.50020603047807E-004, @@ -329,7 +330,8 @@ double n2_factor(int period_in_seconds, int ci) if (period_in_seconds != cache[ci].last_period) { cache[ci].last_period = period_in_seconds; - cache[ci].last_factor = 1 - pow(2.0, -period_in_seconds / (buehlmann_N2_t_halflife[ci] * 60)); + // ln(2)/60 = 1.155245301e-02 + cache[ci].last_factor = 1 - exp(-period_in_seconds * 1.155245301e-02 / buehlmann_N2_t_halflife[ci]); } return cache[ci].last_factor; @@ -344,7 +346,8 @@ double he_factor(int period_in_seconds, int ci) if (period_in_seconds != cache[ci].last_period) { cache[ci].last_period = period_in_seconds; - cache[ci].last_factor = 1 - pow(2.0, -period_in_seconds / (buehlmann_He_t_halflife[ci] * 60)); + // ln(2)/60 = 1.155245301e-02 + cache[ci].last_factor = 1 - exp(-period_in_seconds * 1.155245301e-02 / buehlmann_He_t_halflife[ci]); } return cache[ci].last_factor; diff --git a/core/planner.c b/core/planner.c index fe9176950..bbc1599e7 100644 --- a/core/planner.c +++ b/core/planner.c @@ -562,7 +562,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool len = show_disclaimer ? snprintf(buffer, sz_buffer, "<div><b>%s<b></div><br>", disclaimer) : 0; if (prefs.deco_mode == BUEHLMANN){ - snprintf(temp, sz_temp, translate("gettextFromC", "based on Bühlmann ZHL-16B with GFlow = %d and GFhigh = %d"), + snprintf(temp, sz_temp, translate("gettextFromC", "based on Bühlmann ZHL-16C with GFlow = %d and GFhigh = %d"), diveplan->gflow, diveplan->gfhigh); } else if (prefs.deco_mode == VPMB){ if (prefs.conservatism_level == 0) |