annotate Discovery/Src/test_vpm.c @ 586:bb5ce239741f

Motion control: Jump back to primary view if focus is lost: The modes sector and scroll are tipically used to have a short look at other information pages (e.g. compass). By automatically jumping back to the primary view, there is no longer the need to select the preferred view when leaving focus mode
author Ideenmodellierer
date Sun, 13 Dec 2020 18:31:40 +0100
parents 54d14bc2083c
children aa6006975e76
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;
281
54d14bc2083c Fix typos (There are still many...)
heinrichsweikamp
parents: 269
diff changeset
164 pInput->events.info_manualGasSetO2 = 0;
54d14bc2083c Fix typos (There are still many...)
heinrichsweikamp
parents: 269
diff changeset
165 pInput->events.info_manualGasSetHe = 0;
54d14bc2083c Fix typos (There are still many...)
heinrichsweikamp
parents: 269
diff changeset
166 pInput->events.manualGasSet = 0;
38
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 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
349 }
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 * @brief test 3
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
354 * Trimix 10/70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
355 * everything else identical to test1 by Peter Ryser
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
356 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
357 * @date 19-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
358 * @retval 1 for result is similar to DRx code, 0 otherwise
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
359 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
360 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
361 uint8_t test3_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
362 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
363
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
364 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
365 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
366 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
367 static float decotable_minutes[DECOINFO_STRUCT_MAX_STOPS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
368 static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
369
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
370 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
371 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
372 int i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
373
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
374 init_buehlmann2(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
375 //vpm conservatism = 0, repetitive = false,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
376 vpm_init(&(input.vpm),0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
377
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
378 //runter auf 70 meter mit 26 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
379 simulate_descent(&input, 70.0f, 26.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
380 //10 minuten settigung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
381 decom_tissues_exposure(10 * 60, &input.lifeData);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
382 //buehlmann__test__saturate_tissues(&input, 10 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
383 //buehlmann_calc_deco(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
384
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
385 vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM), DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
386
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
387 //Check time to surface 46 min +- 0.6
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
388
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
389 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
390 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
391 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
392 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
393 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
394
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
395 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
396 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
397 for(i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
398 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
399 if(decotable_minutes[i] != ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
400 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
401 counter2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
402 decotable_minutes[i] = ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
403 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
404 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
405 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
406 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
407
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 * @brief test 4 - find the limit
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
411 * Trimix 10/70
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
412 * 200 Meter, 30 Minuten
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
413 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
414 * @date 19-April-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
415 * @retval 1 for result is similar to DRx code, 0 otherwise
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
416 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
417 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
418 uint8_t test4_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
419 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
420
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
421 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
422 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
423 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
424 static float decotable_minutes[DECOINFO_STRUCT_MAX_STOPS];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
425 static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
426
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
427 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
428 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
429 int i;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
430
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
431 init_buehlmann2(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
432 //vpm conservatism = 0, repetitive = false,
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
433 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
434
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
435 //runter auf 70 meter mit 26 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
436 simulate_descent(&input, 200.0f, 26.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
437 //10 minuten settigung
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
438 decom_tissues_exposure(10 * 60, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
439 //buehlmann__test__saturate_tissues(&input, 30 * 60);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
440 //buehlmann_calc_deco(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
441
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
442 vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM), DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
443
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
444 //Check time to surface 1270 min
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
445 // Multi Deco 1270 Minuten
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
446
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
447 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
448 if (output_time_to_surface_minutes != 1270)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
449 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
450 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
451 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
452
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
453 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
454 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
455 for(i=0;i<DECOINFO_STRUCT_MAX_STOPS;i++)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
456 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
457 if(decotable_minutes[i] != ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
458 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
459 counter2++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
460 decotable_minutes[i] = ((float)input.decolistVPM.output_stop_length_seconds[i]) / 60.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
461 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
462 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
463 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
464 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
465
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
466 /*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
467 uint8_t test5_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
468 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
469 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
470 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
471 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
472
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
473 // static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
474 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
475 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
476
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
477 //uint32_t frame[5];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
478
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
479 uint8_t vpm_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
480
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
481 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
482 frame[0] = frame1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
483 frame[1] = frame2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
484 frame[2] = frame3;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
485 frame[3] = frame4;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
486 frame[4] = frame[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
487 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
488 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
489 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
490 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
491 setSimulationValues(12, 26 , 70, 30);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
492
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
493 long time = 60 * 70 / 26 + 10 *60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
494
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
495 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
496 while(input.lifeData.dive_time_seconds < time )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
497 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
498 /* frame[4] = frame[0];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
499 frame[0] = frame[1];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
500 frame[1] = frame[2];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
501 frame[2] = frame[3];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
502 frame[3] = frame[4];*/
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
503 UpdateLifeDataTest(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
504
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
505 vpm_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
506 if(vpm_count > 20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
507 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
508 vpm_calc(&input.lifeData, &(input.diveSettings),&input.vpm, &input.decolistVPM, DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
509 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
510 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
511
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
512 /*
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
513 #ifdef VGAOUT
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
514 tVGA_refresh(frame[1], &input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
515 GFX_VGA_transform(frame[1],frame[0]);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
516 GFX_SetFrameBuffer(frame[0], TOP_LAYER);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
517 GFX_clear_buffer(frame[3]); // frame[3] is the previous frame[0]
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
518 #endif
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
519 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
520 if(input.lifeData.dive_time_seconds == 60 *5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
521 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
522 input.events.gasChange = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
523 input.events.info_GasChange = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
524 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
525 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
526 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
527 input.events.gasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
528 input.events.info_GasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
529 }
269
6e78137952af cleanup: do not pass large struct by value
Jan Mulder <jlmulder@xs4all.nl>
parents: 219
diff changeset
530 logbook_writeSample(&input);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
531 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
532 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
533
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
534 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
535 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
536 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
537
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
538 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
539 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
540 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
541 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
542 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
543
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
544 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
545 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
546
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
547 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
548 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
549
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
550
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
551 uint8_t test6_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
552 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
553 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
554 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
555 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
556
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
557 // static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
558 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
559 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
560
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
561 //uint32_t frame[5];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
562
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
563 uint8_t vpm_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
564
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
565 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
566 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
567 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
568 setSimulationValues(12, 26 , 65, 15);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
569
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
570 long time = 60 * 70 / 26 + 10 *60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
571
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
572 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
573 while(input.lifeData.dive_time_seconds < time )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
574 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
575 UpdateLifeDataTest(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
576
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
577 vpm_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
578 if(vpm_count > 20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
579 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
580 vpm_calc(&input.lifeData, &(input.diveSettings),&input.vpm, &input.decolistVPM, DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
581 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
582 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
583 if(input.lifeData.dive_time_seconds == 60 *5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
584 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
585 input.events.gasChange = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
586 input.events.info_GasChange = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
587 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
588 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
589 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
590 input.events.gasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
591 input.events.info_GasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
592 }
269
6e78137952af cleanup: do not pass large struct by value
Jan Mulder <jlmulder@xs4all.nl>
parents: 219
diff changeset
593 logbook_writeSample(&input);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
594 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
595 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
596
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
597 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
598 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
599 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
600
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
601 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
602 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
603 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
604 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
605 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
606
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
607 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
608 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
609
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
610 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
611 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
612
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
613 uint8_t test7_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
614 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
615 /* debug code with watch */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
616 static int32_t output_time_to_surface_minutes;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
617 static int32_t counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
618
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
619 // static int32_t counter2 = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
620 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
621 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
622
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
623 //uint32_t frame[5];
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
624
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
625 uint8_t vpm_count;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
626
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
627 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
628 vpm_init(&input.vpm,0,false,0);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
629 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
630 setSimulationValues(12, 26 , 40, 45);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
631
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
632 long time = 60 * 70 / 26 + 10 *60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
633
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
634 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
635 while(input.lifeData.dive_time_seconds < time )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
636 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
637 UpdateLifeDataTest(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
638
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
639 vpm_count++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
640 if(vpm_count > 20)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
641 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
642 vpm_calc(&input.lifeData,&input.diveSettings, &input.vpm, &input.decolistVPM, DECOSTOPS);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
643 vpm_count = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
644 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
645 if(input.lifeData.dive_time_seconds == 60 *5)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
646 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
647 input.events.gasChange = 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
648 input.events.info_GasChange = 2;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
649 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
650 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
651 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
652 input.events.gasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
653 input.events.info_GasChange = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
654 }
269
6e78137952af cleanup: do not pass large struct by value
Jan Mulder <jlmulder@xs4all.nl>
parents: 219
diff changeset
655 logbook_writeSample(&input);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
656 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
657 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
658
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
659 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
660 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
661 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
662
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
663 output_time_to_surface_minutes = input.decolistVPM.output_time_to_surface_seconds / 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
664 if (output_time_to_surface_minutes != 46)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
665 counter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
666 else
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
667 counter++;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
668
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
669 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
670 return false;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
671
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
672 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
673 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
674
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
675 void test_log_only(uint8_t max_depth_meter, uint16_t divetime_minutes)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
676 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
677 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
678 float ascendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
679 float descendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
680 uint32_t divetime_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
681 uint32_t divetime_start_ascend;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
682
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
683 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
684 input.lifeData.max_depth_meter = 0.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
685 input.lifeData.depth_meter = 0.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
686 input.lifeData.temperature_celsius = 22.7;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
687
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
688 ascendrate_seconds = 12.0 / 60.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
689 descendrate_seconds = 20.0 / 60.0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
690 divetime_seconds = divetime_minutes * 60;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
691 divetime_start_ascend = divetime_seconds - (uint32_t)(max_depth_meter / ascendrate_seconds);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
692
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
693 logbook_initNewdiveProfile(&input,&Settings);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
694
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
695 while(input.lifeData.dive_time_seconds < divetime_seconds )
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
696 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
697 input.lifeData.dive_time_seconds += 1;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
698
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
699 if(input.lifeData.max_depth_meter < (float)max_depth_meter)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
700 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
701 input.lifeData.depth_meter += descendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
702 input.lifeData.max_depth_meter = input.lifeData.depth_meter;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
703 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
704 else if((input.lifeData.dive_time_seconds >= divetime_start_ascend) && (input.lifeData.depth_meter > 0))
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
705 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
706 input.lifeData.depth_meter -= ascendrate_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
707 if(input.lifeData.depth_meter < 0)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
708 input.lifeData.depth_meter = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
709 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
710
269
6e78137952af cleanup: do not pass large struct by value
Jan Mulder <jlmulder@xs4all.nl>
parents: 219
diff changeset
711 logbook_writeSample(&input);
38
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
712 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
713 volatile SLogbookHeader* logbookHeader = logbook_getCurrentHeader();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
714 logbookHeader->total_diveTime_seconds = input.lifeData.dive_time_seconds;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
715 logbookHeader->maxDepth = input.lifeData.max_depth_meter * 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
716 logbook_EndDive();
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
717 }
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
718
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
719
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 * @brief test 101
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
723 * a) for air
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
724 * b) air + oxygen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
725 * c) Trimix 10/70 + oxygen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
726 * 65 Meter, 42 Minuten with descent
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
727 * @version V0.0.1
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
728 * @date 26-Oct-2014
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
729 * @retval ToDo: 1 for result is similar to MultiDeco
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
730 ******************************************************************************
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
731 */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
732
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
733 uint8_t test101_buehlmann_unapproved(void)
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
734 {
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
735 /* all the rest */
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
736 SDiveState input;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
737
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
738 init_buehlmann(&input);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
739
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
740 //Gas Change at 6 meter to oxygin
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
741 //input.diveSettings.decogaslist[1].change_during_ascent_depth_bar_otherwise_zero = 0.6f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
742 //input.diveSettings.decogaslist[1].nitrogen_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
743 //input.diveSettings.decogaslist[1].helium_percentage = 0;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
744 input.diveSettings.gf_high = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
745 input.diveSettings.gf_low = 100;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
746 input.diveSettings.ascentRate_meterperminute = 10.0f;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
747 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
748
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
749 //runter auf 65 meter mit 20 meter/minute
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
750 simulate_descent(&input, 65.0f, 20.0f);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
751 //38min 45sec saettigung == 2325 sec
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
752 decom_tissues_exposure(30*60, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
753 // decom_tissues_exposure(2325, &input.lifeData );
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
754
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
755 //vpm_calc(&(input.lifeData),&(input.diveSettings),&(input.vpm),&(input.decolistVPM));
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
756 buehlmann_calc_deco(&input.lifeData,&input.diveSettings,&input.decolistBuehlmann);
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
757
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
758
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
759 //Check time to surface MultiDeco 4.04
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
760 // 308 min with Air
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
761 // 190,5 min with Air + 6m last stop with oxygen
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
762 // 538 min with Trimix 10/70 and oxygen at 6m
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
763
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
764 // ...
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
765
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
766 return true;
5f11787b4f42 include in ostc4 repository
heinrichsweikamp
parents:
diff changeset
767 }