Hi Jan,

On 16 August 2015 at 00:11, Jan Darowski <[email protected]> wrote:

> Hi!
> Here is my next pull request, it adds all the remaining vpm-b
> elements. What is left to code is some way of logged dives rating
> against vpm-b and probably some fixes.
>
>
I've looked at and tested your latest series of VPM-B commits.  From what I
can see, it looks like it's doing the correct thing, except that
first_stop_pressure is reset to zero every iteration, so it then gets set
each stop (rather than just at the first stop) before running the Boyle's
law compensation.  The upshot is that the Boyle's law compensation isn't
work as intended and an overly aggressive profile is calculated.

The attached patch brings the line that sets first_stop_pressure to zero
outside the loop, so it is only run once.  Please have a look at what it
does.

Cheers,

Rick
From 626660c187585b7eaf885e25e1b29892239e5787 Mon Sep 17 00:00:00 2001
From: Rick Walsh <[email protected]>
Date: Sun, 16 Aug 2015 13:16:45 +1000
Subject: [PATCH] VPM-B: Don't reset first_stop_pressure repeatedly

The Boyle's law compensation adjusts the gradient according to the ambient
pressure at the first stop.  By resetting first_stop_pressure again, the
compensation works incorrectly.  This commit takes the statement setting it to
zero outside the while loop that caused the problem.

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

diff --git a/planner.c b/planner.c
index 0aa34ac..8def6e3 100644
--- a/planner.c
+++ b/planner.c
@@ -1096,6 +1096,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 	bottom_gi = gi;
 	bottom_gas = gas;
 	bottom_stopidx = stopidx;
+	first_stop_pressure = 0;
 	//CVA
 	do {
 		is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10);  // CVA time converges
@@ -1115,7 +1116,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 		breaktime = -1;
 		breakcylinder = 0;
 		o2time = 0;
-		first_stop_pressure = 0;
 		last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
 		if ((current_cylinder = get_gasidx(&displayed_dive, &gas)) == -1) {
 			report_error(translate("gettextFromC", "Can't find gas %s"), gasname(&gas));
-- 
2.4.3

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

Reply via email to