Mercurial > public > mk2
comparison code_part1/OSTC_code_c_part2/p2_deco.c @ 491:560764da0629
BUGFIX Surface desat factor missing for Interval planning in GF mode.
author | JeanDo |
---|---|
date | Fri, 04 Nov 2011 16:24:12 +0100 |
parents | 68aa097f0062 |
children | 103051b4d9c1 |
comparison
equal
deleted
inserted
replaced
490:68aa097f0062 | 491:560764da0629 |
---|---|
107 | 107 |
108 // Water vapour partial pressure in the lumb. | 108 // Water vapour partial pressure in the lumb. |
109 #define ppWater 0.0627 | 109 #define ppWater 0.0627 |
110 #define METER_TO_BAR 0.09985 | 110 #define METER_TO_BAR 0.09985 |
111 #define BAR_TO_METER 10.0150 // (1.0/METER_TO_BAR) | 111 #define BAR_TO_METER 10.0150 // (1.0/METER_TO_BAR) |
112 | |
113 // Surface security factor | |
114 #define SURFACE_DESAT_FACTOR 0.7042 | |
112 | 115 |
113 // ************************* | 116 // ************************* |
114 // ** P R O T O T Y P E S ** | 117 // ** P R O T O T Y P E S ** |
115 // ************************* | 118 // ************************* |
116 | 119 |
905 assert( 0.0 < float_desaturation_multiplier && float_desaturation_multiplier <= 1.0 ); | 908 assert( 0.0 < float_desaturation_multiplier && float_desaturation_multiplier <= 1.0 ); |
906 assert( 1.0 <= float_saturation_multiplier && float_saturation_multiplier <= 2.0 ); | 909 assert( 1.0 <= float_saturation_multiplier && float_saturation_multiplier <= 2.0 ); |
907 | 910 |
908 if( char_I_deco_model == 0 ) | 911 if( char_I_deco_model == 0 ) |
909 { | 912 { |
910 if (temp_tissue < 0.0) | 913 if( temp_tissue < 0.0 ) |
911 temp_tissue *= float_desaturation_multiplier; | 914 temp_tissue *= float_desaturation_multiplier; |
912 else | 915 else |
913 temp_tissue *= float_saturation_multiplier; | 916 temp_tissue *= float_saturation_multiplier; |
914 } | 917 } |
915 } | 918 } |
2048 | 2051 |
2049 N2_ratio = 0.7902; // FIXED sum as stated in bühlmann | 2052 N2_ratio = 0.7902; // FIXED sum as stated in bühlmann |
2050 pres_surface = int_I_pres_surface * 0.001; | 2053 pres_surface = int_I_pres_surface * 0.001; |
2051 ppN2 = N2_ratio * (pres_surface - ppWater); | 2054 ppN2 = N2_ratio * (pres_surface - ppWater); |
2052 int_O_desaturation_time = 0; | 2055 int_O_desaturation_time = 0; |
2053 float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101 (70,42%/100.=142) | 2056 float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR); |
2054 | 2057 |
2055 ptr = &buhlmann_ht[0]; | 2058 ptr = &buhlmann_ht[0]; |
2056 for(ci=0; ci<NUM_COMP; ci++) | 2059 for(ci=0; ci<NUM_COMP; ci++) |
2057 { | 2060 { |
2058 overlay float var_N2_halftime = *ptr++; | 2061 overlay float var_N2_halftime = *ptr++; |
2167 | 2170 |
2168 N2_ratio = 0.7902; // FIXED, sum lt. buehlmann | 2171 N2_ratio = 0.7902; // FIXED, sum lt. buehlmann |
2169 pres_respiration = pres_surface = int_I_pres_surface * 0.001; | 2172 pres_respiration = pres_surface = int_I_pres_surface * 0.001; |
2170 ppN2 = N2_ratio * (pres_respiration - ppWater); | 2173 ppN2 = N2_ratio * (pres_respiration - ppWater); |
2171 ppHe = 0.0; | 2174 ppHe = 0.0; |
2172 float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101 (70,42%/100.=142) | 2175 float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR); |
2173 float_saturation_multiplier = char_I_saturation_multiplier * 0.01; | 2176 float_saturation_multiplier = char_I_saturation_multiplier * 0.01; |
2174 | 2177 |
2175 calc_tissue(1); // update the pressure in the tissues N2/He in accordance with the new ambient pressure | 2178 calc_tissue(1); // update the pressure in the tissues N2/He in accordance with the new ambient pressure |
2176 | 2179 |
2177 clear_deco_table(); | 2180 clear_deco_table(); |
2196 // desaturation slowed down to 70,42%. | 2199 // desaturation slowed down to 70,42%. |
2197 // | 2200 // |
2198 static void calc_dive_interval() | 2201 static void calc_dive_interval() |
2199 { | 2202 { |
2200 overlay unsigned char t; | 2203 overlay unsigned char t; |
2204 overlay unsigned char backup_model; | |
2201 | 2205 |
2202 //---- Initialize simulation parameters ---------------------------------- | 2206 //---- Initialize simulation parameters ---------------------------------- |
2203 N2_ratio = 0.7902; // FIXED, sum lt. buehlmann | 2207 N2_ratio = 0.7902; // FIXED, sum lt. buehlmann |
2204 pres_respiration = pres_surface = int_I_pres_surface * 0.001; | 2208 pres_respiration = pres_surface = int_I_pres_surface * 0.001; |
2205 ppN2 = N2_ratio * (pres_respiration - ppWater); | 2209 ppN2 = N2_ratio * (pres_respiration - ppWater); |
2206 ppHe = 0.0; | 2210 ppHe = 0.0; |
2207 float_desaturation_multiplier = char_I_desaturation_multiplier / 142.0; // new in v.101 (70,42%/100.=142) | 2211 float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR); |
2208 float_saturation_multiplier = char_I_saturation_multiplier * 0.01; | 2212 float_saturation_multiplier = char_I_saturation_multiplier * 0.01; |
2209 | 2213 |
2214 // Make sure SURFACE_DESAT_FACTOR is applyed: | |
2215 backup_model = char_I_deco_model; | |
2216 char_I_deco_model = 0; | |
2217 | |
2210 //---- Perform simulation ------------------------------------------------ | 2218 //---- Perform simulation ------------------------------------------------ |
2219 | |
2211 for(t=0; t<char_I_dive_interval; ++t) | 2220 for(t=0; t<char_I_dive_interval; ++t) |
2212 { | 2221 { |
2213 calc_tissue(2); // period = 10min. | 2222 calc_tissue(2); // period = 10min. |
2214 CNS_fraction = 0.92587471 * CNS_fraction; // Half-time = 90min: (1/2)^(1/9) | 2223 CNS_fraction = 0.92587471 * CNS_fraction; // Half-time = 90min: (1/2)^(1/9) |
2215 } | 2224 } |
2216 char_O_CNS_fraction = (char)(CNS_fraction * 100.0 + 0.5); | 2225 char_O_CNS_fraction = (char)(CNS_fraction * 100.0 + 0.5); |
2226 | |
2227 //---- Restore model ----------------------------------------------------- | |
2228 char_I_deco_model = backup_model; | |
2217 } | 2229 } |
2218 | 2230 |
2219 ////////////////////////////////////////////////////////////////////////////// | 2231 ////////////////////////////////////////////////////////////////////////////// |
2220 ////////////////////////////////////////////////////////////////////////////// | 2232 ////////////////////////////////////////////////////////////////////////////// |
2221 ////////////////////////////////// deco_hash ///////////////////////////////// | 2233 ////////////////////////////////// deco_hash ///////////////////////////////// |