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
|
|
@ -1200,19 +1200,25 @@ static int calculate_ccr_po2(struct plot_data *entry, struct divecomputer *dc)
|
|||
static void calculate_gas_information_new(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)
|
||||
{
|
||||
int i;
|
||||
enum dive_comp_type current_divemode;
|
||||
double amb_pressure;
|
||||
struct gasmix *gasmix = NULL;
|
||||
struct event *ev = NULL;
|
||||
struct event *nextev, *evg = NULL, *evd = dc->events;
|
||||
|
||||
current_divemode = dc->divemode;
|
||||
nextev = get_next_divemodechange(&evd);
|
||||
|
||||
for (i = 1; i < pi->nr; i++) {
|
||||
int fn2, fhe;
|
||||
struct plot_data *entry = pi->entry + i;
|
||||
|
||||
gasmix = get_gasmix(dive, dc, entry->sec, &ev, gasmix);
|
||||
|
||||
gasmix = get_gasmix(dive, dc, entry->sec, &evg, gasmix);
|
||||
if (nextev && (entry->sec > nextev->time.seconds)) { // If there are divemode changes and sample 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_pressure = depth_to_bar(entry->depth, dive);
|
||||
|
||||
fill_pressures(&entry->pressures, amb_pressure, gasmix, entry->o2pressure.mbar / 1000.0, dive->dc.divemode);
|
||||
fill_pressures(&entry->pressures, amb_pressure, gasmix, (current_divemode == OC) ? 0.0 : entry->o2pressure.mbar / 1000.0, current_divemode);
|
||||
fn2 = (int)(1000.0 * entry->pressures.n2 / amb_pressure);
|
||||
fhe = (int)(1000.0 * entry->pressures.he / amb_pressure);
|
||||
if (dc->divemode == PSCR) // OC pO2 is calulated for PSCR with or without external PO2 monitoring.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue