Bulhmann decompression calculator (ZH16B)

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: https://technical.swissmicros.com/decoders/dm42/

You can then copy/paste the listing and post it in "code" tags.
Post Reply
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

===================================================
DISCLAIMER :
ZH16B is a DM42 deco program that is given for educational
purpose only (RPN deco calculations)
IT SHOULD NOT BE USED TO PLAN YOUR DIVES...
... although it gives same results (around 99%) as
MULTIDECO ANDROID commercial planner!
===================================================

Version changes :
- 22/11/2022 : BIG BUG correction, somehow the files uploaded where of various date with differences? I corrected uploading the last files version. I added also an alpha string at the top of each file with "DM42 ddmmyyy" indicating the version date of the file (so there is no possible mix of dates)
- 18/09/2022 : small bug correction (hitting R/S when at surface = call a dive would still bug)
- 13/08/2021 : added ppO2 calculation and prompt in register T, there is also a check with 1.4bar ppO2 limit at depth and 1.6bar ppO2 limit at stop and a BEEP alarm sounds if ppO2 is over the limit values (risk of hyperoxia), and a check with BEEP alarm if ppO2 gets below 0.16bar (risk of hypoxia), corrected a bug (could "call a dive" when at surface)
- 11/08/2021 : corrected/augmented documentation, delivered DM41X version (viewtopic.php?f=30&t=3070), improved/simplified code
- 10/08/2021 : corrected/augmented documentation, delivered DM15L_M1B version (viewtopic.php?f=23&t=3068)
- 02/08/2021 : corrected some bugs and documented code
- 26/07/2021 : added surface interval and second dive computing
- 25/07/2021 : Corrected some bugs and documentation errors, split original program in 3 parts, documented code, added mix change during deco stops, added Trimix mixes using Erik Baker's gradient factors
- 21/07/2021 : First release with only Nitrox mixes, no deco mixe changes

Introduction :
This is the first version of a RPN deco planner using the Buhlmann algorithm, the ZH16B algorithm to be precise.
(https://en.m.wikipedia.org/wiki/B%C3%BC ... _algorithm)
The Buhlmann ZH16B algorithm uses a base of 16 M-Values (A and B) for Nitrogen and Helium decompression TABLES.
The program also uses Erik Baker's gradient factors when computing ceiling using Trimix (https://wrobell.dcmod.org/decotengu/model.html)

KNOWN LIMITATIONS : (beware that some are voluntary limitations)
- this version is using Air/Nitrox mixes only (Helium mixes not included but on it's way in some next releases)
(not true anymore in last release)
- this version of the program is limited to only one off-gasing mix (deco mix) (not true anymore in last release)
- the program is METRIC only (but is it really a limitation 🤔)
- the program is limited to 99 meters and 999 minutes
- deco is calculated at sea level in fresh water (but internal data can be changed to accommodate altitude diving in fresh water)
- descent speed is 20m/min, ascent speed is 10m/min, between stops speed is 10m/min (but internals can be changed to accommodate any speed)
- gradient factor is between 0,3 and 0,85 (but internals can be changed to accommodate other values)
- there is NO CHECK on valid/invalid gaz usage in this version. Narcosis and High/Low Oxygen levels are still managed by the computer available between your ears! (not true anymore in the last version, ppO2 is checked against high and low values)
- Narcosis is still managed by the computer available between your ears!

DIVE MODEL :
A dive is modeled by a succession of flat segments (legs?), an ascent to the first deco stop, and deco stops until surface is reached.
You can add as many flat segments (legs?) as you need to model your dive, each segment with it's own diving mix.
Once you decide to "call the dive", the program calculates the ascent to the first deco stop, first deco stop and each successive stops until surface is reached.
Deco can also be done with different deco mixes, you can change deco mix at the end of any stop.
When at surface, you can add a surface interval, then a second dive.

WARNING :
1) As usual during the dive (with travel/bottom mixes) :
- Descent time in INCLUDED in segment time and is retrieved form time spent at depth
- Ascent time is EXCLUDED in segment time and time spent at depth is unchanged
- you change mix once arrived at the flat portion of the segment
2) As usual during deco stops (with deco mixes) :
- Ascent time to the following stop is included in following deco stop time
- deco mix is changed at the bottom and ascent to first stop is done with deco mix

HINTS :
A) Bottom/Travel or Deco Mix change :
You can always force a mix change, at any point of the dive, inserting a "0 minute" segment during the dive when prompted with "(?)"
Example :
Y = oo.hh new mix (oo = 02% and hh = HE%)
X = dd.000 where dd is current depth with 0 minutes
Then hit R/S to compute the dive

B) Message prompt in ALHPA
When ALPHA prompt a message including a :
- "(?)" => then the program asks you for a new segment data or to "call the dive"
- "(R/S)" => then the program asks you to hit R/S to get more travel/deco info

C) Each segment is keyed in as this :
1) the mix used for the segment in register Y as oo.hh, oo being the O2 percentage in the mix, hh being the He percentage in the mix (21.00 for air, 32.00 for a 32% Nitrox, 50.00 for a 50% deco gas, 18.30 for a 18/30 Trimix for example)
2) the next diving segment in register X as dd.mmm , dd being the depth reached in meters and mmm being the duration in minutes of the dive segment (duration INCLUDING descent time and EXCLUDING ascent time)
3) then you hit "R/S" to add the segment to calculations

D) 2 results are show when adding a segment :
1) First result is ascent/descent management to targeted depth shown with a "DIVE ⬇️ (R/S)" or a "DIVE ⬆️ (R/S)" message in ALPHA
- ppO2 value (in bars) in register T, and a BEEP alarm sounds if not in LOW/HIGH range
- total diving time in register Z, often called RUN time (in minutes)
- current mix used by program in register Y (as oo.hh)
- dd.mmm in register X, depth as nn and mmm as real time spent in ascent/descent ONLY
Hit "R/S" to continue (as shown in ALHPA message)
2) Second result is time spent at depth shown with a "DIVE ➡️ (?)" message in ALPHA
- ppO2 value in bars in register T, and a BEEP alarm sounds if not in LOW/HIGH range
- total diving time in register Z (in minutes)
- current mix used by program in register Y (as oo.hh)
- dd.mm in register X, depth as dd and real time spent at depth in mmm (time spent in ascent or descent from previous depth is removed from segment time)

E) You can add as many segments as you need to simulate your dive.

