mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
Merge b7fc06892a
into 4f7d567571
This commit is contained in:
commit
ef8791dd2b
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 */
|
||||
|
|
|
@ -865,17 +865,17 @@ void TestPlan::testVpmbMetricRepeat()
|
|||
|
||||
// check minimum gas result
|
||||
dp = std::find_if(testPlan.dp.begin(), testPlan.dp.end(), [](auto &dp) { return dp.minimum_gas.mbar != 0; });
|
||||
QCOMPARE(lrint(dp == testPlan.dp.end() ? 0.0 : dp->minimum_gas.mbar / 1000.0), 80l);
|
||||
QCOMPARE(lrint(dp == testPlan.dp.end() ? 0.0 : dp->minimum_gas.mbar / 1000.0), 85l);
|
||||
// print first ceiling
|
||||
printf("First ceiling %.1f m\n", dive.mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar) * 0.001);
|
||||
QVERIFY(dive.dcs[0].events.size() >= 3);
|
||||
// check first gas change to 21/35 at 66m
|
||||
// check first gas change to 21/35 at 63m
|
||||
struct event *ev = &dive.dcs[0].events[0];
|
||||
QVERIFY(ev != NULL);
|
||||
QCOMPARE(ev->gas.index, 1);
|
||||
QCOMPARE(ev->gas.mix.o2.permille, 210);
|
||||
QCOMPARE(ev->gas.mix.he.permille, 350);
|
||||
QCOMPARE(get_depth_at_time(&dive.dcs[0], ev->time.seconds), 66000);
|
||||
QCOMPARE(get_depth_at_time(&dive.dcs[0], ev->time.seconds), 63000);
|
||||
// check second gas change to EAN50 at 21m
|
||||
ev = &dive.dcs[0].events[1];
|
||||
QCOMPARE(ev->gas.index, 2);
|
||||
|
|
Loading…
Reference in a new issue