Question How to Calculate First and Final Stop Depths When Implementing Gradient Factors in Bühlmann ZHL-16C?

Please register or login

Welcome to ScubaBoard, the world's largest scuba diving community. Registration is not required to read the forums, but we encourage you to join. Joining has its benefits and enables you to participate in the discussions.

Benefits of registering include

  • Ability to post and comment on topics and discussions.
  • A Free photo gallery to share your dive photos with the world.
  • You can make this box go away

Joining is quick and easy. Log in or Register now!

OP
B
Messages
4
Reaction score
0
Location
Spain
I’m coding a dive computer algorithm using Bühlmann’s ZHL-16C model. So far, I’ve implemented it successfully without incorporating any conservatism. Now, I want to add Gradient Factors (GF). My main reference is Erik C. Baker’s article "Clearing Up the Confusion About 'Deep Stops'".

In the formula presented, I need to calculate the GF slope, which depends on GF_High, GF_Low, the First Stop Depth, and the Final Stop Depth. My question is: How should I calculate the Final Stop Depth and First Stop Depth while considering GF_High and GF_Low?
 

Attachments

The GF high and low are all you need to give you a continuously increasing ceiling. You can then choose whatever discretisation you choose for the stops, most people use every 3m.
It's also common to set a Final stop depth, but again that's your choice a lot of people choose 6m (for various reasons, like less swell, easier buoyancy, higher Po2 all compared to shallower).
First stop depth would also be you choosing to set an artifical stop depth on top of the GF which doesn't seem very helpful - one example of this is the half depth or pressure "deep stop".
If you are coding for gas switches you'd might want to add artifical stops at switch depth to allow for the gas switch.
 
The GF high and low are all you need to give you a continuously increasing ceiling. You can then choose whatever discretisation you choose for the stops, most people use every 3m.
It's also common to set a Final stop depth, but again that's your choice a lot of people choose 6m (for various reasons, like less swell, easier buoyancy, higher Po2 all compared to shallower).
First stop depth would also be you choosing to set an artifical stop depth on top of the GF which doesn't seem very helpful - one example of this is the half depth or pressure "deep stop".
If you are coding for gas switches you'd might want to add artifical stops at switch depth to allow for the gas switch.
Thank you for the explanation! However, since I’m coding a real-time algorithm, I need to account for variations in the GF percentages across different diving profiles. This means I can’t simply use a fixed rule, like setting the deep stop at half the maximum depth, as it wouldn’t adapt to all scenarios, right?

I’m a bit confused about how to dynamically calculate the First Stop Depth in a way that fully integrates the GF percentages (both GF_Low and GF_High). Could you provide or suggest a formula or a step-by-step method that I can implement? Having this would help me ensure the algorithm works consistently for varying dive conditions.

Thank you again for your help!
 
Thank you for the explanation! However, since I’m coding a real-time algorithm, I need to account for variations in the GF percentages across different diving profiles. This means I can’t simply use a fixed rule, like setting the deep stop at half the maximum depth, as it wouldn’t adapt to all scenarios, right?

I’m a bit confused about how to dynamically calculate the First Stop Depth in a way that fully integrates the GF percentages (both GF_Low and GF_High). Could you provide or suggest a formula or a step-by-step method that I can implement? Having this would help me ensure the algorithm works consistently for varying dive conditions.

Thank you again for your help
Heyy, sorry step by step I won't be able to do, but there are open source codes out there to see how others have done.

However, I can help conceptually. You don't need to calculate a "first stop depth". If you have a working code with GF 100/100 then this is simply a series of expotential decay fuctions (16 of them if you're using 16 tissues), the rule is any one of these cannot leed to the M value exceeding what is dictated by GF 100/100 - this dictates your ceiling. This will be a continous depth that is recalulated at whatever your time step/discretising step, but most people round this down to the nearest multiple of 3m and that will be the next stop depth. The first stop is no different, so say you time step is 1s - every second all the parameters (inert gas load, assumed future ascent speed, gas breathing, current depth) will be used to calculate how high you can ascend without hitting the M value, the depth you can get to is your first stop.
 
First ceiling: the depth at which the maximum tissue pressure during the dive crosses the GFLow line. (Check all tissue compartments and take the deepest.) First stop: round the first ceiling up to the next discretized stop depth.
 
I’m coding a dive computer algorithm using Bühlmann’s ZHL-16C model. So far, I’ve implemented it successfully without incorporating any conservatism. Now, I want to add Gradient Factors (GF). My main reference is Erik C. Baker’s article "Clearing Up the Confusion About 'Deep Stops'".

