On 30 August 2015 at 23:00, Rick Walsh <[email protected]> wrote:

> A real ceiling is the ceiling calculated when the ambient pressure is at
> the
> ceiling.  As such, the Boyle's law compensation should be done against the
> ambient pressure at the ceiling.  Instead of doing an iterative
> calculation,
> take the lesser ambient pressure of the ceiling of the previous sample,
> and the
> depth of the current sample.
>
> This approach gets rid of "blips" in the calculated ceiling due to a step
> in
> Boyle's law compensation during ascent.  In limited testing, it also
> appears to
> avoid creating a ceiling deeper than the calculated plan in most cases.
>

Sorry, this is the patch I meant to send

R
From ac912935239d5643e15d250591658f54eab1afe4 Mon Sep 17 00:00:00 2001
From: Rick Walsh <[email protected]>
Date: Sun, 30 Aug 2015 22:41:54 +1000
Subject: [PATCH 2/2] VPM-B: Get rid of ugly blips in ceiling

A real ceiling is the ceiling calculated when the ambient pressure is at the
ceiling.  As such, the Boyle's law compensation should be done against the
ambient pressure at the ceiling.  Instead of doing an iterative calculation,
take the lesser ambient pressure of the ceiling of the previous sample, and the
depth of the current sample.

This approach gets rid of "blips" in the calculated ceiling due to a step in
Boyle's law compensation during ascent.  In limited testing, it also appears to
avoid creating a ceiling deeper than the calculated plan in most cases.

Signed-off-by: Rick Walsh <[email protected]>
---
 profile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/profile.c b/profile.c
index 79effeb..3764b6f 100644
--- a/profile.c
+++ b/profile.c
@@ -853,13 +853,13 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
 			time_stepsize = t1 - t0;
 		for (j = t0 + time_stepsize; j <= t1; j += time_stepsize) {
 			int depth = interpolate(entry[-1].depth, entry[0].depth, j - t0, t1 - t0);
-			boyles_law(depth_to_mbar(entry->depth, &displayed_dive) / 1000.0);
 			double min_pressure = add_segment(depth_to_mbar(depth, dive) / 1000.0,
 							  &dive->cylinder[entry->cylinderindex].gasmix, time_stepsize, entry->o2pressure.mbar, dive, entry->sac);
 			tissue_tolerance = min_pressure;
 			if ((t1 - j < time_stepsize) && (j < t1))
 				time_stepsize = t1 - j;
 		}
+		boyles_law(depth_to_mbar((entry->depth < (entry - 1)->ceiling) ? entry->depth : (entry - 1)->ceiling, &displayed_dive) / 1000.0);
 		if (t0 == t1)
 			entry->ceiling = (entry - 1)->ceiling;
 		else
-- 
2.4.3

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to