Use boyle_compensation in profile

otherwise VPM-B planned profiles seem to violate the ceiling. This needs
the first_stop_pressure to be available also in the profile, so I made
it global in planner.c

Important lesson: If you want to use deco_allowed_depth on a tissue_tolerance
that comes from a VPM-B planned dive, you have to call boyles_law() before
add_segment()!

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-08-19 23:14:00 +02:00 committed by Dirk Hohndel
parent 2a50731139
commit 0bb65a17cb
4 changed files with 17 additions and 9 deletions

View file

@ -33,6 +33,8 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133
double plangflow, plangfhigh;
bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions;
int first_stop_pressure;
const char *disclaimer;
#if DEBUG_PLAN
@ -921,7 +923,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
int bottom_depth;
int bottom_gi;
int bottom_stopidx;
int first_stop_pressure;
bool is_final_plan = true;
int deco_time;
int previous_deco_time;
@ -996,6 +997,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
return(false);
}
tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap);
displayed_dive.surface_pressure.mbar = diveplan->surface_pressure;
#if DEBUG_PLAN & 4
printf("gas %s\n", gasname(&gas));
@ -1160,7 +1162,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
// Boyles Law compensation
if (first_stop_pressure == 0)
first_stop_pressure = depth_to_mbar(depth, &displayed_dive);
boyles_law(first_stop_pressure / 1000.0, depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0);
boyles_law(depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0);
/* Check we need to change cylinder.
* We might not if the cylinder was chosen by the user
@ -1215,7 +1217,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
// Boyles Law compensation
if (first_stop_pressure == 0)
first_stop_pressure = depth_to_mbar(depth, &displayed_dive);
boyles_law(first_stop_pressure / 1000.0, depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0);
boyles_law(depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0);
}
/* Are we waiting to switch gas?