Subsurface minimum gas calculation - First version for review

Stefan Fuchs sfuchs at
Tue Feb 21 14:04:16 PST 2017

Hello Robert, hallo Dirk,

Am 21.02.2017 um 11:44 schrieb Robert Helling:
> Stefan,
>> On 21.02.2017, at 11:02, Stefan Fuchs <sfuchs at
>> <mailto:sfuchs at>> wrote:
>>> the problem is that for computers that don’t have gas information,
>>> the interpolation of cylinder pressures is only done at the plot
>>> stage. The information is in struct plot_data which you find in
>>> profile.h, in particular in cylinderindex and pressure[2] (to access
>>> the latter there is a macro, for usage see profile.c. Strictly
>>> speaking, that is to handle the CCR case which you want to avoid
>>> anyway but it’s better to use this as an accessor).
>> Hmmm... plot_data is rather difficult to access from planner.c. Or do
>> I miss any easy way to do this?
> Hmm. That’s true. Problem is: during planning, so far, we don’t track
> gas usage but compute it only later. Concretely, in planner.c
> staticvoidcreate_dive_from_plan(structdiveplan*diveplan,booltrack_gas)
> close to the bottom there is 
> update_cylinder_pressure(&displayed_dive,sample[-1],depth,time-sample[-1].time.seconds,
> This might be a place where one could inject a test if rock bottom is exceeded if that value is already known at that stage. Alternatively, you might have to store the pressure vs time information or you store the rock bottom value for the gas with the dive and generate the warning only in the plotting stage (close to where the gas pressure curves are created). Thinking about this, I guess the latter is what I would go for.
For the moment I have to stop here because I will be on holiday for a
week soon and this part for sure will need approximately 1-3 years
development time on my side ;-)

What do you think about the part of the minim gas calculation we created
up to now?
Is it already time to do a pull request to maybe have some deeper
testing or do we need to continue testing and review internally?

Tomorrow I may be able to write a few words about this feature for the
user manual. Shall I put user manual updates in a separate commit (I
assume yes)?

Best regards


Stefan Fuchs
E-Mail: sfuchs at <mailto:sfuchs at>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the subsurface mailing list