Package kenozooid :: Package plan :: Module deco

Module deco

source code

Decompression dive planning.
Classes
  DivePlanError
Dive planner exception.
  GasList
List of gas mixes.
  DivePlan
Dive plan information.
  DiveProfile
Dive profile information.
  ProfileType
Dive profile type.
Functions
 
plan_deco_dive(plan, gas_list, depth, time)
Plan decompression dive.
source code
 
deco_stops(plan, profile)
Calculate decompression stops for a dive profile.
source code
 
dive_legs(profile, stops, descent_rate)
Calculate dive legs information.
source code
 
dive_legs_overhead(gas_list, legs)
Determine the overhead part of a decompression dive.
source code
 
dive_slate(profile, stops, legs, descent_rate)
Calculate dive slate for a dive profile.
source code
 
depth_to_time(start, end, rate)
Calculate time required to descent or ascent from start to end depth.
source code
 
sum_deco_time(legs)
Calculate total decompression time using dive legs.
source code
 
sum_dive_time(legs)
Calculate total dive time using dive legs.
source code
 
gas_vol_info(gas_vol, min_gas_vol)
Analyze gas volume requirements using gas mix volume calculations.
source code
 
gas_volume(gas_list, legs, rmv=20)
Calculate dive gas mix volume information.
source code
 
min_gas_volume(gas_list, legs, rmv=20)
Calculate minimal volume of gas mixes required for a dive using rule of thirds.
source code
 
gas_mix_depth_update(gas_list, ppo2, deco_ppo2)
Update gas mix list, so every gas mix has depth specified.
source code
 
plan_to_text(plan)
Convert decompression dive plan to text.
source code
 
parse_gas(t, travel=False)
Parse gas mix.
source code
 
parse_gas_list(*args)
Parse gas mix list.
source code
Variables
  logger = logging.getLogger(__name__)
  RE_GAS = re.compile(...
Function Details

plan_deco_dive(plan, gas_list, depth, time)

source code 

Plan decompression dive.

The dive plan information is calculated and stored in the dive plan object.

Any dive plan configuration should be set in the dive plan object before calling this function.

Parameters:
  • plan - Dive plan object to be filled with dive plan information.
  • gas_list - Gas mix configuration list.
  • depth - Maximum dive depth.
  • time - Dive bottom time.

deco_stops(plan, profile)

source code 

Calculate decompression stops for a dive profile.

The dive plan information is used to configure decompression engine.

Parameters:
  • plan - Dive plan information.
  • profile - Dive profile information.

dive_legs(profile, stops, descent_rate)

source code 

Calculate dive legs information.

The dive legs information is used for other calculations, i.e. dive gas consumption, dive slate.

Dive profile is split into legs using

  • gas mix switch depths
  • dive maximum depth and bottom time
  • descent rate
  • list of decompression stops

The ascent rate is assumed to be 10m/min.

Each dive leg consists of the following information

  • start depth
  • end depth
  • time
  • gas mix used during a dive leg
  • deco zone indicator (true or false)

dive_legs_overhead(gas_list, legs)

source code 

Determine the overhead part of a decompression dive.

The overhead part of a dive is the descent, bottom and ascent parts of
a dive up to first decompression stop or first decompression gas mix
switch.

The overhead part of a dive is used to calculate gas mix consumption
using rule of thirds.

:param gas_list: Gas list information.
:param legs: List of dive legs.

..seealso:: :py:func:`dive_legs`

dive_slate(profile, stops, legs, descent_rate)

source code 

Calculate dive slate for a dive profile.

The dive decompression stops is a collection of items implementing the following interface

depth
Depth of dive stop [m].
time
Time of dive stop [min].

Dive slate is list of items consisting of

  • dive depth
  • decompression stop information, null if no decompression
  • run time in minutes
  • gas mix on gas switch, null otherwise
Parameters:
  • profile - Dive profile information.
  • stops - Dive decompression stops.
  • legs - Dive legs.
  • descent_rate - Dive descent rate.

depth_to_time(start, end, rate)

source code 
Calculate time required to descent or ascent from start to end depth.
Parameters:
  • start - Starting depth.
  • end - Ending depth.
  • rate - Ascent or descent rate.

sum_deco_time(legs)

source code 

Calculate total decompression time using dive legs.

:param legs: List of dive legs.

..seealso:: :py:func:`dive_legs`

sum_dive_time(legs)

source code 

Calculate total dive time using dive legs.

:param legs: List of dive legs.

..seealso:: :py:func:`dive_legs`

gas_vol_info(gas_vol, min_gas_vol)

source code 

Analyze gas volume requirements using gas mix volume calculations.

The list of messages is returned, which confirm required gas mix volume
or warn about gas logistics problems.

:param gas_vol: Gas volume requirements per gas mix.
:param min_gas_vol: Minimal gas mixes volume for the plan.

.. seealso::

   :py:func:`min_gas_volume`
   :py:func:`gas_volume`

gas_volume(gas_list, legs, rmv=20)

source code 

Calculate dive gas mix volume information.

Gas mix volume is calculated for each gas mix on the gas list. The
volume information is returned as dictionary `gas mix name -> usage`,
where gas usage is volume of gas in liters.

The key of the gas mix volume dictionary is gas mix name to merge all
travel and decompression gas mixes information regardless their depth
switch.

FIXME: apply separate RMV for decompression gas

:param gas_list: Gas list information.
:param legs: List of dive legs.
:param rmv: Respiratory minute volume (RMV) [min/l].

..seealso:: :py:func:`dive_legs`

min_gas_volume(gas_list, legs, rmv=20)

source code 

Calculate minimal volume of gas mixes required for a dive using rule of thirds.

The volume information is returned as dictionary gas mix -> usage, where gas usage is volume of gas in liters.

Parameters:
  • gas_list - Gas list information.
  • legs - List of dive legs.

gas_mix_depth_update(gas_list, ppo2, deco_ppo2)

source code 

Update gas mix list, so every gas mix has depth specified.

The following rules are used

  • gas mixes with non-null depth are _not_ changed
  • first travel gas mix switch depth is 0m
  • if no travel gas mixes specified, then bottom gas mix switch depth is set to 0m
  • travel and bottom gas mixes are updated with MOD calculated using ppO2 and O2 value of previous gas mix on the list
  • decompression gas mixes are updated with MOD calculated using decompression ppO2 and O2 value of changed gas mix
Parameters:
  • gas_list - Gas mix list to modify.
  • ppo2 - ppO2 value used to calculate MOD of travel and bottom gas mixes.
  • deco_ppo2 - ppO2 value used to calculate MOD of decompression gas mixes.

parse_gas(t, travel=False)

source code 
Parse gas mix.
Parameters:
  • t - Gas mix string.
  • travel - True if travel gas mix.

parse_gas_list(*args)

source code 
Parse gas mix list.
Parameters:
  • *args - List of gas mix strings.

Variables Details

RE_GAS

Value:
re.compile("""
    ^(?P<name>
        (?P<type> O2 | AIR | EAN | TX)
        ((?<=TX|AN)(?P<o2>[0-9]{2}))?
        ((?<=TX..)/(?P<he>[0-9]{2}))?
    )
    (@(?P<depth>[0-9]+))?
    (\|(?P<tank>([2-9]x[1-9]{1,2})))?
...