[PATCH] Planner: simplify enough_gas comparison

Joakim Bygdell j.bygdell at gmail.com
Sun Oct 11 23:39:55 PDT 2015


On 12 Oct 2015 8:23 am, "Rick Walsh" <rickmwalsh at gmail.com> wrote:
>
> The enough_gas function is used in recreational mode to determine that the
> reserve gas is kept in reserve.  A simple comparison of end pressure =>
reserve
> pressure should suffice.

Reserve gas is calculated as the minimum amount left in the tank at the
surface _IF_ you have to do the ascent with your buddy breathing of your
tank.
That's why it is doubling the SAC on the ascent.

>
> The existing/previous comparison includes deco_gas_used, double-counting
the gas
> used in the ascent/safety stop.
>
> Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
> ---
>
> As an example to check this, plan a dive to 15 m with EAN32 in a 12 l
tank with working pressure 232 bar.  Set reserve gas to 50 bar.  SAC of 20
l/min.  NDL is ~135 minutes with GF 60/80, so gas consumption will govern.
Bottom time is 38 min, giving a total dive of 43 min including a 3 minute
safety stop and ascent at 9 m/min.  End cylinder pressure is 63 bar.  2033
l is used (169 bar), including 149 l (12 bar) on ascent.
>
> With this simple patch, for this example the bottom time is extended an
extra 3 minutes, and the ending pressure is 50 bar.  2183 l (182 bar) is
used, including 149 l (12 bar) on ascent.
>
> Robert, can you please check I'm not overlooking something?
>
>
>  planner.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/planner.c b/planner.c
> index 05fd26e..26a6c44 100644
> --- a/planner.c
> +++ b/planner.c
> @@ -946,7 +946,7 @@ bool enough_gas(int current_cylinder)
>         if (!cyl->start.mbar)
>                 return true;
>         if (cyl->type.size.mliter)
> -               return (float) (cyl->end.mbar - prefs.reserve_gas)
 * cyl->type.size.mliter / 1000.0 > (float) cyl->deco_gas_used.mliter;
> +               return cyl->end.mbar >= prefs.reserve_gas;
>         else
>                 return true;
>  }
> --
> 2.4.3
>
> _______________________________________________
> subsurface mailing list
> subsurface at subsurface-divelog.org
> http://
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
lists.subsurface-
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
divelog.org
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>/
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
cgi-bin
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
/mailman/
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
listinfo
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>
/subsurface
<http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface>

//Jocke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20151012/5ac6b3f3/attachment.html>


More information about the subsurface mailing list