mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Incorporate bailout events in CCR & PSCR gas calculations.
This is a first step to interpret bailout events. 1) The event structures have a new attribute: divemode. Currently interpreted dive modes are OC, CCR, PSCR. 2) When doing fill_pressures(), the calculation is aware of divemode. When divemode is OC (==bailout), then the appropriate calculations of gas pressures are done. 3) Two new functions get_next_divemodechange() and get_divemode_at_time() are created to find divemode changes in the events linked list and to determine the dive mode at any point during the dive. 4) fill_pressures gets a small amendment to facilitate the correct calculations, depending on divemode. The cases where fill_pressures() is used *outside the planner* are changed. The result is that, for dives with bailout, the correct gas pressures are shown on the dive profile. The deco for bailout dives is not yet correct. This is the next step. Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
This commit is contained in:
parent
9b4728c7a9
commit
cf377beb2e
5 changed files with 90 additions and 9 deletions
|
@ -537,12 +537,26 @@ void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_d
|
|||
/* Print warnings for pO2 */
|
||||
dp = diveplan->dp;
|
||||
bool o2warning_exist = false;
|
||||
enum dive_comp_type current_divemode;
|
||||
double amb;
|
||||
struct event *nextev, *evd = dive->dc.events;
|
||||
|
||||
current_divemode = dive->dc.divemode;
|
||||
nextev = get_next_divemodechange(&evd);
|
||||
|
||||
if (dive->dc.divemode != CCR) {
|
||||
while (dp) {
|
||||
if (dp->time != 0) {
|
||||
struct gas_pressures pressures;
|
||||
struct gasmix *gasmix = &dive->cylinder[dp->cylinderid].gasmix;
|
||||
fill_pressures(&pressures, depth_to_atm(dp->depth.mm, dive), gasmix, 0.0, dive->dc.divemode);
|
||||
|
||||
if (nextev && (dp->time >= nextev->time.seconds)) { // If there are divemode changes and divedatapoint time
|
||||
current_divemode = nextev->divemode; // has reached that of the current divemode event, then set the
|
||||
nextev = get_next_divemodechange(&evd); // current divemode and find the next divemode event
|
||||
}
|
||||
|
||||
amb = depth_to_atm(dp->depth.mm, dive);
|
||||
fill_pressures(&pressures, amb, gasmix, (current_divemode == OC) ? 0.0 : amb * gasmix->o2.permille / 1000.0, current_divemode);
|
||||
|
||||
if (pressures.o2 > (dp->entered ? prefs.bottompo2 : prefs.decopo2) / 1000.0) {
|
||||
const char *depth_unit;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue