On 30 August 2015 at 10:57, Rick Walsh <[email protected]> wrote: > Here is a rebased patchset to improve the VPM-B planner and make it pass > all the tests. >
This time I've attached the patches :p > > The only difference in the end result from what I sent earlier is that now > we check in_planner() when testing for prefs.deco_mode > > Thanks for your patience. > > 0001-VPM-B-Tests-Output-first-ceiling.patch > 0002-Update-expected-runtime-of-VPM-B-test-to-match-bench.patch > 0003-VPM-B-Use-correct-gamma-values.patch > 0004-Use-Schreiner-water-vapour-pressure-for-VPM-B.patch > 0005-VPM-B-Calculate-crushing-pressure-on-descent.patch > 0006-Planner-Change-where-we-clear-deco-and-reset-gradien.patch > 0007-VPM-B-Remove-obsolete-first_ceiling_pressure-calcula.patch > 0008-VPM-B-Don-t-break-the-ceiling-due-to-ongassing-on-as.patch > 0009-VPM-B-Tests-Compare-against-known-Subsurface-runtime.patch > > Cheers, > > Rick >
From 0f2b92b85ef3124b304a44ead1ecc2a47e92905b Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 22:30:48 +1000 Subject: [PATCH 9/9] VPM-B Tests: Compare against known Subsurface runtime We should compare the calculated runtime against the runtime previously calculated by Subsurface, expecting them to match exactly, in order to detect if a change has been made. We still compare against a benchmark, allowing some difference. Signed-off-by: Rick Walsh <[email protected]> --- tests/testplan.cpp | 64 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/tests/testplan.cpp b/tests/testplan.cpp index a8bde54..56d511b 100644 --- a/tests/testplan.cpp +++ b/tests/testplan.cpp @@ -194,27 +194,39 @@ void setupPlanVpmb100m10min(struct diveplan *dp) plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, oxygen, 0, 1); } -bool compareDecoTime(int actualRunTimeSeconds, int expectedRunTimeSeconds) +/* We compare the calculated runtimes against two values: + * - Known runtime calculated by Subsurface previously (to detect if anything has changed) + * - Benchmark runtime (we should be close, but not always exactly the same) + */ +bool compareDecoTime(int actualRunTimeSeconds, int benchmarkRunTimeSeconds, int knownSsrfRunTimeSeconds) { + bool result; + // If the calculated run time equals the expected run time, do a simple comparison - if (actualRunTimeSeconds == expectedRunTimeSeconds) { - return true; + if (actualRunTimeSeconds == benchmarkRunTimeSeconds) { + bool result = true; } else { /* We want the difference between the expected and calculated total run time to be not more than * 1% of total run time + 1 minute */ int permilDifferenceAllowed = 1 * 10; int absoluteDifferenceAllowedSeconds = 60; - int totalDifferenceAllowed = 0.001 * permilDifferenceAllowed * expectedRunTimeSeconds + absoluteDifferenceAllowedSeconds; - int totalDifference = abs(actualRunTimeSeconds - expectedRunTimeSeconds); + int totalDifferenceAllowed = 0.001 * permilDifferenceAllowed * benchmarkRunTimeSeconds + absoluteDifferenceAllowedSeconds; + int totalDifference = abs(actualRunTimeSeconds - benchmarkRunTimeSeconds); - printf("Calculated run time = %d seconds\n", actualRunTimeSeconds); - printf("Expected run time = %d seconds\n", expectedRunTimeSeconds); - printf("Allowed time difference is %g percent plus %d seconds = %d seconds\n", + qInfo("Calculated run time = %d seconds", actualRunTimeSeconds); + qInfo("Expected run time = %d seconds", benchmarkRunTimeSeconds); + qInfo("Allowed time difference is %g percent plus %d seconds = %d seconds", permilDifferenceAllowed * 0.1, absoluteDifferenceAllowedSeconds, totalDifferenceAllowed); - printf("total difference = %d seconds\n", totalDifference); + qInfo("total difference = %d seconds", totalDifference); - return (totalDifference <= totalDifferenceAllowed); + bool result = (totalDifference <= totalDifferenceAllowed); + } + if ((knownSsrfRunTimeSeconds > 0) && (actualRunTimeSeconds != knownSsrfRunTimeSeconds)) { + QWARN("Calculated run time does not match known Subsurface runtime"); + qWarning("Calculated runtime: %d", actualRunTimeSeconds); + qWarning("Known Subsurface runtime: %d", knownSsrfRunTimeSeconds); } + return result; } void TestPlan::testMetric() @@ -249,8 +261,8 @@ void TestPlan::testMetric() QCOMPARE(ev->gas.index, 2); QCOMPARE(ev->value, 100); QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000); - // check expected run time of 105 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 108u * 60u)); + // check expected run time of 108 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 108u * 60u, 108u * 60u)); } void TestPlan::testImperial() @@ -285,8 +297,8 @@ void TestPlan::testImperial() QCOMPARE(ev->gas.index, 2); QCOMPARE(ev->value, 100); QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6096); - // check expected run time of 105 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 110u * 60u - 2u)); + // check expected run time of 110 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 110u * 60u - 2u, 110u * 60u - 2u)); } void TestPlan::testVpmbMetric60m30minAir() @@ -311,8 +323,8 @@ void TestPlan::testVpmbMetric60m30minAir() // print first ceiling printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); - // check expected run time of 141 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 141u * 60u + 20u)); + // check benchmark run time of 141 minutes, and known Subsurface runtime of 139 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 141u * 60u + 20u, 139u * 60u + 20u)); } void TestPlan::testVpmbMetric60m30minEan50() @@ -343,8 +355,8 @@ void TestPlan::testVpmbMetric60m30minEan50() QCOMPARE(ev->gas.index, 1); QCOMPARE(ev->value, 50); QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 21000); - // check expected run time of 95 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 95u * 60u + 20u)); + // check benchmark run time of 95 minutes, and known Subsurface runtime of 96 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 95u * 60u + 20u, 96u * 60u + 20u)); } void TestPlan::testVpmbMetric60m30minTx() @@ -375,8 +387,8 @@ void TestPlan::testVpmbMetric60m30minTx() QCOMPARE(ev->gas.index, 1); QCOMPARE(ev->value, 50); QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 21000); - // check expected run time of 89 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 89u * 60u + 20u)); + // check benchmark run time of 89 minutes, and known Subsurface runtime of 88 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 89u * 60u + 20u, 88u * 60u + 20u)); } void TestPlan::testVpmbMetric100m60min() @@ -413,8 +425,8 @@ void TestPlan::testVpmbMetric100m60min() QCOMPARE(ev->gas.index, 2); QCOMPARE(ev->value, 100); QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000); - // check expected run time of 311 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 311u * 60u + 20u)); + // check benchmark run time of 311 minutes, and known Subsurface runtime of 312 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 311u * 60u + 20u, 312u * 60u + 20u)); } void TestPlan::testVpmbMetricMultiLevelAir() @@ -439,8 +451,8 @@ void TestPlan::testVpmbMetricMultiLevelAir() // print first ceiling printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); - // check expected run time of 167 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 167u * 60u + 20u)); + // check benchmark run time of 167 minutes, and known Subsurface runtime of 168 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 167u * 60u + 20u, 168u * 60u + 20u)); } void TestPlan::testVpmbMetric100m10min() @@ -477,8 +489,8 @@ void TestPlan::testVpmbMetric100m10min() QCOMPARE(ev->gas.index, 2); QCOMPARE(ev->value, 100); QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000); - // check expected run time of 58 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 58u * 60u + 20u)); + // check benchmark run time of 58 minutes, and known Subsurface runtime of 57 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 58u * 60u + 20u, 57u * 60u + 20u)); } QTEST_MAIN(TestPlan) -- 2.4.3
From 49950175cb08a5e639a02d426ac28f7457c31a0f Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sun, 30 Aug 2015 00:07:22 +1000 Subject: [PATCH 8/9] VPM-B: Don't break the ceiling due to ongassing on ascent Signed-off-by: Rick Walsh <[email protected]> --- planner.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/planner.c b/planner.c index 95052a9..a0231a3 100644 --- a/planner.c +++ b/planner.c @@ -876,11 +876,11 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time bool clear_to_ascend = true; char *trial_cache = NULL; - // For VPM-B it is not relevant if we would violate a ceiling during ascent to the next stop but - // if the next stop is below the ceiling at the start of the ascent (thus the offgasing during - // the ascent is ignored. - if (prefs.deco_mode == VPMB) - return (deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) <= stoplevel); + // For consistency with other VPM-B implementations, we should not start the ascent while the ceiling is + // deeper than the next stop (thus the offgasing during the ascent is ignored). + // However, we still need to make sure we don't break the ceiling due to on-gassing during ascent. + if (prefs.deco_mode == VPMB && (deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) > stoplevel)) + return false; cache_deco_state(tissue_tolerance, &trial_cache); while (trial_depth > stoplevel) { -- 2.4.3
From db8c487ea6a115f5f96ac6ff79c86cc2676c7d15 Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 22:00:34 +1000 Subject: [PATCH 7/9] VPM-B: Remove obsolete first_ceiling_pressure calculation We now do the first_ceiling_pressure calculation at the start of the CVA loop. We don't need to do it before. Signed-off-by: Rick Walsh <[email protected]> --- planner.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/planner.c b/planner.c index a57247c..95052a9 100644 --- a/planner.c +++ b/planner.c @@ -942,7 +942,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool int *decostoplevels; int decostoplevelcount; unsigned int *stoplevels = NULL; - int vpmb_first_stop; bool stopping = false; bool pendinggaschange = false; bool clear_to_ascend; @@ -1109,21 +1108,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool bottom_gas = gas; bottom_stopidx = stopidx; - // Find first stop used for VPM-B Boyle's law compensation - if (prefs.deco_mode == VPMB) { - vpmb_first_stop = deco_allowed_depth(tissue_tolerance, diveplan->surface_pressure / 1000, &displayed_dive, 1); - if (vpmb_first_stop > 0) { - while (stoplevels[stopidx] > vpmb_first_stop) { - stopidx--; - } - stopidx++; - vpmb_first_stop = stoplevels[stopidx]; - } - first_ceiling_pressure.mbar = depth_to_mbar(vpmb_first_stop, &displayed_dive); - } else { - first_ceiling_pressure.mbar = 0; - } - //CVA do { is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10); // CVA time converges -- 2.4.3
From 93a6eeda449ee1f1f61b04fb9572927b723108c5 Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 21:54:22 +1000 Subject: [PATCH 6/9] Planner: Change where we clear deco and reset gradients We should run clear_deco as early as we can. We should calculate the nuclear regeneration and start gradient after calculating tissue tolerance. We don't need to redo nuclear regeration and start gradient after that. Signed-off-by: Rick Walsh <[email protected]> --- planner.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/planner.c b/planner.c index 0b5bd9b..a57247c 100644 --- a/planner.c +++ b/planner.c @@ -960,6 +960,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth); if (!diveplan->surface_pressure) diveplan->surface_pressure = SURFACE_PRESSURE; + displayed_dive.surface_pressure.mbar = diveplan->surface_pressure; + clear_deco(displayed_dive.surface_pressure.mbar / 1000.0); create_dive_from_plan(diveplan, is_planner); // Do we want deco stop array in metres or feet? @@ -1000,14 +1002,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool create_dive_from_plan(diveplan, is_planner); return(false); } - nuclear_regeneration(clock); - clear_deco(displayed_dive.surface_pressure.mbar / 1000.0); - vpmb_start_gradient(); - previous_deco_time = 100000000; - deco_time = 10000000; - - tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); - displayed_dive.surface_pressure.mbar = diveplan->surface_pressure; #if DEBUG_PLAN & 4 printf("gas %s\n", gasname(&gas)); @@ -1037,6 +1031,11 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool bottom_time = clock = previous_point_time = displayed_dive.dc.sample[displayed_dive.dc.samples - 1].time.seconds; gi = gaschangenr - 1; + /* Set tissue tolerance and initial vpmb gradient at start of ascent phase */ + tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); + nuclear_regeneration(clock); + vpmb_start_gradient(); + if(prefs.deco_mode == RECREATIONAL) { bool safety_stop = prefs.safetystop && max_depth >= 10000; track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time, safety_stop); @@ -1101,8 +1100,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool } // VPM-B or Buehlmann Deco - nuclear_regeneration(clock); - vpmb_start_gradient(); + tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); previous_deco_time = 100000000; deco_time = 10000000; cache_deco_state(tissue_tolerance, &bottom_cache); // Lets us make several iterations -- 2.4.3
From 4095e578d6a9d9ddc3d8b0dbf0020c69677afaaf Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 21:51:35 +1000 Subject: [PATCH 5/9] VPM-B: Calculate crushing pressure on descent By calculating crushing pressure after the manually entered phase, we were doing it wrong for multi-level dives. Signed-off-by: Rick Walsh <[email protected]> --- planner.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/planner.c b/planner.c index ae90938..0b5bd9b 100644 --- a/planner.c +++ b/planner.c @@ -110,6 +110,9 @@ double interpolate_transition(struct dive *dive, duration_t t0, duration_t t1, d int depth = interpolate(d0.mm, d1.mm, j - t0.seconds, t1.seconds - t0.seconds); tissue_tolerance = add_segment(depth_to_mbar(depth, dive) / 1000.0, gasmix, 1, po2.mbar, dive, prefs.bottomsac); } + if (d1.mm > d0.mm) + calc_crushing_pressure(depth_to_mbar(d1.mm, &displayed_dive) / 1000.0); + return tissue_tolerance; } @@ -997,7 +1000,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool create_dive_from_plan(diveplan, is_planner); return(false); } - calc_crushing_pressure(depth_to_mbar(depth, &displayed_dive) / 1000.0); nuclear_regeneration(clock); clear_deco(displayed_dive.surface_pressure.mbar / 1000.0); vpmb_start_gradient(); -- 2.4.3
From 0dd52aa8d869a8fac945e6dc60cbb14637c0d39f Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 21:43:32 +1000 Subject: [PATCH 4/9] Use Schreiner water vapour pressure for VPM-B Inspired gas loading equations depend on the partial pressure of inert gas in the alveolar. P_alv = (P_amb - P_H2O + (1 - Rq) / Rq * P_CO2) * f where: P_alv alveolar partial pressure of inert gas P_amb ambient pressure P_H2O water vapour partial pressure = ~0.0627 bar P_CO2 carbon dioxide partial pressure = ~0.0534 bar Rq respiratory quotient (O2 consumption / CO2 production) f fraction of inert gas In our calculations, we simplify this to use an effective water vapour pressure WV = P_H20 - (1 - Rq) / Rq * P_CO2 Buhlmann ignored the contribution of CO2 (i.e. Rq = 1.0), whereas Schreiner adopted Rq = 0.8. WV_Buhlmann = PP_H2O = 0.0627 bar WV_Schreiner = 0.0627 - (1 - 0.8) / Rq * 0.0534 = 0.0493 bar Buhlmann calculations use the Buhlmann value, VPM-B calculations use the Schreiner value. Concept explained here: http://www.divetable.de/workshop/V1_e.htm Signed-off-by: Rick Walsh <[email protected]> --- deco.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/deco.c b/deco.c index a9dbf4c..fa4cd46 100644 --- a/deco.c +++ b/deco.c @@ -115,7 +115,28 @@ const double buehlmann_He_factor_expositon_one_second[] = { const double conservatism_lvls[] = { 1.0, 1.05, 1.12, 1.22, 1.35 }; -#define WV_PRESSURE 0.0627 // water vapor pressure in bar +/* Inspired gas loading equations depend on the partial pressure of inert gas in the alveolar. + * P_alv = (P_amb - P_H2O + (1 - Rq) / Rq * P_CO2) * f + * where: + * P_alv alveolar partial pressure of inert gas + * P_amb ambient pressure + * P_H2O water vapour partial pressure = ~0.0627 bar + * P_CO2 carbon dioxide partial pressure = ~0.0534 bar + * Rq respiratory quotient (O2 consumption / CO2 production) + * f fraction of inert gas + * + * In our calculations, we simplify this to use an effective water vapour pressure + * WV = P_H20 - (1 - Rq) / Rq * P_CO2 + * + * Buhlmann ignored the contribution of CO2 (i.e. Rq = 1.0), whereas Schreiner adopted Rq = 0.8. + * WV_Buhlmann = PP_H2O = 0.0627 bar + * WV_Schreiner = 0.0627 - (1 - 0.8) / Rq * 0.0534 = 0.0493 bar + + * Buhlmann calculations use the Buhlmann value, VPM-B calculations use the Schreiner value. +*/ +#define WV_PRESSURE 0.0627 // water vapor pressure in bar, based on respiratory quotient Rq = 1.0 (Buhlmann value) +#define WV_PRESSURE_SCHREINER 0.0493 // water vapor pressure in bar, based on respiratory quotient Rq = 0.8 (Schreiner value) + #define DECO_STOPS_MULTIPLIER_MM 3000.0 #define NITROGEN_FRACTION 0.79 @@ -270,7 +291,7 @@ double he_factor(int period_in_seconds, int ci) double calc_surface_phase(double surface_pressure, double he_pressure, double n2_pressure, double he_time_constant, double n2_time_constant) { - double inspired_n2 = (surface_pressure - WV_PRESSURE) * NITROGEN_FRACTION; + double inspired_n2 = (surface_pressure - ((in_planner() && (prefs.deco_mode == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * NITROGEN_FRACTION; if (n2_pressure > inspired_n2) return (he_pressure / he_time_constant + (n2_pressure - inspired_n2) / n2_time_constant) / (he_pressure + n2_pressure - inspired_n2); @@ -468,7 +489,8 @@ double add_segment(double pressure, const struct gasmix *gasmix, int period_in_s int ci; struct gas_pressures pressures; - fill_pressures(&pressures, pressure - WV_PRESSURE, gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode); + fill_pressures(&pressures, pressure - ((in_planner() && (prefs.deco_mode == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE), + gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode); if (buehlmann_config.gf_low_at_maxdepth && pressure > gf_low_pressure_this_dive) gf_low_pressure_this_dive = pressure; @@ -504,7 +526,7 @@ void clear_deco(double surface_pressure) { int ci; for (ci = 0; ci < 16; ci++) { - tissue_n2_sat[ci] = (surface_pressure - WV_PRESSURE) * N2_IN_AIR / 1000; + tissue_n2_sat[ci] = (surface_pressure - ((in_planner() && (prefs.deco_mode == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * N2_IN_AIR / 1000; tissue_he_sat[ci] = 0.0; max_n2_crushing_pressure[ci] = 0.0; max_he_crushing_pressure[ci] = 0.0; -- 2.4.3
From 2a97164963c732093612b5bf3c5f2aa18330999b Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 21:34:19 +1000 Subject: [PATCH 3/9] VPM-B: Use correct gamma values In other implementations of VPM-B, surface_tension_gamma and skin_compression_gammaC are taken as 0.0179 N/msw and 0.257 N/msw respectively. We do pressure calculations in bar, not msw, so our gamma values need to reflect that. Previously we had used 0.179 and 2.57, which are close but not quite correct (10 msw == 1.01325 bar). Signed-off-by: Rick Walsh <[email protected]> --- deco.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deco.c b/deco.c index 7a9f33e..a9dbf4c 100644 --- a/deco.c +++ b/deco.c @@ -52,8 +52,8 @@ struct vpmb_config { double crit_radius_He; //! Critical radius of He nucleon (microns). double crit_volume_lambda; //! Constant corresponding to critical gas volume (bar * min). double gradient_of_imperm; //! Gradient after which bubbles become impermeable (bar). - double surface_tension_gamma; //! Nucleons surface tension constant (N / 10m). - double skin_compression_gammaC; //! Skin compression gammaC (N / 10m). + double surface_tension_gamma; //! Nucleons surface tension constant (N / bar = m2). + double skin_compression_gammaC; //! Skin compression gammaC (N / bar = m2). double regeneration_time; //! Time needed for the bubble to regenerate to the start radius (min). double other_gases_pressure; //! Always present pressure of other gasses in tissues (bar). }; @@ -63,8 +63,8 @@ struct vpmb_config vpmb_config = { .crit_radius_He = 0.45, .crit_volume_lambda = 199.58, .gradient_of_imperm = 8.2, - .surface_tension_gamma = 0.179, - .skin_compression_gammaC = 2.57, + .surface_tension_gamma = 0.18137175, // = 0.0179 N/msw + .skin_compression_gammaC = 2.6040525, // = 0.257 N/msw .regeneration_time = 20160.0, .other_gases_pressure = 0.1359888 }; -- 2.4.3
From e442a4d9f7713f88c2e0925a010776ccebc1db58 Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 21:14:48 +1000 Subject: [PATCH 2/9] Update expected runtime of VPM-B test to match benchmark Signed-off-by: Rick Walsh <[email protected]> --- tests/testplan.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testplan.cpp b/tests/testplan.cpp index 7d57742..a8bde54 100644 --- a/tests/testplan.cpp +++ b/tests/testplan.cpp @@ -413,8 +413,8 @@ void TestPlan::testVpmbMetric100m60min() QCOMPARE(ev->gas.index, 2); QCOMPARE(ev->value, 100); QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000); - // check expected run time of 316 minutes - QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 316u * 60u + 20u)); + // check expected run time of 311 minutes + QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 311u * 60u + 20u)); } void TestPlan::testVpmbMetricMultiLevelAir() -- 2.4.3
From e5408f7615662f4f7a50d99bb82ca109985a15d2 Mon Sep 17 00:00:00 2001 From: Rick Walsh <[email protected]> Date: Sat, 29 Aug 2015 12:05:39 +1000 Subject: [PATCH 1/9] VPM-B Tests: Output first ceiling This is useful for determining why we calculate a difference profile Signed-off-by: Rick Walsh <[email protected]> --- tests/testplan.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/testplan.cpp b/tests/testplan.cpp index b0b9691..7d57742 100644 --- a/tests/testplan.cpp +++ b/tests/testplan.cpp @@ -10,6 +10,8 @@ // testing the dive plan algorithm extern bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool show_disclaimer); +extern pressure_t first_ceiling_pressure; + void setupPrefs() { prefs = default_prefs; @@ -307,6 +309,8 @@ void TestPlan::testVpmbMetric60m30minAir() save_dive(stdout, &displayed_dive); #endif + // print first ceiling + printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); // check expected run time of 141 minutes QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 141u * 60u + 20u)); } @@ -331,6 +335,8 @@ void TestPlan::testVpmbMetric60m30minEan50() save_dive(stdout, &displayed_dive); #endif + // print first ceiling + printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); // check first gas change to EAN50 at 21m struct event *ev = displayed_dive.dc.events; QVERIFY(ev != NULL); @@ -361,6 +367,8 @@ void TestPlan::testVpmbMetric60m30minTx() save_dive(stdout, &displayed_dive); #endif + // print first ceiling + printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); // check first gas change to EAN50 at 21m struct event *ev = displayed_dive.dc.events; QVERIFY(ev != NULL); @@ -391,6 +399,8 @@ void TestPlan::testVpmbMetric100m60min() save_dive(stdout, &displayed_dive); #endif + // print first ceiling + printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); // check first gas change to EAN50 at 21m struct event *ev = displayed_dive.dc.events; QVERIFY(ev != NULL); @@ -427,6 +437,8 @@ void TestPlan::testVpmbMetricMultiLevelAir() save_dive(stdout, &displayed_dive); #endif + // print first ceiling + printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); // check expected run time of 167 minutes QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 167u * 60u + 20u)); } @@ -451,6 +463,8 @@ void TestPlan::testVpmbMetric100m10min() save_dive(stdout, &displayed_dive); #endif + // print first ceiling + printf("First ceiling %.1f m\n", (mbar_to_depth(first_ceiling_pressure.mbar, &displayed_dive) * 0.001)); // check first gas change to EAN50 at 21m struct event *ev = displayed_dive.dc.events; QVERIFY(ev != NULL); -- 2.4.3
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
