mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: Add option to treat O2 as narcotic
When computing the best mix for a target depth, for helium, one can either require that the partial pressure of N2 is the same as at the target depth or the partial pressure of N2 plus O2. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
43b16f0810
commit
9c8fbe494d
12 changed files with 121 additions and 86 deletions
|
@ -3761,13 +3761,17 @@ fraction_t best_o2(depth_t depth, const struct dive *dive)
|
|||
}
|
||||
|
||||
//Calculate He in best mix. O2 is considered narcopic
|
||||
fraction_t best_he(depth_t depth, const struct dive *dive)
|
||||
fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2)
|
||||
{
|
||||
fraction_t fhe;
|
||||
int pnarcotic, ambient;
|
||||
pnarcotic = depth_to_mbar(prefs.bestmixend.mm, dive);
|
||||
ambient = depth_to_mbar(depth.mm, dive);
|
||||
fhe.permille = (100 - 100 * pnarcotic / ambient) * 10; //use integer arithmetic to round up to nearest percent
|
||||
if (o2narcotic) {
|
||||
fhe.permille = (100 - 100 * pnarcotic / ambient) * 10; //use integer arithmetic to round up to nearest percent
|
||||
} else {
|
||||
fhe.permille = 1000 - fo2.permille - N2_IN_AIR * pnarcotic / ambient;
|
||||
}
|
||||
if (fhe.permille < 0)
|
||||
fhe.permille = 0;
|
||||
return fhe;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue