<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 20 October 2017 at 12:22, Rick Walsh <span dir="ltr"><<a href="mailto:rickmwalsh@gmail.com" target="_blank">rickmwalsh@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On 16 October 2017 at 18:20, Willem Ferguson <span dir="ltr"><<a href="mailto:willemferguson@zoology.up.ac.za" target="_blank">willemferguson@zoology.up.ac.<wbr>za</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><span class="gmail-m_-257787298300021239gmail-"><br></span>
    Attached screenshot is 4.6.4.977, downloaded yesterday(Sunday). The
    VPM plan generates an impossible ceiling. Perhaps worth another
    look?<br>
    <br></div></blockquote></span><div>Thanks for this. Yes, that ceiling is not correct and I can reproduce the problem (with 4.6.4-986 Windows binary because that's what's working on this computer, but I don't think anything relevant has changed since).<br></div></div><br></div><div class="gmail_extra">Based on a little bit of testing I'm doing while I can't do my actual work, the good news appears to be:<br>- the issue only relates to the displayed ceiling in the planner, not to the dive plan itself.<br>- The tests still pass.<br>- once the plan is saved, the dive profile is displayed with a reasonable ceiling, consistent with the dive plan<br><br></div><div class="gmail_extra">This is very easy to reproduce for relatively shallow decompression dives (on air, nitrox or trimix), but I couldn't reproduce the problem for dives deeper than 20m with air as bottom gas, or for dives deeper than 35m with 21/35 as bottom gas.  That's not to say the displayed ceiling matches the plan's calculated ceiling exactly, just that the difference becomes negligible for deeper dives.<br><br></div><div class="gmail_extra">In every case where I could reproduce this problem, including your 20m for 60min on air example, the deepest ceiling occurs earlier than it should.  For a constant bottom depth, the deepest ceiling should be at the end of the bottom time, but in your example the deepest ceiling, 6.1m, occurs around 30min, and the ceiling at 60min (end of bottom time) is only 5.9m.  The difference in ceiling looks minor, but I think the difference in duration into the dive when the deepest ceiling occurs plays havoc with the VPM-B Critical Volume Algorithm (CVA).<br><br></div><div class="gmail_extra">The theory behind the CVA is that there's a critical volume of oversize bubbles that the body can tolerate without resulting in decompression sickness.  The algorithm takes this logic and permits the calculated "basic" maximum gradient to be exceeded by a certain amount for the duration of the decompression phase of the dive.  The shorter the "decompression time", the more liberal the algorithm is as the basic maximum gradient will be exceeded for a shorter duration.  When the decompression time is longer, the opposite occurs.  One issue with this when dealing with a real dive with data downloaded from a dive computer is we need to make an assumption as to when decompression starts.  We take it as the point at which the ceiling is deepest.  This is good, but in the 20m for 60min on air plan (and other similar cases) the deepest ceiling is wrongly calculated (but not by much) by the code that determines the ceiling displayed in the profile when in planner mode. Although the difference in calculated ceiling is in the order of centimetres, the difference in dive time means the decompression duration is over-estimated.  Therefore, the basic maximum gradient is only permitted to be exceeded by a little bit (because it is assumed it will be exceeded for longer).<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Previously, we took the calculated ceiling and decompression time directly from the planner (which doesn't calculate the ceiling at each "sample", just at the entered waypoints and decompression stops) when in planner mode, but we changed the data structure in the planner since the 4.6.4 and given my lack of programming ability I couldn't work out how to access this from the profile ceiling code.<br><br></div><div class="gmail_extra">I think the fix is either:<br></div><div class="gmail_extra">1) Work out how to access the deepest ceiling and importantly time of deepest ceiling from the planner, or<br></div><div class="gmail_extra">2) Calculate the deepest ceiling and time of deepest ceiling better for the profile code when in planner mode (outside of the planner, we calculate the decompression time separately for each sample, using the TTS code, which uses the planner to plans an ascent from the current depth and time - we don't do this is planner mode because that is needless iterations of potentially hundreds of plans, when we should "know" the decompression time because we have "the" plan that the planner has calculated)<br><br></div><div class="gmail_extra">The following change to core/profile.c:1015 might be a fix based on the second option, but I don't have a build environment to test.<br>Change:<br>                /* If using VPM-B outside the planner, take first_ceiling_pressure as the deepest ceiling */<br>                if (decoMode() == VPMB) {<br>                    if  (current_ceiling > first_ceiling) {<br>                            time_deep_ceiling = t1;<br>                            <br>                            <br>To:<br>                /* If using VPM-B outside the planner, take first_ceiling_pressure as the deepest ceiling */<br>                if (decoMode() == VPMB) {<br>                    if  (current_ceiling >= first_ceiling || entry->depth >= entry[-1].depth) {<br>                            time_deep_ceiling = t1;<br><br></div></div></blockquote><div>Actually, that could be quite wrong for saw-tooth profiles such as<br><span style="font-weight:600">Subsurface (4.6.4.986) dive plan</span> created on 10/20/17<br>Runtime: 83min + 0:34 /m + 0:41 /min<br>
