diff options
-rw-r--r-- | dive.c | 1 | ||||
-rw-r--r-- | divelist.c | 4 | ||||
-rw-r--r-- | dives/sac-test.xml | 50 |
3 files changed, 53 insertions, 2 deletions
@@ -607,6 +607,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc) end = time; if (depth > SURFACE_THRESHOLD) { + end = time; if (start < 0) start = lasttime; if (depth > maxdepth) diff --git a/divelist.c b/divelist.c index 85fb535ed..143f4d43c 100644 --- a/divelist.c +++ b/divelist.c @@ -749,8 +749,8 @@ static int calculate_sac(struct dive *dive) } } } - /* Mean pressure in bar (SAC calculations are in bar*l/min) */ - pressure = depth_to_mbar(dc->meandepth.mm, dive) / 1000.0; + /* Mean pressure in ATM (SAC calculations are in atm*l/min) */ + pressure = (double) depth_to_mbar(dc->meandepth.mm, dive) / SURFACE_PRESSURE; sac = airuse / pressure * 60 / duration; /* milliliters per minute.. */ diff --git a/dives/sac-test.xml b/dives/sac-test.xml new file mode 100644 index 000000000..b5f0149bb --- /dev/null +++ b/dives/sac-test.xml @@ -0,0 +1,50 @@ +<divelog program='subsurface' version='2'> +<settings> +</settings> +<dives> +<dive number='1' date='2013-02-24' time='09:26:04' duration='25:00 min'> + <location>SAC test dive 1</location> + <notes>SAC should be 20l/min (0.7063 cuft/min) +We have exactly 100 ATM of gas in a 10l cylinder, average 10m for 25min</notes> + <cylinder size='10 l' description='10l' start='202.6 bar' end='101.3 bar' /> + <divecomputer> + <depth max='10.0 m' mean='10.0 m' /> + <sample time='0:00 min' depth='10.0 m' /> + <sample time='5:00 min' depth='10.0 m' /> + <sample time='10:00 min' depth='10.0 m' /> + <sample time='15:00 min' depth='10.0 m' /> + <sample time='20:00 min' depth='10.0 m' /> + <sample time='25:00 min' depth='10.0 m' /> + </divecomputer> +</dive> +<dive number='2' date='2013-02-24' time='10:26:04' duration='25:00 min'> + <location>SAC test dive 2</location> + <notes>SAC should be 20l/min (0.7063 cuft/min) +We have exactly 100 ATM of gas in a 10l cylinder, average 10m for 25min</notes> + <cylinder size='10 l' description='10l' start='202.6 bar' end='101.3 bar' /> + <divecomputer> + <depth max='20.0 m' mean='10.0 m' /> + <sample time='0:00 min' depth='0.0 m' /> + <sample time='12:30 min' depth='20.0 m' /> + <sample time='25:00 min' depth='0.0 m' /> + </divecomputer> +</dive> +<dive number='3' date='2013-02-24' time='11:26:04' duration='25:00 min'> + <location>SAC test dive 3</location> + <notes>SAC should be 20l/min (0.7063 cuft/min) +We have exactly 100 ATM of gas in 15l of cylinder, average 20m for 25min</notes> + <cylinder size='10 l' description='10l' start='202.6 bar' end='101.3 bar' /> + <cylinder size='5 l' description='10l' start='202.6 bar' end='101.3 bar' /> + <divecomputer> + <event time='17:00 min' name='gaschange' /> + <depth max='20.0 m' mean='10.0 m' /> + <sample time='0:00 min' depth='0.0 m' /> + <sample time='5:00 min' depth='20.0 m' /> + <sample time='10:00 min' depth='40.0 m' /> + <sample time='15:00 min' depth='0.0 m' /> + <sample time='20:00 min' depth='40.0 m' /> + <sample time='25:00 min' depth='0.0 m' /> + </divecomputer> +</dive> +</dives> +</divelog> |