comparison 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
comparison
equal deleted inserted replaced
301:a5fd8777a598 302:36cc8f0c1d73
682 //--- Max ascent speed --------------------------------------------------- 682 //--- Max ascent speed ---------------------------------------------------
683 // Recompute leading gas limit, at current depth: 683 // Recompute leading gas limit, at current depth:
684 overlay float depth = (temp_deco - pres_surface) / 0.09985; 684 overlay float depth = (temp_deco - pres_surface) / 0.09985;
685 685
686 // At most, ascent 1 minute, at 10m/min == 10.0 m. 686 // At most, ascent 1 minute, at 10m/min == 10.0 m.
687 overlay float min_depth = depth - 10.0; 687 overlay float min_depth = (depth > 10.0) ? (depth - 10.0) : 0.0;
688 688
689 // Do we need to stop at current depth ? 689 // Do we need to stop at current depth ?
690 overlay unsigned char need_stop = 0; 690 overlay unsigned char need_stop = 0;
691 691
692 assert( depth >= -0.2 ); // Allow for 200mbar of weather change. 692 assert( depth >= -0.2 ); // Allow for 200mbar of weather change.
731 else 731 else
732 // current GF is GF_high - alpha (GF_high - GF_low) 732 // current GF is GF_high - alpha (GF_high - GF_low)
733 // With alpha = currentDepth / maxDepth, hence in [0..1] 733 // With alpha = currentDepth / maxDepth, hence in [0..1]
734 sim_limit( GF_high - first_stop * locked_GF_step ); 734 sim_limit( GF_high - first_stop * locked_GF_step );
735 735
736 // upper limit (lowest pressure tolerated): 736 // upper limit (lowest pressure tolerated), + 1mbar for rounding...:
737 assert( sim_lead_tissue_limit < pres_stop ); 737 assert( sim_lead_tissue_limit < (pres_stop + 0.001) );
738 } 738 }
739 #endif 739 #endif
740 740
741 // Apply correction for the shallowest stop. 741 // Apply correction for the shallowest stop.
742 if( first_stop == 3 ) // new in v104 742 if( first_stop == 3 ) // new in v104
1784 // Note: the correction factor depends both on GF and b, 1784 // Note: the correction factor depends both on GF and b,
1785 // Actual values are in the 1.5 .. 1.0 range (for a GF=30%), 1785 // Actual values are in the 1.5 .. 1.0 range (for a GF=30%),
1786 // so that can change who is the leading gas... 1786 // so that can change who is the leading gas...
1787 // Note: Also depends of the GF_current... 1787 // Note: Also depends of the GF_current...
1788 if( char_I_deco_model == 1 ) 1788 if( char_I_deco_model == 1 )
1789 p = ( p - var_N2_a * GF_current) * var_N2_b 1789 p = ( p - var_N2_a * GF_current)
1790 / (GF_current + var_N2_b * (1.0 - GF_current)); 1790 / (GF_current / var_N2_b + 1.0 - GF_current);
1791 else 1791 else
1792 p = (p - var_N2_a) * var_N2_b; 1792 p = (p - var_N2_a) * var_N2_b;
1793 if( p < 0.0 ) p = 0.0; 1793 if( p < 0.0 ) p = 0.0;
1794 1794
1795 if( p > sim_lead_tissue_limit ) 1795 if( p > sim_lead_tissue_limit )
1882 1882
1883 assert( char_O_gtissue_no < 16 ); 1883 assert( char_O_gtissue_no < 16 );
1884 assert( 0.800 <= pres_respiration && pres_respiration < 14.0 ); 1884 assert( 0.800 <= pres_respiration && pres_respiration < 14.0 );
1885 1885
1886 // tissue > respiration (currently off-gasing) 1886 // tissue > respiration (currently off-gasing)
1887 // GF = 0% when respiration == tissue 1887 // GF = 0% when respiration == tissue, ie. bubbles are at equilibrium.
1888 // GF = 100% when respiration == limit 1888 // GF = 100% when respiration == limit.
1889 temp_tissue = N2 + He; 1889 temp_tissue = N2 + He;
1890 if( temp_tissue <= pres_respiration ) 1890 if( temp_tissue <= pres_respiration )
1891 gf = 0.0; 1891 gf = 0.0;
1892 else 1892 else
1893 { 1893 {
2316 assert( 60 <= char_I_temp && char_I_temp <= 100 ); 2316 assert( 60 <= char_I_temp && char_I_temp <= 100 );
2317 assert( 0 <= int_I_temp && int_I_temp < 2880 ); // Less than 48h... 2317 assert( 0 <= int_I_temp && int_I_temp < 2880 ); // Less than 48h...
2318 2318
2319 int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) * 0.01 ); 2319 int_I_temp = (unsigned short)(((float)int_I_temp * (float)char_I_temp) * 0.01 );
2320 2320
2321 assert( int_I_temp < 1440 ); // Less than 24h... 2321 assert( int_I_temp < 2880 ); // Less than 48h...
2322 } 2322 }
2323 2323
2324 2324
2325 ////////////////////////////////////////////////////////////////////////////// 2325 //////////////////////////////////////////////////////////////////////////////
2326 // deco_gas_volumes 2326 // deco_gas_volumes