mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Merge branch 'boyle-ready' of https://github.com/Slagvi/subsurface
Fixed merge conflicts in deco.c dive.h planner.c Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
commit
d93984448c
10 changed files with 345 additions and 207 deletions
130
deco.c
130
deco.c
|
@ -37,14 +37,14 @@ struct buehlmann_config buehlmann_config = { 1.0, 1.01, 0, 0.75, 0.35, 1.0, fals
|
|||
struct vpmb_config {
|
||||
double crit_radius_N2; //! Critical radius of N2 nucleon (microns).
|
||||
double crit_radius_He; //! Critical radius of He nucleon (microns).
|
||||
double crit_volume_lambda; //! Constant corresponding to critical gas volume (bar-min).
|
||||
double crit_volume_lambda; //! Constant corresponding to critical gas volume (bar * min).
|
||||
double gradient_of_imperm; //! Gradient after which bubbles become impermeable (bar).
|
||||
double surface_tension_gamma; //! Nucleons surface tension constant.
|
||||
double skin_compression_gammaC; //! Skin compression gammaC.
|
||||
double surface_tension_gamma; //! Nucleons surface tension constant (N / 10m).
|
||||
double skin_compression_gammaC; //! Skin compression gammaC (N / 10m).
|
||||
double regeneration_time; //! Time needed for the bubble to regenerate to the start radius (min).
|
||||
double other_gases_pressure; //! Always present pressure of other gasses in tissues (bar).
|
||||
};
|
||||
struct vpmb_config vpmb_config = { 0.8, 0.7, 230.284, 8.2, 0.179, 2.57, 20160, 0.1359888 };
|
||||
struct vpmb_config vpmb_config = { 0.55, 0.45, 230.284, 8.2, 0.179, 2.57, 20160, 0.1359888 };
|
||||
|
||||
const double buehlmann_N2_a[] = { 1.1696, 1.0, 0.8618, 0.7562,
|
||||
0.62, 0.5043, 0.441, 0.4,
|
||||
|
@ -90,8 +90,11 @@ const double buehlmann_He_factor_expositon_one_second[] = {
|
|||
1.00198406028040E-004, 7.83611475491108E-005, 6.13689891868496E-005, 4.81280465299827E-005
|
||||
};
|
||||
|
||||
const double conservatism_lvls[] = { 1.0, 1.05, 1.12, 1.22, 1.35 };
|
||||
|
||||
#define WV_PRESSURE 0.0627 // water vapor pressure in bar
|
||||
#define DECO_STOPS_MULTIPLIER_MM 3000.0
|
||||
#define NITROGEN_FRACTION 0.79
|
||||
|
||||
double tissue_n2_sat[16];
|
||||
double tissue_he_sat[16];
|
||||
|
@ -115,6 +118,25 @@ double allowable_n2_gradient[16];
|
|||
double allowable_he_gradient[16];
|
||||
double total_gradient[16];
|
||||
|
||||
double bottom_n2_gradient[16];
|
||||
double bottom_he_gradient[16];
|
||||
|
||||
double initial_n2_gradient[16];
|
||||
double initial_he_gradient[16];
|
||||
|
||||
double get_crit_radius_He()
|
||||
{
|
||||
if (prefs.conservatism_level <= 4)
|
||||
return vpmb_config.crit_radius_He * conservatism_lvls[prefs.conservatism_level];
|
||||
return vpmb_config.crit_radius_He;
|
||||
}
|
||||
|
||||
double get_crit_radius_N2()
|
||||
{
|
||||
if (prefs.conservatism_level <= 4)
|
||||
return vpmb_config.crit_radius_N2 * conservatism_lvls[prefs.conservatism_level];
|
||||
return vpmb_config.crit_radius_N2;
|
||||
}
|
||||
|
||||
static double tissue_tolerance_calc(const struct dive *dive)
|
||||
{
|
||||
|
@ -223,38 +245,106 @@ double he_factor(int period_in_seconds, int ci)
|
|||
return cache[ci].last_factor;
|
||||
}
|
||||
|
||||
double calc_surface_phase(double surface_pressure, double he_pressure, double n2_pressure, double he_time_constant, double n2_time_constant)
|
||||
{
|
||||
double inspired_n2 = (surface_pressure - WV_PRESSURE) * NITROGEN_FRACTION;
|
||||
|
||||
if (n2_pressure > inspired_n2)
|
||||
return (he_pressure / he_time_constant + (n2_pressure - inspired_n2) / n2_time_constant) / (he_pressure + n2_pressure - inspired_n2);
|
||||
|
||||
if (he_pressure + n2_pressure >= inspired_n2){
|
||||
double gradient_decay_time = 1.0 / (n2_time_constant - he_time_constant) * log ((inspired_n2 - n2_pressure) / he_pressure);
|
||||
double gradients_integral = he_pressure / he_time_constant * (1.0 - exp(-he_time_constant * gradient_decay_time)) + (n2_pressure - inspired_n2) / n2_time_constant * (1.0 - exp(-n2_time_constant * gradient_decay_time));
|
||||
return gradients_integral / (he_pressure + n2_pressure - inspired_n2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool is_vpmb_ok(double pressure)
|
||||
{
|
||||
int ci;
|
||||
double gradient;
|
||||
double gas_tension;
|
||||
|
||||
for (ci = 0; ci < 16; ++ci) {
|
||||
gas_tension = tissue_n2_sat[ci] + tissue_he_sat[ci] + vpmb_config.other_gases_pressure;
|
||||
gradient = gas_tension - pressure;
|
||||
if (gradient > total_gradient[ci])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void vpmb_start_gradient()
|
||||
{
|
||||
int ci;
|
||||
double gradient_n2, gradient_he;
|
||||
|
||||
for (ci = 0; ci < 16; ++ci) {
|
||||
allowable_n2_gradient[ci] = 2.0 * (vpmb_config.surface_tension_gamma / vpmb_config.skin_compression_gammaC) * ((vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma) / n2_regen_radius[ci]);
|
||||
allowable_he_gradient[ci] = 2.0 * (vpmb_config.surface_tension_gamma / vpmb_config.skin_compression_gammaC) * ((vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma) / he_regen_radius[ci]);
|
||||
initial_n2_gradient[ci] = bottom_n2_gradient[ci] = allowable_n2_gradient[ci] = 2.0 * (vpmb_config.surface_tension_gamma / vpmb_config.skin_compression_gammaC) * ((vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma) / n2_regen_radius[ci]);
|
||||
initial_he_gradient[ci] = bottom_he_gradient[ci] = allowable_he_gradient[ci] = 2.0 * (vpmb_config.surface_tension_gamma / vpmb_config.skin_compression_gammaC) * ((vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma) / he_regen_radius[ci]);
|
||||
|
||||
total_gradient[ci] = ((allowable_n2_gradient[ci] * tissue_n2_sat[ci]) + (allowable_he_gradient[ci] * tissue_he_sat[ci])) / (tissue_n2_sat[ci] + tissue_he_sat[ci]);
|
||||
}
|
||||
}
|
||||
|
||||
void vpmb_next_gradient(double deco_time)
|
||||
void vpmb_next_gradient(double deco_time, double surface_pressure)
|
||||
{
|
||||
int ci;
|
||||
double gradient_n2, gradient_he;
|
||||
double n2_b, n2_c;
|
||||
double he_b, he_c;
|
||||
deco_time /= 60.0 ;
|
||||
double desat_time;
|
||||
deco_time /= 60.0;
|
||||
|
||||
for (ci = 0; ci < 16; ++ci) {
|
||||
n2_b = allowable_n2_gradient[ci] + ((vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_N2_t_halflife[ci] * 60.0 / log(2.0))));
|
||||
he_b = allowable_he_gradient[ci] + ((vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_He_t_halflife[ci] * 60.0 / log(2.0))));
|
||||
desat_time = deco_time + calc_surface_phase(surface_pressure, tissue_he_sat[ci], tissue_n2_sat[ci], log(2.0) / buehlmann_He_t_halflife[ci], log(2.0) / buehlmann_N2_t_halflife[ci]);
|
||||
|
||||
n2_b = initial_n2_gradient[ci] + (vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * desat_time);
|
||||
he_b = initial_he_gradient[ci] + (vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * desat_time);
|
||||
|
||||
n2_c = vpmb_config.surface_tension_gamma * vpmb_config.surface_tension_gamma * vpmb_config.crit_volume_lambda * max_n2_crushing_pressure[ci];
|
||||
n2_c = n2_c / (vpmb_config.skin_compression_gammaC * vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_N2_t_halflife[ci] * 60.0 / log(2.0)));
|
||||
n2_c = n2_c / (vpmb_config.skin_compression_gammaC * vpmb_config.skin_compression_gammaC * desat_time);
|
||||
he_c = vpmb_config.surface_tension_gamma * vpmb_config.surface_tension_gamma * vpmb_config.crit_volume_lambda * max_he_crushing_pressure[ci];
|
||||
he_c = he_c / (vpmb_config.skin_compression_gammaC * vpmb_config.skin_compression_gammaC * (deco_time + buehlmann_He_t_halflife[ci] * 60.0 / log(2.0)));
|
||||
he_c = he_c / (vpmb_config.skin_compression_gammaC * vpmb_config.skin_compression_gammaC * desat_time);
|
||||
|
||||
allowable_n2_gradient[ci] = 0.5 * ( n2_b + sqrt(n2_b * n2_b - 4.0 * n2_c));
|
||||
allowable_he_gradient[ci] = 0.5 * ( he_b + sqrt(he_b * he_b - 4.0 * he_c));
|
||||
bottom_n2_gradient[ci] = allowable_n2_gradient[ci] = 0.5 * ( n2_b + sqrt(n2_b * n2_b - 4.0 * n2_c));
|
||||
bottom_he_gradient[ci] = allowable_he_gradient[ci] = 0.5 * ( he_b + sqrt(he_b * he_b - 4.0 * he_c));
|
||||
|
||||
total_gradient[ci] = ((allowable_n2_gradient[ci] * tissue_n2_sat[ci]) + (allowable_he_gradient[ci] * tissue_he_sat[ci])) / (tissue_n2_sat[ci] + tissue_he_sat[ci]);
|
||||
}
|
||||
}
|
||||
|
||||
double update_gradient(double first_stop_pressure, double next_stop_pressure, double first_gradient)
|
||||
{
|
||||
double first_radius = 2.0 * vpmb_config.surface_tension_gamma / first_gradient;
|
||||
double A = next_stop_pressure;
|
||||
double B = -2.0 * vpmb_config.surface_tension_gamma;
|
||||
double C = (first_stop_pressure + 2.0 * vpmb_config.surface_tension_gamma / first_radius) * pow(first_radius, 3.0);
|
||||
|
||||
double low = first_radius;
|
||||
double high = first_radius * pow(first_stop_pressure / next_stop_pressure, (1.0/3.0));
|
||||
double next_radius;
|
||||
double value;
|
||||
int ci;
|
||||
for (ci = 0; ci < 100; ++ci){
|
||||
next_radius = (high + low) /2.0;
|
||||
value = A * pow(next_radius, 3.0) - B * next_radius * next_radius - C;
|
||||
if (value < 0)
|
||||
low = next_radius;
|
||||
else
|
||||
high = next_radius;
|
||||
}
|
||||
return 2.0 * vpmb_config.surface_tension_gamma / next_radius;
|
||||
}
|
||||
|
||||
void boyles_law(double first_stop_pressure, double next_stop_pressure)
|
||||
{
|
||||
int ci;
|
||||
for (ci = 0; ci < 16; ++ci) {
|
||||
allowable_n2_gradient[ci] = update_gradient(first_stop_pressure, next_stop_pressure, bottom_n2_gradient[ci]);
|
||||
allowable_he_gradient[ci] = update_gradient(first_stop_pressure, next_stop_pressure, bottom_he_gradient[ci]);
|
||||
|
||||
total_gradient[ci] = ((allowable_n2_gradient[ci] * tissue_n2_sat[ci]) + (allowable_he_gradient[ci] * tissue_he_sat[ci])) / (tissue_n2_sat[ci] + tissue_he_sat[ci]);
|
||||
}
|
||||
|
@ -267,11 +357,11 @@ void nuclear_regeneration(double time)
|
|||
double crushing_radius_N2, crushing_radius_He;
|
||||
for (ci = 0; ci < 16; ++ci) {
|
||||
//rm
|
||||
crushing_radius_N2 = 1.0 / (max_n2_crushing_pressure[ci] / (2.0 * (vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma)) + 1.0 / vpmb_config.crit_radius_N2);
|
||||
crushing_radius_He = 1.0 / (max_he_crushing_pressure[ci] / (2.0 * (vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma)) + 1.0 / vpmb_config.crit_radius_He);
|
||||
crushing_radius_N2 = 1.0 / (max_n2_crushing_pressure[ci] / (2.0 * (vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma)) + 1.0 / get_crit_radius_N2());
|
||||
crushing_radius_He = 1.0 / (max_he_crushing_pressure[ci] / (2.0 * (vpmb_config.skin_compression_gammaC - vpmb_config.surface_tension_gamma)) + 1.0 / get_crit_radius_He());
|
||||
//rs
|
||||
n2_regen_radius[ci] = crushing_radius_N2 + (vpmb_config.crit_radius_N2 - crushing_radius_N2) * (1.0 - exp (-time / vpmb_config.regeneration_time));
|
||||
he_regen_radius[ci] = crushing_radius_He + (vpmb_config.crit_radius_He - crushing_radius_He) * (1.0 - exp (-time / vpmb_config.regeneration_time));
|
||||
n2_regen_radius[ci] = crushing_radius_N2 + (get_crit_radius_N2() - crushing_radius_N2) * (1.0 - exp (-time / vpmb_config.regeneration_time));
|
||||
he_regen_radius[ci] = crushing_radius_He + (get_crit_radius_He() - crushing_radius_He) * (1.0 - exp (-time / vpmb_config.regeneration_time));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -325,8 +415,8 @@ void calc_crushing_pressure(double pressure)
|
|||
if (max_ambient_pressure >= pressure)
|
||||
return;
|
||||
|
||||
n2_inner_pressure = calc_inner_pressure(vpmb_config.crit_radius_N2, crushing_onset_tension[ci], pressure);
|
||||
he_inner_pressure = calc_inner_pressure(vpmb_config.crit_radius_He, crushing_onset_tension[ci], pressure);
|
||||
n2_inner_pressure = calc_inner_pressure(get_crit_radius_N2(), crushing_onset_tension[ci], pressure);
|
||||
he_inner_pressure = calc_inner_pressure(get_crit_radius_He(), crushing_onset_tension[ci], pressure);
|
||||
|
||||
n2_crushing_pressure = pressure - n2_inner_pressure;
|
||||
he_crushing_pressure = pressure - he_inner_pressure;
|
||||
|
|
4
dive.h
4
dive.h
|
@ -800,7 +800,9 @@ extern void cache_deco_state(double, char **datap);
|
|||
extern double restore_deco_state(char *data);
|
||||
extern void nuclear_regeneration(double time);
|
||||
extern void vpmb_start_gradient();
|
||||
extern void vpmb_next_gradient(double deco_time);
|
||||
extern void vpmb_next_gradient(double deco_time, double surface_pressure);
|
||||
extern bool is_vpmb_ok(double pressure);
|
||||
extern void boyles_law(double first_stop_pressure, double next_stop_pressure);
|
||||
|
||||
/* this should be converted to use our types */
|
||||
struct divedatapoint {
|
||||
|
|
15
planner.c
15
planner.c
|
@ -892,6 +892,10 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time
|
|||
clear_to_ascend = false;
|
||||
break;
|
||||
}
|
||||
if (prefs.deco_mode == VPMB && (!is_vpmb_ok(depth_to_mbar(trial_depth - deltad, &displayed_dive) / 1000.0))){
|
||||
clear_to_ascend = false;
|
||||
break;
|
||||
}
|
||||
trial_depth -= deltad;
|
||||
}
|
||||
restore_deco_state(trial_cache);
|
||||
|
@ -923,6 +927,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
|||
int bottom_depth;
|
||||
int bottom_gi;
|
||||
int bottom_stopidx;
|
||||
int first_stop_pressure;
|
||||
bool is_final_plan = true;
|
||||
int deco_time;
|
||||
int previous_deco_time;
|
||||
|
@ -1102,6 +1107,9 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
|||
//CVA
|
||||
do {
|
||||
is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10); // CVA time converges
|
||||
if (deco_time != 10000000)
|
||||
vpmb_next_gradient(deco_time, diveplan->surface_pressure / 1000.0);
|
||||
|
||||
previous_deco_time = deco_time;
|
||||
restore_deco_state(bottom_cache);
|
||||
|
||||
|
@ -1115,12 +1123,12 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
|||
breaktime = -1;
|
||||
breakcylinder = 0;
|
||||
o2time = 0;
|
||||
first_stop_pressure = 0;
|
||||
last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
|
||||
if ((current_cylinder = get_gasidx(&displayed_dive, &gas)) == -1) {
|
||||
report_error(translate("gettextFromC", "Can't find gas %s"), gasname(&gas));
|
||||
current_cylinder = 0;
|
||||
}
|
||||
vpmb_next_gradient(deco_time);
|
||||
|
||||
while (1) {
|
||||
/* We will break out when we hit the surface */
|
||||
|
@ -1204,6 +1212,11 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
|
|||
plan_add_segment(diveplan, clock - previous_point_time, depth, gas, po2, false);
|
||||
previous_point_time = clock;
|
||||
stopping = true;
|
||||
|
||||
// Boyles Law compensation
|
||||
if (first_stop_pressure == 0)
|
||||
first_stop_pressure = depth_to_mbar(depth, &displayed_dive);
|
||||
boyles_law(first_stop_pressure / 1000.0, depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0);
|
||||
}
|
||||
|
||||
/* Are we waiting to switch gas?
|
||||
|
|
1
pref.h
1
pref.h
|
@ -117,6 +117,7 @@ struct preferences {
|
|||
bool cloud_background_sync;
|
||||
geocoding_prefs_t geocoding;
|
||||
enum deco_mode deco_mode;
|
||||
short conservatism_level;
|
||||
};
|
||||
enum unit_system_values {
|
||||
METRIC,
|
||||
|
|
|
@ -397,6 +397,12 @@ void DivePlannerPointsModel::triggerGFLow()
|
|||
}
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setConservatism(int level)
|
||||
{
|
||||
prefs.conservatism_level = level;
|
||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||
}
|
||||
|
||||
void DivePlannerPointsModel::setSurfacePressure(int pressure)
|
||||
{
|
||||
diveplan.surface_pressure = pressure;
|
||||
|
|
|
@ -65,6 +65,7 @@ slots:
|
|||
void triggerGFHigh();
|
||||
void setGFLow(const int ghflow);
|
||||
void triggerGFLow();
|
||||
void setConservatism(int level);
|
||||
void setSurfacePressure(int pressure);
|
||||
void setSalinity(int salinity);
|
||||
int getSurfacePressure();
|
||||
|
|
|
@ -217,32 +217,37 @@ void PlannerSettingsWidget::decoSacChanged(const double decosac)
|
|||
plannerModel->setDecoSac(decosac);
|
||||
}
|
||||
|
||||
void PlannerSettingsWidget::disableDecoElements(bool value)
|
||||
void PlannerSettingsWidget::disableDecoElements(int mode)
|
||||
{
|
||||
if (prefs.deco_mode == RECREATIONAL) {
|
||||
ui.lastStop->setDisabled(value);
|
||||
ui.backgasBreaks->setDisabled(value);
|
||||
ui.bottompo2->setDisabled(value);
|
||||
ui.decopo2->setDisabled(value);
|
||||
ui.reserve_gas->setDisabled(!value);
|
||||
if (mode == RECREATIONAL) {
|
||||
ui.gflow->setDisabled(false);
|
||||
ui.gfhigh->setDisabled(false);
|
||||
ui.lastStop->setDisabled(true);
|
||||
ui.backgasBreaks->setDisabled(true);
|
||||
ui.bottompo2->setDisabled(true);
|
||||
ui.decopo2->setDisabled(true);
|
||||
ui.reserve_gas->setDisabled(false);
|
||||
ui.conservatism_lvl->setDisabled(true);
|
||||
}
|
||||
else if (prefs.deco_mode == VPMB) {
|
||||
ui.gflow->setDisabled(value);
|
||||
ui.gfhigh->setDisabled(value);
|
||||
ui.lastStop->setDisabled(!value);
|
||||
ui.backgasBreaks->setDisabled(!value);
|
||||
ui.bottompo2->setDisabled(!value);
|
||||
ui.decopo2->setDisabled(!value);
|
||||
ui.reserve_gas->setDisabled(value);
|
||||
else if (mode == VPMB) {
|
||||
ui.gflow->setDisabled(true);
|
||||
ui.gfhigh->setDisabled(true);
|
||||
ui.lastStop->setDisabled(false);
|
||||
ui.backgasBreaks->setDisabled(false);
|
||||
ui.bottompo2->setDisabled(false);
|
||||
ui.decopo2->setDisabled(false);
|
||||
ui.reserve_gas->setDisabled(true);
|
||||
ui.conservatism_lvl->setDisabled(false);
|
||||
}
|
||||
else if (prefs.deco_mode == BUEHLMANN) {
|
||||
ui.gflow->setDisabled(!value);
|
||||
ui.gfhigh->setDisabled(!value);
|
||||
ui.lastStop->setDisabled(!value);
|
||||
ui.backgasBreaks->setDisabled(!value);
|
||||
ui.bottompo2->setDisabled(!value);
|
||||
ui.decopo2->setDisabled(!value);
|
||||
ui.reserve_gas->setDisabled(value);
|
||||
else if (mode == BUEHLMANN) {
|
||||
ui.gflow->setDisabled(false);
|
||||
ui.gfhigh->setDisabled(false);
|
||||
ui.lastStop->setDisabled(false);
|
||||
ui.backgasBreaks->setDisabled(false);
|
||||
ui.bottompo2->setDisabled(false);
|
||||
ui.decopo2->setDisabled(false);
|
||||
ui.reserve_gas->setDisabled(true);
|
||||
ui.conservatism_lvl->setDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,6 +284,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
prefs.drop_stone_mode = s.value("drop_stone_mode", prefs.drop_stone_mode).toBool();
|
||||
prefs.bottomsac = s.value("bottomsac", prefs.bottomsac).toInt();
|
||||
prefs.decosac = s.value("decosac", prefs.decosac).toInt();
|
||||
prefs.conservatism_level = s.value("conservatism", prefs.conservatism_level).toInt();
|
||||
plannerModel->getDiveplan().bottomsac = prefs.bottomsac;
|
||||
plannerModel->getDiveplan().decosac = prefs.decosac;
|
||||
s.endGroup();
|
||||
|
@ -300,6 +306,8 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
ui.recreational_deco->setChecked(prefs.deco_mode == RECREATIONAL);
|
||||
ui.buehlmann_deco->setChecked(prefs.deco_mode == BUEHLMANN);
|
||||
ui.vpmb_deco->setChecked(prefs.deco_mode == VPMB);
|
||||
ui.conservatism_lvl->setValue(prefs.conservatism_level);
|
||||
disableDecoElements((int) prefs.deco_mode);
|
||||
|
||||
// should be the same order as in dive_comp_type!
|
||||
rebreather_modes << tr("Open circuit") << tr("CCR") << tr("pSCR");
|
||||
|
@ -341,11 +349,12 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
|||
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
|
||||
connect(ui.gfhigh, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFHigh()));
|
||||
connect(ui.gflow, SIGNAL(editingFinished()), plannerModel, SLOT(triggerGFLow()));
|
||||
connect(ui.conservatism_lvl, SIGNAL(valueChanged(int)), plannerModel, SLOT(setConservatism(int)));
|
||||
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
|
||||
connect(ui.switch_at_req_stop, SIGNAL(toggled(bool)), plannerModel, SLOT(setSwitchAtReqStop(bool)));
|
||||
connect(ui.min_switch_duration, SIGNAL(valueChanged(int)), plannerModel, SLOT(setMinSwitchDuration(int)));
|
||||
connect(ui.rebreathermode, SIGNAL(currentIndexChanged(int)), plannerModel, SLOT(setRebreatherMode(int)));
|
||||
connect(plannerModel, SIGNAL(recreationChanged(bool)), this, SLOT(disableDecoElements(bool)));
|
||||
connect(modeMapper, SIGNAL(mapped(int)), this, SLOT(disableDecoElements(int)));
|
||||
|
||||
settingsChanged();
|
||||
ui.gflow->setValue(prefs.gflow);
|
||||
|
@ -389,6 +398,7 @@ PlannerSettingsWidget::~PlannerSettingsWidget()
|
|||
s.setValue("bottomsac", prefs.bottomsac);
|
||||
s.setValue("decosac", prefs.decosac);
|
||||
s.setValue("deco_mode", int(prefs.deco_mode));
|
||||
s.setValue("conservatism", prefs.conservatism_level);
|
||||
s.endGroup();
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ slots:
|
|||
void setBottomPo2(double po2);
|
||||
void setDecoPo2(double po2);
|
||||
void setBackgasBreaks(bool dobreaks);
|
||||
void disableDecoElements(bool value);
|
||||
void disableDecoElements(int mode);
|
||||
|
||||
private:
|
||||
Ui::plannerSettingsWidget ui;
|
||||
|
|
|
@ -255,165 +255,6 @@
|
|||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item row="17" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Min. switch duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<widget class="QComboBox" name="rebreathermode">
|
||||
<property name="currentText">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QSpinBox" name="gflow">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="drop_stone_mode">
|
||||
<property name="text">
|
||||
<string>Drop to first depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="lastStop">
|
||||
<property name="text">
|
||||
<string>Last stop at 6m</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="recreational_deco">
|
||||
<property name="text">
|
||||
<string>Recreational mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>GF low</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>26</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="backgasBreaks">
|
||||
<property name="text">
|
||||
<string>Plan backgas breaks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>GF high</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QSpinBox" name="gfhigh">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="switch_at_req_stop">
|
||||
<property name="toolTip">
|
||||
<string>Postpone gas change if a stop is not required</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Only switch at required stops</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="17" column="2">
|
||||
<widget class="QSpinBox" name="min_switch_duration">
|
||||
<property name="suffix">
|
||||
<string>min</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<widget class="QRadioButton" name="vpmb_deco">
|
||||
<property name="text">
|
||||
|
@ -460,6 +301,152 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="2">
|
||||
<widget class="QSpinBox" name="gfhigh">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="switch_at_req_stop">
|
||||
<property name="toolTip">
|
||||
<string>Postpone gas change if a stop is not required</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Only switch at required stops</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QLabel" name="label_15">
|
||||
<property name="text">
|
||||
<string>GF low</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>26</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="backgasBreaks">
|
||||
<property name="text">
|
||||
<string>Plan backgas breaks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<widget class="QLabel" name="label_16">
|
||||
<property name="text">
|
||||
<string>GF high</string>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>25</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="2">
|
||||
<widget class="QSpinBox" name="min_switch_duration">
|
||||
<property name="suffix">
|
||||
<string>min</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="lastStop">
|
||||
<property name="text">
|
||||
<string>Last stop at 6m</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QRadioButton" name="recreational_deco">
|
||||
<property name="text">
|
||||
<string>Recreational mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="1">
|
||||
<widget class="QComboBox" name="rebreathermode">
|
||||
<property name="currentText" stdset="0">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<widget class="QSpinBox" name="gflow">
|
||||
<property name="suffix">
|
||||
<string>%</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>150</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="14" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="drop_stone_mode">
|
||||
<property name="text">
|
||||
<string>Drop to first depth</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Min. switch duration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1" alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="safetystop">
|
||||
<property name="layoutDirection">
|
||||
|
@ -486,6 +473,33 @@
|
|||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Conservatism level</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="2">
|
||||
<widget class="QSpinBox" name="conservatism_lvl">
|
||||
<property name="maximum">
|
||||
<number>4</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -75,7 +75,8 @@ struct preferences default_prefs = {
|
|||
.tag_existing_dives = false,
|
||||
.category = { 0 }
|
||||
},
|
||||
.deco_mode = BUEHLMANN
|
||||
.deco_mode = BUEHLMANN,
|
||||
.conservatism_level = 0
|
||||
};
|
||||
|
||||
int run_survey;
|
||||
|
|
Loading…
Add table
Reference in a new issue