[PATCH] CCR Import from CSV: Calculate correct nitrogen and helium gas pressures (VERSION 3)

Willem Ferguson willemferguson at zoology.up.ac.za
Mon Nov 3 12:36:01 PST 2014


Calculate correct nitrogen and helium gas pressures for CCR after
import from CSV (VERSION 3)


Currently the gas pressures stored in structures of pressure are
calculated using the gasmix composition of the currently selected
cylinder. But with CCR dives the default cylinder is the oxygen
cylinder (here, index 0). However, the gas pressures need to
be calculated using gasmix data from cylinder 1 (the diluent
cylinder). This patch allows setting the appropriate cylinder
for calculating the values in the structures of pressure. It
also allows for correctly calculating gas pressures for any
open circuit cylinders (e.g. bailout) that a CCR diver may
use. This is performed as follows:

1) In dive.h create an enum variable {oxygen, diluent, bailout}

2) Within the definition of cylinder_t, add a member: cylinder_use_type
    This stores an enum variable, one of the above.

3) In file.c where the Poseidon CSV data are read in, assign
    the appropriate enum values to each of the cylinders.

4) Within the definition of structure dive, add two members:
    int oxygen_cylinder_index
    int diluent_cylinder_index
    This will keep the indices of the two main CCR cylinders.

5) In dive.c create a function get_cylinder_use(). This scans the
    cylinders for that dive, looking for a cylinder that has a
    particular cylinder_use_type and returns that cylinder index.

6) In dive.c create a function fixup_cylinder_use() that stores the
    indices of the oxygen and diluent cylinders in the variables
    dive->oxygen_cylinder_index and dive->diluent_cylinder_index,
    making use of the function in 5) above.

7) In profile.c, modify function calculate_gas_information_new()
    to use the above functions for CCR dives to find the oxygen and
    diluent cylinders and to calculate partial gas pressures based
    on the diluent cylinder gas mix.

This results in the correct calculation of gas partial pressures
in the case of CCR dives, displaying the correct partial pressure
graphs in the dive profile widget.

Signed-off-by: willem ferguson <willemferguson at zoology.up.ac.za>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Calculate-correct-nitrogen-and-helium-gas-pressures-.patch
Type: text/x-diff
Size: 7058 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20141103/5cf92bc7/attachment.patch>


More information about the subsurface mailing list