Mercurial > public > hwos_code
comparison src/shared_definitions.h @ 560:b7eb98dbd800
bump to 2.96beta (REFACTORED VERSION)
author | heinrichsweikamp |
---|---|
date | Wed, 31 Jan 2018 19:39:37 +0100 |
parents | 06e9370c6d75 |
children | 1ab93aca7fa9 |
comparison
equal
deleted
inserted
replaced
559:9cb967d844f0 | 560:b7eb98dbd800 |
---|---|
1 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | 1 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
2 ; | 2 ; |
3 ; shared_definitions.h | 3 ; shared_definitions.h REFACTORED VERSION V2.95a1 |
4 ; | 4 ; |
5 ; Declare variables used both in C and ASM code | 5 ; Declare variables used both in C and ASM code |
6 ; | 6 ; |
7 ; This program is free software: you can redistribute it and/or modify | 7 ; This program is free software: you can redistribute it and/or modify |
8 ; it under the terms of the GNU General Public License as published by | 8 ; it under the terms of the GNU General Public License as published by |
65 #define TAB_UCHAR(n,size) n res size | 65 #define TAB_UCHAR(n,size) n res size |
66 #define VAR_UINT(n) n res 2 | 66 #define VAR_UINT(n) n res 2 |
67 #define TAB_UINT(n,size) n res 2*size | 67 #define TAB_UINT(n,size) n res 2*size |
68 #endif | 68 #endif |
69 | 69 |
70 | |
71 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
72 Define model dimensions. | |
73 NUM_COMP is the number of compartiments in the Bühlmann ZH-L16 model, ie 16. | |
74 NUM_STOPS is the maximum number of stops computed by decoplanning. | |
75 Note that the deepest stop is roughly limited to 3m * NUM_STOPS | |
76 (this is assuming all stops up to the surface are used). | |
77 Note also that if the table overflow, extra stops are ignored, | |
78 and not reported in TTS summing. | |
79 NUM_GAS is the number of (potentially) active gas considered during | |
80 ascent simulation. | |
81 #endif | |
82 #define NUM_COMP 0x10 | |
83 #define NUM_STOPS 0x20 | |
84 #define NUM_GAS 5 | |
85 | |
86 | |
70 #ifdef __18CXX | 87 #ifdef __18CXX |
71 //---- BANK 3 DATA ------------------------------------------------------- | 88 //---- BANK 3 DATA ------------------------------------------------------- |
72 // Gather all data C-code --> ASM-code | 89 // Gather all data C-code --> ASM-code |
73 # pragma udata overlay bank3=0x300 | 90 # pragma udata overlay bank3=0x300 |
74 #else | 91 #else |
92 ; In ASM, put the same bank, in overlay mode, at the same address | |
75 bank3 udata_ovr 0x300 | 93 bank3 udata_ovr 0x300 |
76 #endif | 94 #endif |
77 | 95 |
78 | 96 VAR_UINT (int_O_gtissue_press); // pressure of leading compartment |
79 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | 97 |
80 Define model dimensions. | 98 VAR_UINT (int_O_desaturation_time); // time until tissues desaturated to 5% remains, in minutes |
81 NUM_COMP is the number of compartiments in the Bühlmann ZH-L16 model, ie 16. | 99 VAR_UINT (int_O_nofly_time); // altitude / no-fly waiting time time in minutes |
82 NUM_STOPS is the maximum number of stops computed by decoplanning. | 100 |
83 Note that the deapest stop is roughly limited to 3m * NUM_STOPS | 101 VAR_UINT (int_O_ascenttime); // time-to-surface (TTS) in minutes |
84 (this is assuming all stops up to the surface are used). | 102 VAR_UINT (int_O_alternate_ascenttime); // TTS for the alternative dive plan |
85 Note also that if the table overflow, extra stops are ignored, | 103 |
86 and not reported in TTS summing. | 104 VAR_UINT (int_O_CNS_fraction); // current CNS% |
87 NUM_GAS is the number of (potentially) active gas considered during | 105 VAR_UINT (int_O_normal_CNS_fraction); // CNS% at end of dive in normal dive plan |
88 ascent simulation. | 106 VAR_UINT (int_O_alternate_CNS_fraction); // CNS% at end of dive in alternative plan |
89 #endif | 107 |
90 #define NUM_COMP 0x10 | 108 VAR_UINT (int_O_gradient_factor); // current gradient factor in % |
91 #define NUM_STOPS 0x20 | 109 |
92 #define NUM_GAS 5 | 110 VAR_UCHAR (char_O_nullzeit); // remaining NDL time in minutes |
93 | 111 VAR_UCHAR (char_O_alternate_nullzeit); // remaining NDL time for the alternative dive plan |
94 VAR_UINT (int_O_gtissue_press); | 112 |
95 VAR_UINT (int_O_desaturation_time); // | 113 VAR_UCHAR (char_O_main_status); // setup of the deco engine regarding the real tissue computations |
96 VAR_UINT (int_O_ascenttime); // TTS (in minutes) | 114 VAR_UCHAR (char_O_deco_status); // setup of the deco engine regarding the decompression computations |
97 VAR_UINT (int_O_extra_ascenttime); // TTS for @+5min variant (in minutes) | 115 |
98 VAR_UINT (int_O_CNS_fraction); // new in v.101 | 116 VAR_UCHAR (char_O_gtissue_no); // number of the leading compartment |
99 | 117 |
100 VAR_UCHAR (char_O_nullzeit); // | 118 VAR_UCHAR (char_O_EAD); // equivalent air depth (EAD) of breathed gas |
101 VAR_UCHAR (char_O_deco_status); // Deko state-machine state. | 119 VAR_UCHAR (char_O_END); // equivalent narcosis depth (END) of breathed gas |
102 VAR_UCHAR (char_O_deco_last_stop); // Depth reached during deko planning. | 120 |
103 VAR_UCHAR (char_O_gradient_factor); // | 121 VAR_UCHAR (char_O_first_deco_depth); // depth of first stop (deco or gas change) |
104 VAR_UCHAR (char_O_gtissue_no); // | 122 VAR_UCHAR (char_O_first_deco_time) ; // duration of first stop |
105 VAR_UCHAR (char_O_diluent); // new in v.101 | 123 |
106 VAR_UCHAR (char_O_flush_ppO2); // 2011-05-01: ppO2 from diluant (CCR mode). | 124 TAB_UCHAR (char_O_deco_depth, NUM_STOPS); // stops table: depth, ... |
107 VAR_UCHAR (char_O_EAD); // 2011-05-01: Added EAD/END in deco model. | 125 TAB_UCHAR (char_O_deco_time, NUM_STOPS); // ... duration, and |
108 VAR_UCHAR (char_O_END); // 2011-05-01: Added EAD/END in deco model. | 126 TAB_UCHAR (char_O_deco_gas, NUM_STOPS); // ... gas breathed |
109 | 127 |
110 VAR_UCHAR (char_O_first_deco_depth); // Depth of first stop. | 128 TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS); // variant of the stops table for logging purpose |
111 VAR_UCHAR (char_O_first_deco_time) ; // Duration of first stop. | 129 |
112 TAB_UCHAR (char_O_deco_depth, NUM_STOPS); // Fusionned decompression table: | 130 TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP); // nitrogen tissue pressures for display purpose |
113 TAB_UCHAR (char_O_deco_time, NUM_STOPS); // Both ZH-L16 and L16-GF models. | 131 TAB_UCHAR (char_O_tissue_He_saturation, NUM_COMP); // helium tissue pressures for display purpose |
114 TAB_UCHAR (char_O_deco_gas, NUM_STOPS); // Both ZH-L16 and L16-GF models. | 132 |
115 TAB_UCHAR (char_O_deco_time_for_log, NUM_STOPS); // For logging the full decoplan | 133 VAR_UCHAR (char_O_deco_warnings); // vector of warnings generated by the deco engine |
116 | 134 |
117 TAB_UCHAR (char_O_tissue_N2_saturation, NUM_COMP); // Nitrogen compartiment desaturation time, in min. | 135 TAB_UINT (int_O_gas_volumes, NUM_GAS); // gas volumes needed in liters |
118 TAB_UCHAR (char_O_tissue_He_saturation, NUM_COMP); // Helium compartiment desaturation time, in min. | 136 TAB_UINT (int_O_tank_pres_need, NUM_GAS); // tank pressures needed in bar |
119 | 137 VAR_UINT (int_O_ceiling); // ultimate ascent bound in mbar relative pressure |
120 TAB_UINT (int_O_gas_volumes, 5); // Volumes evaluation for each gas tank, in 0.1 liters. | 138 |
121 VAR_UINT (int_O_ceiling); // in mbar | 139 VAR_UINT (int_O_O2_ppO2); // ppO2 of pure O2 at current depth |
140 VAR_UINT (int_O_pure_ppO2); // ppO2 of the current gas or dil if breathed pure | |
141 VAR_UINT (int_O_pSCR_ppO2); // ppO2 calculated in pSCR loop | |
142 VAR_UINT (int_O_breathed_ppO2); // ppO2 actually breathed (= char_O_pure_ppO2 if in OC) | |
143 | |
122 | 144 |
123 #ifdef __18CXX | 145 #ifdef __18CXX |
124 //---- BANK 4 DATA ------------------------------------------------------- | 146 //---- BANK 4 DATA ------------------------------------------------------- |
125 // Gather all data ASM-code --> C-code | 147 // Gather all data ASM-code --> C-code |
126 # pragma udata overlay bank4=0x400 | 148 # pragma udata overlay bank4=0x400 |
127 #else | 149 #else |
128 ; In ASM, put the same bank, in overlay mode, at the same address | 150 ; In ASM, put the same bank, in overlay mode, at the same address |
129 bank4 udata_ovr 0x400 | 151 bank4 udata_ovr 0x400 |
130 #endif | 152 #endif |
131 | 153 |
132 VAR_UCHAR (char_I_step_is_1min); // Use 1min integration for tissue and CNS. | 154 VAR_UINT (int_I_pres_respiration); // absolute pressure breathed |
133 | 155 VAR_UINT (int_I_pres_surface); // absolute pressure at surface |
134 VAR_UINT (int_I_pres_respiration); // | 156 |
135 VAR_UINT (int_I_pres_surface); // | 157 VAR_UCHAR (char_I_current_gas); // number of gas currently breathed (1..5 for configured gases, 6 for the manual gas) |
136 VAR_UINT (int_I_temp); // new in v101 | 158 VAR_UCHAR (char_I_He_ratio); // helium ratio of the currently breathed gas |
137 VAR_UINT (int_I_divemins); // Dive time (minutes) | 159 VAR_UCHAR (char_I_O2_ratio); // oxygen ratio of the currently breathed gas |
138 VAR_UCHAR (char_I_temp); // new in v101 | 160 |
139 VAR_UCHAR (char_I_actual_ppO2); // | 161 VAR_UCHAR (char_I_saturation_multiplier); // safety factor, 100 = no conservatism, 150 = 50% faster saturation |
140 VAR_UCHAR (char_I_first_gas); // Gas used at start of dive (bottom mix) | 162 VAR_UCHAR (char_I_desaturation_multiplier);// safety factor, 100 = no conservatism, 66 = 50% slower desaturation |
141 VAR_UCHAR (char_I_current_gas); // Current gas breathed (1..6). | 163 |
142 VAR_UCHAR (char_I_N2_ratio); // | 164 VAR_UCHAR (char_I_GF_High_percentage); // GF model high value |
143 VAR_UCHAR (char_I_He_ratio); // | 165 VAR_UCHAR (char_I_GF_Low_percentage); // GF model low value |
144 VAR_UCHAR (char_I_O2_ratio); // | 166 |
145 VAR_UCHAR (char_I_saturation_multiplier); // for conservatism/safety values 1.0 no conservatism to 1.5 50% faster saturation | 167 VAR_UCHAR (char_I_deco_distance); // assumed extra depth below required depth for CNS and gas volumes calculations |
146 VAR_UCHAR (char_I_desaturation_multiplier);// for conservatism/safety values 0.66 50% slower desaturation to 1.0 no conservatism// consveratism used in calc_tissue , calc_tissue_step_1_min and sim_tissue_1min | 168 VAR_UCHAR (char_I_depth_last_deco); // depth of the last deco stop in meters |
147 VAR_UCHAR (char_I_GF_High_percentage); // new in v.102 | 169 |
148 VAR_UCHAR (char_I_GF_Low_percentage); // new in v.102 | 170 VAR_UCHAR (char_I_deco_model); // deco model selection: 0 = ZH-L16, 1 = ZH-L16-GF (with gradient factors) |
149 VAR_UCHAR (char_I_deco_distance); // | 171 |
150 VAR_UCHAR (char_I_depth_last_deco); // new in v.101 unit: [m] | 172 VAR_UCHAR (char_I_bottom_depth); // bottom depth, used for gas volume calculations |
151 VAR_UCHAR (char_I_deco_model); // new in v.102. 0 == ZH-L16, 1 = ZH-L16-GF (Gradiant factor) | 173 VAR_UCHAR (char_I_bottom_time); // bottom time, used for gas volume calculations |
152 VAR_UCHAR (char_I_bottom_depth); // Bottom depth for planning (used in gas volume evaluation). | 174 |
153 VAR_UCHAR (char_I_bottom_time); // Bottom time for planning (used in gas volume evaluation). | 175 VAR_UCHAR (char_I_dive_interval); // duration of surface break before next dive in minutes, used in simulation |
154 VAR_UCHAR (char_I_dive_interval); // Delay before next dive simulation. | 176 VAR_UCHAR (char_I_sim_advance_time); // 'fast forward' of dive time, used in simulation (+5 min function) |
155 VAR_UCHAR (char_I_const_ppO2); // new in v.101 | 177 |
156 | 178 VAR_UCHAR (char_I_const_ppO2); // ppO2 reported from sensors or by setpoint |
157 TAB_UCHAR (char_I_deco_gas_change,NUM_GAS); // new in v.101 | 179 |
158 TAB_UCHAR (char_I_dil_change,NUM_GAS); // Must be placed after char_I_deco_gas_change! | 180 TAB_UCHAR (char_I_deco_gas_change,NUM_GAS); // change depths of the OC gases |
159 | 181 TAB_UCHAR (char_I_dil_change, NUM_GAS); // change depths of the diluent gases. Attention: must be placed after char_I_deco_gas_change! Remark: not used by C code, only by ASM code |
160 TAB_UCHAR (char_I_setpoint_change,NUM_GAS); // Change depths in m | 182 |
161 TAB_UCHAR (char_I_deco_N2_ratio, NUM_GAS); // new in v.101 | 183 TAB_UCHAR (char_I_setpoint_change,NUM_GAS); // change depth for the setpoints in meter |
162 TAB_UCHAR (char_I_deco_He_ratio, NUM_GAS); // new in v.101 | 184 TAB_UCHAR (char_I_setpoint_cbar, NUM_GAS); // setpoints in cbar |
163 | 185 |
164 TAB_UCHAR (char_I_setpoint_cbar,NUM_GAS); // Setpoints in cbar | 186 TAB_UCHAR (char_I_deco_O2_ratio, NUM_GAS); // oxygen ratios of the configured gases, used for deco calculations |
165 | 187 TAB_UCHAR (char_I_deco_He_ratio, NUM_GAS); // helium ratios of the configured gases, used for deco calculations |
166 VAR_UCHAR (char_I_bottom_usage); // [l/min] | 188 |
167 VAR_UCHAR (char_I_deco_usage); // [l/min] | 189 TAB_UCHAR (char_I_tank_size, NUM_GAS); // tank sizes, used for pressure needs calculation |
168 | 190 TAB_UCHAR (char_I_tank_pres_fill, NUM_GAS); // tank fill pressures, used for generating warnings |
169 VAR_UCHAR (char_I_extra_time); // [min] | 191 |
170 VAR_UCHAR (temp_bankx400); // temp | 192 VAR_UCHAR (char_I_cc_max_frac_o2); // limiter for maximum O2% in loop |
193 VAR_UCHAR (char_I_PSCR_drop); // pSCR parameter drop [%] | |
194 VAR_UCHAR (char_I_PSCR_lungratio); // pSCR parameter lung ratio [1/x] | |
195 | |
196 VAR_UCHAR (char_I_altitude_wait); // selector for altitude / no-fly waiting time calculation | |
197 | |
198 VAR_UCHAR (char_I_bottom_usage); // gas consumption during bottom part and initial ascent in liters/minute | |
199 VAR_UCHAR (char_I_deco_usage); // gas consumption during deco stops and following ascents in liters/minute | |
200 | |
201 VAR_UCHAR (char_I_extra_time); // extra bottom time for fTTs and delayed ascent calculation in minutes | |
202 | |
203 VAR_UCHAR (char_I_ppO2_max); // warning threshold for maximum ppO2 during working phase of the dive | |
204 VAR_UCHAR (char_I_ppO2_max_deco); // warning threshold for maximum ppO2 during deco phase of the dive | |
205 VAR_UCHAR (char_I_ppO2_min); // warning threshold for maximum ppO2 when breathing OC | |
206 VAR_UCHAR (char_I_ppO2_min_loop); // warning threshold for maximum ppO2 when breathing from CCR or pSCR | |
207 | |
208 VAR_UCHAR (char_I_ascent_speed); // ascent speed in meters/minute | |
209 VAR_UCHAR (char_I_gas_change_time); // extra time spent during a stop for doing a gas change, in minutes | |
210 | |
211 | |
212 #ifdef xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
213 // VAR_UCHAR (char_I_step_is_1min); // Use 1min integration for tissue and CNS. DELETED ## V2.95 - made local to p2_deco.c | |
214 // VAR_UINT (int_I_temp); // new in v101 DELETED ## no fly | |
215 // VAR_UINT (int_I_divemins); // Dive time (minutes) DELETED ## V2.95 - not used by p2_deco.c | |
216 // VAR_UCHAR (char_I_temp); // new in v101 DELETED ## no fly | |
217 // VAR_UCHAR (char_I_actual_ppO2); // DELETED ## V2.94 | |
218 // VAR_UCHAR (char_I_first_gas); // Gas used at start of dive (bottom mix) DELETED ## V2.95 - made local to p2_deco.c | |
219 // VAR_UCHAR (char_I_N2_ratio); // N2 ratio of the currently breathed gas DELETED ## V2.95 - not read from ASM, but actually computed by p2_deco.c from H2 and O2 ratio | |
220 // VAR_UCHAR (char_O_deco_last_stop); // Depth reached during deco planning. DELETED ## V2.95 - not used in ASM | |
221 // VAR_UCHAR (temp_bankx400); // reserved space for temporary variables | |
222 #endif |