Remove option to apply GFlow at maxdepth

This option should have never been there. This is not how
gradient factors are supposed to work. It would only trick
users to use the wrong value..

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2017-09-19 14:38:38 +02:00 committed by Dirk Hohndel
parent a6f186279f
commit 5b080bedde
9 changed files with 61 additions and 105 deletions

View file

@ -45,7 +45,6 @@ struct buehlmann_config {
double gf_high; //! gradient factor high (at surface).
double gf_low; //! gradient factor low (at bottom/start of deco calculation).
double gf_low_position_min; //! gf_low_position below surface_min_shallow.
bool gf_low_at_maxdepth; //! if true, gf_low applies at max. depth instead of at deepest ceiling.
};
struct buehlmann_config buehlmann_config = {
@ -55,7 +54,6 @@ struct buehlmann_config buehlmann_config = {
.gf_high = 0.75,
.gf_low = 0.35,
.gf_low_position_min = 1.0,
.gf_low_at_maxdepth = false
};
//! Option structure for VPM-B decompression.
@ -252,10 +250,8 @@ double tissue_tolerance_calc(const struct dive *dive, double pressure)
((1.0 - deco_state->buehlmann_inertgas_b[ci]) * gf_low + deco_state->buehlmann_inertgas_b[ci]);
if (tissue_lowest_ceiling[ci] > lowest_ceiling)
lowest_ceiling = tissue_lowest_ceiling[ci];
if (!buehlmann_config.gf_low_at_maxdepth) {
if (lowest_ceiling > deco_state->gf_low_pressure_this_dive)
deco_state->gf_low_pressure_this_dive = lowest_ceiling;
}
if (lowest_ceiling > deco_state->gf_low_pressure_this_dive)
deco_state->gf_low_pressure_this_dive = lowest_ceiling;
}
for (ci = 0; ci < 16; ci++) {
double tolerated;
@ -498,9 +494,6 @@ void add_segment(double pressure, const struct gasmix *gasmix, int period_in_sec
fill_pressures(&pressures, pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE),
gasmix, (double) ccpo2 / 1000.0, dive->dc.divemode);
if (buehlmann_config.gf_low_at_maxdepth && pressure > deco_state->gf_low_pressure_this_dive)
deco_state->gf_low_pressure_this_dive = pressure;
for (ci = 0; ci < 16; ci++) {
double pn2_oversat = pressures.n2 - deco_state->tissue_n2_sat[ci];
double phe_oversat = pressures.he - deco_state->tissue_he_sat[ci];
@ -553,7 +546,6 @@ void clear_deco(double surface_pressure)
deco_state->he_regen_radius[ci] = get_crit_radius_He();
}
deco_state->gf_low_pressure_this_dive = surface_pressure;
if (!buehlmann_config.gf_low_at_maxdepth)
deco_state->gf_low_pressure_this_dive += buehlmann_config.gf_low_position_min;
deco_state->max_ambient_pressure = 0.0;
}
@ -603,13 +595,12 @@ int deco_allowed_depth(double tissues_tolerance, double surface_pressure, struct
return depth;
}
void set_gf(short gflow, short gfhigh, bool gf_low_at_maxdepth)
void set_gf(short gflow, short gfhigh)
{
if (gflow != -1)
buehlmann_config.gf_low = (double)gflow / 100.0;
if (gfhigh != -1)
buehlmann_config.gf_high = (double)gfhigh / 100.0;
buehlmann_config.gf_low_at_maxdepth = gf_low_at_maxdepth;
}
void set_vpmb_conservatism(short conservatism)

View file

@ -866,7 +866,7 @@ struct deco_state {
extern void add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int setpoint, const struct dive *dive, int sac);
extern void clear_deco(double surface_pressure);
extern void dump_tissues(void);
extern void set_gf(short gflow, short gfhigh, bool gf_low_at_maxdepth);
extern void set_gf(short gflow, short gfhigh);
extern void set_vpmb_conservatism(short conservatism);
extern void cache_deco_state(struct deco_state **datap);
extern void restore_deco_state(struct deco_state *data, bool keep_vpmb_state);

View file

@ -685,7 +685,7 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
bool o2breaking = false;
int decostopcounter = 0;
set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth);
set_gf(diveplan->gflow, diveplan->gfhigh);
set_vpmb_conservatism(diveplan->vpmb_conservatism);
if (!diveplan->surface_pressure)
diveplan->surface_pressure = SURFACE_PRESSURE;

View file

@ -396,11 +396,6 @@ bool TechnicalDetailsSettings::showSac() const
return prefs.show_sac;
}
bool TechnicalDetailsSettings::gfLowAtMaxDepth() const
{
return prefs.gf_low_at_maxdepth;
}
bool TechnicalDetailsSettings::displayUnusedTanks() const
{
return prefs.display_unused_tanks;
@ -561,7 +556,7 @@ void TechnicalDetailsSettings::setGflow(int value)
s.beginGroup(group);
s.setValue("gflow", value);
prefs.gflow = value;
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
set_gf(prefs.gflow, prefs.gfhigh);
emit gflowChanged(value);
}
@ -574,7 +569,7 @@ void TechnicalDetailsSettings::setGfhigh(int value)
s.beginGroup(group);
s.setValue("gfhigh", value);
prefs.gfhigh = value;
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
set_gf(prefs.gflow, prefs.gfhigh);
emit gfhighChanged(value);
}
@ -684,18 +679,6 @@ void TechnicalDetailsSettings::setShowSac(bool value)
emit showSacChanged(value);
}
void TechnicalDetailsSettings::setGfLowAtMaxDepth(bool value)
{
if (value == prefs.gf_low_at_maxdepth)
return;
QSettings s;
s.beginGroup(group);
s.setValue("gf_low_at_maxdepth", value);
prefs.gf_low_at_maxdepth = value;
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
emit gfLowAtMaxDepthChanged(value);
}
void TechnicalDetailsSettings::setDisplayUnusedTanks(bool value)
{
if (value == prefs.display_unused_tanks)
@ -2244,7 +2227,7 @@ void SettingsObjectWrapper::load()
GET_BOOL("show_ccr_setpoint",show_ccr_setpoint);
GET_BOOL("show_ccr_sensors",show_ccr_sensors);
GET_BOOL("zoomed_plot", zoomed_plot);
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
set_gf(prefs.gflow, prefs.gfhigh);
set_vpmb_conservatism(prefs.vpmb_conservatism);
GET_BOOL("show_sac", show_sac);
GET_BOOL("display_unused_tanks", display_unused_tanks);

View file

@ -133,7 +133,6 @@ class TechnicalDetailsSettings : public QObject {
Q_PROPERTY(bool show_ccr_sensors READ showCCRSensors WRITE setShowCCRSensors NOTIFY showCCRSensorsChanged)
Q_PROPERTY(bool zoomed_plot READ zoomedPlot WRITE setZoomedPlot NOTIFY zoomedPlotChanged)
Q_PROPERTY(bool show_sac READ showSac WRITE setShowSac NOTIFY showSacChanged)
Q_PROPERTY(bool gf_low_at_maxdepth READ gfLowAtMaxDepth WRITE setGfLowAtMaxDepth NOTIFY gfLowAtMaxDepthChanged)
Q_PROPERTY(bool display_unused_tanks READ displayUnusedTanks WRITE setDisplayUnusedTanks NOTIFY displayUnusedTanksChanged)
Q_PROPERTY(bool show_average_depth READ showAverageDepth WRITE setShowAverageDepth NOTIFY showAverageDepthChanged)
Q_PROPERTY(bool show_pictures_in_profile READ showPicturesInProfile WRITE setShowPicturesInProfile NOTIFY showPicturesInProfileChanged)
@ -163,7 +162,6 @@ public:
bool showCCRSensors() const;
bool zoomedPlot() const;
bool showSac() const;
bool gfLowAtMaxDepth() const;
bool displayUnusedTanks() const;
bool showAverageDepth() const;
bool showPicturesInProfile() const;
@ -191,7 +189,6 @@ public slots:
void setShowCCRSensors(bool value);
void setZoomedPlot(bool value);
void setShowSac(bool value);
void setGfLowAtMaxDepth(bool value);
void setDisplayUnusedTanks(bool value);
void setShowAverageDepth(bool value);
void setShowPicturesInProfile(bool value);

View file

@ -38,7 +38,6 @@ void PreferencesGraph::refreshSettings()
ui->gflow->setValue(prefs.gflow);
ui->gfhigh->setValue(prefs.gfhigh);
ui->vpmb_conservatism->setValue(prefs.vpmb_conservatism);
ui->gf_low_at_maxdepth->setChecked(prefs.gf_low_at_maxdepth);
ui->show_ccr_setpoint->setChecked(prefs.show_ccr_setpoint);
ui->show_ccr_sensors->setChecked(prefs.show_ccr_sensors);
ui->defaultSetpoint->setValue((double)prefs.defaultsetpoint / 1000.0);
@ -69,7 +68,6 @@ void PreferencesGraph::syncSettings()
tech->setGflow(ui->gflow->value());
tech->setGfhigh(ui->gfhigh->value());
tech->setVpmbConservatism(ui->vpmb_conservatism->value());
tech->setGfLowAtMaxDepth(ui->gf_low_at_maxdepth->isChecked());
tech->setShowCCRSetpoint(ui->show_ccr_setpoint->isChecked());
tech->setShowCCRSensors(ui->show_ccr_sensors->isChecked());
tech->setDisplayUnusedTanks(ui->display_unused_tanks->isChecked());
@ -93,7 +91,6 @@ void PreferencesGraph::on_buehlmann_toggled(bool buehlmann)
ui->gflow->setEnabled(buehlmann);
ui->label_GFhigh->setEnabled(buehlmann);
ui->label_GFlow->setEnabled(buehlmann);
ui->gf_low_at_maxdepth->setEnabled(buehlmann);
ui->vpmb_conservatism->setEnabled(!buehlmann);
ui->label_VPMB->setEnabled(!buehlmann);
}

View file

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>650</width>
<width>655</width>
<height>634</height>
</rect>
</property>
@ -178,23 +178,23 @@
<string>Ceiling display setup</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="2" column="1">
<widget class="QLabel" name="label_VPMB">
<item row="3" column="3">
<widget class="QLabel" name="label_GFhigh">
<property name="text">
<string>Conservatism level</string>
<string>GFHigh</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_22">
<property name="enabled">
<bool>true</bool>
<item row="4" column="4">
<widget class="QSpinBox" name="pscrfactor">
<property name="suffix">
<string/>
</property>
<property name="text">
<string>Algorithm for calculated ceiling:</string>
<property name="prefix">
<string>1:</string>
</property>
</widget>
</item>
@ -208,46 +208,26 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="red_ceiling">
<item row="1" column="0">
<widget class="QLabel" name="label_22">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Draw dive computer reported ceiling red</string>
<string>Algorithm for calculated ceiling:</string>
</property>
</widget>
</item>
<item row="5" column="4">
<widget class="QSpinBox" name="pscrfactor">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>1:</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="label_GFhigh">
<item row="4" column="3">
<widget class="QLabel" name="label_28">
<property name="text">
<string>GFHigh</string>
<string>Dilution ratio</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QDoubleSpinBox" name="psro2rate">
<property name="suffix">
<string>/min</string>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QSpinBox" name="gflow">
<property name="suffix">
@ -261,33 +241,16 @@
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="MetabolicRate">
<item row="2" column="1">
<widget class="QLabel" name="label_VPMB">
<property name="text">
<string>Metabolic rate O₂</string>
<string>Conservatism level</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_28">
<property name="text">
<string>Dilution ratio</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="2" colspan="2">
<widget class="QCheckBox" name="gf_low_at_maxdepth">
<property name="text">
<string>GFLow at max. depth</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="vpmb_conservatism">
<property name="prefix">
@ -301,10 +264,33 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="pSCR">
<item row="4" column="1">
<widget class="QLabel" name="MetabolicRate">
<property name="text">
<string>pSCR options:</string>
<string>Metabolic rate O₂</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QCheckBox" name="red_ceiling">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Draw dive computer reported ceiling red</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QDoubleSpinBox" name="psro2rate">
<property name="suffix">
<string>/min</string>
</property>
<property name="decimals">
<number>3</number>
</property>
</widget>
</item>
@ -328,6 +314,13 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="pSCR">
<property name="text">
<string>pSCR options:</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_GFlow">
<property name="text">
@ -394,7 +387,6 @@
<tabstop>buehlmann</tabstop>
<tabstop>gflow</tabstop>
<tabstop>gfhigh</tabstop>
<tabstop>gf_low_at_maxdepth</tabstop>
<tabstop>psro2rate</tabstop>
<tabstop>pscrfactor</tabstop>
<tabstop>display_unused_tanks</tabstop>

View file

@ -208,7 +208,7 @@ void DivePlannerPointsModel::setPlanMode(Mode m)
// the planner may reset our GF settings that are used to show deco
// reset them to what's in the preferences
if (m != PLAN) {
set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth);
set_gf(prefs.gflow, prefs.gfhigh);
set_vpmb_conservatism(prefs.vpmb_conservatism);
}
}

View file

@ -132,8 +132,6 @@ void TestPreferences::testPreferences()
TEST(tecDetails->zoomedPlot(), true);
tecDetails->setShowSac(true);
TEST(tecDetails->showSac(), true);
tecDetails->setGfLowAtMaxDepth(true);
TEST(tecDetails->gfLowAtMaxDepth(), true);
tecDetails->setDisplayUnusedTanks(true);
TEST(tecDetails->displayUnusedTanks(), true);
tecDetails->setShowAverageDepth(true);
@ -175,8 +173,6 @@ void TestPreferences::testPreferences()
TEST(tecDetails->zoomedPlot(), false);
tecDetails->setShowSac(false);
TEST(tecDetails->showSac(), false);
tecDetails->setGfLowAtMaxDepth(false);
TEST(tecDetails->gfLowAtMaxDepth(), false);
tecDetails->setDisplayUnusedTanks(false);
TEST(tecDetails->displayUnusedTanks(), false);
tecDetails->setShowAverageDepth(false);