mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
f072f78c29
commit
f2fe389abd
3 changed files with 22 additions and 21 deletions
15
core/dive.c
15
core/dive.c
|
|
@ -1172,6 +1172,21 @@ static void sanitize_cylinder_info(struct dive *dive)
|
|||
}
|
||||
}
|
||||
|
||||
/* 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) pointers to two gas mixes, the gas being switched from and the gas being switched to.
|
||||
* 2) 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;
|
||||
}
|
||||
|
||||
/* some events should never be thrown away */
|
||||
static bool is_potentially_redundant(struct event *event)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue