comparison src/p2_deco.c @ 314:226e1405b86c new_screen_layout

Merged default into new_screen_layout
author Janos Kovacs <kovjanos@gmail.com>
date Wed, 10 Jun 2015 22:24:27 +0100
parents 0ce5fa241b8e
children fe06f1d1a285
comparison
equal deleted inserted replaced
310:453a3d13570f 314:226e1405b86c
90 // 2014/06/29: [mH] Compute int_O_ceiling 90 // 2014/06/29: [mH] Compute int_O_ceiling
91 // 91 //
92 // TODO: 92 // TODO:
93 // 93 //
94 // Literature: 94 // Literature:
95 // Bühlmann, Albert: Tauchmedizin; 4. Auflage [2002]; 95 // Buhlmann, Albert: Tauchmedizin; 4. Auflage [2002];
96 // Schr"oder, Kai & Reith, Steffen; 2000; S"attigungsvorg"ange beim Tauchen, das Modell ZH-L16, Funktionsweise von Tauchcomputern; http://www.achim-und-kai.de/kai/tausim/saett_faq 96 // Schr"oder, Kai & Reith, Steffen; 2000; S"attigungsvorg"ange beim Tauchen, das Modell ZH-L16, Funktionsweise von Tauchcomputern; http://www.achim-und-kai.de/kai/tausim/saett_faq
97 // Morrison, Stuart; 2000; DIY DECOMPRESSION; http://www.lizardland.co.uk/DIYDeco.html 97 // Morrison, Stuart; 2000; DIY DECOMPRESSION; http://www.lizardland.co.uk/DIYDeco.html
98 // Balthasar, Steffen; Dekompressionstheorie I: Neo Haldane Modelle; http://www.txfreak.de/dekompressionstheorie_1.pdf 98 // Balthasar, Steffen; Dekompressionstheorie I: Neo Haldane Modelle; http://www.txfreak.de/dekompressionstheorie_1.pdf
99 // Baker, Erik C.; Clearing Up The Confusion About "Deep Stops" 99 // Baker, Erik C.; Clearing Up The Confusion About "Deep Stops"
100 // Baker, Erik C.; Understanding M-values; http://www.txfreak.de/understanding_m-values.pdf 100 // Baker, Erik C.; Understanding M-values; http://www.txfreak.de/understanding_m-values.pdf
196 static float ppN2; 196 static float ppN2;
197 static float ppHe; 197 static float ppHe;
198 static float temp_tissue; 198 static float temp_tissue;
199 static float N2_ratio; // Breathed gas nitrogen ratio. 199 static float N2_ratio; // Breathed gas nitrogen ratio.
200 static float He_ratio; // Breathed gas helium ratio. 200 static float He_ratio; // Breathed gas helium ratio.
201 static float var_N2_a; // Bühlmann a, for current N2 tissue. 201 static float var_N2_a; // Buhlmann a, for current N2 tissue.
202 static float var_N2_b; // Bühlmann b, for current N2 tissue. 202 static float var_N2_b; // Buhlmann b, for current N2 tissue.
203 static float var_He_a; // Bühlmann a, for current He tissue. 203 static float var_He_a; // Buhlmann a, for current He tissue.
204 static float var_He_b; // Bühlmann b, for current He tissue. 204 static float var_He_b; // Buhlmann b, for current He tissue.
205 static float var_N2_e; // Exposition, for current N2 tissue. 205 static float var_N2_e; // Exposition, for current N2 tissue.
206 static float var_He_e; // Exposition, for current He tissue. 206 static float var_He_e; // Exposition, for current He tissue.
207 static float var_N2_ht; // Half-time for current N2 tissue. 207 static float var_N2_ht; // Half-time for current N2 tissue.
208 static float var_He_ht; // Half-time for current N2 tissue. 208 static float var_He_ht; // Half-time for current N2 tissue.
209 209
316 # endif 316 # endif
317 #endif 317 #endif
318 318
319 ////////////////////////////////////////////////////////////////////////////// 319 //////////////////////////////////////////////////////////////////////////////
320 // Fast subroutine to read timer 5. 320 // Fast subroutine to read timer 5.
321 // Note: result is in 1/32 of msecs (30,51757813µs/bit to be precise) 321 // Note: result is in 1/32 of msecs (30,51757813 us/bit to be precise)
322 static unsigned short tmr5(void) 322 static unsigned short tmr5(void)
323 { 323 {
324 #ifndef CROSS_COMPILE 324 #ifndef CROSS_COMPILE
325 _asm 325 _asm
326 movff 0xf7c,PRODL // TMR5L 326 movff 0xf7c,PRODL // TMR5L
892 pres_respiration = int_I_pres_respiration * 0.001; 892 pres_respiration = int_I_pres_respiration * 0.001;
893 893
894 p = N2_ratio * (pres_respiration - ppWater); 894 p = N2_ratio * (pres_respiration - ppWater);
895 for(ci=0; ci<NUM_COMP; ci++) 895 for(ci=0; ci<NUM_COMP; ci++)
896 { 896 {
897 // cycle through the 16 Bühlmann N2 tissues 897 // cycle through the 16 Buhlmann N2 tissues
898 pres_tissue_N2[ci] = p; 898 pres_tissue_N2[ci] = p;
899 899
900 // cycle through the 16 Bühlmann tissues for Helium 900 // cycle through the 16 Buhlmann tissues for Helium
901 pres_tissue_He[ci] = 0.0; 901 pres_tissue_He[ci] = 0.0;
902 } 902 }
903 903
904 clear_deco_table(); 904 clear_deco_table();
905 char_O_deco_status = 0; 905 char_O_deco_status = 0;
1029 1029
1030 pres_respiration = int_I_pres_respiration * 0.001; 1030 pres_respiration = int_I_pres_respiration * 0.001;
1031 pres_surface = int_I_pres_surface * 0.001; 1031 pres_surface = int_I_pres_surface * 0.001;
1032 N2_ratio = char_I_N2_ratio * 0.01; 1032 N2_ratio = char_I_N2_ratio * 0.01;
1033 He_ratio = char_I_He_ratio * 0.01; 1033 He_ratio = char_I_He_ratio * 0.01;
1034 float_deco_distance = char_I_deco_distance * 0.01; // Get offset is in mbar. 1034 float_deco_distance = char_I_deco_distance * 0.01; // Get offset in BAR
1035 1035
1036 // ____________________________________________________ 1036 // ____________________________________________________
1037 // 1037 //
1038 // _____________ G A S _ C H A N G E S ________________ 1038 // _____________ G A S _ C H A N G E S ________________
1039 // ____________________________________________________ 1039 // ____________________________________________________
1675 { 1675 {
1676 overlay float limit = calc_lead_tissue_limit; 1676 overlay float limit = calc_lead_tissue_limit;
1677 // NOTE: in GF model, calc_lead_tissue_limit include already the 1677 // NOTE: in GF model, calc_lead_tissue_limit include already the
1678 // correction due to gradient factor. To compute the actual 1678 // correction due to gradient factor. To compute the actual
1679 // current GF, we need to (re-)compute the raw ambiant-pressure 1679 // current GF, we need to (re-)compute the raw ambiant-pressure
1680 // limit from the Bühlmann model. 1680 // limit from the Buhlmann model.
1681 if( char_I_deco_model != 0 ) 1681 if( char_I_deco_model != 0 )
1682 { 1682 {
1683 ci = char_O_gtissue_no; 1683 ci = char_O_gtissue_no;
1684 read_buhlmann_coefficients(); 1684 read_buhlmann_coefficients();
1685 var_N2_a = (var_N2_a * N2 + var_He_a * He) / temp_tissue; 1685 var_N2_a = (var_N2_a * N2 + var_He_a * He) / temp_tissue;
1736 RESET_C_STACK 1736 RESET_C_STACK
1737 1737
1738 assert( 800 < int_I_pres_surface && int_I_pres_surface < 1100 ); 1738 assert( 800 < int_I_pres_surface && int_I_pres_surface < 1100 );
1739 assert( 0 < char_I_desaturation_multiplier && char_I_desaturation_multiplier <= 100 ); 1739 assert( 0 < char_I_desaturation_multiplier && char_I_desaturation_multiplier <= 100 );
1740 1740
1741 N2_ratio = 0.7902; // FIXED sum as stated in bühlmann 1741 N2_ratio = 0.7902; // FIXED sum as stated in buhlmann
1742 pres_surface = int_I_pres_surface * 0.001; 1742 pres_surface = int_I_pres_surface * 0.001;
1743 ppN2 = N2_ratio * (pres_surface - ppWater); 1743 ppN2 = N2_ratio * (pres_surface - ppWater);
1744 int_O_desaturation_time = 0; 1744 int_O_desaturation_time = 0;
1745 float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR); 1745 float_desaturation_multiplier = char_I_desaturation_multiplier * (0.01 * SURFACE_DESAT_FACTOR);
1746 1746