Prepare for PSCR calculations

Calculations for passive semi-closed rebreathers are pretty much like OC
except the pO2 is lower bey a certain (SAC dependent) factor. This patch
introduces the corresponding calculations in case dctype == PSCR which is
so far never set and there is currently no UI for these calculations. As
pO2 is SAC dependent it takes a certain attempt at getting it and drops to
defaults from the prefs otherwise.

As there is no UI at this point and I also don't have any dives, this has
not received much testing, yet, but it compiles. At least.

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 2014-10-24 16:40:21 +02:00 committed by Dirk Hohndel
parent f31d34adfd
commit 06ddfc0122
8 changed files with 29 additions and 19 deletions

5
deco.c
View file

@ -18,6 +18,7 @@
#include <math.h>
#include <string.h>
#include "dive.h"
#include <assert.h>
//! Option structure for Buehlmann decompression.
struct buehlmann_config {
@ -184,12 +185,12 @@ double he_factor(int period_in_seconds, int ci)
}
/* add period_in_seconds at the given pressure and gas to the deco calculation */
double add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive)
double add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive, int sac)
{
int ci;
struct gas_pressures pressures;
fill_pressures(&pressures, pressure - WV_PRESSURE, gasmix, (double) ccpo2 / 1000.0);
fill_pressures(&pressures, pressure - WV_PRESSURE, gasmix, (double) ccpo2 / 1000.0, ccpo2 ? CCR : OC, sac);
if (buehlmann_config.gf_low_at_maxdepth && pressure > gf_low_pressure_this_dive)
gf_low_pressure_this_dive = pressure;