[DM15L_M1B] Buhlmann decompression calculator (ZH16B)

Contributed software for the DM10, DM11, DM12, DM15 and DM16 goes here.

Please prefix the subject of your post with the model of the calculator that your program is for.
Post Reply
Boub65
Posts: 231
Joined: Tue Sep 12, 2017 4:34 pm
Location: Rabat, Morocco

[DM15L_M1B] Buhlmann decompression calculator (ZH16B)

Post by Boub65 »

===============================================
DISCLAIMER :
ZH16B is a DM15L/DM15 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 :
- 10/08/2021 : First release with only Air/Nitrox mixes, deco mix changes and surface intervals

Introduction :
This is the first version of a RPN deco planner for the DM15L/DM15 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 decompression TABLES.
The program also uses Erik Baker's gradient factors when computing ceiling using Nitrox (https://wrobell.dcmod.org/decotengu/model.html)

KNOWN LIMITATIONS : (beware that some are voluntary limitations)
- this program runs only on DM15L_M1B and DM15_M1B because it needs a lot of memory and program steps
- this version is using Air/Nitrox mixes only (there is not enough memory space in the DM15_M1B platform to include Helium mixes)
- 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!

DIVE MODEL :
A dive is modeled by a succession of flat segments (or legs), an ascent to the first deco stop, and deco stops until surface is reached.
You can add as many flat segments 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 duration and each successive stops duration 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.000 new mix (oo = 02% in the mix)
X = dd.000 where dd is current depth with 0 minutes
Then hit R/S to compute the dive

B) Message prompt is in the imaginary part of the display
When complex "C" annunciator is on, a prompt code/message is available in the imaginary part.
You can read the "prompt code" keying (f) (i) displaying temporarily imaginary part of X.
Prompt code/message table :
"1111" => "At surface, key in first segment or surface interval"
"2222" => "Descending, hit R/S to continue"
"3333" => "At depth, key in additional segment or call the dive"
"4444" => "Ascending, hit R/S to continue"
"8888" => "Stop, hit R/S to go to next stop or key in new deco mix"
"9999" => "Surface reached, hit R/S to continue"

C) Each segment is keyed in as this :
1) the mix used for the segment in Y as oo.000, oo being the O2 percentage in the mix (21.000 for air, 32.000 for a 32% Nitrox, 50.000 for a 50% deco mix, 100.000 for 100% Oxygen deco gas for example)
2) the next diving segment in 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 "2222" or a "4444" message in imaginary part of display
- total diving time in Z, often called RUN time (in minutes)
- current mix used by program in Y (as oo.000)
- dd.mmm in X, depth as dd 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 "3333" message in imaginary part of display
- total diving time in Z (in minutes)
- current mix used by program in Y (as oo.000)
- dd.mmm in 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.
For each segment the program replies with
- the ascent/descend time if it exists (not a flat segment)
- the segment time

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 Y as oo.000 (see explanation up somewhere)
- 0.000 in X because you are asking to reach the surface (0 meters asked as next depth)
- 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 "4444" message in imaginary part of display
- total dive time still in Z (in minutes)
- Mix used during deco in Y (as oo.000)
- dd.mmm in 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
- total dive time still in Z (in minutes)
- Mix used during deco in Y (as oo.000)
- dd.mmm in 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 Y as oo.000 (see explanation up somewhere)
- 0.000 in 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 "9999" message summing the dive in imaginary part of display
- Z is showing total run time (in minutes)
- Y is showing the last deco mix
- X is showing 00.000
- then hit R/S to finish the dive and start from 0 either for a surface interval or a new dive
You get a "1111" message in imaginary part of display
- Z is showing 0.000 (ready for either a surface interval or a new dive)
- Y is showing 21.000 (at surface we breath air)
- X is showing 00.000 (we are at 0m)
You can add a surface segment with 0.mmm where 0 is for surface and mmm the surface interval or a second dive segment

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 available as LBL A
you get a "1111" message in imaginary part of display
21.00 (air as travel/bottom mix)
ENTER
30.030 (30m, 30 minutes)
R/S
you get a "2222" message in imaginary part of display with
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 "3333" message in imaginary part of display with
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 "4444" message in imaginary part of display
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 "3333" message in imaginary part of display with
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 "4444" message in imaginary part of display with
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 "8888" message in imaginary part of display with
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 "8888" message in imaginary part of display with
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 "8888" message in imaginary part of display with
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 "9999" message in imaginary part of display with
Z = 69 (RUN time)
Y = 100.00 (100% Oxygen used)
X = 0.000 (you reached surface)
HIT R/S

===============================================

Code: Select all