<table style="margin:0px" border="0" cellspacing="2" cellpadding="0"><thead>
<tr>
<td><br></td>
<td>
<p style="margin:0px;text-indent:0px" align="center"><span style="font-weight:600">depth</span></p></td>
<td>
<p style="margin:0px;text-indent:0px" align="center"><span style="font-weight:600">duration</span></p></td>
<td>
<p style="margin:0px;text-indent:0px" align="center"><span style="font-weight:600">runtime</span></p></td>
<td>
<p style="margin:0px;text-indent:0px" align="center"><span style="font-weight:600">gas</span></p></td></tr></thead>
<tbody><tr>
<td>
<p style="margin:0px;text-indent:0px">➘</p></td>
<td>
<p style="margin:0px;text-indent:0px">50m</p></td>
<td>
<p style="margin:0px;text-indent:0px">3min</p></td>
<td>
<p style="margin:0px;text-indent:0px">3min</p></td>
<td>
<p style="margin:0px;text-indent:0px"><span style="font-weight:600;color:rgb(255,0,0)">(18/45)</span></p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">➙</p></td>
<td>
<p style="margin:0px;text-indent:0px">50m</p></td>
<td>
<p style="margin:0px;text-indent:0px">17min</p></td>
<td>
<p style="margin:0px;text-indent:0px">20min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">➚</p></td>
<td>
<p style="margin:0px;text-indent:0px">30m</p></td>
<td>
<p style="margin:0px;text-indent:0px">2min</p></td>
<td>
<p style="margin:0px;text-indent:0px">22min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">➙</p></td>
<td>
<p style="margin:0px;text-indent:0px">30m</p></td>
<td>
<p style="margin:0px;text-indent:0px">10min</p></td>
<td>
<p style="margin:0px;text-indent:0px">32min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">➘</p></td>
<td>
<p style="margin:0px;text-indent:0px">35m</p></td>
<td>
<p style="margin:0px;text-indent:0px">1min</p></td>
<td>
<p style="margin:0px;text-indent:0px">33min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">➙</p></td>
<td>
<p style="margin:0px;text-indent:0px">35m</p></td>
<td>
<p style="margin:0px;text-indent:0px">10min</p></td>
<td>
<p style="margin:0px;text-indent:0px">43min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">➚</p></td>
<td>
<p style="margin:0px;text-indent:0px">21m</p></td>
<td>
<p style="margin:0px;text-indent:0px">2min</p></td>
<td>
<p style="margin:0px;text-indent:0px">45min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">-</p></td>
<td>
<p style="margin:0px;text-indent:0px">21m</p></td>
<td>
<p style="margin:0px;text-indent:0px">1min</p></td>
<td>
<p style="margin:0px;text-indent:0px">46min</p></td>
<td>
<p style="margin:0px;text-indent:0px"><span style="font-weight:600;color:rgb(255,0,0)">EAN50</span></p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">-</p></td>
<td>
<p style="margin:0px;text-indent:0px">15m</p></td>
<td>
<p style="margin:0px;text-indent:0px">2min</p></td>
<td>
<p style="margin:0px;text-indent:0px">48min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">-</p></td>
<td>
<p style="margin:0px;text-indent:0px">12m</p></td>
<td>
<p style="margin:0px;text-indent:0px">3min</p></td>
<td>
<p style="margin:0px;text-indent:0px">51min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">-</p></td>
<td>
<p style="margin:0px;text-indent:0px">9m</p></td>
<td>
<p style="margin:0px;text-indent:0px">6min</p></td>
<td>
<p style="margin:0px;text-indent:0px">57min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">-</p></td>
<td>
<p style="margin:0px;text-indent:0px">6m</p></td>
<td>
<p style="margin:0px;text-indent:0px">26min</p></td>
<td>
<p style="margin:0px;text-indent:0px">83min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr>
<tr>
<td>
<p style="margin:0px;text-indent:0px">➚</p></td>
<td>
<p style="margin:0px;text-indent:0px">0m</p></td>
<td>
<p style="margin:0px;text-indent:0px">1min</p></td>
<td>
<p style="margin:0px;text-indent:0px">84min</p></td>
<td>
<p style="margin:0px;text-indent:0px"> </p></td></tr></tbody></table><br>Try:<br>                /* If using VPM-B outside the planner, take first_ceiling_pressure as the deepest ceiling */<br>                if (decoMode() == VPMB) {<br>                    if  (current_ceiling >= first_ceiling || (time_deep_ceiling = t0 && entry->depth >= entry[-1].depth)) {<br>                            time_deep_ceiling = t1;<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"></div><div class="gmail_extra">Could someone with a build environment please test?<br></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">On 16 October 2017 at 22:29, Stefan Fuchs <span dir="ltr"><<a href="mailto:sfuchs@gmx.de" target="_blank">sfuchs@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <br><div bgcolor="#FFFFFF">
    <p>Hi All,</p><span>
    Am 16.10.2017 um 10:55 schrieb Rick Walsh:<br>
    <blockquote type="cite">About
      the "EAN32" issue (which may not be only restricted to EAN32):<br>
      - Yes, at least the "deepest ceiling before end of bottom time"
      part of the EAN32 issue is still there. And what we see here looks
      very similar to this.<br>
      - Also for this example setup the ceiling calculated inside and
      outside the planner is different<br>
      - For the ceiling calculated outside the planner I also still have
      the effect that ceiling for EAN31 is larger/deeper than for EAN30%</blockquote>
    <br></span>
    I once again investigated the EAN32 dive with the strange ceiling
    results and took some more screenshots.<br>
    What is so strange here:<br>
    Inside the planner the ceiling for EAN32 is already somehow strange.
    Maybe in the same way strange as the examples from Willem.<br></div></blockquote></span><div>Yes, I think it is related to what's explained above.  It may not always calculated a "broken" ceiling, but I think it's getting the CVA stuff wrong. <br></div><span class="gmail-"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    <br>
    If I then save the dive and leave the planner, deselect the created
    dive and select it again (pictures "normal view") I see a different
    ceiling. And if I then change the O2 percentage outside the planner
    I see a even more strange effect. Please see pictures.<br>
    <br></div></blockquote></span>I see the problem in your screenshots, but wasn't able to reproduce it with the 4.6.4-986 build I'm using right now.  I'm not sure what's going on there.<br><br></div><div class="gmail_quote">Cheers,<br><br></div><div class="gmail_quote">Rick<br></div></div></div>
</blockquote></div><br></div></div>