changeset 821:162058703100

FIX NDL prediction error with Buhlmann model: might be desaturating too fast.
author heinrichsweikamp
date Wed, 17 Jun 2015 13:33:15 +0200
parents 4fd718965e8f
children fe0fbdc31abe
files code_part1/OSTC_code_c_part2/p2_deco.c
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Tue Jun 09 02:18:57 2015 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Wed Jun 17 13:33:15 2015 +0200
@@ -92,6 +92,7 @@
 // 2013/12/21: [jDG] Fix CNS calculation in decoplan w/o marked gas switch
 // 2014/06/16: [jDG] Fix Helium diluant. Fix volumes with many travel mix.
 // 2014/06/29: [mH] Compute int_O_ceiling
+// 2015/06/12: [jDG] Fix NDL prediction while desaturating with the Buhlmann model.
 //
 // TODO:
 //  + Allow to abort MD2 calculation (have to restart next time).
@@ -1515,8 +1516,13 @@
             //---- Apply security margin when using the non-GF model
             if( char_I_deco_model == 0 )
             {
-                dTN2 *= float_saturation_multiplier;
-                dTHe *= float_saturation_multiplier;
+                // NDL can be computed while ascending... SO we have
+                // to check wether we are saturating or desaturating.
+                if( dTN2 > 0.0 ) dTN2 *= float_saturation_multiplier;
+                else             dTN2 *= float_desaturation_multiplier;
+
+                if( dTHe > 0.0 ) dTHe *= float_saturation_multiplier;
+                else             dTHe *= float_saturation_multiplier;
             }
             else // Or GF-based model
                 M0 = GF_high * (M0 - pres_surface) + pres_surface;