F) "calling the dive" or computing the deco stops
When you "call the dive", you have to key :
- the first mix used during deco in register Y as oo.he (see explanation up somewhere)
- 0 in register X because you are asking to reach the surface (0 meters)
then hit R/S to calculate first deco stop
1) You get first an ascent to the first deco stop, then as many information as there is stops in the deco (every 3 meters)
1.1) First the result is ascent to the first stop with a "ASCENT (R/S)" message in ALPHA
- ppO2 value in bars in register T, and a BEEP alarm sounds if not in LOW/HIGH range
- total dive time still in register Z (in minutes)
- Mix used during deco in register Y (as oo.hh)
- dd.mmm in register X, dd as depth of first deco stop and mmm as duration of the first stop INCLUDING ascent time from last segment
Hit R/S to continue and get all the deco stops informations
1.2) Following results are all the deco stops
- ppO2 value in bars in register T, and a BEEP alarm sounds if not in LOW/HIGH range
- total dive time still in register Z (in minutes)
- Mix used during deco in register Y (as oo.hh)
- dd.mmm in register X, dd as depth of deco stop and mmm as duration of the first stop INCLUDING ascent time from last stop
1.3) after each stop you have two choices
1.3.1) You either hit R/S to continue the deco with the same mix,
1.3.2) Or you enter a new deco mix
- the new mix used during deco in register Y as oo.he (see explanation up somewhere)
- 00.000 in register X because you are still asking to reach the surface
then hit R/S to calculate next deco stop with new deco mix

G) Reaching surface, surface interval and second dive
When you reach 0m you get a "SURFACE (?)" message in ALPHA and register X is showing 00.000 and register Y is showing 21.00 (we suppose you are breathing Air at surface)
You can add a surface segment with 00.mmm where 0 is for surface and mmm the surface interval, you get a "SURFACE ➡️ (?)" asking either for another surface interval segment or a second dive

EXAMPLE OF A DIVE :
You want to plan the following dive :
- segment 1 : 30 minutes at 30m with air
- segment 2 : 30 minutes at 20m with 32% Nitrox
- Then you call the dive USING a 50% Nitrox mix for deco
- At 6m stop, you SWITCH to 100% Oxygen deco mix

