summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-04-10 21:20:38 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2018-04-11 21:15:38 +0200
commitece714556fa2403dddec481a7a09d68eb82e84fa (patch)
treec422e24795d7d866d2e98d0baa223677aa084eb4
parent71d1e78db2435c74a3170a9fe0d3e4e0e6c946c2 (diff)
downloadsubsurface-ece714556fa2403dddec481a7a09d68eb82e84fa.tar.gz
Look for actual isobaric counter diffusion
Identify segements that fullfill the folllowing criteria for the leading compartment: He is off-gasing while N2 is on-gasing Overall there is on-gasing Add a line to the info box for those segments Signed-off-by: Robert C. Helling <helling@atdotde.de>
-rw-r--r--CHANGELOG.md1
-rw-r--r--core/deco.c8
-rw-r--r--core/dive.h1
-rw-r--r--core/profile.c5
-rw-r--r--core/profile.h1
5 files changed, 14 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index da4359901..550b616d4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+- Profile: Add information about actual isobaric counter diffusion happening
- Suunto DM import: improved temperature parsing in special cases
# Always add new entries at the very top of this file above other
# existing entries.
diff --git a/core/deco.c b/core/deco.c
index 9943d470f..f72454b9b 100644
--- a/core/deco.c
+++ b/core/deco.c
@@ -482,7 +482,7 @@ void add_segment(struct deco_state *ds, double pressure, const struct gasmix *ga
(void) sac;
int ci;
struct gas_pressures pressures;
-
+ bool icd = false;
fill_pressures(&pressures, pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE),
gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode);
@@ -494,6 +494,11 @@ void add_segment(struct deco_state *ds, double pressure, const struct gasmix *ga
double n2_satmult = pn2_oversat > 0 ? buehlmann_config.satmult : buehlmann_config.desatmult;
double he_satmult = phe_oversat > 0 ? buehlmann_config.satmult : buehlmann_config.desatmult;
+ // Report ICD if N2 is more on-gasing than He off-gasing in leading tissue
+ if (ci == ds->ci_pointing_to_guiding_tissue && pn2_oversat > 0.0 && phe_oversat < 0.0 &&
+ pn2_oversat * n2_satmult * n2_f + phe_oversat * he_satmult * he_f > 0)
+ icd = true;
+
ds->tissue_n2_sat[ci] += n2_satmult * pn2_oversat * n2_f;
ds->tissue_he_sat[ci] += he_satmult * phe_oversat * he_f;
ds->tissue_inertgas_saturation[ci] = ds->tissue_n2_sat[ci] + ds->tissue_he_sat[ci];
@@ -501,6 +506,7 @@ void add_segment(struct deco_state *ds, double pressure, const struct gasmix *ga
}
if (decoMode() == VPMB)
calc_crushing_pressure(ds, pressure);
+ ds->icd_warning = icd;
return;
}
diff --git a/core/dive.h b/core/dive.h
index f81423f24..acbb6eb27 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -896,6 +896,7 @@ struct deco_state {
int ci_pointing_to_guiding_tissue;
double gf_low_pressure_this_dive;
int deco_time;
+ bool icd_warning;
};
extern void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, const struct dive *dive, int sac);
diff --git a/core/profile.c b/core/profile.c
index 2fbc3a892..835e68dcc 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -1036,7 +1036,8 @@ void calculate_deco_information(struct deco_state *ds, struct deco_state *planne
for (j = t0 + time_stepsize; j <= t1; j += time_stepsize) {
int depth = interpolate(entry[-1].depth, entry[0].depth, j - t0, t1 - t0);
add_segment(ds, depth_to_bar(depth, dive),
- gasmix, time_stepsize, entry->o2pressure.mbar, dive, entry->sac);
+ gasmix, time_stepsize, entry->o2pressure.mbar, dive, entry->sac);
+ entry->icd_warning = ds->icd_warning;
if ((t1 - j < time_stepsize) && (j < t1))
time_stepsize = t1 - j;
}
@@ -1498,6 +1499,8 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me
}
}
}
+ if (entry->icd_warning)
+ put_format(b, "%s", translate("gettextFromC", "ICD in leading tissue\n"));
if (entry->heartbeat && prefs.hrgraph)
put_format_loc(b, translate("gettextFromC", "heart rate: %d\n"), entry->heartbeat);
if (entry->bearing >= 0)
diff --git a/core/profile.h b/core/profile.h
index fa92070c6..0a215d47e 100644
--- a/core/profile.h
+++ b/core/profile.h
@@ -63,6 +63,7 @@ struct plot_data {
double ambpressure;
double gfline;
double density;
+ bool icd_warning;
};
struct ev_select {