diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-03-15 22:28:36 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2017-03-19 17:11:52 -0700 |
commit | 6f21d2749e67926128bf1e536382aad9890fc846 (patch) | |
tree | 45c6d6b265eb941fe26edd48c5e18ccf63d095d8 /core | |
parent | ce420d7720213aa0f255f07ee04e243f4c1c1242 (diff) | |
download | subsurface-6f21d2749e67926128bf1e536382aad9890fc846.tar.gz |
Tests for minimum gas
Add automatic tests in TestPlan for minimum gas:
- Copy minimum gas result (pressure) to diveplan.
- Add cylinder size and working pressure for bottom gas to every dive in TestPlan
Hint: Unrealistic cylinder sizes (100l, 200l) have to be used for the very long and deep dives in TestPlan
- Add minimum gas check for every dive
- Add two additional test dives in TestPlan which produce sane minimum gas results with 24l tank
Hint: Deco check for these new dives is commented out at the moment
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/dive.h | 1 | ||||
-rw-r--r-- | core/planner.c | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/core/dive.h b/core/dive.h index b8096d50c..bc029dbcd 100644 --- a/core/dive.h +++ b/core/dive.h @@ -847,6 +847,7 @@ struct divedatapoint { int time; depth_t depth; int cylinderid; + pressure_t minimum_gas; int setpoint; bool entered; struct divedatapoint *next; diff --git a/core/planner.c b/core/planner.c index aa77f11e8..b8a8b63b5 100644 --- a/core/planner.c +++ b/core/planner.c @@ -384,6 +384,7 @@ struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po dp->time = time_incr; dp->depth.mm = depth; dp->cylinderid = cylinderid; + dp->minimum_gas.mbar = 0; dp->setpoint = po2; dp->entered = false; dp->next = NULL; @@ -903,15 +904,14 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool * depth_to_bar(lastbottomdp->depth.mm, dive) + prefs.sacfactor / 100.0 * cyl->deco_gas_used.mliter); /* Calculate minimum gas pressure for cyclinder. */ - pressure_t mingasp; - mingasp.mbar = lrint(isothermal_pressure(&cyl->gasmix, 1.0, + lastbottomdp->minimum_gas.mbar = lrint(isothermal_pressure(&cyl->gasmix, 1.0, mingasv.mliter, cyl->type.size.mliter) * 1000); /* Translate all results into correct units */ mingas_volume = get_volume_units(mingasv.mliter, NULL, &unit); - mingas_pressure = get_pressure_units(mingasp.mbar, &pressure_unit); + mingas_pressure = get_pressure_units(lastbottomdp->minimum_gas.mbar, &pressure_unit); mingas_depth = get_depth_units(lastbottomdp->depth.mm, NULL, &depth_unit); /* Print it to results */ - if (cyl->start.mbar > mingasp.mbar) snprintf(mingas, sizeof(mingas), + if (cyl->start.mbar > lastbottomdp->minimum_gas.mbar) snprintf(mingas, sizeof(mingas), translate("gettextFromC", "<br> — <span style='color: green;'>Minimum gas</span> (based on %.1fxSAC/+%dmin@%.0f%s): %.0f%s/%.0f%s"), prefs.sacfactor / 100.0, prefs.problemsolvingtime, mingas_depth, depth_unit, |