first cut of dive planning

Dirk Hohndel dirk at hohndel.org
Sat Jan 5 00:03:32 PST 2013


Another long evening, another bit of progress. Here's the commit message: 

    First stab at simplistic dive planning
    
    This comes with absolutely no gui - so the plan literally needs to be
    compiled into Subsurface. Not exactly a feature, but this allowed me to
    focus on the planning part instead of spending time on tedious UI work.
    
    A new menu "Planner" with entry "Test Planner" calls into the hard-coded
    function in planner.c. There a simple dive plan can be constructed with
    calls to plan_add_segment(&diveplan, duration, depth at the end, fO2, pO2)
    
    Calling plan(&diveplan) does the deco calculations and creates deco stops
    that keep us below the ceiling (with the GFlow/high values currently
    configured). The stop levels used are defined at the top of planner.c in
    the stoplevels array - there is no need to do the traditional multiples of
    3m or anything like that.
    
    The dive including the ascents and deco stops all the way to the surface
    is completed and then added as simulated dive to the end of the divelist
    (I guess we could automatically select it later) and can be viewed.
    
    This is crude but shows the direction we can go with this. Envision a nice
    UI that allows you to simply enter the segments and pick the desired
    stops.
    
    What is missing is the ability to give the algorithm additional gases that
    it can use during the deco phase - right now it simply keeps using the
    last gas used in the diveplan.
    
    All that said, there are clear bugs here - and sadly they seem to be in
    the deco calculations, as with the example given the ceiling that is
    calculated makes no sense. When displayed in smooth mode it has very
    strange jumps up and down that I wouldn't expect. For example with GF
    35/75 (the default) the deco ceiling when looking at the simulated dive
    jumps from 16m back up to 13m around 14:10 into the dive. That seems very
    odd.

This code does take the ascent into account when calculating deco
stops. Let's assume your current ceiling is 12.1m and you are at 36m
depth. The next stop would be at 15m. By the time you reach 15m your
ceiling has moved up to 11.8m. The code simply keeps going up to the 12m
stop in this case.

As I said in the commit message: there clearly are bugs hiding in
there. Don't even dream of using this to plan a real dive (we actually
need to figure out what disclaimers we need so this doesn't turn into a
potential liability...).

But by all means, please play with it and test.

And if you feel like writing a cool UI for all this, please let the rest
of us know...

enjoy.

/D


More information about the subsurface mailing list