diff options
author | Willem Ferguson <willemferguson@zoology.up.ac.za> | 2018-01-19 21:13:34 +0200 |
---|---|---|
committer | Robert C. Helling <helling@atdotde.de> | 2018-01-20 10:10:09 +0100 |
commit | f2fe389abd8e9be648792e21365689c0265d556e (patch) | |
tree | 02ede938ce91a1a04c53af27020560ff235497c1 /core/plannernotes.c | |
parent | f072f78c296cb943c7ef3a0cf104347a2ea851bb (diff) | |
download | subsurface-f2fe389abd8e9be648792e21365689c0265d556e.tar.gz |
Move function isobaric_counterdiffusion()
Move the above function from plannernotes.c to dive.c so that
it is available to be called from the dive log part of the
software, and not only from the planner. The following was done:
1) Edit the comment above the code to make it more accurate
2) Move the structure icd_data to dive.h
3) Create an external reference in dive.h for the above function
4) Copy the body of isobaric_counterdiffusion() to dive.c
Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Diffstat (limited to 'core/plannernotes.c')
-rw-r--r-- | core/plannernotes.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/core/plannernotes.c b/core/plannernotes.c index 4021806ea..1c03d2048 100644 --- a/core/plannernotes.c +++ b/core/plannernotes.c @@ -30,27 +30,6 @@ int diveplan_duration(struct diveplan *diveplan) return (duration + 30) / 60; } -struct icd_data { // This structure provides communication between function isobaric_counterdiffusion() and the calling software. - int dN2; // The change in fraction (permille) of nitrogen during the change - int dHe; // The change in fraction (permille) of helium during the change -}; - -/* Perform isobaric counterdiffusion calculations for gas changes in trimix dives. - * Here we use the rule-of-fifths where, during a change involving trimix gas, the increase in nitrogen - * should not exceed one fifth of the decrease in helium. - * Parameters: 1) Pointer to the dive structure. - * 2) pointers to two gas mixes, the gas being switched from and the gas being switched to. - * 3) a pointer to an icd_data structure. - * Output: i) The icd_data stucture is filled with the delta_N2 and delta_He numbers (as permille). - * ii) Function returns a boolean indicating an exceeding of the rule-of-fifths. False = no icd problem. - */ -bool isobaric_counterdiffusion(struct gasmix *oldgasmix, struct gasmix *newgasmix, struct icd_data *results) -{ - results->dN2 = get_he(oldgasmix) + get_o2(oldgasmix) - get_he(newgasmix) - get_o2(newgasmix); - results->dHe = get_he(newgasmix) - get_he(oldgasmix); - return get_he(oldgasmix) && results->dN2 > 0 && 5 * results->dN2 > -results->dHe; -} - /* Add the icd results of one trimix gas change to the dive plan html buffer. Two rows are added to the table, one * indicating fractions of gas, the other indication partial pressures of gas. This function makes use of the * icd_data structure that was filled with information by the function isobaric_counterdiffusion(). |