mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 22:03:23 +00:00
Don't let the oxygen partial pressure drop below 0.
No oxygen at all is not quite enough for the average diver but this prevents inifintie loops/extremely long deco when subsurface is used in pscr mode with unrealistic values for pscr preferences. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
991531d847
commit
52b92ee03b
1 changed files with 2 additions and 0 deletions
2
dive.c
2
dive.c
|
@ -1683,6 +1683,8 @@ extern void fill_pressures(struct gas_pressures *pressures, const double amb_pre
|
|||
} else {
|
||||
if (divemode == PSCR) { /* The steady state approximation should be good enough */
|
||||
pressures->o2 = get_o2(mix) / 1000.0 * amb_pressure - (1.0 - get_o2(mix) / 1000.0) * prefs.o2consumption / (prefs.bottomsac * prefs.pscr_ratio / 1000.0);
|
||||
if (pressures->o2 < 0) // He's dead, Jim.
|
||||
pressures->o2 = 0;
|
||||
if (get_o2(mix) != 1000) {
|
||||
pressures->he = (amb_pressure - pressures->o2) * get_he(mix) / (1000.0 - get_o2(mix));
|
||||
pressures->n2 = (amb_pressure - pressures->o2) * (1000 - get_o2(mix) - get_he(mix)) / (1000.0 - get_o2(mix));
|
||||
|
|
Loading…
Add table
Reference in a new issue