dive {scuba} | R Documentation |
Define a dive profile.
dive(..., begin=0, end=0, tanklist=NULL)
... |
Any number of arguments, specifying a sequence of events that make up the dive. The arguments may specify depths, time spent at each depth, ascent or descent rates, and gas switches. See Details. |
begin, end |
The depths at the start and finish of the dive (normally zero indicating that the dive starts and finishes at the surface). |
tanklist |
Optional list of the gases contained in each tank, for a dive with multiple tanks. |
This function creates
an object of class "dive"
which represents a scuba dive.
The dive profile is assumed to be piecewise linear, that is,
the graph of depth against time is a broken straight line.
Dives are assumed to start and finish at the surface.
The arguments ...
specify a succession of events
that make up the dive. Each argument can be
c(depth, duration)
where depth
gives the depth in metres
and duration
the length of stay at this depth, in minutes.
"gas"
nitrox
and trimix
.
The diver switches to this gas.
tank=n
tanklist
.
The value n
should be a valid index for this list
(either a serial number in the tank list or a character string
matching one of the names in the tank list).
ascent
or
descent
. This resets the default
rate of ascent or descent.
mm:ss
,
or an integer vector containing elapsed times in seconds,
or a vector of class difftime
representing elapsed times in any time unit.
"dive"
Dives are assumed to start and finish at the surface (this can be changed
by specifying values for begin
and end
).
Initially the descent rate is set to 30 metres per minute,
the descent rate is 18 metres per minute, and the breathing gas is
air. These settings may be changed during the dive
by the ...
arguments.
A dive object may include periods spent at the surface (depth zero) and may therefore represent a succession of dives separated by surface intervals.
Once an object of class "dive"
has been created,
it can be plotted and printed (using plot.dive
and print.dive
). The nitrogen saturation can be
computed using haldane
and the
cumulative oxygen toxicity using oxtox
.
An object of class "dive"
describing the dive profile
and the breathing gases used.
The depths and elapsed times at each waypoint during the dive
can be extracted and changed using depths.dive
and times.dive
.
It is possible to alter the breathing gases used in a dive d
,
yielding a new dive object.
You simply modify the tanklist using tanklist(d) <- value
.
This makes it possible to study the effect of conducting the same
dive profile with a different breathing gas.
Not suitable for representing altitude dives.
Adrian Baddeley adrian@maths.uwa.edu.au http://www.maths.uwa.edu.au/~adrian/
nitrox
,
ascent
,
descent
,
haldane
,
plot.dive
,
times.dive
,
durations.dive
,
depths.dive
,
chop.dive
,
tanklist
.
# Dive to 25 m for 20 min followed by safety stop at 5 metres for 3 min d <- dive(c(25,20),c(5,3)) plot(d) # Bounce dive to 20 metres d <- dive(20) # Two dives separated by a one-hour surface interval d <- dive(c(30,15),c(9,2),c(5,5),c(0,60),c(12,60),c(5,5)) # ASCENT RATES # Ascent rate 18 m/min below 9 metres, 6m/min above 9 metres d <- dive(c(30, 12), ascent(18), 9, ascent(6), c(5,3)) # UPLOADED DIVE PROFILE data(baron) pro <- baron[, 1:2] d <- dive(pro) plot(d) # GAS USE # 30-metre dive on Nitrox 32 d <- dive(nitrox(0.32), c(30,20), c(5,5)) # GAS SWITCHING # Dive to 18 m for 30 min on air, # switch to Nitrox 36, ascend to 5 metres, safety stop d <- dive(c(18, 30), nitrox(0.36), c(5,3)) # Same as above, but ascend to 5 m on air, then switch gas d <- dive(c(18, 30), 5, nitrox(0.36), c(5,3)) # SWITCHING TO SPECIFIC TANKS d <- dive(tanklist=list(main=air, deco=nitrox(0.50)), tank="main", c(30, 20), 5, tank="deco", c(5,10)) # Descend to 5 metres on pure oxygen, switch to Trimix, # descend to 30 metres, remain 40 minutes, ascend to 6 metres, # switch to pure oxygen, ascend to 5 metres, decompress 10 minutes, # surface and continue breathing pure oxygen for 10 minutes d <- dive(tanklist=list(travel=trimix(0.15, 0.5), deco=nitrox(1)), tank="deco", 5, tank="travel", c(30,40), 6, tank="deco", c(5,10), c(0,10))