In the formula presented, I need to calculate the GF slope, which depends on GF_High, GF_Low, the First Stop Depth, and the Final Stop Depth. My question is: How should I calculate the Final Stop Depth and First Stop Depth while considering GF_High and GF_Low?

Here's how I did it:

'calculate the first stop at GFLo using the formula:

' D = ((P - GF * a) / (GF / b - GF + 1)) - Psb
'where: D = depth, P = total gas pressure, GF = gradient factor = GFLo,
'a = coefficient a, b = coefficient b, Psb = ambient surface pressure
'the first part within parentheses calculats a pressure. Subtracting
'the surface pressure converts the result to a gauge depth.

first_stop = ((p_gas - gf_lo * a_n2he) / (gf_lo / b_n2he - gf_lo + 1)) - sp

Get the incremental difference in GF's between deco stops:

gf_delta = (gf_hi - gf_lo) / (first_stop_depth / stop_interval)

To calculate the next deco stop's gf add gf_delta to the current gf:

gf = gf + gf_delta

Calculate the pressure at the deco stop by iterating through all 16 compartments for the deepest (highest) ceiling:

Pamb = (p_gas - gf * a_n2he) / (gf / b_n2he - gf + 1)

Convert pressure to a depth:

new_ceiling = Pamb - sp

The final stop is just the surface (0 ft. or 0 m)
 
Here's how I did it:

'calculate the first stop at GFLo using the formula:

' D = ((P - GF * a) / (GF / b - GF + 1)) - Psb
'where: D = depth, P = total gas pressure, GF = gradient factor = GFLo,
'a = coefficient a, b = coefficient b, Psb = ambient surface pressure
'the first part within parentheses calculats a pressure. Subtracting
'the surface pressure converts the result to a gauge depth.

first_stop = ((p_gas - gf_lo * a_n2he) / (gf_lo / b_n2he - gf_lo + 1)) - sp

Get the incremental difference in GF's between deco stops:

gf_delta = (gf_hi - gf_lo) / (first_stop_depth / stop_interval)

To calculate the next deco stop's gf add gf_delta to the current gf:

gf = gf + gf_delta

Calculate the pressure at the deco stop by iterating through all 16 compartments for the deepest (highest) ceiling:

Pamb = (p_gas - gf * a_n2he) / (gf / b_n2he - gf + 1)

Convert pressure to a depth:

new_ceiling = Pamb - sp

The final stop is just the surface (0 ft. or 0 m)
Hi EFX,

I tried sending you a private message, but I don't fulfill the requirements.

I wanted to take a moment to thank you—your responses have been insightful and impactful for my work. I’m currently pursuing a degree in Computer Science Engineering in Spain, and for my Bachelor's thesis, I’m diving deep into the fascinating world of decompression algorithms. My goal is to not only understand these concepts but also to implement them in a real-time system.

That said, I still have some questions about how to effectively apply the GF formulas to my specific scenario. Given your expertise, I’d be thrilled to discuss this further with you. Would you be open to a video conference to explore these questions together? Your guidance would be invaluable in helping me reach a practical and elegant solution, and I’d be incredibly grateful for your time and insight.
 
Hi EFX,

I tried sending you a private message, but I don't fulfill the requirements.

I wanted to take a moment to thank you—your responses have been insightful and impactful for my work. I’m currently pursuing a degree in Computer Science Engineering in Spain, and for my Bachelor's thesis, I’m diving deep into the fascinating world of decompression algorithms. My goal is to not only understand these concepts but also to implement them in a real-time system.

That said, I still have some questions about how to effectively apply the GF formulas to my specific scenario. Given your expertise, I’d be thrilled to discuss this further with you. Would you be open to a video conference to explore these questions together? Your guidance would be invaluable in helping me reach a practical and elegant solution, and I’d be incredibly grateful for your time and insight.
Sure, I would be open to a video conference. I have zoom and can use other software as long as it runs on Linux. Even though you are responding in English I have to state up front that I do not speak or understand Spanish. Furthermore, any information or advice I give you is solely based on books, articles, and what I've received from papers from Erik Baker and others that are in the public domain. I have not communicated with nor have I been given any information from commercial vendors of computer decompression software that has had any significant impact on the software that I have written. I only state this so there are no misunderstandings going forward.

So, with that disclaimer out of the way let me know how we can proceed.
 

Back
Top Bottom