changeset 129:239aa58b533d FlipDisplay

Added function to initialise structures with the actual ambient pressure
author Ideenmodellierer
date Sun, 17 Feb 2019 21:14:09 +0100
parents c78bcbd5deda
children b7689d9e888a
files Common/Inc/decom.h Common/Src/decom.c
diffstat 2 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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);
--- 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: */