Mercurial > public > ostc4
changeset 249:cefee1448ea6
Merged in janlmulder/ostc4/bm-1 (pull request #16)
Replace Relative GF by saturation
author | heinrichsweikamp <bitbucket@heinrichsweikamp.com> |
---|---|
date | Thu, 11 Apr 2019 10:26:22 +0000 |
parents | c282f9e88c66 (current diff) ac2b06b5d09f (diff) |
children | 822416168585 90cbeee0e1d4 |
files | |
diffstat | 7 files changed, 23 insertions(+), 96 deletions(-) [+] |
line wrap: on
line diff
--- a/Common/Inc/data_central.h Wed Apr 10 11:04:56 2019 +0200 +++ b/Common/Inc/data_central.h Thu Apr 11 10:26:22 2019 +0000 @@ -86,7 +86,7 @@ int output_time_to_surface_seconds; int output_ndl_seconds; float output_ceiling_meter; - float output_relative_gradient; + float super_saturation; uint32_t tickstamp; } SDecoinfo;
--- a/Discovery/Inc/buehlmann.h Wed Apr 10 11:04:56 2019 +0200 +++ b/Discovery/Inc/buehlmann.h Thu Apr 11 10:26:22 2019 +0000 @@ -32,7 +32,7 @@ void buehlmann_init(void); void buehlmann_calc_deco(SLifeData* pLifeData, SDiveSettings * pDiveSettings, SDecoinfo * pDecoInfo); void buehlmann_ceiling_calculator(SLifeData* pLifeData, SDiveSettings * pDiveSettings, SDecoinfo * pDecoInfo); -void buehlmann_relative_gradient_calculator(SLifeData* pLifeData, SDiveSettings * pDiveSettings, SDecoinfo * pDecoInfo); +void buehlmann_super_saturation_calculator(SLifeData* pLifeData, SDecoinfo * pDecoInfo); float buehlmann_get_gCNS(void); #endif /* BUEHLMANN_H */
--- a/Discovery/Src/base.c Wed Apr 10 11:04:56 2019 +0200 +++ b/Discovery/Src/base.c Thu Apr 11 10:26:22 2019 +0000 @@ -1707,7 +1707,7 @@ case CALC_BUEHLMANN: buehlmann_calc_deco(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann); buehlmann_ceiling_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann); - buehlmann_relative_gradient_calculator(&stateDeco.lifeData,&stateDeco.diveSettings,&stateDeco.decolistBuehlmann); + buehlmann_super_saturation_calculator(&stateDeco.lifeData,&stateDeco.decolistBuehlmann); decoLock = DECO_CALC_FINSHED_Buehlmann; return; case CALC_BUEHLMANN_FUTURE:
--- a/Discovery/Src/buehlmann.c Wed Apr 10 11:04:56 2019 +0200 +++ b/Discovery/Src/buehlmann.c Thu Apr 11 10:26:22 2019 +0000 @@ -406,46 +406,43 @@ return global_ceiling; } -// hw 161121 for relative gradient -float tissue_tolerance_without_gf_correction(float *tissue_inertgas_saturation_output) +void buehlmann_super_saturation_calculator(SLifeData* pLifeData, SDecoinfo * pDecoInfo) { float tissue_inertgas_saturation; float inertgas_a; float inertgas_b; float ceiling; - float global_ceiling; + float super_saturation; + float pres_respiration = pLifeData->pressure_ambient_bar; int ci; - global_ceiling = -1; + pDecoInfo->super_saturation = 0; for (ci = 0; ci < 16; ci++) { if(gTissue_helium_bar[ci] == 0) { tissue_inertgas_saturation = gTissue_nitrogen_bar[ci]; - // inertgas_a = buehlmann_N2_a[ci]; inertgas_b = buehlmann_N2_b[ci]; } else { tissue_inertgas_saturation = gTissue_nitrogen_bar[ci] + gTissue_helium_bar[ci]; - // inertgas_a = ( ( buehlmann_N2_a[ci] * gTissue_nitrogen_bar[ci]) + ( buehlmann_He_a[ci] * gTissue_helium_bar[ci]) ) / tissue_inertgas_saturation; inertgas_b = ( ( buehlmann_N2_b[ci] * gTissue_nitrogen_bar[ci]) + ( buehlmann_He_b[ci] * gTissue_helium_bar[ci]) ) / tissue_inertgas_saturation; } - // - ceiling = inertgas_b * ( tissue_inertgas_saturation - inertgas_a ); - if(ceiling > global_ceiling) + + ceiling = pres_respiration / inertgas_b + inertgas_a; + if(tissue_inertgas_saturation > pres_respiration) { - global_ceiling = ceiling; - if(tissue_inertgas_saturation_output) - { - *tissue_inertgas_saturation_output = tissue_inertgas_saturation; - } + super_saturation = + (tissue_inertgas_saturation - pres_respiration) / (ceiling - pres_respiration); + + if (super_saturation > pDecoInfo->super_saturation) + pDecoInfo->super_saturation = super_saturation; } } - return global_ceiling; } @@ -789,73 +786,3 @@ pDecoInfo->output_ceiling_meter = 999; } } - - -void buehlmann_relative_gradient_calculator(SLifeData* pLifeData, SDiveSettings * pDiveSettings, SDecoinfo * pDecoInfo) -{ - float gf_low; - float gf_high; - float gf_delta; - int dv_gf_low_stop_meter; - - float rgf; // relative gradient factor by hwOS p2_deco.c - float temp_tissue; - float limit; - float pres_respiration; - float gf; - - gf_low = pDiveSettings->gf_low; - gf_high = pDiveSettings->gf_high; - - dv_gf_low_stop_meter = (int)((pDiveSettings->internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero - pLifeData->pressure_surface_bar) * 10); - - if(dv_gf_low_stop_meter < 1) - { - gf_delta = 0; - } - else - { - gf_delta = gf_high - gf_low; - gf_delta /= dv_gf_low_stop_meter; // gf_delta is delta for each meter now!! - } - - - limit = tissue_tolerance_without_gf_correction(&temp_tissue); - pres_respiration = pLifeData->pressure_ambient_bar; - - if( temp_tissue <= pres_respiration ) - { - gf = 0.0; - } - else - { - gf = (temp_tissue - pres_respiration) - / (temp_tissue - limit) - * 100.0f; - } - - if(dv_gf_low_stop_meter < 1) - { - rgf = gf_high; - } - else - { - float temp1 = dv_gf_low_stop_meter; - float temp2 = pLifeData->depth_meter; - - if (temp2 <= 0) - rgf = gf_high; - else if (temp2 >= temp1) - rgf = gf_low; - else - rgf = gf_low + (temp1 - temp2)*gf_delta; - } - - rgf = gf / rgf; - - // avoid discussions about values > 100 below next deco stop - if((rgf > 1.0f) && (pLifeData->depth_meter >= pDecoInfo->output_ceiling_meter)) - rgf = 1.0f; - - pDecoInfo->output_relative_gradient = rgf; -}
--- a/Discovery/Src/t7.c Wed Apr 10 11:04:56 2019 +0200 +++ b/Discovery/Src/t7.c Thu Apr 11 10:26:22 2019 +0000 @@ -2578,7 +2578,7 @@ /* actual GF */ case 8: headerText[2] = TXT_ActualGradient; - snprintf(text,TEXTSIZE,"\020%.0f",100 * pDecoinfoStandard->output_relative_gradient); + snprintf(text,TEXTSIZE,"\020%.0f\016\016%%\017",100 * pDecoinfoStandard->super_saturation); break; } headerText[3] = 0; @@ -3098,7 +3098,7 @@ text[textpointer++] = '\n'; text[textpointer++] = '\r'; text[textpointer++] = '\t'; - textpointer += snprintf(&text[textpointer],10,"\020%.0f", 100 * pDecoinfoStandard->output_relative_gradient); + textpointer += snprintf(&text[textpointer],10,"\020%.0f\016\016%%\017", 100 * pDecoinfoStandard->super_saturation); text[textpointer++] = '\n'; text[textpointer++] = '\r'; text[textpointer++] = '\t';
--- a/Discovery/Src/text_multilanguage.c Wed Apr 10 11:04:56 2019 +0200 +++ b/Discovery/Src/text_multilanguage.c Thu Apr 11 10:26:22 2019 +0000 @@ -156,11 +156,11 @@ static uint8_t text_ES_Ceiling[] = "Techo"; // dive mode -static uint8_t text_EN_ActualGradient[] = "Relative GF"; -static uint8_t text_DE_ActualGradient[] = "Relativ GF"; -static uint8_t text_FR_ActualGradient[] = "GF relatif"; -static uint8_t text_IT_ActualGradient[] = "GF relativo"; -static uint8_t text_ES_ActualGradient[] = "GF relativo"; +static uint8_t text_EN_ActualGradient[] = "Saturation"; +static uint8_t text_DE_ActualGradient[] = ""; +static uint8_t text_FR_ActualGradient[] = ""; +static uint8_t text_IT_ActualGradient[] = ""; +static uint8_t text_ES_ActualGradient[] = ""; // dive mode static uint8_t text_EN_Stopwatch[] = "Stopwatch";
--- a/Discovery/Src/vpm.c Wed Apr 10 11:04:56 2019 +0200 +++ b/Discovery/Src/vpm.c Thu Apr 11 10:26:22 2019 +0000 @@ -306,7 +306,7 @@ pDECOINFO->output_time_to_surface_seconds = 0; pDECOINFO->output_ndl_seconds = 0; pDECOINFO->output_ceiling_meter = 0; - pDECOINFO->output_relative_gradient = 0; + pDECOINFO->super_saturation = 0; uint8_t tmp_calc_status; for(int i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++) {