annotate Discovery/Src/test_vpm.c @ 218:ff59d1d07f9c Improve_IPC_Sync

Splitted 120 seconds UART timeout into chunks of 500ms The UART connection via Bluetooth was realized using a receive call with 120 seconds timeout. By cancellation it seemed for the user as if the connection would have been aborted. In reality the received function keeped executing the wait for RX data till timeout occure. To avaoid this the timeout has been splitted into several calls with 500ms timeout => If the user disconnects by pressing "back" the COMM function is now ended.
author ideenmodellierer
date Sun, 31 Mar 2019 15:44:12 +0200
parents 5f11787b4f42
children f9b17e898a7a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
2 /// -*- coding: UTF-8 -*-
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
3 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
4 /// \file Discovery/Src/test_vpm.c
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
5 /// \brief test 101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
6 /// \author Heinrichs Weikamp
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
7 /// \date 26-Oct-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
8 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
9 /// \details
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
10 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
11 /// $Id$
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
12 ///////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
13 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
14 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
15 /// This program is free software: you can redistribute it and/or modify
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
16 /// it under the terms of the GNU General Public License as published by
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
17 /// the Free Software Foundation, either version 3 of the License, or
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
18 /// (at your option) any later version.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
19 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
20 /// This program is distributed in the hope that it will be useful,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
21 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
22 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
23 /// GNU General Public License for more details.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
24 ///
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
25 /// You should have received a copy of the GNU General Public License
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
26 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
27 //////////////////////////////////////////////////////////////////////////////
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
28
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
29 #include <stdio.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
30 #include <stdint.h>
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
31 //#include "LED.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
32 //#include "Keyboard.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
33 //#include "stm32f4xx_hal.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
34 #include "buehlmann.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
35 #include "calc_crush.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
36 #include "vpm.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
37 #include "display.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
38 #include "test_vpm.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
39 #include "math.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
40 #include "data_central.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
41 #include "decom.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
42 #include "logbook.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
43 #include "tInfoLog.h"
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
44
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
45 #define true 1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
46 #define false 0
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
47 //#define uint8_t unsigned char
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
48
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
49 extern SSettings Settings;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
50
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
51 _Bool simulate_descent(SDiveState* pInput, float ending_depth_meter, float rate_meter_per_minutes);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
52 void init_buehlmann(SDiveState* pInput);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
53
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
54 _Bool test1(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
55 uint8_t test2_unapproved(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
56 uint8_t test3_unapproved(void);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
57
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
58 _Bool simulate_descent(SDiveState* pInput,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
59 float ending_depth_meter,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
60 float rate_meter_per_minutes)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
61 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
62 int i =0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
63 static float initial_helium_pressure[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
64 static float initial_nitrogen_pressure[16];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
65 static float initial_inspired_he_pressure;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
66 static float initial_inspired_n2_pressure;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
67 static float fraction_nitrogen_begin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
68 static float fraction_nitrogen_end;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
69 static float fraction_helium_begin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
70 static float fraction_helium_end;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
71 static float nitrogen_rate;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
72 static float helium_rate;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
73 static float time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
74
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
75 extern const float WATER_VAPOR_PRESSURE;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
76 extern const float HELIUM_TIME_CONSTANT[];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
77 extern const float NITROGEN_TIME_CONSTANT[];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
78
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
79 float starting_ambient_pressure = pInput->lifeData.pressure_ambient_bar * 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
80 float ending_ambient_pressure = ending_depth_meter + pInput->lifeData.pressure_surface_bar * 10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
81
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
82 if((rate_meter_per_minutes <= 0) || (starting_ambient_pressure >= ending_ambient_pressure))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
83 return 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
84
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
85 for(i=0; i<16; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
86 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
87 initial_helium_pressure[i] = pInput->lifeData.tissue_helium_bar[i] * 10.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
88 initial_nitrogen_pressure[i] = pInput->lifeData.tissue_nitrogen_bar[i] * 10.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
89 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
90
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
91 //New
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
92 time = (ending_ambient_pressure - starting_ambient_pressure) / rate_meter_per_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
93 decom_get_inert_gases(starting_ambient_pressure / 10, &pInput->lifeData.actualGas, &fraction_nitrogen_begin, &fraction_helium_begin );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
94 decom_get_inert_gases(ending_ambient_pressure / 10, &pInput->lifeData.actualGas, &fraction_nitrogen_end, &fraction_helium_end );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
95 initial_inspired_he_pressure = (starting_ambient_pressure - WATER_VAPOR_PRESSURE) * fraction_helium_begin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
96 initial_inspired_n2_pressure = (starting_ambient_pressure - WATER_VAPOR_PRESSURE) * fraction_nitrogen_begin;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
97 helium_rate = ((ending_ambient_pressure - WATER_VAPOR_PRESSURE)* fraction_helium_end - initial_inspired_he_pressure)/time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
98 nitrogen_rate = ((ending_ambient_pressure - WATER_VAPOR_PRESSURE)* fraction_nitrogen_end - initial_inspired_n2_pressure)/time;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
99 pInput->lifeData.pressure_ambient_bar = ending_ambient_pressure/10;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
100
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
101 for( i = 0; i < 16; i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
102 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
103 pInput->lifeData.tissue_helium_bar[i] = schreiner_equation__2(&initial_inspired_he_pressure,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
104 &helium_rate,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
105 &time,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
106 &HELIUM_TIME_CONSTANT[i],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
107 &initial_helium_pressure[i])/10.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
108
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
109 pInput->lifeData.tissue_nitrogen_bar[i] = schreiner_equation__2(&initial_inspired_n2_pressure,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
110 &nitrogen_rate,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
111 &time,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
112 &NITROGEN_TIME_CONSTANT[i],
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
113 &initial_nitrogen_pressure[i]) / 10.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
114 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
115
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
116
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
117 calc_crushing_pressure(&pInput->lifeData, &pInput->vpm,initial_helium_pressure,initial_nitrogen_pressure,starting_ambient_pressure, rate_meter_per_minutes);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
118
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
119 pInput->lifeData.dive_time_seconds += ((ending_ambient_pressure - starting_ambient_pressure)/rate_meter_per_minutes) * 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
120 return 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
121 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
122 void init_buehlmann(SDiveState* pInput)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
123 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
124 pInput->diveSettings.internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
125 pInput->lifeData.dive_time_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
126 for(int i=0;i<BUEHLMANN_STRUCT_MAX_GASES;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
127 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
128 pInput->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
129 pInput->diveSettings.decogaslist[i].nitrogen_percentage = 79 - i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
130 pInput->diveSettings.decogaslist[i].helium_percentage = i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
131 pInput->diveSettings.decogaslist[i].setPoint_cbar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
132 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
133 pInput->lifeData.actualGas = pInput->diveSettings.decogaslist[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
134 pInput->diveSettings.last_stop_depth_bar = 0.3f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
135 pInput->diveSettings.input_next_stop_increment_depth_bar = 0.3f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
136
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
137 pInput->decolistVPM.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
138 pInput->decolistFutureVPM.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
139 pInput->decolistBuehlmann.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
140 pInput->decolistFutureBuehlmann.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
141 for(int i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
142 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
143 pInput->decolistVPM.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
144 pInput->decolistFutureVPM.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
145
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
146 pInput->decolistBuehlmann.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
147 pInput->decolistFutureBuehlmann.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
148 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
149 for(int i=0;i<16;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
150 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
151 pInput->lifeData.tissue_nitrogen_bar[i] = 0.750927f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
152 pInput->lifeData.tissue_helium_bar[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
153 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
154 pInput->diveSettings.gf_high = 80;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
155 pInput->diveSettings.gf_low = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
156 pInput->diveSettings.vpm_conservatism = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
157
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
158 pInput->lifeData.pressure_surface_bar = 1.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
159 pInput->lifeData.pressure_ambient_bar = 1.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
160
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
161 pInput->warnings.decoMissed = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
162 pInput->events.gasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
163 pInput->events.info_GasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
164 pInput->events.info_manuelGasSetO2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
165 pInput->events.info_manuelGasSetHe = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
166 pInput->events.manuelGasSet = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
167 pInput->warnings.ppO2High = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
168 pInput->warnings.ppO2Low = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
169 pInput->warnings.slowWarning = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
170
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
171
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
172 //pInput->decolistVPM.UNUSED_input_necessary_stop_length_seconds_otherwise_zero[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
173 /*for(i=0;i<BUEHLMANN_STRUCT_MAX_ASCENDRATES;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
174 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
175 pInput->lifeData.ascentrate[i].rate_bar_per_minute = 1.2f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
176 pInput->lifeData.ascentrate[i].use_from_depth_bar = 0; // only one ascendrate at the moment
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
177 }*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
178 //pInput->diveSettings.input_second_stop_depth_bar = 0.6f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
179 //pInput->lifeData.actual_gas_id = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
180 //pInput->lifeData.actual_setpoint_bar_if_rebreather_otherwise_zero = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
181 //pInput->lifeData.distance_used_below_stop_levels_bar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
182 // pInput->lifeData.pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
183
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
184 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
185
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
186
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
187 void init_buehlmann2(SDiveState* pInput)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
188 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
189 pInput->diveSettings.internal__pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
190 pInput->lifeData.dive_time_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
191 int i=0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
192 for(i=0;i<BUEHLMANN_STRUCT_MAX_GASES;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
193 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
194 pInput->diveSettings.decogaslist[i].change_during_ascent_depth_meter_otherwise_zero = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
195 pInput->diveSettings.decogaslist[i].nitrogen_percentage = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
196 pInput->diveSettings.decogaslist[i].helium_percentage = 70;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
197 pInput->diveSettings.decogaslist[i].setPoint_cbar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
198 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
199 pInput->lifeData.actualGas = pInput->diveSettings.decogaslist[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
200 /*for(i=0;i<BUEHLMANN_STRUCT_MAX_ASCENDRATES;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
201 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
202 pInput->lifeData.ascentrate[i].rate_bar_per_minute = 1.2f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
203 pInput->lifeData.ascentrate[i].use_from_depth_bar = 0; // only one ascendrate at the moment
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
204 }*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
205 pInput->diveSettings.last_stop_depth_bar = 0.3f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
206 //pInput->diveSettings.input_second_stop_depth_bar = 0.6f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
207 pInput->diveSettings.input_next_stop_increment_depth_bar = 0.3f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
208 pInput->decolistVPM.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
209 pInput->decolistFutureVPM.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
210 pInput->decolistBuehlmann.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
211 pInput->decolistFutureBuehlmann.output_time_to_surface_seconds = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
212 for(int i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
213 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
214 pInput->decolistVPM.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
215 pInput->decolistFutureVPM.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
216
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
217 pInput->decolistBuehlmann.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
218 pInput->decolistFutureBuehlmann.output_stop_length_seconds[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
219 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
220 for(i=0;i<16;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
221 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
222 pInput->lifeData.tissue_nitrogen_bar[i] = 0.750927f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
223 pInput->lifeData.tissue_helium_bar[i] = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
224 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
225
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
226 // pInput->lifeData.distance_used_below_stop_levels_bar = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
227 pInput->diveSettings.gf_high = 80;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
228 pInput->diveSettings.gf_low = 20;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
229 pInput->diveSettings.vpm_conservatism = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
230 // pInput->lifeData.pressure_first_stop_ambient_bar_as_upper_limit_for_gf_low_otherwise_zero = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
231 pInput->lifeData.pressure_surface_bar = 1.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
232 pInput->lifeData.pressure_ambient_bar = 1.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
233 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
234
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
235
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
236 _Bool test1()
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
237 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
238 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
239 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
240 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
241 //static float decotable_minutes[DECOINFO_STRUCT_MAX_STOPS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
242
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
243 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
244 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
245
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
246 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
247 //vpm conservatism = 0, repetitive = false,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
248 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
249
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
250 //runter auf 70 meter mit 26 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
251 simulate_descent(&input, 70.0f, 26.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
252 //10 minuten settigung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
253 //buehlmann__test__saturate_tissues(&input, 10 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
254 decom_tissues_exposure(10 * 60, &input.lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
255 //buehlmann_calc_deco(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
256
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
257 vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM), DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
258
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
259 //Check time to surface 46 min +- 0.6
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
260 // MultiDeco hw: 42 min
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
261
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
262 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
263 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
264 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
265 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
266 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
267
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
268 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 46.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
269 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
270 /* for(i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
271 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
272
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
273 if(decotable_minutes[i] != ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
274 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
275 counter2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
276 decotable_minutes[i] = ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
277 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
278 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
279 i = i;*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
280
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
281 vpm_saturation_after_ascent(&input.lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
282 input.vpm.decomode_vpm_plus_conservatism_last_dive = input.diveSettings.vpm_conservatism;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
283
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
284 //Pause 60 min
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
285 decom_tissues_exposure(60 * 60, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
286 //buehlmann__test__saturate_tissues(&input, 60 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
287 vpm_init(&input.vpm,0,true, 60 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
288 //runter auf 70 meter mit 26 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
289 simulate_descent(&input, 70.0f, 26.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
290 //10 minuten settigung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
291 //buehlmann__test__saturate_tissues(&input, 10 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
292 decom_tissues_exposure(10 * 60, &input.lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
293 vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM), DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
294 //Check time to surface 46 min +- 0.6
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
295 // MultiDeco hw: 42 min
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
296
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
297 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
298
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
299 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 57.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
300 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
301
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
302 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
303 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
304
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
305
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
306 uint8_t test2_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
307 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
308 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
309 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
310 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
311 static float decotable_minutes[DECOINFO_STRUCT_MAX_STOPS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
312 static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
313
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
314 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
315 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
316 int i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
317
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
318 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
319 //vpm conservatism = 3, repetitive = false,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
320 vpm_init(&(input.vpm),3,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
321
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
322 //runter auf 70 meter mit 26 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
323 simulate_descent(&input, 70.0f, 26.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
324 //30 minuten saetigung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
325 //buehlmann__test__saturate_tissues(&input, 30 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
326 decom_tissues_exposure(30 * 60, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
327 //buehlmann_calc_deco(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
328
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
329 vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM), DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
330 //Check time to surface 179.833 min (Peter Version 140415) +- 0.6, MultiDeco is 195 min
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
331
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
332 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
333 if (output_time_to_surface_minutes != 180)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
334 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
335 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
336 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
337
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
338 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 180.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
339 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
340 for(i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
341 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
342 if(decotable_minutes[i] != ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
343 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
344 counter2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
345 decotable_minutes[i] = ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
346 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
347 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
348 i = i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
350 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
351
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
352 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
353 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 * @brief test 3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 * Trimix 10/70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 * everything else identical to test1 by Peter Ryser
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 * @date 19-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 * @retval 1 for result is similar to DRx code, 0 otherwise
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 uint8_t test3_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 static float decotable_minutes[DECOINFO_STRUCT_MAX_STOPS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369 static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373 int i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 init_buehlmann2(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 //vpm conservatism = 0, repetitive = false,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377 vpm_init(&(input.vpm),0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 //runter auf 70 meter mit 26 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 simulate_descent(&input, 70.0f, 26.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 //10 minuten settigung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 decom_tissues_exposure(10 * 60, &input.lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 //buehlmann__test__saturate_tissues(&input, 10 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384 //buehlmann_calc_deco(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386 vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM), DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388 //Check time to surface 46 min +- 0.6
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
396 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 46.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 for(i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 if(decotable_minutes[i] != ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 counter2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 decotable_minutes[i] = ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 i = i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
408 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
409
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
410 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 * @brief test 4 - find the limit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 * Trimix 10/70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 * 200 Meter, 30 Minuten
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 * @date 19-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 * @retval 1 for result is similar to DRx code, 0 otherwise
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420 uint8_t test4_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426 static float decotable_minutes[DECOINFO_STRUCT_MAX_STOPS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 int i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 init_buehlmann2(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434 //vpm conservatism = 0, repetitive = false,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 //runter auf 70 meter mit 26 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 simulate_descent(&input, 200.0f, 26.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 //10 minuten settigung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 decom_tissues_exposure(10 * 60, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441 //buehlmann__test__saturate_tissues(&input, 30 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 //buehlmann_calc_deco(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM), DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446 //Check time to surface 1270 min
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 // Multi Deco 1270 Minuten
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 if (output_time_to_surface_minutes != 1270)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
454
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 1270.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 for(i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 if(decotable_minutes[i] != ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 counter2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 decotable_minutes[i] = ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465 i = i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
467 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 /*uint8_t test5_unapproved(uint32_t frame1, uint32_t frame2, uint32_t frame3, uint32_t frame4)*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 uint8_t test5_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476 // static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480 //uint32_t frame[5];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 uint8_t vpm_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 frame[0] = frame1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 frame[1] = frame2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 frame[2] = frame3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 frame[3] = frame4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 frame[4] = frame[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494 setSimulationValues(12, 26 , 70, 30);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 long time = 60 * 70 / 26 + 10 *60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 while(input.lifeData.dive_time_seconds < time )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 /* frame[4] = frame[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 frame[0] = frame[1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 frame[1] = frame[2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504 frame[2] = frame[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 frame[3] = frame[4];*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 UpdateLifeDataTest(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 vpm_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 if(vpm_count > 20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511 vpm_calc(&input.lifeData, &(input.diveSettings),&input.vpm, &input.decolistVPM, DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 #ifdef VGAOUT
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 tVGA_refresh(frame[1], &input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 GFX_VGA_transform(frame[1],frame[0]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 GFX_SetFrameBuffer(frame[0], TOP_LAYER);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 GFX_clear_buffer(frame[3]); // frame[3] is the previous frame[0]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 if(input.lifeData.dive_time_seconds == 60 *5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 input.events.gasChange = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 input.events.info_GasChange = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
530 input.events.gasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 input.events.info_GasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533 logbook_writeSample(input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
545 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 46.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 uint8_t test6_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560 // static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564 //uint32_t frame[5];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 uint8_t vpm_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571 setSimulationValues(12, 26 , 65, 15);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 long time = 60 * 70 / 26 + 10 *60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576 while(input.lifeData.dive_time_seconds < time )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 UpdateLifeDataTest(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 vpm_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 if(vpm_count > 20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 vpm_calc(&input.lifeData, &(input.diveSettings),&input.vpm, &input.decolistVPM, DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 if(input.lifeData.dive_time_seconds == 60 *5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 input.events.gasChange = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 input.events.info_GasChange = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
593 input.events.gasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 input.events.info_GasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596 logbook_writeSample(input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
608 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 46.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 uint8_t test7_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622 // static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626 //uint32_t frame[5];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 uint8_t vpm_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633 setSimulationValues(12, 26 , 40, 45);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 long time = 60 * 70 / 26 + 10 *60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638 while(input.lifeData.dive_time_seconds < time )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 UpdateLifeDataTest(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 vpm_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 if(vpm_count > 20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 vpm_calc(&input.lifeData,&input.diveSettings, &input.vpm, &input.decolistVPM, DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 if(input.lifeData.dive_time_seconds == 60 *5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 input.events.gasChange = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 input.events.info_GasChange = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
655 input.events.gasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 input.events.info_GasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658 logbook_writeSample(input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
670 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 if(fabsf( ((float)input.decolistVPM.output_time_to_surface_seconds / 60.0f) - 46.0f) >= 0.6f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 void test_log_only(uint8_t max_depth_meter, uint16_t divetime_minutes)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 float ascendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682 float descendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 uint32_t divetime_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 uint32_t divetime_start_ascend;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687 input.lifeData.max_depth_meter = 0.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 input.lifeData.depth_meter = 0.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 input.lifeData.temperature_celsius = 22.7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 ascendrate_seconds = 12.0 / 60.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692 descendrate_seconds = 20.0 / 60.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 divetime_seconds = divetime_minutes * 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694 divetime_start_ascend = divetime_seconds - (uint32_t)(max_depth_meter / ascendrate_seconds);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698 while(input.lifeData.dive_time_seconds < divetime_seconds )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 input.lifeData.dive_time_seconds += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 if(input.lifeData.max_depth_meter < (float)max_depth_meter)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 input.lifeData.depth_meter += descendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 input.lifeData.max_depth_meter = input.lifeData.depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 else if((input.lifeData.dive_time_seconds >= divetime_start_ascend) && (input.lifeData.depth_meter > 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 input.lifeData.depth_meter -= ascendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710 if(input.lifeData.depth_meter < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
711 input.lifeData.depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 logbook_writeSample(input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
720 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
721
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
722
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723 /**
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 * @brief test 101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 * a) for air
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 * b) air + oxygen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 * c) Trimix 10/70 + oxygen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729 * 65 Meter, 42 Minuten with descent
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731 * @date 26-Oct-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732 * @retval ToDo: 1 for result is similar to MultiDeco
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 uint8_t test101_buehlmann_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 //Gas Change at 6 meter to oxygin
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 //input.diveSettings.decogaslist[1].change_during_ascent_depth_bar_otherwise_zero = 0.6f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745 //input.diveSettings.decogaslist[1].nitrogen_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 //input.diveSettings.decogaslist[1].helium_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 input.diveSettings.gf_high = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
748 input.diveSettings.gf_low = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 input.diveSettings.ascentRate_meterperminute = 10.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 input.diveSettings.last_stop_depth_bar = 0.3f; // input.diveSettings.last_stop_depth_bar = 0.6f; /* ist egal bei oxygen */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 //runter auf 65 meter mit 20 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753 simulate_descent(&input, 65.0f, 20.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754 //38min 45sec saettigung == 2325 sec
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
755 decom_tissues_exposure(30*60, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 // decom_tissues_exposure(2325, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758 //vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759 buehlmann_calc_deco(&input.lifeData,&input.diveSettings,&input.decolistBuehlmann);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762 //Check time to surface MultiDeco 4.04
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763 // 308 min with Air
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
764 // 190,5 min with Air + 6m last stop with oxygen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
765 // 538 min with Trimix 10/70 and oxygen at 6m
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
767 // ...
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
768
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
769 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
770 }