Bulhmann decompression calculator (ZH16B)

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 DM41X 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 :
- 13/11/2022 : Did some housekeeping on the code (every global routine now starts with ZH). I added an alpha string at the top of each file with "DM41X ddmmyyy" indicating the version date of the file (so there is no possible mix of dates). Optimised some code. Added comments.
- 20/09/2022 : big bug correction when using trimix
- 19/09/2022 : bug correction if at surface and asking to call the dive. 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)
- 11/08/2021 : first DM41X version with Air/Nitrox/Trimix gas usage as travel, bottom or deco mixes. Surface interval between dives also allowed.

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 Air/Nitrox/Trimix (https://wrobell.dcmod.org/decotengu/model.html)

Documentation :
The ZH16B program for the DM41X has the same specifications as the DM42 program, although it is not the same program.
Some ALPHA prompts my slightly differ because all characters are not available in the DM41X, but noting that would force a specific documentation for DM41X
Please refer to this thread (viewtopic.php?f=19&t=3044) for the documentation, examples, discussion, etc...

DM41X limitations :
- 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!- the other limitation is that you have to use HEPAX module to store the 3x DM41X programs. The programs use 190 registers, and is quite long, so it could not fit in standard memory.

I have split the (very long program) into 3 parts :
zh16b.raw
(1.06 KiB) Downloaded 150 times
zhtools.raw
(573 Bytes) Downloaded 158 times
zhinit.raw
(1.28 KiB) Downloaded 154 times
===============================================

Code: Select all

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

Code: Select all

00 { 570-Byte Prgm }
01▸LBL "ZHTOOLS"
02 "DM41X 13112022"
@ compute PP for N2 or He during horizontal dive
@ going from c (Reg27) to b (Reg29)
@ Index in X (either N2 or He)
@ Reg28 is TN2 or THe
@ Reg27 is cN2 or cHe
@ Reg29 is bN2 or bHe
@ Reg16 Pio
03▸LBL "ZHN2HEH"
04 STO 28
05 48
06 +
07 STO 29
08 16
09 +
10 STO 27
11▸LBL 50
12 RCL IND 28
13 RCL 23
14 ×
15 +/-
16 E^X
17 1
18 -
19 RCL IND 27
20 RCL 16
21 -
22 ×
23 RCL IND 27
24 +
25 STO IND 29
26 1
27 STO+ 29
28 STO+ 27
29 ISG 28
30 GTO 50
31 RTN
@ compute PP for N2 or He during ascent/descent dive
@ going from b (Reg27) to c (Reg29)
@ Index in X (either N2 or He)
@ Reg28 is TN2 or THe
@ Reg27 is bN2 or bHe
@ Reg29 is cN2 or cHe
@ Reg16 Pio
@ Reg17 R
@ Reg18 tr
32▸LBL "ZHN2HEV"
33 STO 28
34 48
35 +
36 STO 27
37 16
38 +
39 STO 29
40▸LBL 60
41 RCL 16
42 RCL IND 27
43 -
44 RCL 17
45 RCL IND 28
46 ÷
47 -
48 RCL IND 28
49 RCL 18
50 ×
51 +/-
52 E^X
53 ×
54 +/-
55 RCL 16
56 +
57 RCL 18
58 RCL IND 28
59 1/X
60 -
61 RCL 17
62 ×
63 +
64 STO IND 29
65 1
66 STO+ 29
67 STO+ 27
68 ISG 28
69 GTO 60
70 RTN
@ Copies the PP from B to C (either N2 or He depending on register X
@ Index in X
71▸LBL "ZHB2C"
72 STO 28
73 16
74 +
75 STO 27
76▸LBL 70
77 RCL IND 28
78 STO IND 27
79 1
80 STO+ 27
81 ISG 28
82 GTO 70
83 RTN
@ Copies the PP from C to B (either N2 or He depending on register X
@ Index in X
84▸LBL "ZHC2B"
85 STO 28
86 16
87 +
88 STO 27
89▸LBL 80
90 RCL IND 27
91 STO IND 28
92 1
93 STO+ 27
94 ISG 28
95 GTO 80
96 RTN
@ ===========================================
@ we compute ceiling first for N2 then for He
@ ===========================================
@ depending on Index in X
@ Index in X
@ Reg09 gf
@ Reg14 Patm 
@ Reg15 mtob
@ Reg22 actual/found ceiling (return value)
97▸LBL "ZHCEIL"
@ we compute the ceiling using Buhlmann equation
@ extended with gradient factors by Erik Baker
98 XEQ 10
@ we have the ceiling in PROF2
@ we first check if we are near surface
99 RCL 11
100 RCL 22
101 X<Y?
102 GTO 12
103 3
104 ÷
105 RCL 11
106 +
107 IP
108 1
109 +
110 3
111 ×
112 GTO 13
113▸LBL 12
114 0
115▸LBL 13
116 STO 22
117 RTN
118▸LBL 10
@ index I (reg28) is N2A
119 46.06101
120 STO 28
@ index J (reg27) is HEA
121 126.14101
122 STO 27
@ loop on all compartiments
123▸LBL 11
@ k (Reg29) = P = PPN2 +PPHE
@ we retreive PPN2b (BN2)
124 RCL 28
125 32
126 +
@ PPN2 (Reg20)
127 RCL IND ST X
128 STO 20
@ P = PPN2
129 STO 29
@ we retreive PPHEb (BHE)
130 RCL 27
131 32
132 +
@ PPHE (Reg21)
133 RCL IND ST X
134 STO 21
@ P = P + PPHE
135 STO+ 29
@ A = (PPN2 * N2A + PPHE * HEA) / P
136 RCL IND 28
137 RCL 20
138 ×
139 RCL IND 27
140 RCL 21
141 ×
142 +
143 RCL 29
144 ÷
@ we keep A in stack
@ B = (PPN2 * N2B + PPHE * HEB) / P
145 RCL 28
146 16
147 +
148 RCL IND ST X
@ we remove the index
149 X<>Y
150 R↓
151 RCL 20
152 ×
153 RCL 27
154 16
155 +
156 RCL IND ST X
@ we remove the index
157 X<>Y
158 R↓
159 RCL 21
160 ×
161 +
162 RCL 29
163 ÷
@ Reg21 is now B (in stack at X)
164 STO 21
165 R↓
@ Reg20 is now A (in stack at Y)
166 STO 20
@ compute big Erik baker formula
167 RCL 29
168 RCL 20
169 RCL 09
170 ×
171 -
172 RCL 09
173 RCL 21
174 ÷
175 1
176 +
177 RCL 09
178 -
179 ÷
180 RCL 14
181 -
182 RCL 15
183 ÷
@ did we find a greater ceiling?
@ if yes, we must store it
184 RCL 22
185 X<Y?
186 X<>Y
187 STO 22
188 1
189 STO+ 27
190 ISG 28
191 GTO 11
192 RTN
@ ========================================================
@ function that shows information during an ascent/descent
@ We take :
@ time = TR (claculated ascent/descent time)
@ X = leg as dd.mmm with PROF2 (target depth)
@ ========================================================
193▸LBL "ZHSHOWV"
194 RCL 18
195 1ᴇ3
196 ÷
197 RCL 22
198 +
@ I (Reg28) = dd.mmm
199 STO 28
200 GTO 31
@ ========================================================
@ function that shows information during a leg
@ We take :
@ time = T2 (entered leg time)
@ X = leg as dd.mmm with PROF (current depth)
@ ========================================================
201▸LBL "ZHSHOW"
202 RCL 23
203 1ᴇ3
204 ÷
205 RCL 00
206 +
@ I (Reg2) = dd.mmm
207 STO 28
@ ========================================================
@ function that shows information during a leg or
@ ascent/descent
@ T = PPO2 in bars
@ X = leg as dd.mmm with PROF
@ ========================================================
208▸LBL 31
@ during ascent/descent we take the greatest depth between prof 
@ and prof2
209 RCL 22
210 RCL 00
211 X<Y?
212 X<>Y
@ we convert depth to bars
213 RCL 15
214 ×
215 RCL 14
216 +
217 RCL 12
218 -
@ we calculate the % of oxygen
219 1
220 RCL 02
221 -
222 RCL 03
223 -
@ pressure of oxygen x %O2
224 ×
@ J (Reg27) = PPO2
225 STO 27
226 1.4
227 X<Y?
228 BEEP
229 X<>Y
230 .16
231 X>Y?
232 BEEP
233 GTO 30
@ ========================================================
@ function that shows information during a stop
@ we take :
@ time = T2 (calculated stop time)
@ T = PPO2 in bars
@ X = leg as dd.mmm with stop informations (stop depth)
@ ========================================================
234▸LBL "ZHSHOWP"
@ I = dd.mmm = stop.time
235 RCL 23
236 1ᴇ3
237 ÷
238 RCL 00
239 +
@ I (Reg28) = dd.mmm
240 STO 28
@ during stop we take PROF to calculate PPO2
241 RCL 00
@ we convert depth to bars
242 RCL 15
243 ×
244 RCL 14
245 +
246 RCL 12
247 -
@ we calculate the % of oxygen
248 1
249 RCL 02
250 -
251 RCL 03
252 -
@ pressure of oxygen x %O2
253 ×
@ J (Reg27) = PPO2
254 STO 27
255 1.6
256 X<Y?
257 BEEP
258 X<>Y
259 .16
260 X>Y?
261 BEEP
@ ========================================================
@ now we calculate the 2 missing data that are the same
@ for all 3 ZHSHOW* routines
@ T = PPO2 (Reg27 ou J)
@ Z = DTR
@ Y = O2.He mix used (Reg29 ou K)
@ X = dd.mmm (Reg28 ou I)
@ ========================================================
262▸LBL 30
@ we start with 100% O2
263 100
@ we retreive now the N2 part
264 RCL 02
265 100
266 ×
267 IP
268 -
@ we retreive now the HE part
269 RCL 03
270 100
271 ×
272 IP
273 -
@ we add the fractional part of HE%
274 RCL 03
275 +
@ k (Reg29) = oo.hh
276 STO 29
277 RCL 27
278 RCL 01
279 RCL 29
280 RCL 28
281 RTN
282 END
===============================================

Code: Select all

00 { 1303-Byte Prgm }
01▸LBL "ZHINIT"
02 "DM41X 13112022"
03 190
@ PSIZE instruction removed/added when converting to .raw
XEQ PSIZE
04 FIX 03
05 0
06 STO 00
07 STO 01
08 STO 18
09 STO 03
10 STO 22
11 STO 23
12 STO 25
13 0.7902
14 STO 02
15 STO 24
16 STO 13
17 20
18 STO 04
19 10
20 +/-
21 STO 05
22 STO 06
23 0.3
24 STO 07
25 0.85
26 STO 08
27 1ᴇ-6
28 STO 11
29 0.0627
30 STO 12
31 1.01325
32 STO 14
33 0.09985
34 STO 15
35 0
36 STO 26
37 STO 27
38 STO 28
@ =========
@ N2 values
@ =========
@ TN2
39 30.04501
40 STO 29
41 5
42 STO IND 29
43 ISG 29
44 8
45 STO IND 29
46 ISG 29
47 12.5
48 STO IND 29
49 ISG 29
50 18.5
51 STO IND 29
52 ISG 29
53 27
54 STO IND 29
55 ISG 29
56 38.3
57 STO IND 29
58 ISG 29
59 54.3
60 STO IND 29
61 ISG 29
62 77
63 STO IND 29
64 ISG 29
65 109
66 STO IND 29
67 ISG 29
68 146
69 STO IND 29
70 ISG 29
71 187
72 STO IND 29
73 ISG 29
74 239
75 STO IND 29
76 ISG 29
77 305
78 STO IND 29
79 ISG 29
80 390
81 STO IND 29
82 ISG 29
83 498
84 STO IND 29
85 ISG 29
86 635
87 STO IND 29
@ we store LN(2)/HALF_TIME rather than half_time
@ this is proper to DM41X because it is way slower than DM42
88 30.04501
89 STO 29
90 2
91 LN
92 STO 28
93▸LBL 00
94 RCL 28
95 RCL IND 29
96 ÷
97 STO IND 29
98 ISG 29
99 GTO 00
@ N2A
100 46.06101
101 STO 29
102 1.1696
103 STO IND 29
104 ISG 29
105 1
106 STO IND 29
107 ISG 29
108 0.8618
109 STO IND 29
110 ISG 29
111 0.7562
112 STO IND 29
113 ISG 29
114 0.6667
115 STO IND 29
116 ISG 29
117 0.56
118 STO IND 29
119 ISG 29
120 0.4947
121 STO IND 29
122 ISG 29
123 0.45
124 STO IND 29
125 ISG 29
126 0.4187
127 STO IND 29
128 ISG 29
129 0.3798
130 STO IND 29
131 ISG 29
132 0.3497
133 STO IND 29
134 ISG 29
135 0.3223
136 STO IND 29
137 ISG 29
138 0.285
139 STO IND 29
140 ISG 29
141 0.2737
142 STO IND 29
143 ISG 29
144 0.2523
145 STO IND 29
146 ISG 29
147 0.2327
148 STO IND 29
@ N2B
149 62.07701
150 STO 29
151 0.5578
152 STO IND 29
153 ISG 29
154 0.6514
155 STO IND 29
156 ISG 29
157 0.7222
158 STO IND 29
159 ISG 29
160 0.7825
161 STO IND 29
162 ISG 29
163 0.8126
164 STO IND 29
165 ISG 29
166 0.8434
167 STO IND 29
168 ISG 29
169 0.8693
170 STO IND 29
171 ISG 29
172 0.891
173 STO IND 29
174 ISG 29
175 0.9092
176 STO IND 29
177 ISG 29
178 0.9222
179 STO IND 29
180 ISG 29
181 0.9319
182 STO IND 29
183 ISG 29
184 0.9403
185 STO IND 29
186 ISG 29
187 0.9477
188 STO IND 29
189 ISG 29
190 0.9544
191 STO IND 29
192 ISG 29
193 0.9602
194 STO IND 29
195 ISG 29
196 0.9653
197 STO IND 29
@ bN2
198 78.09301
199 STO 29
200 RCL 14
201 RCL 12
202 -
203 RCL 13
204 ×
205▸LBL 99
206 STO IND 29
207 ISG 29
208 GTO 99
@ cN2
209 94.10901
210 STO 29
211 0
212▸LBL 98
213 STO IND 29
214 ISG 29
215 GTO 98
@ =========
@ He values
@ =========
@ THe
216 110.12501
217 STO 29
218 1.88
219 STO IND 29
220 ISG 29
221 3.02
222 STO IND 29
223 ISG 29
224 4.72
225 STO IND 29
226 ISG 29
227 6.99
228 STO IND 29
229 ISG 29
230 10.21
231 STO IND 29
232 ISG 29
233 14.48
234 STO IND 29
235 ISG 29
236 20.53
237 STO IND 29
238 ISG 29
239 29.11
240 STO IND 29
241 ISG 29
242 41.20
243 STO IND 29
244 ISG 29
245 55.19
246 STO IND 29
247 ISG 29
248 70.69
249 STO IND 29
250 ISG 29
251 90.34
252 STO IND 29
253 ISG 29
254 115.29
255 STO IND 29
256 ISG 29
257 147.42
258 STO IND 29
259 ISG 29
260 188.24
261 STO IND 29
262 ISG 29
263 240.03
264 STO IND 29
@ we store LN(2)/HALF_TIME rather than half_time
@ this is proper to DM41X because it is way slower than DM42
265 110.12501
266 STO 29
267 2
268 LN
269 STO 28
270▸LBL 01
271 RCL 28
272 RCL IND 29
273 ÷
274 STO IND 29
275 ISG 29
276 GTO 01
@ HeA
277 126.14101
278 STO 29
279 1.6189
280 STO IND 29
281 ISG 29
282 1.3830
283 STO IND 29
284 ISG 29
285 1.1919
286 STO IND 29
287 ISG 29
288 1.0458
289 STO IND 29
290 ISG 29
291 0.9220
292 STO IND 29
293 ISG 29
294 0.8205
295 STO IND 29
296 ISG 29
297 0.7305
298 STO IND 29
299 ISG 29
300 0.6502
301 STO IND 29
302 ISG 29
303 0.5950
304 STO IND 29
305 ISG 29
306 0.5545
307 STO IND 29
308 ISG 29
309 0.5333
310 STO IND 29
311 ISG 29
312 0.5189
313 STO IND 29
314 ISG 29
315 0.5181
316 STO IND 29
317 ISG 29
318 0.5176
319 STO IND 29
320 ISG 29
321 0.5172
322 STO IND 29
323 ISG 29
324 0.5119
325 STO IND 29
@ HeB
326 142.15701
327 STO 29
328 0.4770
329 STO IND 29
330 ISG 29
331 0.5747
332 STO IND 29
333 ISG 29
334 0.6527
335 STO IND 29
336 ISG 29
337 0.7223
338 STO IND 29
339 ISG 29
340 0.7582
341 STO IND 29
342 ISG 29
343 0.7957
344 STO IND 29
345 ISG 29
346 0.8279
347 STO IND 29
348 ISG 29
349 0.8553
350 STO IND 29
351 ISG 29
352 0.8757
353 STO IND 29
354 ISG 29
355 0.8903
356 STO IND 29
357 ISG 29
358 0.8997
359 STO IND 29
360 ISG 29
361 0.9073
362 STO IND 29
363 ISG 29
364 0.9122
365 STO IND 29
366 ISG 29
367 0.9171
368 STO IND 29
369 ISG 29
370 0.9217
371 STO IND 29
372 ISG 29
373 0.9267
374 STO IND 29
@ bHe
375 158.17301
376 STO 29
377 0
378▸LBL 97
379 STO IND 29
380 ISG 29
381 GTO 97
@ cHe
382 174.18901
383 STO 29
384 0
385▸LBL 96
386 STO IND 29
387 ISG 29
388 GTO 96
389 RTN
390 END
=================================================
Last edited by Boub65 on Sun Nov 13, 2022 7:51 pm, edited 5 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)
Ángel Martin
Posts: 145
Joined: Mon Apr 24, 2017 8:19 pm

Re: Bulhmann decompression calculator (ZH16B)

Post by Ángel Martin »

Boub65 wrote:
Wed Aug 11, 2021 1:05 pm

DM41X limitations :
The only limitation is that you have to use HEPAX module to store the 3x DM41X programs.
The programs use 190 registers, and is quite long, so it could not fit in standard memory.
... or use the attached MODule that contains all programs plus one from the MoHP Forum:
https://www.hpmuseum.org/forum/thread-6 ... ight=SCUBA

Cheers,
ÁM
Attachments
DIVER.zip
(4.99 KiB) Downloaded 255 times
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

Re: Bulhmann decompression calculator (ZH16B)

Post by Boub65 »

Thank you Angel,
Will test it...
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,
I found some slight differences between the results found on DM41X vs DM42.

For example... a dive of 20min at 60m using 18/30 mix.
DM42 finds a first stop at 30m (same as MutiDeco Android progam).
DM41X finds a first stop at 33m (more conservative than DM42 and MultiDeco Android program).

I suppose "as of today" that it is due to precision differences beetween the two plateforms.


Bug corrected.
Was wrong usage of one register in two different subroutines for two differents variables.
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