From 7f8c3592ce29d5fd4cd177d8e86ede9fdf3ab747 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Sat, 11 Feb 2017 20:24:18 +0100 Subject: Minimum gas calculation - Calculations and UI parameters Add minimum gas calculation to planner output. Add the two UI parameters prefs.sacfactor and prefs.problemsolvingtime. Connect UI signals and slots for recalculation of diveplan. Disable minimum gas calculation if there was already a warning before. If minimum gas result is larger then cylinder start pressure give warning message instead of result. Add line break before pO2 warnings but only if warnings exist. Signed-off-by: Joachim Ritter Signed-off-by: Stefan Fuchs --- desktop-widgets/diveplanner.cpp | 14 ++++ desktop-widgets/diveplanner.h | 2 + desktop-widgets/plannerSettings.ui | 128 +++++++++++++++++++++++++++---------- 3 files changed, 109 insertions(+), 35 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/diveplanner.cpp b/desktop-widgets/diveplanner.cpp index 1cf0b911f..804ea89e1 100644 --- a/desktop-widgets/diveplanner.cpp +++ b/desktop-widgets/diveplanner.cpp @@ -300,6 +300,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) ui.display_runtime->setChecked(prefs.display_runtime); ui.display_transitions->setChecked(prefs.display_transitions); ui.safetystop->setChecked(prefs.safetystop); + ui.sacfactor->setValue(prefs.sacfactor / 100.0); + ui.problemsolvingtime->setValue(prefs.problemsolvingtime); ui.bottompo2->setValue(prefs.bottompo2 / 1000.0); ui.decopo2->setValue(prefs.decopo2 / 1000.0); ui.backgasBreaks->setChecked(prefs.doo2breaks); @@ -362,6 +364,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f) connect(ui.descRate, SIGNAL(valueChanged(int)), this, SLOT(setDescRate(int))); connect(ui.ascRateStops, SIGNAL(valueChanged(int)), this, SLOT(setAscRateStops(int))); connect(ui.ascRateLast6m, SIGNAL(valueChanged(int)), this, SLOT(setAscRateLast6m(int))); + connect(ui.sacfactor, SIGNAL(valueChanged(double)), this, SLOT(sacFactorChanged(double))); + connect(ui.problemsolvingtime, SIGNAL(valueChanged(int)), this, SLOT(problemSolvingTimeChanged(int))); connect(ui.bottompo2, SIGNAL(valueChanged(double)), this, SLOT(setBottomPo2(double))); connect(ui.decopo2, SIGNAL(valueChanged(double)), this, SLOT(setDecoPo2(double))); connect(ui.bestmixEND, SIGNAL(valueChanged(int)), this, SLOT(setBestmixEND(int))); @@ -480,6 +484,16 @@ void PlannerSettingsWidget::setDescRate(int rate) SettingsObjectWrapper::instance()->planner_settings->setDescrate(rate * UNIT_FACTOR); } +void PlannerSettingsWidget::sacFactorChanged(const double factor) +{ + plannerModel->setSacFactor(factor); +} + +void PlannerSettingsWidget::problemSolvingTimeChanged(const int minutes) +{ + plannerModel->setProblemSolvingTime(minutes); +} + void PlannerSettingsWidget::setBottomPo2(double po2) { SettingsObjectWrapper::instance()->planner_settings->setBottompo2((int) (po2 * 1000.0)); diff --git a/desktop-widgets/diveplanner.h b/desktop-widgets/diveplanner.h index 91501ceb7..f0cae3e5b 100644 --- a/desktop-widgets/diveplanner.h +++ b/desktop-widgets/diveplanner.h @@ -78,6 +78,8 @@ slots: void setAscRateStops(int rate); void setAscRateLast6m(int rate); void setDescRate(int rate); + void sacFactorChanged(const double factor); + void problemSolvingTimeChanged(const int min); void setBottomPo2(double po2); void setDecoPo2(double po2); void setBestmixEND(int depth); diff --git a/desktop-widgets/plannerSettings.ui b/desktop-widgets/plannerSettings.ui index c6e16e54a..90331bdf6 100644 --- a/desktop-widgets/plannerSettings.ui +++ b/desktop-widgets/plannerSettings.ui @@ -402,7 +402,7 @@ - + @@ -530,7 +530,40 @@ 2 - + + + + ℓ/min + + + 0 + + + 99.000000000000000 + + + + + + + Deco SAC + + + + + + + Qt::Vertical + + + + 20 + 20 + + + + + Qt::Vertical @@ -543,7 +576,7 @@ - + bar @@ -572,7 +605,7 @@ - + bar @@ -588,8 +621,11 @@ - + + + Used to calculate best mix. Select best mix depth in 'Available gases' table by entering gas depth, followed by "B" (best trimix mix) or "BN" (best nitrox mix) + m @@ -602,9 +638,6 @@ 30 - - Used to calculate best mix. Select best mix depth in 'Available gases' table by entering gas depth, followed by "B" (best trimix mix) or "BN" (best nitrox mix) - @@ -614,21 +647,21 @@ - + Bottom pO₂ - + Best mix END - + Notes @@ -692,45 +725,67 @@ - - - - ℓ/min + + + + Deco pO₂ + + + + + + + SAC factor + + + + + + + Used to calculate minimum gas. Consider two divers with possibly increased SAC after OoG event. - 0 + 1 + + + 2.000000000000000 - 99.000000000000000 + 10.000000000000000 + + + 0.100000000000000 + + + 4.000000000000000 - + - Deco pO₂ + Problem solving time - - - - Deco SAC + + + + Used to calculate minimum gas. Additional time at max. depth after OoG event. - - - - - - Qt::Vertical + + min - - - 20 - 20 - + + - + + 10 + + + 4 + + @@ -755,6 +810,7 @@ gflow gfhigh vpmb_deco + vpmb_conservatism drop_stone_mode lastStop backgasBreaks @@ -763,6 +819,8 @@ rebreathermode bottomSAC decoStopSAC + sacfactor + problemsolvingtime bottompo2 decopo2 bestmixEND -- cgit v1.2.3-70-g09d2