Launch "zh16b" program
you get a "SURFACE (?)" message in ALHPA, then key
21.00 (air as travel/bottom mix)
ENTER
30.030 (30m, 30 minutes)
R/S
you get a "DIVE ⬇️ (R/S)" message in ALPHA with
T = 0.829 (ppO2 in bar)
Z = 1.5 min (RUN time)
Y = 21.00 (air used)
X = 30.002 (2 minutes descent time from surface to 30m)
HIT R/S
you get a ""DIVE ➡️ (?)" message in ALPHA with
T = 0.829 (ppO2 in bar)
Z = 30 min (RUN time)
Y = 21.00 (air used)
X = 30.029 (29 minutes spent at 30m depth)
You key in
32.00 (new travel/bottom mix)
ENTER
20.030 (20m, 30 minutes)
R/S
You get a "DIVE ⬆️ (R/S)" message in ALPHA
T = 0.829 (ppO2 in bar)
Z = 31 min (RUN time)
Y = 21.00 (air used up to next flat segment)
X = 20.001 (1 minutes ascent time from 30m to 20m)
HIT R/S
you get a "DIVE ➡️ (?)" message in ALPHA with
T = 0.943 (ppO2 in bar)
Z = 61 minute (RUN time)
Y = 32.00 (32% Nitrox used)
X = 20.030 (30 minutes spent at 20m)
You key in
50.00 (we switch to a 50% Nitrox mix for deco)
ENTER
0 (request deco stops computing)
R/S
you get a "ASCENT (R/S)" message in ALPHA with
T = 1.474 (ppO2 in bar) with an alarm BEEP
Z = 62.1 (RUN time)
Y = 50.00 (50% Nitrox used)
X = 9.001 (first stop is 9m and one minute ascent between 20m and 9m)
HIT R/S
you get a "STOP (R/S)" message in ALPHA with
T = 0.925 (ppO2 in bar)
Z = 63 (RUN time)
Y = 50.00 (50% Nitrox used)
X = 9.001 (first stop is 9m and one minute stop at 9m, including the ascent time)
You key in
100.00 (we switch to a 100% Oxygen mix for deco)
ENTER
0 (request following deco stops computing)
R/S
you get a "STOP (R/S)" message in ALPHA with
T = 1.550 (ppO2 in bar)
Z = 64 (RUN time)
Y = 100.00 (100% Oxygen used)
X = 6.001 (next stop is 6m and one minute stop at 6m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA with
T = 1.250 (ppO2 in bar)
Z = 69 (RUN time)
Y = 100.00 (100% Oxygen used)
X = 3.005 (next stop is 3m and 5 minutes stop at 3m, including the ascent time)
HIT R/S
you get a "SURFACE" message in ALPHA with
T = 0.951 (ppO2 in bar)
Z = 69 (RUN time)
Y = 100.00 (100% Oxygen used)
X = 0.000 (you reached surface)
HIT R/S

===================================
I will try to keep in this post short with only the informations to run the ZH16B program on DM42
=> all test dives and comparison with the ANDOID commercial MULTIDECO program in a following post
=> all the program internal informations in a following post to allow anyone to tune their deco scheme
===================================

I have split the (very long program) into 3 parts :
zh16b.raw
(1.69 KiB) Downloaded 132 times
zhtools.raw
(946 Bytes) Downloaded 128 times
zhinit.raw
(1.61 KiB) Downloaded 125 times
===============================================

Code: Select all

00 { 1724-Byte Prgm }
01▸LBL "ZH16B"
02 "DM42 22112022"
03 XEQ "ZHINIT"
04 "SURFACE (?)"
05▸LBL "LOOP"
06 XEQ "ZHSHOW"
07 STOP
@ we first look at the mix entered
08 X<>Y
09 STO "O2.HE"
10 R↓
@ PROF2 is stored in the format dd.mmm
@ dd = depth and mmm = minutes of the leg
11 STO "PROF2"
12 RCL "O2.HE"
@ did we enter a mix = 0?
13 X=0?
14 GTO 00
@ mix!=0, we extract the mix composition
@ HE2% is just the fractional part of the mix
15 FP
16 STO "%HE2"
@ now we compute the N22% part
@ N2 = (100 - O2)/100 - HE2%
@ we start at N22% = 100%
17 100
@ we retreive O2 part and compute the %
18 RCL "O2.HE"
19 IP
20 -
21 100
22 ÷
@ we retreive now HE2%
23 RCL "%HE2"
24 -
25 STO "%N22"
@ main and no mix change
26▸LBL 00
@ PROF2 is still in the format dd.mmm
@ dd = depth and mmm = minutes of the leg
27 RCL "PROF2"
@ did we not request a stop calculcation (X<>0)?
@ if yes, we continue to add a leg
28 X≠0?
29 GTO "ZHLEG"
@ if not we asked for stop calculation (X=0)
@ are we at a deph <> 0
30 RCL "PROF"
31 X≠0?
32 GTO "STOPS"
@ if not wrong request of stop at depth = 0
@ we loop
33 GTO "LOOP"
@ not a stop, we add a new leg
@ we extract first the depth and time of the leg
@ PROF2 = dd.mmm
@ T2 = mmm
34▸LBL "ZHLEG"
35 FP
36 1ᴇ3
37 ×
38 STO "T2"
@ PROF2 = dd
39 RCL "PROF2"
40 IP
41 STO "PROF2"
@ now we calculate the depth gradient 
@ new depth - current depth
42 RCL "PROF"
43 -
@ are we ascending (new depth - current depth>0?)
44 X<0?
45 GTO "UP"
@ are we descending (new deth - current detph>0?)
46 X>0?
47 GTO "DOWN"
@ we are staying at same depth! no need to calculate 
@ ascent od descent part of the leg
@ nor ascent or descent values (R=TR=0)
48 0
49 STO "R"
50 STO "TR"
@ no need to calculate PP because of heavy calculations,
@ just copy B => C
51 XEQ "ZHPPB2C"
@ new mix is now current mix
52 RCL "%N22"
53 STO "%N2"
54 RCL "%HE2"
55 STO "%HE"
@ we have now to calculate the horizontal part of leg
56 GTO "HORIZ"
@ case we are ascending
@ we need to calculate tr and R with Vdwn
57▸LBL "UP"
58 "DIVE ↑ (R/S)"
@ we calculate the ascending leg with current mix
@ rule is to use the current mix when ascending
@ (certainly due to risk of high O2 if we use new 
@ mix of the leg)
@ we use V = Vup
59 RCL "VUP"
60 STO "V"
61 GTO 01
@ case we are descending
@ we need to calculate tr and R with Vdwn
62▸LBL "DOWN"
63 "DIVE ↓ (R/S)"
64 RCL "VDWN"
@ is it the first leg?
65 RCL "PROF"
66 X≠0?
67 GTO 04
@ if it is the first leg, the current mix used during
@ decent is the leg mix!
68 RCL "%N22"
69 STO "%N2"
70 RCL "%HE2"
71 STO "%HE"
@ we reset DTR because it is first leg
@ important if we track surface intervals
72 0
73 STO "DTR"
@ now we are sure to have the good mix in %N2 and %HE
74▸LBL 04
@ we calculate the descending with current mix
@ rule is to use the current mix when descending
@ we use k = Vdwn
75 RCL "VDWN"
76 STO "V"
@ all the calculation are now independent of Vup 
@ and Vdwn stored in V
77▸LBL 01
@ tr = (Proff - Profi)/V
@ proff is leg depth
@ profi is current depth
78 RCL "PROF2"
79 RCL "PROF"
80 -
81 RCL "V"
82 ÷
83 STO "TR"
@ R = mtob*N2*V
84 RCL "%N2"
85 RCL "MTOB"
86 ×
87 RCL "V"
88 ×
89 STO "R"
@ Pio2 = (Prof*mtob + Patm - Pwvp)
@ Pio = Pio2 * N2
90 RCL "PATM"
91 RCL "PWVP"
92 -
93 RCL "PROF"
94 RCL "MTOB"
95 ×
96 +
97 STO "PIO2"
98 RCL "%N2"
99 ×
100 STO "PIO"
@ we calculate then PP during ascent/descend
@ PP (Pio, tr, R, Periode, B => C)
101 RCL "TN2"
102 XEQ "ZHPPV"
@ R = mtob*He*V
103 RCL "%HE"
104 RCL "MTOB"
105 ×
106 RCL "V"
107 ×
108 STO "R"
@ Pio = Pio2 * He
109 RCL "PIO2"
110 RCL "%HE"
111 ×
112 STO "PIO"
@ we calculate then PP during ascent/descend
@ PP (Pio, tr, R, Periode, B => C)
113 RCL "THE"
114 XEQ "ZHPPV"
@ dtr = dtr + tr
115 RCL "TR"
116 STO+ "DTR"
117 XEQ "ZHSHOWV"
118 STOP
@ after calculating ascent/descent with current mix,
@ the leg is now calculated with leg mix 
119 RCL "%N22"
120 STO "%N2"
121 RCL "%HE2"
122 STO "%HE"
@ calculate the flat portion of the leg
123▸LBL "HORIZ"
124 "DIVE → (?)"
@ did we dive or is it just a surface interval?
125 RCL "PROF2"
126 X=0?
@ here we know that we are dealing with a surface
@ interval
127 "SURFACE → (?)"
@ is it a "virtual leg" with no time at depth.
@ this is used to change mixes for example
128 RCL "T2"
129 X=0?
130 GTO 02
@ were we ascending ? if we are time during ascent
@ is not retreived from time at depth
@ total leg time is kept unchanged
131 RCL "PROF2"
132 RCL "PROF"
133 -
134 X<0?
135 GTO 03
@ were are descending, so time during descent is
@ included in total leg time
136 RCL "TR"
137 STO- "T2"
@ do we find ourselves with a negative time at depth, 
@ so we need to correct with 0 and skip heavy PP
@ calculations
138 RCL "T2"
139 X>0?
140 GTO 03
141 0
142 STO "T2"
@ we skip heavy PP computing because time in flat 
@ part of the leg is =0
143 GTO 02
@ now we calculate the flat portion of the leg
144▸LBL 03
@ new depth = leg depth
145 RCL "PROF2"
146 STO "PROF"
@ Pio2 = (Prof*mtob + Patm - Pwvp)
@ Pio = Pio2 * N2
147 RCL "PROF"
148 RCL "MTOB"
149 ×
150 RCL "PATM"
151 +
152 RCL "PWVP"
153 -
154 STO "PIO2"
155 RCL "%N2"
156 ×
157 STO "PIO"
@ we calculate PP (Pio, t, Periode, C => B)
158 RCL "TN2"
159 XEQ "ZHPP"
@ Pio = Pio2 * He
160 RCL "PIO2"
161 RCL "%HE"
162 ×
163 STO "PIO"
@ we calculate PP (Pio, t, Periode, C => B)
164 RCL "THE"
165 XEQ "ZHPP"
@ dtr = dtr + t2
166 RCL "T2"
167 STO+ "DTR"
168 GTO "LOOP"
@ in case flat portion of leg is = 0
@ we just copy C => B due to heavy calculation in PP
169▸LBL 02
@ new depth = leg depth (should already be the case!)
170 RCL "PROF2"
171 STO "PROF"
172 XEQ "ZHPPC2B"
@ dtr = dtr + t2 (should be +0!)
173 RCL "T2"
174 STO+ "DTR"
175 GTO "LOOP"
@ ==========================
@ part of the program that computes the end of the dive
@ ==========================
176▸LBL "STOPS"
@ are we already at surface ?
177 RCL "PROF"
178 X=0?
179 GTO "LOOP"
@ we suppose ceiling is surface
180 0
181 STO "PROF2"
@ we start with gf = gfmin
182 RCL "GFMIN"
183 STO "GF"
@ calculate the ceiling in PROF2 going from bottom
@ ceiling is calculated for both N2 and He
184 XEQ "ZHCEIL"
185 RCL "PROF2"
@ new target depth is now the calculated ceiling
186 STO "PROF2"
@ tr = (proff - profi) / Vup
@ proff is first stop
@ profi is bottom depth
187 RCL "PROF2"
188 RCL "PROF"
189 -
190 RCL "VUP"
191 ÷
192 STO "TR"
@ R = Vup*mtob*N2
@ we are still ascending with Vup speed
@ mix used is new deco mix rather than current bottom @ mix so we use %N22 and %HE2
193 RCL "VUP"
194 RCL "%N22"
195 ×
196 RCL "MTOB"
197 ×
198 STO "R"
@ Pio = (prof*mtob + Patm - Pwvp)
@ Pio = Pio2 * N2
@ Prof is bottom
199 RCL "PATM"
200 RCL "PWVP"
201 -
202 RCL "PROF"
203 RCL "MTOB"
204 ×
205 +
206 STO "PIO2"
207 RCL "%N22"
208 ×
209 STO "PIO"
@ we calculate then PP during ascent/descend
@ PP (Pio, tr, R, Periode, B => C)
210 RCL "TN2"
211 XEQ "ZHPPV"
@ R = Vup*mtob*He
@ we are still ascending with Vup speed
212 RCL "VUP"
213 RCL "%HE2"
214 ×
215 RCL "MTOB"
216 ×
217 STO "R"
@ Pio = Pio2*HE
@ Prof is bottom
218 RCL "PIO2"
219 RCL "%HE2"
220 ×
221 STO "PIO"
@ we calculate then PP during ascent/descend
@ PP (Pio, tr, R, Periode, B => C)
222 RCL "THE"
223 XEQ "ZHPPV"
@ dtr = dtr + tr
224 RCL "TR"
225 STO+ "DTR"
@ we need to switch now current mix with new mix 
@ or the display will be wrong showing bottom mix
@ now that we have ascended, we switch to new deco mix
@ for flat leg
226 RCL "%N22"
227 STO "%N2"
228 RCL "%HE2"
229 STO "%HE"
230 "ASCENT (R/S)"
231 XEQ "ZHSHOWV"
232 STOP
@ new depth is first stop depth for flat leg
233 RCL "PROF2"
234 STO "PROF"
@ did we reach surface?
235 X=0?
@ if we reached surface during first ascent
236 GTO 31
@ we didn't reach surface we need to calculate stop time
@ first stop time is was is left from ascent rounded to
@ nearest minute
237 RCL "TR"
238 RCL "TR"
239 IP
240 -
241 STO "TR"
@ we compute now gfsteps using 
@ steps = int(palier/3)
@ gfsteps = (gfmax- gfmin)/steps or 0
242 RCL "PROF"
243 3
244 ÷
245 IP
@ if steps = 0 we do not divide by steps
@ we should NOT have palier = 0!
246 X=0?
247 GTO 22
248 RCL "GFMAX"
249 RCL "GFMIN"
250 -
251 X<>Y
252 ÷
253▸LBL 22
254 STO "GFSTEP"
@ loop on stops until stop <= 0 (surface is reached)
255▸LBL 30
256 RCL "PROF"
@ did we reach surface, then we exit
257 X≤0?
258 GTO 31
@ we didn't reach surface, we compute time spent at stop
@ Pio2 = (palier*mtob + Patm - Pwvp)
259 RCL "PATM"
260 RCL "PWVP"
261 -
262 RCL "PROF"
263 RCL "MTOB"
264 ×
265 +
266 STO "PIO2"
@ t2 -= tr 
@ we remove from first minute of deco time spent 
@ ascending to the stop
267 RCL "TR"
268 +/-
269 STO "T2"
@ PROF2 = palier for the +1minute loop 
270 RCL "PROF"
271 STO "PROF2"
@ gf += gfstep
272 RCL "GFSTEP"
273 STO+ "GF"
@ loop did we change deco stop adding +1minute
@ in computing
274▸LBL 40
275 RCL "PROF"
276 RCL "PROF2"
@ did we change stop depth?
@ we get out of the "LBL 40" loop
277 X≠Y?
278 GTO 41
@ we add +1minute to stop time
279 1
280 STO+ "T2"
@ Pio = Pio2 * N2
281 RCL "PIO2"
282 RCL "%N2"
283 ×
284 STO "PIO"
@ we compute PP with one more minute at stop
@ we compute PP (Pio, t, Periode, C => B)
285 RCL "TN2"
286 XEQ "ZHPP"
@ Pio = Pio2 * He
287 RCL "PIO2"
288 RCL "%HE"
289 ×
290 STO "PIO"
@ we compute PP with one more minute at stop
@ we compute PP (Pio, t, Periode, C => B)
291 RCL "THE"
292 XEQ "ZHPP"
293 0
294 STO "PROF2"
295 XEQ "ZHCEIL"
296 RCL "PROF2"
297 RCL "PROF"
298 3
299 -
@ did the new ceiling > current depth +3m ?
@ in that case new ceiling is current - 3m
300 X<Y?
301 X<>Y
302 STO "PROF2"
@ we loop for one more minute?
303 GTO 40
@ we reached enought time to go to next stop
304▸LBL 41
@ DTR = DTR + t2
305 RCL "T2"
306 STO+ "DTR"
307 RCL "TR"
308 STO+ "T2"
309 "STOP (R/S)"
310 XEQ "ZHSHOWP"
311 STOP
@ are we requesting a new deco mix beetween stops?
@ new deco mix requested with X=0
312 X≠0?
313 GTO 42
@ new mix requested
314 R↓
315 STO "O2.HE"
@ the HE% part is just the frational part
316 FP
317 STO "%HE2"
@ now we compute the N22% part
@ N2 = (100 - O2)/100 - HE2%
@ we start at N22% = 100%
318 100
@ we retreive O2 part and compute the %
319 RCL "O2.HE"
320 IP
321 -
322 100
323 ÷
@ we retreive now HE2%
324 RCL "%HE2"
325 -
326 STO "%N22"
@ we continue to next stop
327▸LBL 42
@ tr = (PROF2 - current) / Vpalier
328 RCL "PROF2"
329 RCL "PROF"
330 -
331 RCL "VPALIER"
332 ÷
333 STO "TR"
@ mix is still the last on ascent one before swithing
@ R = Vpalier*mtob*N2
334 RCL "VPALIER"
335 RCL "MTOB"
336 ×
337 RCL "%N2"
338 ×
339 STO "R"
@ Pio is still ok from last calculation
@ depth for Pio is last stop
340 RCL "PIO2"
341 RCL "%N2"
342 ×
343 STO "PIO"
@ we calculate then PP during ascent/descend
@ PP (Pio, tr, R, Periode, B => C)
344 RCL "TN2"
345 XEQ "ZHPPV"
@ R = Vpalier*mtob*He
346 RCL "VPALIER"
347 RCL "MTOB"
348 ×
349 RCL "%HE"
350 ×
351 STO "R"
@ Pio is still ok from last calculation
352 RCL "PIO2"
353 RCL "%HE"
354 ×
355 STO "PIO"
@ we calculate then PP during ascent/descend
@ PP (Pio, tr, R, Periode, B => C)
356 RCL "THE"
357 XEQ "ZHPPV"
@ now new mix will be used
358 RCL "%N22"
359 STO "%N2"
360 RCL "%HE2"
361 STO "%HE"
@ new depth is current stop
362 RCL "PROF2"
363 STO "PROF"
@ did we surface => end
364 X=0?
365 GTO 31
@ we didn't surface we add ascent to stop in run time
366 RCL "TR"
367 STO+ "DTR"
@ loop
368 GTO 30
@ end of the dive, we reched surface
369▸LBL 31
@ we reached surface, depth = 0, time leg = 0
370 "SURFACE ↑ (R/S)"
371 0
372 STO "PROF2"
373 STO "PROF"
374 STO "T2"
375 XEQ "ZHSHOW"
376 STOP
@ before looping to surface
@ we put the DTR = 0
@ and reset mix to surface air mix
377 0
378 STO "DTR"
379 STO "TR"
380 STO "%HE2"
381 STO "%HE"
382 RCL "N2SURF"
383 STO "%NE"
384 STO "%NE2"
385 "SURFACE (?)"
386 GTO "LOOP"
387 END
===============================================

Code: Select all

00 { 943-Byte Prgm }
01▸LBL "ZHTOOLS"
02 "DM42 22112022"
03▸LBL "ZHPP"
04 STO "I"
05▸LBL 50
06 RCL "I"
07 RCL 00
08 4
09 ×
10 +
11 STO "J"
12 2
13 LN
14 RCL IND "I"
15 ÷
16 RCL "T2"
17 ×
18 +/-
19 E^X
20 1
21 -
22 RCL IND "J"
23 RCL "PIO"
24 -
25 ×
26 RCL IND "J"
27 +
28 RCL "I"
29 RCL 00
30 3
31 ×
32 +
33 X<>Y
34 STO IND ST Y
35 ISG "I"
36 GTO 50
37 RTN
38▸LBL "ZHPPV"
39 STO "I"
40▸LBL 60
41 RCL "I"
42 RCL 00
43 3
44 ×
45 +
46 STO "J"
47 2
48 LN
49 RCL IND "I"
50 ÷
51 STO "K"
52 RCL "PIO"
53 RCL IND "J"
54 -
55 RCL "R"
56 RCL "K"
57 ÷
58 -
59 RCL "K"
60 RCL "TR"
61 ×
62 +/-
63 E^X
64 ×
65 +/-
66 RCL "PIO"
67 +
68 RCL "TR"
69 RCL "K"
70 1/X
71 -
72 RCL "R"
73 ×
74 +
75 RCL "I"
76 RCL 00
77 4
78 ×
79 +
80 X<>Y
81 STO IND ST Y
82 ISG "I"
83 GTO 60
84 RTN
85▸LBL "ZHPPB2C"
86 RCL "BN2"
87 XEQ 70
88 RCL "BHE"
89 XEQ 70
90 RTN
91▸LBL 70
92 STO "I"
93▸LBL 71
94 RCL "I"
95 RCL 00
96 +
97 STO "J"
98 RCL IND "I"
99 STO IND "J"
100 ISG "I"
101 GTO 71
102 RTN
103▸LBL "ZHPPC2B"
104 RCL "BN2"
105 XEQ 80
106 RCL "BHE"
107 XEQ 80
108 RTN
109▸LBL 80
110 STO "I"
111▸LBL 81
112 RCL "I"
113 RCL 00
114 +
115 STO "J"
116 RCL IND "J"
117 STO IND "I"
118 ISG "I"
119 GTO 81
120 RTN
@ ===========================================
@ we compute ceiling first for N2 then for He
@ ===========================================
121▸LBL "ZHCEIL"
@ we compute the ceiling using Buhlmann equation
@ extended with gradient factors by Erik Baker
122 XEQ 10
@ we have the ceiling in PROF2
@ we first check if we are near surface
123 RCL "EPSILON"
124 RCL "PROF2"
125 X<Y?
@ celiling is 0 (surface)
126 GTO 12
@ else we fing the nearest stop (multiple of 3m)
127 3
128 ÷
129 RCL "EPSILON"
130 +
131 IP
132 1
133 +
134 3
135 ×
136 GTO 13
137▸LBL 12
138 0
139▸LBL 13
140 STO "PROF2"
141 RTN
142▸LBL 10
143 RCL "N2A"
144 LSTO "I"
145 RCL "HEA"
146 LSTO "J"
147▸LBL 11
@ we retreive PBN2b (BN2)
148 RCL "I"
149 RCL 00
150 2
151 ×
152 +
@ PPN2
153 RCL IND ST X
154 LSTO "PN2"
@ P = PPN2 (+ PPHE)
155 LSTO "P"
@ we retreive N2A
156 RCL IND "I"
157 RCL "PN2"
158 ×
@ A = PPN2 x N2A
159 LSTO "A"
@ we retreive PBHEb (BHE)
160 RCL "J"
161 RCL 00
162 2
163 ×
164 +
@ PPHE
165 RCL IND ST X
166 LSTO "PHE"
@ P = PPN2 + PPHE
167 STO+ "P"
@ we retreive HEA
168 RCL IND "J"
169 RCL "PHE"
170 ×
@ A = PPN2 * N2A + PPHE * HEA
171 STO+ "A"
172 RCL "P"
@ A = A/P
173 STO÷ "A"
@ we retreive N2B
174 RCL "I"
175 RCL 00
176 +
@ N2B
177 RCL IND ST X
@ B = N2B * PN2
178 RCL "PN2"
179 ×
180 LSTO "B"
@ we retreive HEB
181 RCL "J"
182 RCL 00
183 +
@ HEB
184 RCL IND ST X
@ B = N2B * PN2 + HEB * PHE
185 RCL "PHE"
186 ×
187 STO+ "B"
188 RCL "P"
@ B = B/P
189 STO÷ "B"
@ we retreive N2A
190 RCL "P"
191 RCL "A"
192 RCL "GF"
193 ×
194 -
195 RCL "GF"
196 RCL "B"
197 ÷
198 1
199 +
200 RCL "GF"
201 -
202 ÷
203 RCL "PATM"
204 -
205 RCL "MTOB"
206 ÷
@ did we find a greater ceiling?
@ if yes, we must store it
207 RCL "PROF2"
208 X<Y?
209 X<>Y
210 STO "PROF2"
211 1
212 STO+ "J"
213 ISG "I"
214 GTO 11
215 RTN
@ ========================================================
@ function that shows information during an ascent/descent
@ T = PPO2 in bars
@ X = leg as dd.mmm with PROF2
@ ========================================================
216▸LBL "ZHSHOWV"
217 RCL "TR"
218 1ᴇ3
219 ÷
220 RCL "PROF2"
221 +
222 STO "I"
@ during ascent/descent we take the greatest depth between prof 
@ and prof2
223 RCL "PROF2"
224 RCL "PROF"
225 X<Y?
226 X<>Y
@ we convert depth to bars
227 RCL "MTOB"
228 ×
229 RCL "PATM"
230 +
231 RCL "PWVP"
232 -
@ we calculate the % of oxygen
233 1
234 RCL "%N2"
235 -
236 RCL "%HE"
237 -
@ pressure of oxygen x %O2
238 ×
239 STO "J"
240 RCL "PPDEPTH"
241 X<Y?
242 BEEP
243 X<>Y
244 RCL "PPMIN"
245 X>Y?
246 BEEP
247 GTO 97
@ ========================================================
@ T = PPO2 in bars
@ X = leg as dd.mmm with PROF
@ ========================================================
248▸LBL "ZHSHOW"
@ during ascent/descent we take the greatest depth between prof 
@ and prof2
249 RCL "T2"
250 1ᴇ3
251 ÷
252 RCL "PROF"
253 +
254 STO "I"
@ during ascent/descent we take the greatest depth between prof 
@ and prof2
255 RCL "PROF2"
256 RCL "PROF"
257 X<Y?
258 X<>Y
@ we convert depth to bars
259 RCL "MTOB"
260 ×
261 RCL "PATM"
262 +
263 RCL "PWVP"
264 -
@ we calculate the % of oxygen
265 1
266 RCL "%N2"
267 -
268 RCL "%HE"
269 -
@ pressure of oxygen x %O2
270 ×
271 STO "J"
272 RCL "PPDEPTH"
273 X<Y?
274 BEEP
275 X<>Y
276 RCL "PPMIN"
277 X>Y?
278 BEEP
279 GTO 97
@ ========================================================
@ function that shows information during a stop
@ T = PPO2 in bars
@ X = leg as dd.mmm with stop informations
@ ========================================================
280▸LBL "ZHSHOWP"
@ I = dd.mmm = stop.time
281 RCL "T2"
282 1ᴇ3
283 ÷
284 RCL "PROF"
285 +
286 STO "I"
@ during stop we take PROF to calculate PPO2
287 RCL "PROF"
@ we convert depth to bars
288 RCL "MTOB"
289 ×
290 RCL "PATM"
291 +
292 RCL "PWVP"
293 -
@ we calculate the % of oxygen
294 1
295 RCL "%N2"
296 -
297 RCL "%HE"
298 -
@ pressure of oxygen x %O2
299 ×
300 STO "J"
301 RCL "PPSTOP"
302 X<Y?
303 BEEP
304 X<>Y
305 RCL "PPMIN"
306 X>Y?
307 BEEP
@ function that shows information
@ T = PPO2 in bars
@ Z = RUN time in minutes
@ Y = mix as oo.hh
@ X = leg as dd.mmm
308▸LBL 97
@ we start with 100% O2
309 100
@ we retreive now the N2 part
310 RCL "%N2"
311 100
312 ×
313 IP
314 -
@ we retreive now the HE part
315 RCL "%HE"
316 100
317 ×
318 IP
319 -
@ we add the fractional part of HE%
320 RCL "%HE"
321 +
322 STO "O2.HE"
323 RCL "J"
324 RCL "DTR"
325 RCL "O2.HE"
326 RCL "I"
327 RTN
328 END
===============================================

Code: Select all

00 { 1647-Byte Prgm }
01▸LBL "ZHINIT"
02 "DM42 22112022"
@ size is 5 x N2 + 5 x He = 160 elements
@ N2 is : TN2, N2A, N2B, BN2, CN2
@ He is : HE2, HEA, HEB, BHE, CHE
03 SIZE 161
04 FIX 03
05 0
06 STO "PROF"
07 STO "DTR"
08 STO "TR"
09 STO "%HE"
10 STO "PROF2"
11 STO "T2"
12 STO "%HE2"
@ percentage of N2 in air
13 0.7902
14 STO "%N2"
15 STO "%N22"
16 STO "N2SURF"
@ vertical speed while descending = 20m/min
17 20
18 STO "VDWN"
@ vertical speed while ascending = -10m/min
19 10
20 +/-
21 STO "VUP"
@ vertical speed between stops ascending = -10m/min
22 STO "VPALIER"
23 0
24 STO "V"
@ Erik's baker gradiant lower value
25 0.3
26 STO "GFMIN"
@ Erik's baker gradiant higher value
27 0.85
28 STO "GFMAX"
@ error rounding value for stop calculation
29 1ᴇ-6
30 STO "EPSILON"
@ water vapor in lungs
31 0.0627
32 STO "PWVP"
@ atmospherique pressure in bars
33 1.01325
34 STO "PATM"
@ from meters of water to bars (sea water)
35 0.09985
36 STO "MTOB"
@ hyperoxia level while diving
37 1.4
38 STO "PPDEPTH"
@ hyperoxia level while at stop
39 1.6
40 STO "PPSTOP"
@ hypoxia level
41 0.16
42 STO "PPMIN"
43 16
44 STO "I"
45 STO 00
46 1.01601
47 STO "TN2"
48 STO "I"
49 5
50 STO IND "I"
51 ISG "I"
52 8
53 STO IND "I"
54 ISG "I"
55 12.5
56 STO IND "I"
57 ISG "I"
58 18.5
59 STO IND "I"
60 ISG "I"
61 27
62 STO IND "I"
63 ISG "I"
64 38.3
65 STO IND "I"
66 ISG "I"
67 54.3
68 STO IND "I"
69 ISG "I"
70 77
71 STO IND "I"
72 ISG "I"
73 109
74 STO IND "I"
75 ISG "I"
76 146
77 STO IND "I"
78 ISG "I"
79 187
80 STO IND "I"
81 ISG "I"
82 239
83 STO IND "I"
84 ISG "I"
85 305
86 STO IND "I"
87 ISG "I"
88 390
89 STO IND "I"
90 ISG "I"
91 498
92 STO IND "I"
93 ISG "I"
94 635
95 STO IND "I"
96 17.03201
97 STO "N2A"
98 STO "I"
99 1.1696
100 STO IND "I"
101 ISG "I"
102 1
103 STO IND "I"
104 ISG "I"
105 0.8618
106 STO IND "I"
107 ISG "I"
108 0.7562
109 STO IND "I"
110 ISG "I"
111 0.6667
112 STO IND "I"
113 ISG "I"
114 0.56
115 STO IND "I"
116 ISG "I"
117 0.4947
118 STO IND "I"
119 ISG "I"
120 0.45
121 STO IND "I"
122 ISG "I"
123 0.4187
124 STO IND "I"
125 ISG "I"
126 0.3798
127 STO IND "I"
128 ISG "I"
129 0.3497
130 STO IND "I"
131 ISG "I"
132 0.3223
133 STO IND "I"
134 ISG "I"
135 0.285
136 STO IND "I"
137 ISG "I"
138 0.2737
139 STO IND "I"
140 ISG "I"
141 0.2523
142 STO IND "I"
143 ISG "I"
144 0.2327
145 STO IND "I"
146 33.04801
147 STO "N2B"
148 STO "I"
149 0.5578
150 STO IND "I"
151 ISG "I"
152 0.6514
153 STO IND "I"
154 ISG "I"
155 0.7222
156 STO IND "I"
157 ISG "I"
158 0.7825
159 STO IND "I"
160 ISG "I"
161 0.8126
162 STO IND "I"
163 ISG "I"
164 0.8434
165 STO IND "I"
166 ISG "I"
167 0.8693
168 STO IND "I"
169 ISG "I"
170 0.891
171 STO IND "I"
172 ISG "I"
173 0.9092
174 STO IND "I"
175 ISG "I"
176 0.9222
177 STO IND "I"
178 ISG "I"
179 0.9319
180 STO IND "I"
181 ISG "I"
182 0.9403
183 STO IND "I"
184 ISG "I"
185 0.9477
186 STO IND "I"
187 ISG "I"
188 0.9544
189 STO IND "I"
190 ISG "I"
191 0.9602
192 STO IND "I"
193 ISG "I"
194 0.9653
195 STO IND "I"
196 49.06401
197 STO "BN2"
198 STO "I"
199 RCL "PATM"
200 RCL "PWVP"
201 -
202 RCL "N2SURF"
203 ×
204▸LBL 99
205 STO IND "I"
206 ISG "I"
207 GTO 99
208 65.08001
209 STO "CN2"
210 STO "I"
211 0
212▸LBL 98
213 STO IND "I"
214 ISG "I"
215 GTO 98
@ =========
@ He values
@ =========
216 81.09601
217 STO "THE"
218 STO "I"
219 1.88
220 STO IND "I"
221 ISG "I"
222 3.02
223 STO IND "I"
224 ISG "I"
225 4.72
226 STO IND "I"
227 ISG "I"
228 6.99
229 STO IND "I"
230 ISG "I"
231 10.21
232 STO IND "I"
233 ISG "I"
234 14.48
235 STO IND "I"
236 ISG "I"
237 20.53
238 STO IND "I"
239 ISG "I"
240 29.11
241 STO IND "I"
242 ISG "I"
243 41.20
244 STO IND "I"
245 ISG "I"
246 55.19
247 STO IND "I"
248 ISG "I"
249 70.69
250 STO IND "I"
251 ISG "I"
252 90.34
253 STO IND "I"
254 ISG "I"
255 115.29
256 STO IND "I"
257 ISG "I"
258 147.42
259 STO IND "I"
260 ISG "I"
261 188.24
262 STO IND "I"
263 ISG "I"
264 240.03
265 STO IND "I"
266 97.11201
267 STO "HEA"
268 STO "I"
269 1.6189
270 STO IND "I"
271 ISG "I"
272 1.3830
273 STO IND "I"
274 ISG "I"
275 1.1919
276 STO IND "I"
277 ISG "I"
278 1.0458
279 STO IND "I"
280 ISG "I"
281 0.9220
282 STO IND "I"
283 ISG "I"
284 0.8205
285 STO IND "I"
286 ISG "I"
287 0.7305
288 STO IND "I"
289 ISG "I"
290 0.6502
291 STO IND "I"
292 ISG "I"
293 0.5950
294 STO IND "I"
295 ISG "I"
296 0.5545
297 STO IND "I"
298 ISG "I"
299 0.5333
300 STO IND "I"
301 ISG "I"
302 0.5189
303 STO IND "I"
304 ISG "I"
305 0.5181
306 STO IND "I"
307 ISG "I"
308 0.5176
309 STO IND "I"
310 ISG "I"
311 0.5172
312 STO IND "I"
313 ISG "I"
314 0.5119
315 STO IND "I"
316 113.12801
317 STO "HEB"
318 STO "I"
319 0.4770
320 STO IND "I"
321 ISG "I"
322 0.5747
323 STO IND "I"
324 ISG "I"
325 0.6527
326 STO IND "I"
327 ISG "I"
328 0.7223
329 STO IND "I"
330 ISG "I"
331 0.7582
332 STO IND "I"
333 ISG "I"
334 0.7957
335 STO IND "I"
336 ISG "I"
337 0.8279
338 STO IND "I"
339 ISG "I"
340 0.8553
341 STO IND "I"
342 ISG "I"
343 0.8757
344 STO IND "I"
345 ISG "I"
346 0.8903
347 STO IND "I"
348 ISG "I"
349 0.8997
350 STO IND "I"
351 ISG "I"
352 0.9073
353 STO IND "I"
354 ISG "I"
355 0.9122
356 STO IND "I"
357 ISG "I"
358 0.9171
359 STO IND "I"
360 ISG "I"
361 0.9217
362 STO IND "I"
363 ISG "I"
364 0.9267
365 STO IND "I"
366 129.14401
367 STO "BHE"
368 STO "I"
369 0
370▸LBL 97
371 STO IND "I"
372 ISG "I"
373 GTO 97
374 145.16001
375 STO "CHE"
376 STO "I"
377 0
378▸LBL 96
379 STO IND "I"
380 ISG "I"
381 GTO 96
382 RTN
383 END
=================================================
Last edited by Boub65 on Sat Nov 12, 2022 2:41 pm, edited 22 times in total.
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

This project started as a DM41X project.

Unfortunately, DM41X cannot handle such a big program with a minimum of 160 Buhlmann data (16x period, a and b values for N2 and same for He).

I should have used Hepax modules to make it possible on DM41X. I postponed to go on that path, because the Hepax learning curve is "though" AND it suppresses DM42 compatibility!

So I switched to DM42 just changing registers by variables in first release.
That's why there is no use (yet) of
- Matrices
- Menus

I will improve the progam in the future using 100% of DM42 features, now that DM41X platform is excluded.

Sincerely,
Boubker.
Last edited by Boub65 on Tue Aug 10, 2021 11:25 am, edited 2 times in total.
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

You have read the disclaimer :
=========================================
DISCLAIMER :
this DM42 deco program is given for educational
purpose only (RPN deco calculations)
IT SHOULD NOT BE USED TO PLAN YOUR DIVES...
... although it gives same results (around 99%) as MULTIDECO commercial planner!
=========================================
But...
... nevertheless, here is some dives that were tested against the ANDROID MULTIDECO commercial program with exact same results :
Dive#1 : 30m, 3min, Air
Dive#2 : 40m, 20min, Air
Dive#3 : 35m, 40min, Air
Dive#4 : 40m, 35min, Air
Dive#5 : 20m, 35min, Air
Dive#6 : 20m, 10min, Air
Dive#7 : 20m, 6min, Air
Dive#8 : 20m, 7min, Air
Dive#9 : 26m 25min, Air
Dive#10 : 30m, 30min, Air
Dive#11 : 32m, 15min, 32% Nitrox
Dive#12 : 32m, 50min, 32% Nitrox
Dive#13 : 32m, 25min, 32% Nitrox
Dive#14 : 32m, 49min, 32% Nitrox
Dive#15 : 30m, 10min, Air + 20m, 20min Air
Dive#16 : 36m, 20min, Air + 20m, 20min Air
Dive#17 : 20m, 7min, Air + 36m, 20min, Air
Dive#18 : 60m, 20min, 18/30 Trimix, 50% Nitrox, 100% Oxygen

Some dives give differents results when tested against MULTIDECO, but it's always a +1 or -1 minute difference in a stop and a -1 or +1 difference in next stop.
This is certainly only due to precision difference in deco calculation between different programs.
I could not reproduce a 100% MULTIDECO precision scheme in my program although I did try hard!

Sincerely,
Boubker.
Last edited by Boub65 on Mon Jul 26, 2021 12:33 am, edited 2 times in total.
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

Today, I added the ability :
- to use Trimix
- and to switch deco mixes

Example of a Trimix dive :

You want to plan the following dive :
20 minutes at 60m with 18/30 Trimix
You call the dive USING 18/30 Trimix as deco mix
At 21m stop you SWITCH to a 50% Nitrox deco mix
At 6m stop you SWITCH to a 100% Oxygen deco mix

Launch ZH16B, you get a "SURFACE (?)" message in ALHPA
18.30 (18/30 Trimix)
ENTER
60.020
R/S
you get a "DIVE ⬇️ (R/S)" message in ALPHA with
T = 1.249 (ppO2 in bar)
Z = 3 min (RUN time)
Y = 18.30 (18/30 Trimix used)
X = 60.003 (3 minutes descent time from surface to 60m)
HIT R/S
you get a ""DIVE ➡️ (?)" message in ALPHA with
T = 1.249 (ppO2 in bar)
Z = 20 min (RUN time)
Y = 18.30 (18/30 Trimix used)
X = 60.017 (17 minutes spent at 60m depth)
You key in
18.30
ENTER
0
R/S
you get a "ASCENT (R/S)" message in ALPHA
T = 1.249 (ppO2 in bar)
Z = 23 (RUN time)
Y = 18.30 (18/30 Trimix used)
X = 30.003 (first stop is 30m and 3 minute ascent between 60m and 30m)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = 0.710 (ppO2 in bar)
Z = 24 (RUN time)
Y = 18.30 (18/30 Trimix used)
X = 30.001 (first stop is 30m and one minute stop at 30m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = 0.656 (ppO2 in bar)
Z = 25 (RUN time)
Y = 18.30 (18/30 Trimix used)
X = 27.001 (next stop is 27m and one minute stop at 27m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = 0.602 (ppO2 in bar)
Z = 26 (RUN time)
Y = 18.30 (18/30 Trimix used)
X = 24.001 (next stop is 24m and one minute stop at 24m, including the ascent time)
You then switch deco mix to a 50% Nitrox deco mix
50.00 (50% Nitrox deco mix)
ENTER
0
R/S
you get a "STOP (R/S)" message in ALPHA
T = 1.524 (ppO2 in bar)
Z = 27 (RUN time)
Y = 50.00 (50% Nitrox used)
X = 21.001 (next stop is 21m and one minute stop at 21m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = 1.374 (ppO2 in bar)
Z = 28 (RUN time)
Y = 50.00 (50% Nitrox used)
X = 18.001 (next stop is 18m and one minute stop at 18m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = 1.224 (ppO2 in bar)
Z = 30 (RUN time)
Y = 50.00 (50% Nitrox used)
X = 15.002 (next stop is 15m and 2 minute stop at 15m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = 1.074 (ppO2 in bar)
Z = 33 (RUN time)
Y = 50.00 (50% Nitrox used)
X = 12.003 (next stop is 12m and 3 minute stop at 12m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = .925 (ppO2 in bar)
Z = 37 (RUN time)
Y = 50.00 (50% Nitrox used)
X = 9.004 (next stop is 9m and 4 minute stop at 9m, including the ascent time)
You then switch deco mix to a 100% Oxygen deco mix
100.00 (100% Oxygen deco mix)
ENTER
0
R/S
you get a "STOP (R/S)" message in ALPHA
T = 1.550 (ppO2 in bar)
Z = 42 (RUN time)
Y = 100.00 (100% Oxygen used)
X = 6.005 (next stop is 6m and 5 minute stop at 6m, including the ascent time)
HIT R/S
you get a "STOP (R/S)" message in ALPHA
T = 1.250 (ppO2 in bar)
Z = 51 (RUN time)
Y = 100.00 (100% Oxygen used)
X = 3.009 (next stop is 3m and 9 minute stop at 3m, including the ascent time)
HIT R/S
T = 0.951 (ppO2 in bar)
Z = 51 (RUN time)
Y = 100.00 (100% Oxygen used)
X = 0.000 (you reached surface)
HIT R/S

Here is the same dive on the MULTIDECO Android commercial application (with the exact same results) :
20210725_204123.jpg
20210725_204123.jpg (169.86 KiB) Viewed 4232 times
Last edited by Boub65 on Sun Nov 06, 2022 10:09 pm, edited 4 times in total.
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

Hello All...

I am in the process of trying to convert the zh16b Bulhmann deco program for :
- DM41X with usage of HEPAX RAM because program is way too long with its 190 registers for standard memory!
- DM15L limited to Air/Nitrox usage due to limited memory (I could only fit Nitrogen data = 80 registers in the matrices memory)

EDIT : Both progams for DM41X and DM15(L)_M1B are now available.
DM41X here : viewtopic.php?f=30&t=3070
DM15(L)_M1B here : viewtopic.php?f=23&t=3068
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

Here is an example of two dives with a 1 hour interval between them.

Dive #1 : 30 minutes at 30m with Air
Interval of 1 hour after surfacing Dive #1
Dive #2 : again 30 minutes at 30m with Air

At surface, you key in the Dive#1
21.00 (Air)
ENTER
30.030 (30m and 30minutes)
R/S

You go through all the steps to get the following stops
1 minute at 15m
1 minute at 12m
1 minute at 9m
4 minutes at 6m
7 minutes at 3m

Then when you are back at surface with a "SURFACE (?)" prompt message, you key in the interval
21.00 (Air)
ENTER
0.060 (0m for surface and 60 minutes)
R/S
you get a "SURFACE ➡️ (?)" message in ALPHA with
T = 0.200 (ppO2 in bar)
Z = 60 min (interval time)
Y = 21.00 (Air)
X = 0.060 (60 minutes spent at 0m = surface)
You key in second dive
21.00
ENTER
30.030
R/S

and you go through all the steps to get the following stops
1 minute at 15m
1 minute at 12m
1 minute at 9m
5 minutes at 6m
17 minutes at 3m
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

Hello All,
I just re-uploaded all the 3 files, because I found a BIG BUG!
This bug was introduced because somehow my 3 DM42 files version got mixed (with different incompatible date version).
So... for security, I also added on top of the 3 files an alpha message with the version : "DM42 ddmmyyyy" (ddmmyyyy being the version date of the file)
Please re-upload.
Sincèrement, Sincerely, 73,
Boubker

DM15L, DM41L, DM42 #00855 (domes upgraded), DM41X #00707
HP48SX (with dark screen), HP42s, HP32SII (1990 with fraction bug), HP41C/CV
TI-89 titanium, CASIO fx-cg50 and Numworks (to play with micropython)
Post Reply