Hi Jan, On 15 July 2015 at 23:59, Rick Walsh <rickmwa...@gmail.com> wrote:
> > On 15 Jul 2015 11:38 pm, "Jan Darowski" <jan.darow...@gmail.com> wrote: > > > > I was checking against C implementation from github (which is the > > easiest for quick modifications and additional data extraction and > > also is an original codes direct translation). After finding two more > > bugs I got around 20min of difference with the depth of 80m and 30min > > at the bottom (15/45 mix). CVA can't be a problem as I switched it off > > to isolate the Boyles influence. I suspect one more place: the > > original implementation uses projected depths (estimates some maximum > > depth the diver can ascend to) and later verifies it but only in one > > direction. So maybe, that's why for deeper dives it's more > > conservative. > > > > For sure, original implementation has slightly different saturation > > results. But tracing it and saying which way it changes the schedule > > is terrible as it depends on the depth. I would say that <10% of deco > > time difference is the limit. As long as we can stay there, it's fine. > > If you just play with the bottom time (for example increase it by > > 1-2min), you can see that the original code generates very uneven > > schedules. > > I agree that is odd. Essentially it's scaling the algorithm according to > the depth of the first stop. Which would be ok, except there's a step > change between defined stop levels. > > But if that's how it is, I think you should stick with that method, flawed > or not, for consistency with other programmes. > The Boyles law compensation is effectively adjusting the conservatism of the model according to the depth of the first deco stop. But changes in deco stop depths vary in 3m steps, and as you pointed out this can lead to some odd changes in a profile with very small increments in bottom time. In order to avoid step changes, I thought it might be worth doing the initial Boyles law compensation based on the ceiling of the initial ascent, rather than the depth of the first deco stop. They represent a similar concept, but the ceiling changes incrementally, whereas the deco stops vary in 3m increments. The attached patch does this (on top of your github). It is a small change from the published algorithm, so I'm not saying it should be used. But it's worth considering, especially when you compare the profiles with small increments in bottom time. I compared both these methods of Boyle's law compensation against the total ascent times and depth of first stop for the 200ft trimix dive VPM-B profiles published by Eric Maiken (linked in my previous email). These comparison are plotted on the attached pdf and spreadsheet. For consistency with the published profiles, the following parameters were used: Gasses 18/45 50.00% 100.00% Critical radii (microns) N2 0.55 He 0.45 Ascent rate 33 ft/min Descent rate 99 ft/min The published profiles have bottom times (including descent) in 10 min increments up to 120 min. To further compare the methods of Boyle's law compensation, I added in 1 min increments in the range 10-20 min, and 40-50 min. As seen by the first two graphs, all three models give generally similar profiles. However, when looking at small bottom time increments which result in a change in the depth of the first deco stop, odd changes occur in the total ascent time when basing the Boyle's law compensation from the first deco stop depth, whereas my modified method gives a much more regular change. Obviously, this is just testing with limited dive profiles. Cheers, Rick
VPM-B model comparison.ods
Description: application/vnd.oasis.opendocument.spreadsheet
VPM-B model comparison.pdf
Description: Adobe PDF document
From 2a7c3ec1bda1fe060daa9cf22046a083efeeab27 Mon Sep 17 00:00:00 2001 From: Rick Walsh <rickmwa...@gmail.com> Date: Fri, 17 Jul 2015 00:04:08 +1000 Subject: [PATCH] VPM-B: Adjust Boyles law compensation incrementally Run the initial Boyles law compesation based on the depth of the initial ascent ceiling, rather than the depth of the first deco stop. Signed-off-by: Rick Walsh <rickmwa...@gmail.com> --- planner.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/planner.c b/planner.c index 72a08ef..7b1bf69 100644 --- a/planner.c +++ b/planner.c @@ -33,6 +33,7 @@ int decostoplevels[sizeof(decostoplevels_metric) / sizeof(int)]; double plangflow, plangfhigh; bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions; +int first_ascent_ceiling_pressure; const char *disclaimer; @@ -840,6 +841,8 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time } if (prefs.deco_mode == VPMB && (!is_vpmb_ok(depth_to_mbar(trial_depth - deltad, &displayed_dive) / 1000.0))){ clear_to_ascend = false; + if (first_ascent_ceiling_pressure == 0) + first_ascent_ceiling_pressure = depth_to_mbar(trial_depth, &displayed_dive); break; } trial_depth -= deltad; @@ -869,7 +872,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool int bottom_depth; int bottom_gi; int bottom_stopidx; - int first_stop_pressure; bool is_final_plan = true; int deco_time; int previous_deco_time; @@ -1052,7 +1054,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool breaktime = -1; breakcylinder = 0; o2time = 0; - first_stop_pressure = 0; + first_ascent_ceiling_pressure = 0; last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time); if ((current_cylinder = get_gasidx(&displayed_dive, &gas)) == -1) { report_error(translate("gettextFromC", "Can't find gas %s"), gasname(&gas)); @@ -1139,9 +1141,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool stopping = true; // Boyles Law compensation - if (first_stop_pressure == 0) - first_stop_pressure = depth_to_mbar(depth, &displayed_dive); - boyles_law(first_stop_pressure / 1000.0, depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0); + boyles_law(first_ascent_ceiling_pressure / 1000.0, depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0); } if (pendinggaschange) { -- 2.4.3
_______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface