mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Adjust GFlow to apply at deepest ceiling instead of at max depth
This moves the point where GF_low applies up which implies that at all shallower depth (i.e. during deco) a lower GF results which makes the deco longer compared to the previous implementation. Of course, "GF_low" applies at first deco stop is a bit tricky since the depth of the first deco stop again depends on GF_low, i.e. there is another equation to solve. You can do this by inverting the equation for the ambient pressure and use GF_low as the gradient factor. This yields amb = (b * M_value_corrected - GF_low * a * b) / ((1-b) * GF_low + b) Signed-off-by: Robert C. Helling helling@atdotde.de Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									1aa3c0d514
								
							
						
					
					
						commit
						4c13f1f6b4
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		
							
								
								
									
										12
									
								
								deco.c
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								deco.c
									
										
									
									
									
								
							|  | @ -81,6 +81,8 @@ const double buehlmann_He_factor_expositon_one_second[] = { | |||
| #define N2_IN_AIR 0.7902 | ||||
| #define DECO_STOPS_MULTIPLIER_MM 3000.0 | ||||
| 
 | ||||
| #define GF_LOW_AT_MAXDEPTH 0 | ||||
| 
 | ||||
| double tissue_n2_sat[16]; | ||||
| double tissue_he_sat[16]; | ||||
| double tissue_tolerated_ambient_pressure[16]; | ||||
|  | @ -96,6 +98,7 @@ static double tissue_tolerance_calc(const struct dive *dive) | |||
| 	double gf_high = buehlmann_config.gf_high; | ||||
| 	double gf_low = buehlmann_config.gf_low; | ||||
| 	double surface = dive->surface_pressure.mbar / 1000.0; | ||||
| 	double lowest_ceiling; | ||||
| 
 | ||||
| 	for (ci = 0; ci < 16; ci++) | ||||
| 	{ | ||||
|  | @ -105,6 +108,13 @@ static double tissue_tolerance_calc(const struct dive *dive) | |||
| 
 | ||||
| 		/* tissue_tolerated_ambient_pressure[ci] = (tissue_inertgas_saturation - buehlmann_inertgas_a) * buehlmann_inertgas_b; */ | ||||
| 
 | ||||
| #if !GF_LOW_AT_MAXDEPTH | ||||
| 		lowest_ceiling = (buehlmann_inertgas_b * tissue_inertgas_saturation - gf_low * buehlmann_inertgas_a * buehlmann_inertgas_b) / | ||||
| 		  ((1.0 - buehlmann_inertgas_b) * gf_low + buehlmann_inertgas_b); | ||||
| 		if(lowest_ceiling > gf_low_pressure_this_dive) | ||||
| 		  gf_low_pressure_this_dive = lowest_ceiling; | ||||
| #endif | ||||
| 
 | ||||
| 		tissue_tolerated_ambient_pressure[ci] = (-buehlmann_inertgas_a * buehlmann_inertgas_b * (gf_high * gf_low_pressure_this_dive - gf_low * surface) - | ||||
| 								(1.0 - buehlmann_inertgas_b) * (gf_high - gf_low) * gf_low_pressure_this_dive * surface + | ||||
| 								buehlmann_inertgas_b * (gf_low_pressure_this_dive - surface) * tissue_inertgas_saturation) / | ||||
|  | @ -129,8 +139,10 @@ double add_segment(double pressure, struct gasmix *gasmix, int period_in_seconds | |||
| 	double ppn2 = (pressure - WV_PRESSURE) * (1000 - fo2 - gasmix->he.permille) / 1000.0; | ||||
| 	double pphe = (pressure - WV_PRESSURE) * gasmix->he.permille / 1000.0; | ||||
| 
 | ||||
| #if GF_LOW_AT_MAXDEPTH | ||||
| 	if (pressure > gf_low_pressure_this_dive) | ||||
| 	        gf_low_pressure_this_dive = pressure; | ||||
| #endif | ||||
| 
 | ||||
| 	if (ccpo2 > 0.0) { /* CC */ | ||||
| 		double rel_o2_amb, f_dilutent; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue