mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
VPM-B: Calculate first_stop_pressure before starting ascent
The Boyle's law compensation depends on first_stop_pressure. To produce
profiles similar to other VPM-B implementations, we should calculate it as the
ceiling before starting the ascent.
Commit 159c9eb2c1
, Compare ceiling to next stop
rather than try to ascent for VPM-B, changed (VPM-B) to consider the current
ceiling rather than an incremental ascent between one stop level and the next.
However, the initial ascent generally steps through several stop levels, so
first_stop_pressure was still not calculated as the ceiling prior to commencing
the calculated ascent.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
898ea6acb5
commit
634e698664
1 changed files with 17 additions and 5 deletions
22
planner.c
22
planner.c
|
@ -939,6 +939,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
||||||
int *decostoplevels;
|
int *decostoplevels;
|
||||||
int decostoplevelcount;
|
int decostoplevelcount;
|
||||||
unsigned int *stoplevels = NULL;
|
unsigned int *stoplevels = NULL;
|
||||||
|
int vpmb_first_stop;
|
||||||
bool stopping = false;
|
bool stopping = false;
|
||||||
bool pendinggaschange = false;
|
bool pendinggaschange = false;
|
||||||
bool clear_to_ascend;
|
bool clear_to_ascend;
|
||||||
|
@ -1100,6 +1101,22 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
||||||
bottom_gi = gi;
|
bottom_gi = gi;
|
||||||
bottom_gas = gas;
|
bottom_gas = gas;
|
||||||
bottom_stopidx = stopidx;
|
bottom_stopidx = stopidx;
|
||||||
|
|
||||||
|
// Find first stop used for VPM-B Boyle's law compensation
|
||||||
|
if (prefs.deco_mode == VPMB) {
|
||||||
|
vpmb_first_stop = deco_allowed_depth(tissue_tolerance, diveplan->surface_pressure / 1000, &displayed_dive, 1);
|
||||||
|
if (vpmb_first_stop > 0) {
|
||||||
|
while (stoplevels[stopidx] > vpmb_first_stop) {
|
||||||
|
stopidx--;
|
||||||
|
}
|
||||||
|
stopidx++;
|
||||||
|
vpmb_first_stop = stoplevels[stopidx];
|
||||||
|
}
|
||||||
|
first_stop_pressure.mbar = depth_to_mbar(vpmb_first_stop, &displayed_dive);
|
||||||
|
} else {
|
||||||
|
first_stop_pressure.mbar = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//CVA
|
//CVA
|
||||||
do {
|
do {
|
||||||
is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10); // CVA time converges
|
is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10); // CVA time converges
|
||||||
|
@ -1119,7 +1136,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
||||||
breaktime = -1;
|
breaktime = -1;
|
||||||
breakcylinder = 0;
|
breakcylinder = 0;
|
||||||
o2time = 0;
|
o2time = 0;
|
||||||
first_stop_pressure.mbar = 0;
|
|
||||||
last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
|
last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
|
||||||
if ((current_cylinder = get_gasidx(&displayed_dive, &gas)) == -1) {
|
if ((current_cylinder = get_gasidx(&displayed_dive, &gas)) == -1) {
|
||||||
report_error(translate("gettextFromC", "Can't find gas %s"), gasname(&gas));
|
report_error(translate("gettextFromC", "Can't find gas %s"), gasname(&gas));
|
||||||
|
@ -1160,8 +1176,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
||||||
stopping = true;
|
stopping = true;
|
||||||
|
|
||||||
// Boyles Law compensation
|
// Boyles Law compensation
|
||||||
if (first_stop_pressure.mbar == 0)
|
|
||||||
first_stop_pressure.mbar = depth_to_mbar(depth, &displayed_dive);
|
|
||||||
boyles_law(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.
|
/* Check we need to change cylinder.
|
||||||
|
@ -1215,8 +1229,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
||||||
stopping = true;
|
stopping = true;
|
||||||
|
|
||||||
// Boyles Law compensation
|
// Boyles Law compensation
|
||||||
if (first_stop_pressure.mbar == 0)
|
|
||||||
first_stop_pressure.mbar = depth_to_mbar(depth, &displayed_dive);
|
|
||||||
boyles_law(depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0);
|
boyles_law(depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue