mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:43:24 +00:00
Support different salinity in planner
Depth is often mentioned in a length unit, but what we care about is pressure. When diving in fresh water the pressure is lower than the same depth in salt water. This adds support for using different salinities in planning. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
1617d437d4
commit
a06befc007
5 changed files with 86 additions and 29 deletions
1
dive.h
1
dive.h
|
@ -766,6 +766,7 @@ struct diveplan {
|
||||||
int surface_pressure; /* mbar */
|
int surface_pressure; /* mbar */
|
||||||
int bottomsac; /* ml/min */
|
int bottomsac; /* ml/min */
|
||||||
int decosac; /* ml/min */
|
int decosac; /* ml/min */
|
||||||
|
int salinity;
|
||||||
short gflow;
|
short gflow;
|
||||||
short gfhigh;
|
short gfhigh;
|
||||||
struct divedatapoint *dp;
|
struct divedatapoint *dp;
|
||||||
|
|
|
@ -259,6 +259,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
|
||||||
printf("in create_dive_from_plan\n");
|
printf("in create_dive_from_plan\n");
|
||||||
dump_plan(diveplan);
|
dump_plan(diveplan);
|
||||||
#endif
|
#endif
|
||||||
|
displayed_dive.salinity = diveplan->salinity;
|
||||||
// reset the cylinders and clear out the samples and events of the
|
// reset the cylinders and clear out the samples and events of the
|
||||||
// displayed dive so we can restart
|
// displayed dive so we can restart
|
||||||
reset_cylinders(&displayed_dive, track_gas);
|
reset_cylinders(&displayed_dive, track_gas);
|
||||||
|
|
|
@ -297,6 +297,7 @@ DivePlannerWidget::DivePlannerWidget(QWidget *parent, Qt::WindowFlags f) : QWidg
|
||||||
connect(ui.dateEdit, SIGNAL(dateChanged(QDate)), plannerModel, SLOT(setStartDate(QDate)));
|
connect(ui.dateEdit, SIGNAL(dateChanged(QDate)), plannerModel, SLOT(setStartDate(QDate)));
|
||||||
connect(ui.ATMPressure, SIGNAL(valueChanged(int)), this, SLOT(atmPressureChanged(int)));
|
connect(ui.ATMPressure, SIGNAL(valueChanged(int)), this, SLOT(atmPressureChanged(int)));
|
||||||
connect(ui.atmHeight, SIGNAL(valueChanged(int)), this, SLOT(heightChanged(int)));
|
connect(ui.atmHeight, SIGNAL(valueChanged(int)), this, SLOT(heightChanged(int)));
|
||||||
|
connect(ui.salinity, SIGNAL(valueChanged(double)), this, SLOT(salinityChanged(double)));
|
||||||
connect(DivePlannerPointsModel::instance(), SIGNAL(startTimeChanged(QDateTime)), this, SLOT(setupStartTime(QDateTime)));
|
connect(DivePlannerPointsModel::instance(), SIGNAL(startTimeChanged(QDateTime)), this, SLOT(setupStartTime(QDateTime)));
|
||||||
|
|
||||||
// Creating (and canceling) the plan
|
// Creating (and canceling) the plan
|
||||||
|
@ -367,6 +368,12 @@ void DivePlannerWidget::heightChanged(const int height)
|
||||||
plannerModel->setSurfacePressure(pressure);
|
plannerModel->setSurfacePressure(pressure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivePlannerWidget::salinityChanged(const double salinity)
|
||||||
|
{
|
||||||
|
/* Salinity is expressed in weight in grams per 10l */
|
||||||
|
plannerModel->setSalinity(10000 * salinity);
|
||||||
|
}
|
||||||
|
|
||||||
void PlannerSettingsWidget::bottomSacChanged(const double bottomSac)
|
void PlannerSettingsWidget::bottomSacChanged(const double bottomSac)
|
||||||
{
|
{
|
||||||
plannerModel->setBottomSac(bottomSac);
|
plannerModel->setBottomSac(bottomSac);
|
||||||
|
@ -786,6 +793,12 @@ void DivePlannerPointsModel::setSurfacePressure(int pressure)
|
||||||
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivePlannerPointsModel::setSalinity(int salinity)
|
||||||
|
{
|
||||||
|
diveplan.salinity = salinity;
|
||||||
|
emit dataChanged(createIndex(0, 0), createIndex(rowCount() - 1, COLUMNS - 1));
|
||||||
|
}
|
||||||
|
|
||||||
int DivePlannerPointsModel::getSurfacePressure()
|
int DivePlannerPointsModel::getSurfacePressure()
|
||||||
{
|
{
|
||||||
return diveplan.surface_pressure;
|
return diveplan.surface_pressure;
|
||||||
|
|
|
@ -70,6 +70,7 @@ slots:
|
||||||
void setGFLow(const int ghflow);
|
void setGFLow(const int ghflow);
|
||||||
void triggerGFLow();
|
void triggerGFLow();
|
||||||
void setSurfacePressure(int pressure);
|
void setSurfacePressure(int pressure);
|
||||||
|
void setSalinity(int salinity);
|
||||||
int getSurfacePressure();
|
int getSurfacePressure();
|
||||||
void setBottomSac(double sac);
|
void setBottomSac(double sac);
|
||||||
void setDecoSac(double sac);
|
void setDecoSac(double sac);
|
||||||
|
@ -146,6 +147,7 @@ slots:
|
||||||
void settingsChanged();
|
void settingsChanged();
|
||||||
void atmPressureChanged(const int pressure);
|
void atmPressureChanged(const int pressure);
|
||||||
void heightChanged(const int height);
|
void heightChanged(const int height);
|
||||||
|
void salinityChanged(const double salinity);
|
||||||
void printDecoPlan();
|
void printDecoPlan();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="6" column="0" colspan="2">
|
<item row="5" column="0" colspan="3">
|
||||||
<widget class="TableView" name="tableWidget" native="true">
|
<widget class="TableView" name="tableWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0" colspan="2">
|
<item row="4" column="0" colspan="3">
|
||||||
<widget class="TableView" name="cylinderTableWidget" native="true">
|
<widget class="TableView" name="cylinderTableWidget" native="true">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
@ -110,7 +110,30 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QDateEdit" name="dateEdit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="calendarPopup">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
|
<widget class="QTimeEdit" name="startTime">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
@ -123,33 +146,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
|
||||||
<layout class="QHBoxLayout" name="dateAndTime">
|
|
||||||
<item>
|
|
||||||
<widget class="QDateEdit" name="dateEdit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="calendarPopup">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTimeEdit" name="startTime">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -164,8 +160,21 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Salinity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1">
|
||||||
<widget class="QSpinBox" name="ATMPressure">
|
<widget class="QSpinBox" name="ATMPressure">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string>mbar</string>
|
<string>mbar</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -179,6 +188,12 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QSpinBox" name="atmHeight">
|
<widget class="QSpinBox" name="atmHeight">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
<property name="suffix">
|
<property name="suffix">
|
||||||
<string>m</string>
|
<string>m</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -193,6 +208,31 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QDoubleSpinBox" name="salinity">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> kg/ℓ</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>1.050000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<double>0.010000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>1.030000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Add table
Reference in a new issue