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

Robert C. Helling helling at atdotde.de
Wed Oct 28 13:18:10 PDT 2015


Hi Rick,

here are some more comments but I think we are converging on all the points.

> On 28 Oct 2015, at 13:10, Rick Walsh <rickmwalsh at gmail.com> wrote:
> >
> > 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.

This is really about how to interpret the (in itself not very logical) philosophy of the model. I would argue, that whenever the tissues are oversaturated compared to the ambient pressure we are adding gas to the bubbles and those are there to stay (their decay is supposed to have a half time of two weeks). So, there is „free gas“ no matter if we later go to greater depth again or not. So I would count it. Or, maybe more convincing: Imagine a dive where you do something which in the real world would be rather stupid: You do all you stops and when at last the 3m ceiling clears, you realise that the anchor needs to be freed. So you do a final bounce to the bottom and then ascent. In that case, you would want to count all the bubbles of the real deco not just those of the bounce.

> 
> >
> > 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.

I don’t follow you here. Next gradient is about the next round of the CVA. What you say sounds more like you are talking about the Boyle compensation. Taking care of the latter is rather trivial: When entry->ceiling >= first_ceiling you don’t compensate and otherwise you do. (First ceiling is actually the max_ceiling up to that point).

> 
> >
> > 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.

In a quick look, I could not see what the loop is run only once if we are not using VPM. But I need to do some more understanding and thinking here.

Best
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151028/fbd95848/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151028/fbd95848/attachment.sig>


More information about the subsurface mailing list