mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Round MOD to lower depths
When computing the suggested switch depth for a gas, we should take the next stop depth above the MOD, i.e. round down. Otherwise we can produce MOD violation warnings. We need, however, a bit of fudge as otherwise we do not suggest to switch to o2 at 6m. TestPlan uses the MOD to determine the depth to switch to Tx21/35. This happens to be 65.378m. Therefore, switching at 66m violates the MOD, the switch should be at 63m. This then affects the gas usage. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
a898173ce7
commit
7dc92e170f
2 changed files with 6 additions and 4 deletions
|
|
@ -2457,7 +2457,9 @@ int dive::mbar_to_depth(int mbar) const
|
|||
depth_t dive::gas_mod(struct gasmix mix, pressure_t po2_limit, int roundto) const
|
||||
{
|
||||
double depth = (double) mbar_to_depth(po2_limit.mbar * 1000 / get_o2(mix));
|
||||
return depth_t { .mm = int_cast<int>(depth / roundto) * roundto };
|
||||
// Rounding should be towards lower=safer depths but we give a bit
|
||||
// of fudge to all to switch to o2 at 6m. So from .9 we round up.
|
||||
return depth_t { .mm = (int)(depth / roundto + 0.1) * roundto };
|
||||
}
|
||||
|
||||
/* Maximum narcotic depth rounded to multiples of roundto mm */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue