[PATCH 1/2] Calculate VPM-B ceiling outside of planner

Rick Walsh rickmwalsh at gmail.com
Wed Oct 28 05:10:28 PDT 2015


Robert,

On 27 October 2015 at 08:09, Rick Walsh <rickmwalsh at gmail.com> wrote:

> Thanks Roberts,
>
(sorry for adding an s to your name)

> On 27 Oct 2015 06:08, "Robert C. Helling" <helling at atdotde.de> wrote:
> >
> > Hi Rick,
> >
> >> On 26 Oct 2015, at 10:25, Rick Walsh <rickmwalsh at gmail.com> wrote:
> >>
> >> So, using your observation that it converges fast, I realized we don't
> actually need to calculate tts for every sample point.  We just need to
> calculate tts for the final sample, iif the ceiling has been broken.  We
> can then take deco_time = time from max ceiling depth until the ceiling
> clears, or would have cleared.
> >>
> >> See patches attached.  More testing is needed, and feedback welcome.
> >
> >
> > I think this makes much more sense. Just a few comments/questions for
> patch 1:
> >
> > 1) I think deco_time is defined, at least in the prose of the VPM-B
> documents as the time at which at least one tissue is off-gassing. Given
> that we have to go through all samples, can’t we just detect off-gassing in
> add_segment by checking if at least one oversat is negative, i.e. start with
> >
> > bool off_gassing = false
> >
> > and then in the loop
> >
> > off_gassing ||= (pn2_oversat < 0) || (phe_oversat <0);
> >
> > and finally change add_segment from void to bool by returning
> off_gassing. Then we can simply add all the time for all segments the we
> added which return true.
>
> This would work, but will achieve almost the same outcome.  Taking deco
> time as time from max ceiling until time of clear ceiling implies that at
> least one tissues, the leading tissue, is off-gassing.  With a very deep
> (setting deepest ceiling) to shallow (shallower ceiling) to deep (all
> tissues on-gas and ceiling deepens but not to max), there could be a small
> difference in calculated deco time.
>
A problem with this approach is that with a deep -> shallow -> deeper
(setting deepest ceiling) profile is that it would start counting deco time
before we are in the real ascent phase and actual offgassing.  I don't
believe we should be distributing the extra bubble volume allowed by the
CVA over this section.  I have kept it as is, but happy to discuss further.


> >
> > 2) I don’t really understand what you are doing
> with first_ceiling_pressure_set. It seems to me you want to pick up the
> first step after the maximum of the ceiling. So you look for a segment
> where the ceiling goes up but in the previous step it didn’t. Why don’t you
> simply memorise the last step where the ceiling gets deeper (it should be
> the previous), by getting rid of first_ceiling_pressure_set and simply doing
> >
> > if (entry->ceiling > first_ceiling) {
> > first_ceiling = entry->ceiling;
> > first_ceiling_pressure.mbar = depth_to_mbar(first_ceiling, dive);
> > }
> >
> > This would give you the value for the maximum ceiling.
>
> Yes, that's much simpler way to achieve the same thing.  I'll do that.
>
I tried doing that.  But it messes up the setting of the gradients.  Until
we reach the deepest ceiling, we want to use first_gradient, after setting
the deepest ceiling, we want to use next_gradient (set once, when
first_ceiling_pressure is set) with the approximated deco_time.  To
distinguish, I have used the first_ceiling_pressure_set boolean variable.


> >
> > 3) I am a bit worried that the last hunk copies quite a bit of
> non-trivial code. Wouldn’t it be possible to factor this out, i.e. do it
> with a loop or as a separate function that the logic is in the source only
> once? Otherwise, we are almost guaranteed that when changing the code in
> the future we will end up with two inconsistent copies.
> >
> Yes, at first glance I thought only a little bit of code needed to be
> repeated so I thought copying it would be better.  But it turns out I
> needed to copy most of it.  I loop is better.
>
I have reworked to loop through the code until it deco_time converges, or a
max of 3 iterations.


> > But all this in the end is cosmetic, I like what the code is doing.
> >
> Thanks.  I'll resubmit addressing your second and third points at least.
> I need to think about the effect (or not) of calculating deco time as you
> suggested.
>
> All I have really changed is that the code now loops, rather than copying
code.  Please let me know if you can think of a better way to create the
VPM-B ceiling.

Note that if you cut short a planned deco profile, skipping the final gas
change, then the final_tts will be over-estimated because it doesn't
consider using the final gas.  This alters the CVA calculation, so the
calculated ceiling does change a little bit from that of the planned
profile if it isn't cut short.  We could change this by altering the tts
calculation to use all gasses in the cylinder list, but I think that would
be worse.  For a real dive, we should only consider the gasses that were
used in that dive.

Cheers,

Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151028/d4149241/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Calculate-VPM-B-ceiling-outside-of-planner.patch
Type: text/x-patch
Size: 11515 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151028/d4149241/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Profile-Display-VPM-B-rather-than-GF-when-in-VPM-B-m.patch
Type: text/x-patch
Size: 5568 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151028/d4149241/attachment-0003.bin>


More information about the subsurface mailing list