DM15_M1B
00  02100000000001  00000000000000  00000000000000  00000000000000
04  00000ffffff000  00000000000008  0000000000000c  0f001000001eae
08  00000000000000  2f808befbf2200  00000100000000  00000000000000
10  00000000000000  00000000000000  09999000000003  07900000000001
14  00998500000000  20336373838383  000000000007a2  000000004c0000
18  00000000000000  0310011001107f  00000000a00000  00000000000000
1c  00000000000000  00000000000000  00000000000000  09999000000003
24  07902000000999  07902000000999  97888150000999  00000000000000
28  02000000000001  02000000000001  91000000000001  91000000000001
2c  08500000000999  01100000000999  06270000000998  01013250000000
30  09875790000999  00000000000000  00000000000000  01386294361999
34  08664339758998  05545177445998  03746741517998  02567211780998
38  01809783761998  01276514145998  09001911436997  06359148446997
3c  04747583429997  03706669415997  02900197408997  02272613707997
40  01777300463997  01391861808997  01091570363997  01169600000000
44  01000000000000  08618000000999  07562000000999  06667000000999
48  05600000000999  04947000000999  04500000000999  04187000000999
4c  03798000000999  03497000000999  03223000000999  02850000000999
50  02737000000999  02523000000999  02327000000999  05578000000999
54  06514000000999  07222000000999  07825000000999  08126000000999
58  08434000000999  08693000000999  08910000000999  09092000000999
5c  09222000000999  09319000000999  09403000000999  09477000000999
60  09544000000999  09602000000999  09653000000999  01075215024000
64  01253941546000  01463723680000  01590523120000  01633897279000
68  01616844569000  01557460214000  01465765623000  01355633782000
6c  01259345769000  01181172987000  01110008207000  01047193489000
70  09924526767999  09464023248999  09082708832999  01066791724000
74  01244058114000  01453910800000  01582458840000  01628029750000
78  01612796070000  01554829460000  01464156700000  01354706600000
7c  01258790600000  01180826200000  01109798800000  01047072200000
80  09923869000999  09463701000999  09082580000999  00000000000000
a0  00000000000000  00000000000000  b244f000ffb244  fcf3faf1ebfac3
a4  f6c6f1fdf310ff  78c5c3f6c6f134  11ff3bbf40f144  c57834fdd8fb57
a8  fdfb54faf1fd3a  c440f354fbfc54  3ac440f23b01ff  91ff02ff1b69f1
ac  f1f1f14647f2f0  f9f7c04943f028  ff69f9f9f9f945  4442f00e1083df
b0  391eec42344637  24ff48fc36fcd8  5349fd53fb3234  06ff47fdf0f0f1
b4  fbc5f0f0f1ebc4  16ff7029ff69f8  f8f8f885df3983  df3509b21d44c5
b8  78fbf3323422ff  44f023ff85dff1  197634320d94df  55443245c33968
bc  fc36fafcd832fb  56571e74320065  fdebfdf332f5f5  c0f049fbeb3939
c0  1eec423427ff69  f4f4f4f4463783  df3924ff48fc52  fcd83668fc36fa
c4  fcd832fb565749  fd52fb323422ff  64f3c044f00c1b  83df35abff7c42
c8  34071b83df3523  ff68fc36fb56fa  57fcd834423408  1745f0187135a5
cc  df391872fb3234  17ec3505ff69f1  f1f1f115ff7034  69f3f3f3f30446
d0  3727ff83df3924  ff48fc50fcd836  68fc36fafcd832  fb565749fd50fb
d4  32340560510643  f0463716703269  f2f2f2f2031560  5269f4f4f4f402
d8  144637acff7b49  48f013711272fb  3244eb3445fcf3  c6f1a31cec3401
dc  47fdf0f0f1fbc5  f0f0f111ec3044  c440c528ff0b69  f1f1f1f1acfff0
e0  abfffcf2f0f9f7  c0fb565791ffd9  f5f8f9f9f0c067  f5f2f3f1f0c0f1
e4  66f7f2f6f0c063  62c3f0f161f0f2  4746f2f0f9f7c0  45444342f063ff
e8  0ab2884cbffafc  38fbce3a39fa58  c3fccbc3fc393a  fbfd3a38fb3b58
ec  91ff97c3f0f3f1  04ffb2884bbffa  3cfcfb583cfbf1  cbc3fc353a91ff
f0  97c3f7f0f103ff  b2c2a45930c533  c531fbebfcf0f0  f136f0f0f181df
f4  fdf0f0f1fcf0f6  a3fb393241ebfb  393540fa32fdf3  c6f13509ff8897
f8  c3f1f881dffdf0  f0f1fcf0f6a335  41eb3540fa32fd  f3c6f13508ff88
fc  97c3f1f881dffd  f0f0f1fcf0f6a3  3941eb3940fa34  fdf3c6f13907ff
A: 00000ffffff000  B: 00000ffffffeae  C: 0f001000001eae
S: 00000000000000
M: 00000000000000  N: 00000000000000  G: 03
=================================================
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