summaryrefslogtreecommitdiffstats
path: root/subsurface-core/dive.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2016-02-24 11:31:03 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-25 00:45:38 +0100
commit7ebc31c1ec15ef6b34c27b9c0f892a5a90b0eef3 (patch)
tree19876d62ecf2a50407802b980123a4a4d996c309 /subsurface-core/dive.c
parent82c003c914de17101ee8999ab3775e516cc76064 (diff)
downloadsubsurface-7ebc31c1ec15ef6b34c27b9c0f892a5a90b0eef3.tar.gz
gas pressures: do not use gas compressibility for cylinder naming
This actually didn't make a difference for the common case, since our simplified gas compressibility model had a compressibility factor of 1.0 up to 200 bar, and increased smoothly from there. As a result, the common 2400 and 3000 psi workpressures didn't really see an effect from this. Not taking compressibility into account does kind of make sense for cylinder naming, since the cylinder may be used for different gases with very different compressibility characteristics. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/dive.c')
-rw-r--r--subsurface-core/dive.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/subsurface-core/dive.c b/subsurface-core/dive.c
index b7beadce5..f6fbc3261 100644
--- a/subsurface-core/dive.c
+++ b/subsurface-core/dive.c
@@ -973,10 +973,15 @@ void sanitize_gasmix(struct gasmix *mix)
/*
* See if the size/workingpressure looks like some standard cylinder
* size, eg "AL80".
+ *
+ * NOTE! We don't take compressibility into account when naming
+ * cylinders. That makes a certain amount of sense, since the
+ * cylinder name is independent from the gasmix, and different
+ * gasmixes have different compressibility.
*/
static void match_standard_cylinder(cylinder_type_t *type)
{
- double cuft;
+ double cuft, bar;
int psi, len;
const char *fmt;
char buffer[40], *p;
@@ -985,8 +990,9 @@ static void match_standard_cylinder(cylinder_type_t *type)
if (type->description)
return;
+ bar = type->workingpressure.mbar / 1000.0;
cuft = ml_to_cuft(type->size.mliter);
- cuft *= surface_volume_multiplier(type->workingpressure);
+ cuft *= bar_to_atm(bar);
psi = to_PSI(type->workingpressure);
switch (psi) {
@@ -1040,10 +1046,11 @@ static void sanitize_cylinder_type(cylinder_type_t *type)
return;
if (xml_parsing_units.volume == CUFT) {
+ double bar = type->workingpressure.mbar / 1000.0;
/* confusing - we don't really start from ml but millicuft !*/
volume_of_air = cuft_to_l(type->size.mliter);
- /* milliliters at 1 atm: "true size" */
- volume = volume_of_air / surface_volume_multiplier(type->workingpressure);
+ /* milliliters at 1 atm: not corrected for compressibility! */
+ volume = volume_of_air / bar_to_atm(bar);
type->size.mliter = rint(volume);
}