Subsurface minimum gas calculation - First version for review

Dirk Hohndel dirk at
Tue Feb 21 15:10:59 PST 2017

> On Feb 21, 2017, at 2:04 PM, Stefan Fuchs <sfuchs at> wrote:
> 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
>> static void create_dive_from_plan(struct diveplan *diveplan, bool track_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.

I'm worried about the amount of complexity that is going into this - we should keep in mind the ratio of "general benefit" and "code complexity impact".

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

I'd like to ask that anything that is submitted for master has had some review and testing, comes with an automated test or two and most importantly tries to be as non-invasive as possible.

> 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)?

Yes, please.

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

More information about the subsurface mailing list