diff code_part1/OSTC_code_c_part2/p2_deco.c @ 302:36cc8f0c1d73

Minor corrections in assert conditions.
author JeanDo
date Sat, 30 Apr 2011 13:07:37 +0200
parents e0083f259552
children 5bc3467fc421
line wrap: on
line diff
--- a/code_part1/OSTC_code_c_part2/p2_deco.c	Sat Apr 30 10:40:18 2011 +0200
+++ b/code_part1/OSTC_code_c_part2/p2_deco.c	Sat Apr 30 13:07:37 2011 +0200
@@ -684,7 +684,7 @@
     overlay float depth = (temp_deco - pres_surface) / 0.09985;
 
     // At most, ascent 1 minute, at 10m/min == 10.0 m.
-    overlay float min_depth = depth - 10.0;
+    overlay float min_depth = (depth > 10.0) ? (depth - 10.0) : 0.0;
     
     // Do we need to stop at current depth ?
     overlay unsigned char need_stop = 0;
@@ -733,8 +733,8 @@
                     // With alpha = currentDepth / maxDepth, hence in [0..1]
                     sim_limit( GF_high - first_stop * locked_GF_step );
 
-                // upper limit (lowest pressure tolerated):
-                assert( sim_lead_tissue_limit < pres_stop );
+                // upper limit (lowest pressure tolerated), + 1mbar for rounding...:
+                assert( sim_lead_tissue_limit < (pres_stop + 0.001) );
             }
 #endif
 
@@ -1786,8 +1786,8 @@
         //       so that can change who is the leading gas...
         // Note: Also depends of the GF_current...
         if( char_I_deco_model == 1 )
-            p = ( p - var_N2_a * GF_current) * var_N2_b
-              / (GF_current + var_N2_b * (1.0 - GF_current));
+            p = ( p - var_N2_a * GF_current) 
+              / (GF_current / var_N2_b + 1.0 - GF_current);
         else
             p = (p - var_N2_a) * var_N2_b;
         if( p < 0.0 ) p = 0.0;
@@ -1884,8 +1884,8 @@
     assert( 0.800 <= pres_respiration && pres_respiration < 14.0 );
 
 	// tissue > respiration (currently off-gasing)
-	// GF =   0% when respiration == tissue
-	// GF = 100% when respiration == limit
+	// GF =   0% when respiration == tissue, ie. bubbles are at equilibrium.
+	// GF = 100% when respiration == limit.
     temp_tissue = N2 + He;
     if( temp_tissue <= pres_respiration )
  		gf = 0.0;
@@ -2318,7 +2318,7 @@
 
     int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) * 0.01 );
 
-    assert( int_I_temp < 1440 );                            // Less than 24h...
+    assert( int_I_temp < 2880 );                            // Less than 48h...
 }