diff options
author | Robert C. Helling <helling@lmu.de> | 2013-01-08 15:37:41 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-08 08:59:20 -0800 |
commit | 67d59ff0181f4dccdd46923d53cda7902f279a57 (patch) | |
tree | 2eabab870d6c75e3d1e52d2473d03e2a945b141c /profile.c | |
parent | e3bdbb7c0f686050a68bbab1b1123c1ed3617d52 (diff) | |
download | subsurface-67d59ff0181f4dccdd46923d53cda7902f279a57.tar.gz |
Rewrite of the deco code
o) Instead of using gradient factors as means of comparison, I now use
pressure (as in: maximal ambient pressure).
o) tissue_tolerance_calc() now computes the maximal ambient pressure now
respecting gradient factors. For this, it needs to know about the
surface pressure (as refernce for GF_high), thus gets *dive as an
argument. It is called from add_segment() which this also needs *dive
as an additional argument.
o) This implies deco_allowed_depth is now mainly a ambient-pressure to
depth conversion with decorations to avoid negative depth (i.e. no deco
obliation), implementation of quantization (!smooth => multiples of 3m)
and explicit setting of last deco depth (e.g. 6m for O2 deco).
o) gf_low_pressure_this_dive (slight change of name), the max depth in
pressure units is updated in add_segment. I set the minimal value in
buehlmann_config to the equivalent of 20m as otherwise good values of
GF_low add a lot of deco to shallow dives which do not need deep stops
in the first place.
o) The bogus loop is gone as well as actual_gradient_limit() and
gradient_factor_calculation() and large parts of deco_allowed_depth()
although I did not delete the code but put it in comments.
o) The meat is in the formula in lines 147-154 of deco.c. Here is the
rationale:
Without gradient factors, the M-value (i.e the maximal tissue pressure)
at a given depth is given by ambient_pressure / buehlmann_b + a.
According to "Clearing Up The Confusion About "Deep Stops" by Erik C.
Baker (as found via google) the effect of the gradient factors is no
replace this by a reduced affine relation (i.e. another line) such that
at the surface the difference between M-value and ambient pressure is
reduced by a factor GF_high and at the maximal depth by a factor
GF_low.
That is, we are looking for parameters alpha and beta such that
alpha surface + beta = surface + gf_high * (surface/b + a - surface)
and
alpha max_p + beta = max_p + gf_low * (max_p/b + a - max_p)
This can be solved for alpha and beta and then inverted to obtain the
max ambient pressure given tissue loadings. The result is the above
mentioned formula.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1870,7 +1870,7 @@ static void calculate_deco_information(struct dive *dive, struct divecomputer *d for (j = t0; j < t1; j++) { int depth = 0.5 + (entry - 1)->depth + (j - t0) * (entry->depth - (entry - 1)->depth) / (t1 - t0); double min_pressure = add_segment(depth_to_mbar(depth, dive) / 1000.0, - &dive->cylinder[cylinderindex].gasmix, 1, entry->po2); + &dive->cylinder[cylinderindex].gasmix, 1, entry->po2, dive); if (min_pressure > tissue_tolerance) tissue_tolerance = min_pressure; } |