summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-11-04 19:50:23 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-04 11:45:32 -0800
commit54692fb81431fb3366a239a6dcbf3c52f9d34520 (patch)
tree3b4790746beebd99c05f4574e9f5d02eaa0ef4b4
parent20a9db779d3a7ba1591e8d336c6b99b80aef71de (diff)
downloadsubsurface-54692fb81431fb3366a239a6dcbf3c52f9d34520.tar.gz
Use the CCR corrected gases for EAD and END calculations
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--profile.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/profile.c b/profile.c
index 04d747a98..7c4a8856d 100644
--- a/profile.c
+++ b/profile.c
@@ -893,19 +893,19 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p
double amb_pressure;
for (i = 1; i < pi->nr; i++) {
- int fo2, fhe;
+ int fn2, fhe;
struct plot_data *entry = pi->entry + i;
int cylinderindex = entry->cylinderindex;
amb_pressure = depth_to_mbar(entry->depth, dive) / 1000.0;
- fo2 = get_o2(&dive->cylinder[cylinderindex].gasmix);
- fhe = get_he(&dive->cylinder[cylinderindex].gasmix);
// For CCR dives use the diluent gas composition for calculating partial gas pressures:
if ((dive->dc.dctype == CCR) && (cylinderindex == dive->oxygen_cylinder_index))
cylinderindex = dive->diluent_cylinder_index;
fill_pressures(&entry->pressures, amb_pressure, &dive->cylinder[cylinderindex].gasmix, entry->pressures.o2, dive->dc.dctype, entry->sac);
+ fn2 = (int) (1000.0 * entry->pressures.n2 / amb_pressure);
+ fhe = (int) (1000.0 * entry->pressures.he / amb_pressure);
/* Calculate MOD, EAD, END and EADD based on partial pressures calculated before
* so there is no difference in calculating between OC and CC
@@ -914,7 +914,7 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p
pressure_t modpO2 = { .mbar = (int)(prefs.modpO2 * 1000) };
entry->mod = (double)gas_mod(&dive->cylinder[cylinderindex].gasmix, modpO2, 1).mm;
entry->end = (entry->depth + 10000) * (1000 - fhe) / 1000.0 - 10000;
- entry->ead = (entry->depth + 10000) * (1000 - fo2 - fhe) / (double)N2_IN_AIR - 10000;
+ entry->ead = (entry->depth + 10000) * fn2 / (double)N2_IN_AIR - 10000;
entry->eadd = (entry->depth + 10000) *
(entry->pressures.o2 / amb_pressure * O2_DENSITY +
entry->pressures.n2 / amb_pressure * N2_DENSITY +