diff options
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 106 |
1 files changed, 1 insertions, 105 deletions
diff --git a/core/dive.c b/core/dive.c index 2d82f5565..a54c3aa00 100644 --- a/core/dive.c +++ b/core/dive.c @@ -866,13 +866,6 @@ static void update_min_max_temperatures(struct dive *dive, temperature_t tempera } } -int gas_volume(const cylinder_t *cyl, pressure_t p) -{ - double bar = p.mbar / 1000.0; - double z_factor = gas_compressibility_factor(cyl->gasmix, bar); - return lrint(cyl->type.size.mliter * bar_to_atm(bar) / z_factor); -} - /* * If the cylinder tank pressures are within half a bar * (about 8 PSI) of the sample pressures, we consider it @@ -948,31 +941,6 @@ void update_setpoint_events(const struct dive *dive, struct divecomputer *dc) } } -void sanitize_gasmix(struct gasmix *mix) -{ - unsigned int o2, he; - - o2 = mix->o2.permille; - he = mix->he.permille; - - /* Regular air: leave empty */ - if (!he) { - if (!o2) - return; - /* 20.8% to 21% O2 is just air */ - if (gasmix_is_air(*mix)) { - mix->o2.permille = 0; - return; - } - } - - /* Sane mix? */ - if (o2 <= 1000 && he <= 1000 && o2 + he <= 1000) - return; - fprintf(stderr, "Odd gasmix: %u O2 %u He\n", o2, he); - memset(mix, 0, sizeof(*mix)); -} - /* * See if the size/workingpressure looks like some standard cylinder * size, eg "AL80". @@ -1059,23 +1027,6 @@ 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) -{ - if (!prefs.show_icd) - return false; - 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) > 0 && results->dN2 > 0 && results->dHe < 0 && get_he(oldgasmix) && results->dN2 > 0 && 5 * results->dN2 > -results->dHe; -} - /* some events should never be thrown away */ static bool is_potentially_redundant(const struct event *event) { @@ -1464,29 +1415,6 @@ static void fixup_dive_pressures(struct dive *dive, struct divecomputer *dc) simplify_dc_pressures(dc); } -int find_best_gasmix_match(struct gasmix mix, const cylinder_t array[], unsigned int used) -{ - int i; - int best = -1, score = INT_MAX; - - for (i = 0; i < MAX_CYLINDERS; i++) { - const cylinder_t *match; - int distance; - - if (used & (1 << i)) - continue; - match = array + i; - if (cylinder_nodata(match)) - continue; - distance = gasmix_distance(mix, match->gasmix); - if (distance >= score) - continue; - best = i; - score = distance; - } - return best; -} - /* * Match a gas change event against the cylinders we have */ @@ -2031,17 +1959,6 @@ extern int get_cylinder_idx_by_use(const struct dive *dive, enum cylinderuse cyl return -1; // negative number means cylinder_use_type not found in list of cylinders } -int gasmix_distance(struct gasmix a, struct gasmix b) -{ - int a_o2 = get_o2(a), b_o2 = get_o2(b); - int a_he = get_he(a), b_he = get_he(b); - int delta_o2 = a_o2 - b_o2, delta_he = a_he - b_he; - - delta_he = delta_he * delta_he; - delta_o2 = delta_o2 * delta_o2; - return delta_he + delta_o2; -} - /* fill_pressures(): Compute partial gas pressures in bar from gasmix and ambient pressures, possibly for OC or CCR, to be * extended to PSCT. This function does the calculations of gas pressures applicable to a single point on the dive profile. * The structure "pressures" is used to return calculated gas pressures to the calling software. @@ -2052,7 +1969,7 @@ int gasmix_distance(struct gasmix a, struct gasmix b) * divemode = the dive mode pertaining to this point in the dive profile. * This function called by: calculate_gas_information_new() in profile.c; add_segment() in deco.c. */ -extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, struct gasmix mix, double po2, enum divemode_t divemode) +void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, struct gasmix mix, double po2, enum divemode_t divemode) { if ((divemode != OC) && po2) { // This is a rebreather dive where pressures->o2 is defined if (po2 >= amb_pressure) { @@ -2180,20 +2097,6 @@ void cylinder_renumber(struct dive *dive, int mapping[]) dc_cylinder_renumber(dive, dc, mapping); } -static bool gasmix_is_invalid(struct gasmix mix) -{ - return mix.o2.permille < 0; -} - -int same_gasmix(struct gasmix a, struct gasmix b) -{ - if (gasmix_is_invalid(a) || gasmix_is_invalid(b)) - return 0; - if (gasmix_is_air(a) && gasmix_is_air(b)) - return 1; - return a.o2.permille == b.o2.permille && a.he.permille == b.he.permille; -} - int same_gasmix_cylinder(cylinder_t *cyl, int cylid, struct dive *dive, bool check_unused) { struct gasmix mygas = cyl->gasmix; @@ -3922,13 +3825,6 @@ fraction_t best_he(depth_t depth, const struct dive *dive) return fhe; } -bool gasmix_is_air(struct gasmix gasmix) -{ - int o2 = gasmix.o2.permille; - int he = gasmix.he.permille; - return (he == 0) && (o2 == 0 || ((o2 >= O2_IN_AIR - 1) && (o2 <= O2_IN_AIR + 1))); -} - void invalidate_dive_cache(struct dive *dive) { memset(dive->git_id, 0, 20); |