mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Recmode: Take safety stop into account when calculating ascent gas consumption.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a8d06b848e
commit
695637dcff
1 changed files with 6 additions and 2 deletions
|
@ -802,13 +802,17 @@ int ascent_velocity(int depth, int avg_depth, int bottom_time)
|
|||
}
|
||||
}
|
||||
|
||||
void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom_time)
|
||||
void track_ascent_gas(int depth, cylinder_t *cylinder, int avg_depth, int bottom_time, bool safety_stop)
|
||||
{
|
||||
while (depth > 0) {
|
||||
int deltad = ascent_velocity(depth, avg_depth, bottom_time) * TIMESTEP;
|
||||
if (deltad > depth)
|
||||
deltad = depth;
|
||||
update_cylinder_pressure(&displayed_dive, depth, depth - deltad, TIMESTEP, prefs.bottomsac, cylinder, true);
|
||||
if (depth <= 5000 && safety_stop){
|
||||
update_cylinder_pressure(&displayed_dive, 5000, 5000, 180, prefs.bottomsac, cylinder, true);
|
||||
safety_stop = false;
|
||||
}
|
||||
depth -= deltad;
|
||||
}
|
||||
}
|
||||
|
@ -944,7 +948,7 @@ int plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool s
|
|||
gi = gaschangenr - 1;
|
||||
if(prefs.recreational_mode) {
|
||||
bool safety_stop = prefs.safetystop && max_depth >= 10000;
|
||||
track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time);
|
||||
track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time, safety_stop);
|
||||
// How long can we stay at the current depth and still directly ascent to the surface?
|
||||
while (trial_ascent(depth, 0, avg_depth, bottom_time, tissue_tolerance, &displayed_dive.cylinder[current_cylinder].gasmix,
|
||||
po2, diveplan->surface_pressure / 1000.0) &&
|
||||
|
|
Loading…
Add table
Reference in a new issue