mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Show correct gas density in CCR mode
When collecting the data for the infobox, we have already computed the current partial pressures of the breathing gas taking into accoutn the divemode. Use those rather than fractions (which for CCR mode are those of diluent) to compute the gas density. Reported-by: Pietro Tranquillini <p.tranquillini@gmail.com> Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
46365b3199
commit
741099bdbb
6 changed files with 31162 additions and 31166 deletions
|
@ -1,3 +1,4 @@
|
|||
profile: Show correct gas density when in CCR mode
|
||||
statistics: show correct color of selected scatter items when switching to unbinned mode
|
||||
statistics: fix display of month number in continuous date axis
|
||||
statistics: fix range of continuous date axis
|
||||
|
|
|
@ -83,12 +83,3 @@ double isothermal_pressure(struct gasmix gas, double p1, int volume1, int volume
|
|||
|
||||
return p_ideal * gas_compressibility_factor(gas, p_ideal);
|
||||
}
|
||||
|
||||
double gas_density(struct gasmix gas, int pressure)
|
||||
{
|
||||
int fo2 = get_o2(gas);
|
||||
int fhe = get_he(gas);
|
||||
int density = fhe * HE_DENSITY + fo2 * O2_DENSITY + (1000 - fhe - fo2) * N2_DENSITY;
|
||||
|
||||
return density * (double) pressure / gas_compressibility_factor(gas, pressure / 1000.0) / SURFACE_PRESSURE / 1000000.0;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ extern bool isobaric_counterdiffusion(struct gasmix oldgasmix, struct gasmix new
|
|||
|
||||
extern double gas_compressibility_factor(struct gasmix gas, double bar);
|
||||
extern double isothermal_pressure(struct gasmix gas, double p1, int volume1, int volume2);
|
||||
extern double gas_density(struct gasmix gas, int pressure);
|
||||
extern int same_gasmix(struct gasmix a, struct gasmix b);
|
||||
|
||||
static inline int get_o2(const struct gasmix mix)
|
||||
|
|
|
@ -1160,6 +1160,11 @@ static int calculate_ccr_po2(struct plot_data *entry, const struct divecomputer
|
|||
}
|
||||
}
|
||||
|
||||
static double gas_density(const struct gas_pressures *pressures)
|
||||
{
|
||||
return (pressures->o2 * O2_DENSITY + pressures->he * HE_DENSITY + pressures->n2 * N2_DENSITY) / 1000.0;
|
||||
}
|
||||
|
||||
static void calculate_gas_information_new(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi)
|
||||
{
|
||||
int i;
|
||||
|
@ -1196,7 +1201,7 @@ static void calculate_gas_information_new(const struct dive *dive, const struct
|
|||
entry->pressures.n2 / amb_pressure * N2_DENSITY +
|
||||
entry->pressures.he / amb_pressure * HE_DENSITY) /
|
||||
(O2_IN_AIR * O2_DENSITY + N2_IN_AIR * N2_DENSITY) * 1000), dive);
|
||||
entry->density = gas_density(gasmix, depth_to_mbar(entry->depth, dive));
|
||||
entry->density = gas_density(&entry->pressures);
|
||||
if (entry->mod < 0)
|
||||
entry->mod = 0;
|
||||
if (entry->ead < 0)
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue