Planner. Strange behavior while changing deco mixes. (fwd)
Dirk Hohndel
dirk at hohndel.org
Sat Feb 23 16:18:44 PST 2013
Sorry for the slow handling of this patch, Robert.
There just always was something else that seemed more urgent to do and
this one took some time to read and understand. But you hit the nail on
the head an came up with the correct solution.
Thanks
/D
"Robert C. Helling" <helling at lmu.de> writes:
> Hi,
>
> I sent this yesterday almost exactly at the time of the release. It might
> have gotten lost in your excitement... so I send it again.
>
> Best
> Robert
>
> --
> .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
> Robert C. Helling Elite Master Course Theoretical and Mathematical Physics
> Scientific Coordinator
> Ludwig Maximilians Universitaet Muenchen, Dept. Physik
> print "Just another Phone: +49 89 2180-4523 Theresienstr. 39, rm. B339
> stupid .sig\n"; http://www.atdotde.de
>
> ---------- Forwarded message ----------
> From: Robert C. Helling <helling at lmu.de>
> Reply-To: helling at atdotde.de
> To: Salvador Cuñat <salvador.cunat at gmail.com>
> Cc: subsurface at hohndel.org
> Date: Thu, 21 Feb 2013 16:40:24 +0100 (CET)
> Subject: Re: Planner. Strange behavior while changing deco mixes.
>
> On Wed, 20 Feb 2013, Salvador Cuñat wrote:
>
>> Hi.
>>
>> I was just testing the recent patches to the planner and realized that
>> when changing deco mixes (EAN 50 - 21 m and O2 - 6m) the calculated
>> plan diverges widely from the calculated ceiling.
>> While at the 21 m stop the profile shows an EAD of 21m, when it must be
>> 13,29 m (if I'm not wrong), and an strangely long duration, then jumps
>> to a very brief 15m stop, without 18m.
>> Something very similar on the 6m stop except for the EAD which is a
>> correct 0m in this case, and don't loose the 3m stop.
>>
>> Attached is a printout with the simulated dive.
>
> The problem that when reaching the gas change depth and computing the stop
> time, no gas change event is created yet but time_at_last_depth tries to
> determine the gas for the stop from events.
>
> Here is a patch that adds o2 and he as parameters of that function instead of
> the events logic. Dirk, I do not completely understand your gas logic and do
> not understand why you did it your way previously. But this seems to make sense
> for me. If you like:
>
> Signed-off-by: Robert C. Helling <helling at atdotde.de>
>
> Best
> Robert
>
>
> --
> .oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
> Robert C. Helling Elite Master Course Theoretical and Mathematical Physics
> Scientific Coordinator
> Ludwig Maximilians Universitaet Muenchen, Dept. Physik
> print "Just another Phone: +49 89 2180-4523 Theresienstr. 39, rm. B339
> stupid .sig\n"; http://www.atdotde.dediff --git a/planner.c b/planner.c
> index ee13b8b..2e6b920 100644
> --- a/planner.c
> +++ b/planner.c
> @@ -177,9 +177,9 @@ double tissue_at_end(struct dive *dive, char **cached_datap)
> }
>
> /* how many seconds until we can ascend to the next stop? */
> -int time_at_last_depth(struct dive *dive, int next_stop, char **cached_data_p)
> +int time_at_last_depth(struct dive *dive, int o2, int he, int next_stop, char **cached_data_p)
> {
> - int depth, gasidx, o2, he;
> + int depth, gasidx;
> double surface_pressure, tissue_tolerance;
> int wait = 0;
> struct sample *sample;
> @@ -190,10 +190,6 @@ int time_at_last_depth(struct dive *dive, int next_stop, char **cached_data_p)
> tissue_tolerance = tissue_at_end(dive, cached_data_p);
> sample = &dive->dc.sample[dive->dc.samples - 1];
> depth = sample->depth.mm;
> - /* we always start with gas 0 (unless an event tells us otherwise) */
> - o2 = dive->cylinder[0].gasmix.o2.permille;
> - he = dive->cylinder[0].gasmix.he.permille;
> - get_gas_from_events(&dive->dc, sample->time.seconds, &o2, &he);
> gasidx = get_gasidx(dive, o2, he);
> while (deco_allowed_depth(tissue_tolerance, surface_pressure, dive, 1) > next_stop) {
> wait++;
> @@ -690,7 +686,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep)
> #endif
> gi--;
> }
> - wait_time = time_at_last_depth(dive, stoplevels[stopidx - 1], cached_datap);
> + wait_time = time_at_last_depth(dive, o2, he, stoplevels[stopidx - 1], cached_datap);
> /* typically deco plans are done in one minute increments; we may want to
> * make this configurable at some point */
> wait_time = ((wait_time + 59) / 60) * 60;
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
> _______________________________________________
> subsurface mailing list
> subsurface at hohndel.org
> http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
More information about the subsurface
mailing list