Mission class module
A Mission a basically a list of repetitive dives. It could also be called a ‘DiveTrip’ for example
Mission Class
a Mission represent all repetitive dives for a given set of time. the Mission will keep consistency between repetitive dives
An isolated dive is a Mission with only one dive inside
tanks: | (dict) – list of each individual tank used (at least once) during the mission. |
---|---|
dives: | (list) – list of Dive object of the same mission |
description: | (str) – description of the mission (OPTIONAL) |
status: | (str) – actual status of the mission. Could be either: |
STATUS_NONE: not calculated
parameter has changed and recalculation is needed)
STATUS_OK: calculated (calculation is up to date)
Todo
Insert dive(s) in a certain position
Todo
change dive order, permutations, etc...
Todo
decide if we define a common list of tanks for a given mission in this case, each dive will be able to pickup some tank
Todo
decide if settings is included in Mission object or remains global
Mission constructor
Initialize the Mission object if no parameter is given, instantiate an ‘empty’ Mission
dive_or_divelist: | |
---|---|
– either a Dive object or a list of Dive object | |
tank_or_tankdict: | |
– either a Tank object or a dict of tanks | |
description: | (str)– description of the Mission |
calculate and return len of Session object
usage example:
print(len(my_mission))
int: | number of Dives in this mission |
---|
dumps the Mission object in json format
loads a json structure and update the mission object with the new values.
This method can be used in http PUT method to update object value
input_json: | (string) – the json structure to be loaded |
---|
clean the mission
what: | (str) – what the method should clean by default: all (clean all) Values allowed: [‘all’, ‘dives’, ‘description’, ] |
---|
Change the status of the mission
if no status is given in args, toggle the status from OK to CHANGED else, update the status with the given value
status: | (str) – status code (optionnal) |
---|
add a Dive or a list of dive to the Mission
they will be added at the end of the list
dive_or_divelist: | |
---|---|
– either a Dive object or a list of Dive objects |
add a Tank or a dict of tanks to the Mission
if a tank already exists in the dict with the same name, the new one will not be added.
tank_or_tanklist: | |
---|---|
– either a Tank object or a list of Tank objects |
x.__str__() <==> str(x)
dive class module
Each Dive represent one dive (and only one) For successive dives, it is possible to provide the parameters of the previous dive in order to calculate the next one.
raised when the is no input segments to process
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
raised when the Dive constructor encounters a problem. In this case, it can not continue
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
raised when the is no input segments to process
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
raised when the deco time becomes enourmous (like infinite)
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
Conducts dive based on inputSegments, knownGases, and an existing model. Iterates through dive segments updating the Model. When all dive segments are processed then calls ascend(0.0) to return to the surface.
The previous_profile (Model) can be either null in which case a new model is created, or can be an existing model with tissue loadings.
Gas switching is done on the final ascent if OC deco or bailout is specified.
Outputs profile to a List of dive segments
Attributes:
Constructor for Profile class
For fist dive, instanciate the profile class with no model (profile will create one for you) For repetative dives, instanciate profile class with the previous model
mission: | (Mission) – mission object the dive belongs to |
---|---|
known_segments: | – list of input segments |
known_tanks: | – list of tanks for this dive |
previous_profile: | |
(Model) – model object of the precedent dive |
Note
the constructor should not fail. If something if wrong, it MUST still instantiate itself, with errors in his own object
Return a human readable name of the segment
Return a human readable name of the segment in unicode
Compare a dive to another dive, based on run_time
otherdive: | (Dive) – another dive object |
---|
add a Segment or a list of Segments to the Dive’s input_segments list. They will be added at the end of the list
segment_or_segmentlist: | |
---|---|
– either a Segment object or a list of Segment objects |
dumps the Dive object in dict format for later json conversion
loads a json structure and update the tank object with the new values.
This method can be used in http PUT method to update object value
TODO: do something with automatic_tank_refill: global or local (dive) parameter ?
input_json: | (string) – the json structure to be loaded |
---|
Make this dive a repetitive dive by cloning the previous model history into the current dive
previous_dive: | (Dive) – previous dive profile |
---|
Returns the dive profile calculated, using the template given in settings or command lines. (and not only the default template)
Conducts a surface interval by performing a constant depth calculation on air at zero meters
time: | (int) – duration of the interval, in seconds if not provided, uses the surface_interval defined in this dive |
---|
Returns surface interval in mm:ss format
refile all tanks defined in this dive it is used for repetitive dives
Returns true if there are loaded dive segments else false means there is nothing to process
False (bool) – if there is no dive segment to process
Call do_dive, and handle exceptions internally : do not raise any “dive related” exception : add the exception inside self.dive_exceptions instead.
Process the dive
Returns no flight time (if calculated) in hhmmss format instead of an int in seconds
Note
This method does not calculate no_flight_time you need to call no_flight_time() or no_flight_time_wo_exception() before.
Call no_flight_time, and handle exceptions internally: do not raise any “dive related” exception: add the exception inside self.dive_exceptions instead.
altitude: | (int) – in meter : altitude used for the calculation |
---|---|
flight_ascent_rate: | |
(float) – in m/s | |
tank: | (Tank) – optionnal: it is possible to provide a tank while calling no_flight_time to force “no flight deco” with another mix than air. In this case, we will ‘consume’ the tank When the tank is empty, it automatically switch to air |
Evaluate the no flight time by ‘ascending’ to the choosen flight altitude. Ascending will generate the necessary ‘stop’ at the current depth (which is 0m). The stop time represents the no flight time
altitude: | (int) – in meter : altitude used for the calculation |
---|---|
flight_ascent_rate: | |
(float) – in m/s | |
tank: | (Tank) – optionnal: it is possible to provide a tank while calling no_flight_time to force “no flight deco” with another mix than air. In this case, we will ‘consume’ the tank When the tank is empty, it automatically switch to air |
Ascend to target depth, decompressing if necessary. If inFinalAscent then gradient factors start changing, and automatic gas selection is made.
This method is called by do_dive()
target_depth: | (float) – in meter, target depth for the ascend |
---|
Returns: <nothing>
Raise: <Exceptions from model>
Segment classes A segment is a portion of a dive in the same depth (depth + duration)
raised when the MOD is not possible according to the depth(s) of the segment
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
Base class for all types of segments
dive (Dive) – Dive object the segment belongs to
type (str) – type of segment
types of segments can be :
in_use (boolean) – True if segment is used
depth (float) – depth of this segment, in meter
time (float) – duration of this segment, in seconds
run_time (float) – runtime (displayed in profile informations)
setpoint (float) – setpoint for CCR
tank (Tank) – refer to tank object used in this segment
constructor for Segment base class, just defines all the parameters
Return a human readable name of the segment
Return a human readable name of the segment in unicode
dumps the Segment object in json format
loads a json structure and update the segment object with the new values.
This method can be used in http PUT method to update object value
input_json: | (string) – the json structure to be loaded |
---|
ValueError : if json is not loadable
100% for example (or negatives values)
or ABSOLUTE_MAX_MOD.
ABSOLUTE_MAX_MOD is a global settings which can not be exceeded.
values or are incorrect (like negatives) values
check if it’s a valid segment Should be executed before calculating dives
the check does not return anything if nok, but raises Exceptions
checks the mod for this segment according to the used tank.
max_ppo2: | (float) – max tolerated ppo2 |
---|
checks the minimum od for this segment according to the used tank. (hypoxic cases)
returns segment time in the form MMM:SS
returns runtime in the form MMM:SS
returns the absolute pression in bar (1atm = 1ATA = 1.01325 bar = 14.70psi)
Simple method : 10m = +1 bar Complex method : use real density of water, T°, etc...
Calculates and returns E.N.D : Equivalent Narcosis Depth
Instead of Mvplan, it uses a ‘calculation method’ based on narcosis effet of all gas used, assuming there is no trace of other gases (like argon) in the breathing gas, but compare the narcotic effect with surface gas, wich is ‘air’ and contains a small amount of argon
Specialisation of segment class for dive segments
Constructor for SegmentDive class. Look at base class for more explanations
depth: | (float) – in meter, the (constant) depth for this segment |
---|---|
time: | (float) – in second, duration of this segment |
tank: | (Tank) – object instance of Tank class : describe the tank used in this segment |
setpoint: | (float) – for CCR, setpoint used for this segment for OC : setpoint should be zero |
calculates returns the quantity (in liter) of gas used for this segment
Return a human readable name of the segment
Return a human readable name of the segment in unicode
check if it’s a valid segment Should be executed before calculating dives
the check does not return anything if nok, but raises Exceptions
checks the minimum od for this segment according to the used tank. (hypoxic cases)
checks the mod for this segment according to the used tank.
max_ppo2: | (float) – max tolerated ppo2 |
---|
dumps the Segment object in json format
Calculates and returns E.N.D : Equivalent Narcosis Depth
Instead of Mvplan, it uses a ‘calculation method’ based on narcosis effet of all gas used, assuming there is no trace of other gases (like argon) in the breathing gas, but compare the narcotic effect with surface gas, wich is ‘air’ and contains a small amount of argon
returns the absolute pression in bar (1atm = 1ATA = 1.01325 bar = 14.70psi)
Simple method : 10m = +1 bar Complex method : use real density of water, T°, etc...
returns runtime in the form MMM:SS
returns segment time in the form MMM:SS
loads a json structure and update the segment object with the new values.
This method can be used in http PUT method to update object value
input_json: | (string) – the json structure to be loaded |
---|
ValueError : if json is not loadable
100% for example (or negatives values)
or ABSOLUTE_MAX_MOD.
ABSOLUTE_MAX_MOD is a global settings which can not be exceeded.
values or are incorrect (like negatives) values
Specialisation of segment class for deco segments
Constructor for SegmentDeco class. Look at base class for more explanations
In deco segment, we also have to manage some new parameters :
depth: | (float) – in meter, the (constant) depth for this segment |
---|---|
time: | (float) – in second, duration of this segment |
tank: | (Tank) – object instance of Tank class : describe the tank used in this segment |
setpoint: | (float) – for CCR, setpoint used for this segment for OC : setpoint should be zero |
calculates returns the quantity (in liter) of gas used for this segment
Return a human readable name of the segment
Return a human readable name of the segment in unicode
check if it’s a valid segment Should be executed before calculating dives
the check does not return anything if nok, but raises Exceptions
checks the minimum od for this segment according to the used tank. (hypoxic cases)
checks the mod for this segment according to the used tank.
max_ppo2: | (float) – max tolerated ppo2 |
---|
dumps the Segment object in json format
Calculates and returns E.N.D : Equivalent Narcosis Depth
Instead of Mvplan, it uses a ‘calculation method’ based on narcosis effet of all gas used, assuming there is no trace of other gases (like argon) in the breathing gas, but compare the narcotic effect with surface gas, wich is ‘air’ and contains a small amount of argon
returns the absolute pression in bar (1atm = 1ATA = 1.01325 bar = 14.70psi)
Simple method : 10m = +1 bar Complex method : use real density of water, T°, etc...
returns runtime in the form MMM:SS
returns segment time in the form MMM:SS
loads a json structure and update the segment object with the new values.
This method can be used in http PUT method to update object value
input_json: | (string) – the json structure to be loaded |
---|
ValueError : if json is not loadable
100% for example (or negatives values)
or ABSOLUTE_MAX_MOD.
ABSOLUTE_MAX_MOD is a global settings which can not be exceeded.
values or are incorrect (like negatives) values
Specialisation of segment class for Ascent or Descent segments
Constructor for SegmentAscDesc class. Look at base class for more explanations in this segment, we do not specify time, but rate (of ascending or descending) and start_depth and end_depth The comparaison between start and end depth determine if asc or desc rate is given in m/min
start_depth: | (float) – in meter, the starting depth for this segment |
---|---|
end_depth: | (float) – in meter, the ending depth for this segment |
rate: | (float) – in m/s, rate of ascending or descending |
tank: | (Tank) – object instance of Tank class : describe the tank used in this segment |
setpoint: | (float) – for CCR, setpoint used for this segment for OC : setpoint should be zero |
checks the mod for this segment according to the used tank.
max_ppo2: | (float) – max tolerated ppo2 |
---|
checks the minimum od for this segment according to the used tank. (hypoxic cases)
Return a human readable name of the segment
Return a human readable name of the segment in unicode
check if it’s a valid segment Should be executed before calculating dives
the check does not return anything if nok, but raises Exceptions
dumps the Segment object in json format
calc. and returns the quantity (in liter) of gas used in this segment because it’s ascend or descent, the gas is not used at the same rate during the segment Because the rate is the same during all the segment, we can use the consumption at the average depth of the segment
Calculates and returns E.N.D : Equivalent Narcosis Depth
Instead of Mvplan, it uses a ‘calculation method’ based on narcosis effet of all gas used, assuming there is no trace of other gases (like argon) in the breathing gas, but compare the narcotic effect with surface gas, wich is ‘air’ and contains a small amount of argon
returns the absolute pression in bar (1atm = 1ATA = 1.01325 bar = 14.70psi)
Simple method : 10m = +1 bar Complex method : use real density of water, T°, etc...
returns runtime in the form MMM:SS
returns segment time in the form MMM:SS
loads a json structure and update the segment object with the new values.
This method can be used in http PUT method to update object value
input_json: | (string) – the json structure to be loaded |
---|
ValueError : if json is not loadable
100% for example (or negatives values)
or ABSOLUTE_MAX_MOD.
ABSOLUTE_MAX_MOD is a global settings which can not be exceeded.
values or are incorrect (like negatives) values
Contains a Tank Class
Note
in MVPlan, this class was the ‘Gas’ class
Exception raised when the gas informations provided for the Tank are invalid
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
Exception raised when the tank infos provided are invalid
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
Exception raised when the given MOD is incompatible with the gas provided for the tank
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
Exception raised when trying to consume more gas in tank than the remaining gas
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
This class implements a representation of dive tanks wich contains breathing Gas We provide proportion of N2, O2, He, calculates MOD and volumes during the dives We can also (optionally) provide the type of tanks :
Note
About imperial unit conversion
In ‘imperial’ countries (North America), it’s common to describe a tank with the volume of air stored in the cylinder at its working pressure (if you where to release it at the surface), instead of (internal volume * pressure).
This make difficult if not impossible to switch between the two units without any approximation or implementation choices.
eg: 80-cubic-foot aluminium cylinder (AL80)
TODO: continuer le texte explicatif
Attributes:
f_o2 (float) – fraction of oxygen in the gas in % (>= 0.0 & <= 1.0)
f_he (float) – fraction of helium in the gas in % (>= 0.0 & <= 1.0)
- f_n2 (float) – fraction of nitrogen in the gas in %
(>= 0.0 & <= 1.0)
max_ppo2 (float) – maximum tolerated ppo2 for this tank
volume (float) – volume of tank in liter
pressure (float) – pressure of tank in bar
rule (str) – tank rule for minimum gas calculation
mod (float) – maximum operating depth of the tank
in_use (boolean) – is the tank used for the dive of not
total_gas (float) – total gas volume of the tank in liter
used_gas (float) – used gas in liter
remaining_gas (float) – remaining gas in liter
min_gas (float) – minimum remaining gas in liter
- name (str) – name of the Tank if not provided,
try to set it automatically
Constructor for Tank class
If nothing is provided, create a default ‘Air’ with 12l/200b tank and max_ppo2 to 1.6 (used to calculate mod) if mod not provided, mod is calculed based on max tolerable ppo2
f_o2: | (float) – Fraction of O2 in the gaz in % value between 0.0 and 1.0 |
---|---|
f_he: | (float) – Fraction of He in the gaz in % value between 0.0 and 1.0 |
max_ppo2: | (float) – sets the maximum ppo2 you want for this tank (default: settings.DEFAULT_MAX_PPO2) |
mod: | (float) – Specify the mod you want. if not provided, calculates the mod based on max_ppo2
|
volume: | (float) – Volume of the tank in liter |
pressure: | (float) – Pressure of the tank, in bar |
rule: | – rule for warning in the tank consumption must be either : ‘xxxb’ or ‘1/x’. Note xxxb (ex: 50b) means 50 bar minimum at the end of the dive Note 1/x (ex : 1/3 for rule of thirds: 1/3 for way in, 1/3 for way out, 1/3 remains at the end of the dive) ex2: 1/6 rule: 1/6 way IN,1/6 way OUT, 2/3 remains |
name: | (str) – set a specific name for the Tank. if not given, it will be generated automatically based on the gas. |
Raise:
InvalidGas – see validate()
- InvalidMod – if mod > max mod based on
max_ppo2 and see validate()
InvalidTank – see validate()
sets the minimum gas volume for this tank based on the min_gas rule provided
deepcopy method will be called by copy.deepcopy
Used for “cloning” the object into another new object.
memo: | – not used here |
---|
Calculate the real gas volume of the tank (in liter) based on Van der waals equation: (P+n2.a/V2).(V-n.b)=n.R.T
volume: | (float) – Volume of the tank in liter optional : if not provided, use self.volume |
---|---|
pressure: | (float) – Pressure of the tank in bar optional : if not provided, use self.pressure |
f_o2: | (float) – fraction of O2 in the gas optional : if not provided, use self.f_o2 |
f_he: | (float) – fraction of He in the gas optional : if not provided, use self.f_he |
Return a human readable name of the tank
Return a human readable name of the tank in unicode
Compare a tank to another tank, based on MOD
dumps the Tank object in json format
loads a json structure and update the tank object with the new values.
This method can be used in http PUT method to update object value
input_json: | (string) – the json structure to be loaded |
---|
ValueError : if json is not loadable
100% for example (or negatives values)
or ABSOLUTE_MAX_MOD.
ABSOLUTE_MAX_MOD is a global settings which can not be exceeded.
values or are incorrect (like negatives) values
calculate and returns mod for a given ppo2 based on this tank info result in meter
max_ppo2: | – maximum ppo2 accepted (float). Any value accepted, but should be > 0.0 |
---|
Test the validity of the tank informations inside this object if validity check fails raise an Exception ‘InvalidTank’
100% for example (or negatives values)
or ABSOLUTE_MAX_MOD.
ABSOLUTE_MAX_MOD is a global settings which can not be exceeded.
values or are incorrect (like negatives) values
returns a Human readable name for the gaz and tanks Different possibilities: Air, Nitrox, Oxygen, Trimix, Heliox
returns tank infos : size, remaining vol example of tank info: 15l-90% (2800/3000l)
return mod (maximum operating depth) in meter if no argument provided, return the mod based on the current tank (and configured max_ppo2) if max_ppo2 is provided, returns the (new) mod based on the given ppo2
max_ppo2: | (float) – ppo2 for mod calculation |
---|
return in meter the minimum operating depth for the gas in the tank return 0 if diving from/to surface is ok with this gaz
min_ppo2: | (float) – minimum tolerated ppo2 |
---|
calculate a mod based on given end and based on gaz inside the tank
Note
end calculation is based on narcotic index for all gases.
By default, dipplanner considers that oxygen is narcotic (same narcotic index than nitrogen)
All narcotic indexes can by changed in the config file, in the [advanced] section
end: | (int) – equivalent narcotic depth in meter |
---|
calculate end (equivalent narcotic depth) based on given depth and based on gaz inside the tank
Note
end calculation is based on narcotic index for all gases.
By default, dipplanner considers that oxygen is narcotic (same narcotic index than nitrogen)
All narcotic indexes can by changed in the config file, in the [advanced] section
Consume gas inside this tank
gas_consumed: | (float) – gas consumed in liter |
---|
Defines Exceptions for buhlmann model
Generic Model Exception
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
Model State Exception
constructor : call the upper constructor and set the logger
description: | (str) – text describing the error |
---|
String representing the object
unicode string representing the object
Defines a Buhlmann compartment
Buhlmann compartment class
Constructor for Compartment can be called without params, in this case, does not initiate anything can be called with time params and coef and in this case initate the compartment time constants
h_he: | (float) – helium halftime |
---|---|
h_n2: | (float) – nitrogen halftime |
a_he: | (float) – helium: a coefficient |
b_he: | (float) – helium: b coefficient |
a_n2: | (float) – nitrogen: a coefficient |
b_n2: | (float) – nitrogen: b coefficient |
deepcopy method will be called by copy.deepcopy
Used for “cloning” the object into another new object.
memo: | – not used here |
---|
Return a human readable name of the segment
Return a human readable name of the segment in unicode
Sets the compartment’s time constants
h_he: | (float) – Helium Halftime |
---|---|
h_n2: | (float) – Nitrogen Halftime |
a_he: | (float) – Helium : a coefficient |
b_he: | (float) – Helium : b coefficient |
a_n2: | (float) – Nitrogen : a coefficient |
b_n2: | (float) – Nitrogen : b coefficient |
Sets partial pressures of He and N2
pp_he: | (float) – partial pressure of Helium |
---|---|
pp_n2: | (float) – partial pressure of Nitrogen |
Constant depth calculations. Uses instananeous equation: P = Po + (Pi - Po)(1-e^-kt) store the new values in self.pp_he and self.pp_n2
pp_he_inspired: | (float) – partial pressure of inspired helium |
---|---|
pp_n2_inspired: | (float) – partial pressure of inspired nitrogen |
seg_time: | (float) – segment time in seconds |
Ascend or descent calculations. Uses equation : P=Pio+R(t -1/k)-[Pio-Po-(R/k)]e^-kt store the new values in self.pp_he and self.pp_n2
pp_he_inspired: | (float) – partial pressure of inspired helium |
---|---|
pp_n2_inspired: | (float) – partial pressure of inspired nitrogen |
rate_he: | (float) – rate of change of pp_he |
rate_n2: | (float) – rate of change of pp_n2 |
seg_time: | (float) – segment time in seconds |
Gets M-Value for given ambient pressure using the Buhlmann equation Pm = Pa/b +a where:
- Pm = M-Value pressure,
- Pa = ambiant pressure
- a,b co-efficients
Note
Not used for decompression but for display of M-value limit line
Note
this method does not use gradient factors.
pressure: | (float) – ambient pressure (in bar) |
---|
gradient module
Defines a Gradient Factor object
A GF Object maintains a low and high setting and is able to determine a GF for any depth between its initialisation depth (see setGfAtDepth()) and the surface.
Constructor for Gradient object
gf_low: | (float) – low Gradient factor, from 0.0 to 1.0 |
---|---|
gf_high: | (float) – high Gradient factor, from 0.0 to 1.0 |
deepcopy method will be called by copy.deepcopy
Used for “cloning” the object into another new object.
memo: | – not used here |
---|
Returns current GF with bounds checking if gf < gf_low, returns gf_low
Sets the gf for a given depth. Must be called after setGfSlope() has initialised slope
depth: | (float) – current depth, in meter |
---|
Set gf Slope at specified depth. Typically called once to initialise the GF slope.
depth: | (float) – current depth, in meter |
---|
Sets gf low setting
value: | (float) – low Gf, between 0.0 and 1.0 |
---|
Sets gf high setting
value: | (float) – high Gf, between 0.0 and 1.0 |
---|
x.__str__() <==> str(x)
Oxygen Toxicity model
Defines a Oxygen Toxicity model
cns (float) – central nervous system toxicity
(see http://en.wikipedia.org/wiki/Oxygen_toxicity#Signs_and_symptoms)
otu (float- – Oxygen toxicity Units
max_ox (float) – maximum ppo2
Constructor for OxTox class
deepcopy method will be called by copy.deepcopy
Used for “cloning” the object into another new object.
memo: | – not used here |
---|
Adds oxygen load into model.
Uses NOAA lookup table to add percentage based on time and ppO2. Calculate OTU using formula OTU= T * (0.5/(pO2-0.5))^-(5/6)
this OTU formula need T (time) in minutes, so we need to convert the time in second to minutes while using this formula
pp_o2: | (float) – partial pressure of oxygen |
---|---|
time: | (float) – time of segment (in seconds) |
Removes oxygen load from model during surface intervals
time: | (float) – time of segment (in seconds) |
---|
x.__str__() <==> str(x)
Buhlmann model module
Contains: Model – class
Represents a Buhlmann model. Composed of a tissue array of Compartment[] Has an OxTox and Gradient object
Can throw a ModelStateException propagated from a Compartment if pressures or time is out of bounds.
Models are initialised by initModel() if they are new models, or validated by validateModel() if they are rebuild from a saved model.
The model is capable of ascending or descending via ascDec() using the ascDec() method of Compartment, or accounting for a constant depth using the constDepth() method of Compartment.
Constructor for model class
deepcopy method will be called by copy.deepcopy
Used for “cloning” the object into another new object.
memo: | – not used here |
---|
Return a human readable name of the segment
Return a human readable name of the segment in unicode
Initialise the gradient attribute uses the default settings parameters for gf_low and high
Initialize time constants in buhlmann tissue list Only for metric values
deco_model: | (str) – “ZHL16b” or “ZHL16c” |
---|
Validate model - checks over the model and looks for corruption
This is needed to check a model that has been loaded from XML Resets time constants
Determine the controlling compartment at ceiling (1-16)
Determine the current ceiling depth
Determine the current ceiling
Determine the maximum M-Value for a given depth (pressure)
pressure: | (float) – in bar |
---|
Constant depth profile. Calls Compartment.constDepth for each compartment to update the model.
Keyword arguments:
pressure: (float)– pressure of this depth of segment in bar seg_time: (float) – Time of segment in seconds f_he: (float) – fraction of inert gas Helium in inspired gas mix f_n2: (float) – fraction of inert gas Nitrogen in inspired gas mix pp_o2: (float) – For CCR mode, partial pressure of oxygen in bar. If == 0.0, then open circuit
Ascend/Descend profile. Calls Compartment.asc_desc to update compartments
Keyword arguments:
start: (float) – start pressure of this segment in bar (WARNING: not meter ! it’s a pressure) finish: (float) – finish pressure of this segment in bar (WARNING: not meter ! it’s a pressure) rate: (float) – rate of ascent or descent in m/s f_he: (float) – Fraction of inert gas Helium in inspired gas mix f_n2: (float) – Fraction of inert gas Nitrogen in inspired gas mix pp_o2: (float) – For CCR mode, partial pressure of oxygen in bar. If == 0.0, then open circuit
Base Class for exceptions for dipplanner module
Base exception class for dipplanner
DipplannerException constructor
description: | (str) – text describing the error |
---|
tools modules
This modules contains some utility functions like unit conversions, etc...
Small an safe eval function usable only for simple calculation (only the basic operators)
text_to_eval: | (str) – the text (formula) that should be evaluated |
---|
SyntaxError: when the given expression is incorrect
Convert a value in seconds into a string representing the time in minutes and seconds (like 2:06) It does returns only minutes and seconds, not hours, minutes and seconds
seconds: | (float) – the duration in seconds |
---|
Convert a value in seconds into a string representing the time in hour:minutes and seconds like 22:34:44
seconds: | (float) – the duration in seconds |
---|
output absolute pressure for give “depth” in meter.
altitude_or_depth: | |
---|---|
(float (signed)) – in meter |
Convert a given altitude in pressure in bar uses the formula: p = 101325.(1-2.25577.10^-5.h)^5.25588
altitude: | (float) – current altitude in meter |
---|
Calculates depth pressure based on depth using a more complex method than only /10
depth: | (float) – in meter |
---|
Calculates depth based on give pressure using a more complex method than only x10
pressure: | (float) – pressure in bar |
---|
Calculates and return vapor pressure of water at surface using Antoine equation (http://en.wikipedia.org/wiki/Vapour_pressure_of_water)
temperature: | (float) [OPTIONNAL] – in ° Celcius |
---|
SI –> imperial pressure conversion function
value: | (float) – pressure in bar |
---|
imperial –> SI pressure conversion function
value: | (float) – pressure in psi |
---|
SI –> imperial volume conversion function
value: | (float) – volume in liter |
---|
imperial –> SI volume conversion function
value: | (float) – volume in cubicfeet |
---|
main dipplanner module for command line usage.
This module is used by the only “executable” of the project: bin/dipplanner (which is an empty shell)
runs in command line and output resulting dive profile also initiate log files
Todo
logger.tutu(“message %s”, allo) au lieu de logger.tutu(“message %s” % allo)
setup the default debug parameters
it’s mainly used for test cases who needs also logging to be set
setup the default debug parameters
it’s mainly used for test cases who needs also logging to be set
main uses the parameters, tanks and dives given in config file(s) and/or command line, calculates the dives and return the output in stdout.
Global settings for dipplannerand their default values
All the settings can be changed by dipplanner command-line documentation and/or dipplanner config file documentation
water density kg/l
water density kg/l
in bar
in bar
in bar
in liter
Temperature at surface. Used to calculate PP_H2O_SURFACE
helium narcotic value
nitrogen narcotic value
oxygen narcotic value
argon narcotic value
in meter
in meter : last stop before surfacing
in second
once deco stop begun, force to stop to each deco depth stop
surface pressure (in bar)
either simple (/10) or complex
“late” or “early”
in meter practicly, this value can not be bigger than about 2850m because breathing air at 0m will only ‘prepare the body’ to a decompression until this value. To go higher, another ‘stop’ is needed between.
template should be in templates/ directory
ZHL16c or ZHL16b
water density kg/l
surface pressure (in bar)
in bar
in bar
in meter
liter/s
liter/s
m/s
m/s
Warning
if RUN-TIME is True, the segment duration must include descent time
if the duration is too small dipplanner will raise an error if True: segments represents runtime, if false, segments represents segtime
if True, use enabled gases of decomp in oc or bailout
% between 0.0 and 1.0
% between 0.0 and 1.0
TO CHECK
automatic refill of tanks between dives
dipplanner GUI module.
Starts the GUI
Todo
uniquely name the tanks (in addition of tank_id (int) AND handle Tank references (from tank list) to: current_tank and segment.tank
Actually: each tank is separated
WORK IN PROGRESS (reste en cours: les dumps_dict a modifier)
defines all the routes and others parameters for the app
Starts the html GUI server
At this time, there is only one Mission at a time for a dipplanner session (if the user need to work on another mission, he MUST close the current Mission first).
The API reflects this current limitation
GET method for the Mission object Api
returns a json dumps of the mission object.
Sample usage:
curl -H "Content-Type: application/json" http://localhost:8080/api/v1/mission/
returns the actual status of the mission
returns a json object with the current status of the Mission object.
ex:
{ 'status': 'Calculated and Up to date' }
POST method for the Mission object Api
create a new mission an new mission may only be created if the existing mission is empty (api user MUST call DELETE before calling POST)
if a json structure is POSTed with the request, dipplanner will try to load this stucture inside the mission object. A full structure may be given.
PATCH method for the Mission object Api
update the mission object
api for dives inside the mission object
GET method for the Dive object Api
returns a json dumps of the dives in the current mission object.
resource_id: | (str) – either a number representing the position of the dive (first dive is dive 1) or the name of the dive |
---|
POST method for the Dive object Api
create a new dive for this mission
if a json structure is POSTed with the request, dipplanner will try to load this structure while instanciating the new dive A full dive structure may be given, but a partial structure will also be allowed. (all non given parameters will use the default values)
PATCH method for the Dive object Api
update the dive object
if no resource_id is given, returns 404 if resource_id is given, try to patch the resource and returns the entive patched Dive with code 200 OK
resource_id: | –str : number of the dive, starting by 1 |
---|
DELETE method for the Dive object Api
if no resource_id is given, all the dives will be deleted. If resource_id is given and exists, only one dive will be deleted
resource_id: | –str : number of the dive, starting by 1 |
---|
api for dives inside the mission object
GET method for the Tank object Api
returns a json dumps of the tanks in the current mission object.
resource_id: | (int) – number of the dive, first dive is dive 1 |
---|
POST method for the Tank object Api
create a new tank for this dive
if a json structure is POSTed with the request, dipplanner will try to load this structure while instanciating the new tank A full Tank structure may be given, but a partial structure will also be allowed. (all non given parameters will use the default values)
PATCH method for the Tank object Api
update the tank object
if no tank_id is given, returns 404 if tank_id is given, try to patch the resource and returns the entive patched Tank with code 200 OK
dive_id: | – (str): number of the tank, starting by 1 |
---|---|
tank_id: | –str : number of the dive, starting by 1 |
DELETE method for the Tank object Api
if no resource_id is given, all the tanks will be deleted. If resource_id is given and exists, only one tank will be deleted
tank_id: | –str : number of the tank, starting by 1 |
---|