mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix ATM-vs-bar confusion
SAC should be calculated in relationship to surface pressure, not "1 bar".
I also realize that we have a few other cases where we do the same
mistake: the partial pressure calculations do things like
po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive);
which is wrong as well - the partial pressure is also relative to
standard atmospheric pressures.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
92bbed3304
commit
e58f54cac1
4 changed files with 16 additions and 6 deletions
|
|
@ -221,7 +221,7 @@ static int calculate_otu(struct dive *dive)
|
|||
po2 = sample->po2;
|
||||
} else {
|
||||
int o2 = active_o2(dive, dc, sample->time);
|
||||
po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive);
|
||||
po2 = o2 * depth_to_atm(sample->depth.mm, dive);
|
||||
}
|
||||
if (po2 >= 500)
|
||||
otu += pow((po2 - 500) / 1000.0, 0.83) * t / 30.0;
|
||||
|
|
@ -285,7 +285,7 @@ static int calculate_cns(struct dive *dive)
|
|||
po2 = sample->po2;
|
||||
} else {
|
||||
int o2 = active_o2(dive, dc, sample->time);
|
||||
po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive);
|
||||
po2 = o2 / depth_to_atm(sample->depth.mm, dive);
|
||||
}
|
||||
/* Find what table-row we should calculate % for */
|
||||
for (j = 1; j < sizeof(cns_table)/(sizeof(int) * 3); j++)
|
||||
|
|
@ -338,7 +338,7 @@ static int calculate_sac(struct dive *dive)
|
|||
return 0;
|
||||
|
||||
/* Mean pressure in ATM (SAC calculations are in atm*l/min) */
|
||||
pressure = (double) depth_to_mbar(meandepth, dive) / SURFACE_PRESSURE;
|
||||
pressure = depth_to_atm(meandepth, dive);
|
||||
sac = airuse / pressure * 60 / duration;
|
||||
|
||||
/* milliliters per minute.. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue