# HG changeset patch # User Ideenmodellierer # Date 1550434449 -3600 # Node ID 239aa58b533da06ac514b4f50a8db7b5e4ad852e # Parent c78bcbd5deda93764dde591e48ff4f1d822b141b Added function to initialise structures with the actual ambient pressure diff -r c78bcbd5deda -r 239aa58b533d Common/Inc/decom.h --- a/Common/Inc/decom.h Sun Feb 17 21:12:22 2019 +0100 +++ b/Common/Inc/decom.h Sun Feb 17 21:14:09 2019 +0100 @@ -36,6 +36,7 @@ void decom_tissues_exposure2(int period_in_seconds, SGas* pActualGas, float pressure_ambient_bar, float *tissue_N2_selected_stage, float *tissue_He_selected_stage); float decom_schreiner_equation(float *initial_inspired_gas_pressure, float *rate_change_insp_gas_pressure, float *interval_time_minutes, const float *gas_time_constant, float *initial_gas_pressure); void decom_reset_with_1000mbar(SLifeData * pLifeData); +void decom_reset_with_ambientmbar(float ambient, SLifeData * pLifeData); void decom_tissues_exposure_stage_schreiner(int period_in_seconds, SGas* pGas, float starting_ambient_pressure_bar, float ending_ambient_pressure_bar, float* pTissue_nitrogen_bar, float* pTissue_helium_bar); diff -r c78bcbd5deda -r 239aa58b533d Common/Src/decom.c --- a/Common/Src/decom.c Sun Feb 17 21:12:22 2019 +0100 +++ b/Common/Src/decom.c Sun Feb 17 21:14:09 2019 +0100 @@ -406,6 +406,24 @@ pLifeData->no_fly_time_minutes = 0; } +void decom_reset_with_ambientmbar(float ambient, SLifeData * pLifeData) +{ + + float saturation = 1.0; + saturation = ambient; + saturation -= WATER_VAPOUR_PRESSURE; + saturation *= FRACTION_N2_AIR; + + for(int i=0;i<16;i++) + { + pLifeData->tissue_nitrogen_bar[i] = saturation; + pLifeData->tissue_helium_bar[i] = 0; + } + pLifeData->otu = 0; + pLifeData->cns = 0; + pLifeData->desaturation_time_minutes = 0; + pLifeData->no_fly_time_minutes = 0; +} /* =============================================================================== */ /* NOTE ABOUT PRESSURE UNITS USED IN CALCULATIONS: */