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.

The existing/previous comparison includes deco_gas_used, double-counting the gas
used in the ascent/safety stop.

Signed-off-by: Rick Walsh <[email protected]>
---

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
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to