[PATCH] VPMB gradient of imperm: don't confuse atm and bar

2015-09-16 Thread Rick Walsh
Other VPM-B implementations (V-Planner, MultiDeco, Fortran code) take the
default gradient of onset of impermeability as 8.2 atm.  We use bar as the
pressure unit, and 8.2 atm = 8.30865 bar.

This has negligible effect on all of the calculated plans I've tested, resulting
in a maximum decrease of 1 minute in total dive time for ~150 m deep dives, but
we should get unit conversions correct anyway.

Signed-off-by: Rick Walsh 
---
 deco.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/deco.c b/deco.c
index 5d3b1d8..ec4501b 100644
--- a/deco.c
+++ b/deco.c
@@ -69,7 +69,7 @@ struct vpmb_config vpmb_config = {
.crit_radius_N2 = 0.55,
.crit_radius_He = 0.45,
.crit_volume_lambda = 199.58,
-   .gradient_of_imperm = 8.2,
+   .gradient_of_imperm = 8.30865,  // = 8.2 atm
.surface_tension_gamma = 0.18137175,// = 0.0179 N/msw
.skin_compression_gammaC = 2.6040525,   // = 0.257 N/msw
.regeneration_time = 20160.0,
-- 
2.4.3

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] VPMB gradient of imperm: don't confuse atm and bar

2015-09-16 Thread Dirk Hohndel
On Wed, Sep 16, 2015 at 07:57:24PM +1000, Rick Walsh wrote:
> Other VPM-B implementations (V-Planner, MultiDeco, Fortran code) take the
> default gradient of onset of impermeability as 8.2 atm.  We use bar as the
> pressure unit, and 8.2 atm = 8.30865 bar.
> 
> This has negligible effect on all of the calculated plans I've tested, 
> resulting
> in a maximum decrease of 1 minute in total dive time for ~150 m deep dives, 
> but
> we should get unit conversions correct anyway.

I'm not arguing against that. But with this patch TestPlan fails.
So either submit a patch that also adapts the runtime we expect in the
test (and argue why that is the right thing to do), or... 

NAK as it is

/D

> ---
>  deco.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/deco.c b/deco.c
> index 5d3b1d8..ec4501b 100644
> --- a/deco.c
> +++ b/deco.c
> @@ -69,7 +69,7 @@ struct vpmb_config vpmb_config = {
>   .crit_radius_N2 = 0.55,
>   .crit_radius_He = 0.45,
>   .crit_volume_lambda = 199.58,
> - .gradient_of_imperm = 8.2,
> + .gradient_of_imperm = 8.30865,  // = 8.2 atm
>   .surface_tension_gamma = 0.18137175,// = 0.0179 N/msw
>   .skin_compression_gammaC = 2.6040525,   // = 0.257 N/msw
>   .regeneration_time = 20160.0,
> -- 
> 2.4.3
> 
> ___
> subsurface mailing list
> subsurface@subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] VPMB gradient of imperm: don't confuse atm and bar

2015-09-16 Thread Rick Walsh
On 17 September 2015 at 04:21, Dirk Hohndel  wrote:

> On Wed, Sep 16, 2015 at 07:57:24PM +1000, Rick Walsh wrote:
> > Other VPM-B implementations (V-Planner, MultiDeco, Fortran code) take the
> > default gradient of onset of impermeability as 8.2 atm.  We use bar as
> the
> > pressure unit, and 8.2 atm = 8.30865 bar.
> >
> > This has negligible effect on all of the calculated plans I've tested,
> resulting
> > in a maximum decrease of 1 minute in total dive time for ~150 m deep
> dives, but
> > we should get unit conversions correct anyway.
>
> I'm not arguing against that. But with this patch TestPlan fails.
> So either submit a patch that also adapts the runtime we expect in the
> test (and argue why that is the right thing to do), or...
>
> NAK as it is
>

Oops - I should have checked that - it's a bit embarrassing.

While sitting in the naughty corner, I realized we were calculating the CVA
next gradient based on the tissue loading at the end of the previous
iteration, rather than the end of the user-entered portion of the dive.
The attached patch fixes that, and it also makes all the tests pass when
applied on top of the previous patch.

Rick
From 03ffbd542faec470f3f35b2ebeb9879c80cba570 Mon Sep 17 00:00:00 2001
From: Rick Walsh 
Date: Thu, 17 Sep 2015 07:18:16 +1000
Subject: [PATCH] VPM-B restore deco state before calculating next gradient

The next gradient calculation at the start of the CVA loop should be performed
using the tissue loading before starting the iterations, rather than the loading
at the end of the previous iteration.

Signed-off-by: Rick Walsh 
---
 planner.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/planner.c b/planner.c
index a94aafb..db044e3 100644
--- a/planner.c
+++ b/planner.c
@@ -1142,11 +1142,11 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
 	//CVA
 	do {
 		is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10);  // CVA time converges
+		restore_deco_state(bottom_cache);
 		if (deco_time != 1000)
 			vpmb_next_gradient(deco_time, diveplan->surface_pressure / 1000.0);
 
 		previous_deco_time = deco_time;
-		restore_deco_state(bottom_cache);
 
 		depth = bottom_depth;
 		gi = bottom_gi;
-- 
2.4.3

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface