mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly handle air in the deco code
We mark air with o2.permille = 0. But it's actually 20.9% O2. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1b22ac16f2
commit
d87a606039
1 changed files with 3 additions and 2 deletions
5
deco.c
5
deco.c
|
@ -148,13 +148,14 @@ static double tissue_tolerance_calc(void)
|
|||
double add_segment(double pressure, struct gasmix *gasmix, int period_in_seconds, double ccpo2)
|
||||
{
|
||||
int ci;
|
||||
double ppn2 = (pressure - WV_PRESSURE) * (1000 - gasmix->o2.permille - gasmix->he.permille) / 1000.0;
|
||||
int fo2 = gasmix->o2.permille ? gasmix->o2.permille : 209;
|
||||
double ppn2 = (pressure - WV_PRESSURE) * (1000 - fo2 - gasmix->he.permille) / 1000.0;
|
||||
double pphe = (pressure - WV_PRESSURE) * gasmix->he.permille / 1000.0;
|
||||
|
||||
if (ccpo2 > 0.0) { /* CC */
|
||||
double rel_o2_amb, f_dilutent;
|
||||
rel_o2_amb = ccpo2 / pressure;
|
||||
f_dilutent = (1 - rel_o2_amb) / (1 - gasmix->o2.permille / 1000.0);
|
||||
f_dilutent = (1 - rel_o2_amb) / (1 - fo2 / 1000.0);
|
||||
if (f_dilutent < 0) { /* setpoint is higher than ambient pressure -> pure O2 */
|
||||
ppn2 = 0.0;
|
||||
pphe = 0.0;
|
||||
|
|
Loading…
Add table
Reference in a new issue