Subsurface minimum gas calculation - First version for review

Rick Walsh rickmwalsh at
Tue Feb 14 17:23:50 PST 2017

On 15 February 2017 at 06:50, Stefan Fuchs <sfuchs at> wrote:

> Hi All,
> Joachim (R.) and I finished our first basic version of the minimum gas
> calculation for the planner.
> We are now looking for testing and feedback :-)
Great work on tackling this.  It's really good to see new ideas and new
developers contributing to the code.  I will test when I get a chance,
which unfortunately won't be for a few days.  In the meantime, I have a few

> More details below...
> Link to initial idea and discussion:
> Link to feature branch on Github:
> My feedback to comments from Robert and Joachim (B.):
> - Increased deco for longer bottom time due to problem solving time: No,
> honestly this would have been much too complex for me at the moment. Also
> this would not be according to how I would even handle it during a real
> dive. But this may be a longer discussion... ;-)
This is a worthy consideration, but beyond the scope of what's intended for
the moment.  Of course someone could look into this is the future..

> - Real gases: Yes, hopefully implemented correctly.
> - No hard coded SAC*2: Yes, good idea, we didn't do this but for the
> moment I limited SAC factor to min 2.0/max 10.0. 2.0 would be two divers
> with unchanged SAC. SAC factor of e.g. 4.0 would be two divers with doubled
> SAC. BTW: Setting problem solving time to 0min comes close to "disabling"
> the feature.
> - Support rec dives: Yes, clearly, calculation is active for all OC dives.
> I put some limitations for min depth (>18m) and min tank size (12l).
> Calculating minimum gas for smaller cylinders is from my point of view
> almost useless.
I don't see the reason for limiting tank size and depth.  10.5l steel
cylinders are pretty common where I dive, and AL80 (11.1l) cylinders are
the most common in warm water.  Also there are smaller 300bar cylinders
popular in some areas.  Minimum gas is also relevant for bailout cylinders,
and some people use AL40 (5.6l) for them (although we don't do any
automatic bailout calculations).  Surely having sufficient gas is just as
important a consideration for small cylinders.

I agree minimum gas is usually less of a concern for shallow dives, but
spend an hour or more at 18m on air without a deco cylinder and you will
require a significant amount of gas to allow two divers to surface safely.
Do we gain anything by excluding this possibility?

> - Calculating problem solving time as result: No, this would not fit with
> my idea of doing and using it.
> Open questions:
> - Most important: Any huge mistakes? Do we screw up ;-)
> - What is missing? What else will we need to do? E.g.:
>     o Everything ready for translations?
Dirk usually does a call for translations in the lead up to each release.
In the meantime, just make sure strings are included in translate()
functions, and it looks like you've covered that.

>     o Which documentation would be mandatory?
A paragraph in the manual explaining what the minimum gas calculation means
and how to use it should be fine.  Note, edit
Documentation/user-manual.txt, not the HTML directly.  Other
"documentation" should be in commit messages and code comments (if/where

> - Any dive setups where this should work but doesn't based on this
> implementation? Remark: It is clear for me that this implementation is
> currently only useful for limited types of dive scenarios.
> Possible enhancements I still have in my mind:
> - Print such a tiny little yellow warning flag in the profile when minimum
> gas is exceeded before end of bottom time. Anyone could guide me how to do
> this?
> - Tooltips for the new preferences. I can easily do this. One question:
> What about line breaks in tooltips? Good/not good? How do they work?
In general, try to keep tooltips as short as possible so that they don't
need more than one line.  If you really do need to go over ~10 words, a
line break could be worth considering.  I can't remember, does Qt wrap
tooltips automatically?

Robert mentioned this his comments, so sorry to repeat, but where possible
try to use the special unit types defined in core/dive.h: duration_t (unit
seconds), depth_t (unit mm), pressure_t (unit mbar), volume_t (unit ml).
It's a little bit of extra work, but it makes the code clearer to read and
debug.  Obviously the UI should present the values in friendly units.

> Best regards
> Stefan
> --
> Stefan Fuchs
> E-Mail: sfuchs at
> _______________________________________________
> subsurface mailing list
> subsurface at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the subsurface mailing list