New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look for actual isobaric counter diffusion #1154

Merged
merged 2 commits into from Apr 11, 2018

Conversation

Projects
None yet
6 participants
@atdotde
Collaborator

atdotde commented Mar 7, 2018

Identify segements that fullfill the folllowing criteria for
the leading compartment:

He is off-gasing while N2 is on-gasing
Overall there is on-gasing

Add a line to the info box for those segments

Signed-off-by: Robert C. Helling helling@atdotde.de

Describe the pull request:

  • Bug fix
  • Functional change
  • New feature
  • Code cleanup
  • Build system change
  • Documentation change
  • Language translation

Pull request long description:

Our previous criterium for ICD is used by others but not very well justified (I ranted about it on https://thetheoreticaldiver.org/wordpress/index.php/2018/01/24/isobaric-counter-diffusion-criteria/ )

The advantage of that criterium is though, that it only depends on the gas switch, i.e. on the two gases breathed before and after the switch, so it is easy to check even in a mental calculation.

This PR introduces a different criterium motivated by what the OSTCs do (according to Matthias Heinrichs): It looks at the leading compartment and checks for two conditions:

  • He is off-gassing while N2 is on-gassing
  • The net-effect is on-gassing

This has to know about the current state of the tissues (to decide about on/off-gassinfg) and it only depends on the gas currently in use (not a previous one, at least not directly).

This criterium is now checked for in deco.c add_segemnt() which returns now a bool.

To the user, this is displayed as a line in the info box (but one could as well add an icon if required).

I should say, I have been unable to plan a dive that actually triggers this condition (bit I have not really tried). Dropping either the "only in leading compartment" or the "net-on-gassing" criteria this is however triggered.

I believe, in the long run, we should adopt this criterium in place of the other.

Changes made:

Related issues:

Additional information:

Release note:

Documentation change:

Mentions:

@willemferguson
@janmulder

This comment has been minimized.

Collaborator

janmulder commented Mar 7, 2018

Tried this, and yes, I see the ICD warning in some of my profiles. The warnings are short (< 1 minute), and occur typically at the end of the bottom phase just before ascending. It is unclear to me this is correct behavior, but it feels like another thing I do not really believe in (like the CNS clock). Interestingly, this new method is not related to gas switches, so it will definitely confuse the people that believe that ICD is something related to gas switches. Obviously, I will look carefully to my OSTC3 to see this new feature (since firmware 2.97) during diving, but as the warning periods are short ... it seems something very easy to miss.

@willemferguson

This comment has been minimized.

Contributor

willemferguson commented Mar 8, 2018

I get this in some of my dives during the deep ascent, for periods of less than 1 min. Very interesting, Robert, thank you. I believe, in the long run, this should only replace the rule of fifths if the technical dive community accepts this new norm in favour of the the rule of fifths. I do not think that it is appropriate that we, in this software, should decide that the technical dive community should adopt a new norm. The best we can do is to reflect what is being used in this community at present.

@janmulder

This comment has been minimized.

Collaborator

janmulder commented Mar 8, 2018

@willemferguson. As ICD is (and most likely, will remain) a controversial subject, there will never be broad consensus in the technical diving community. For example, before your initial implementation of the "old rule" (1:5), I never heard of this in any GUE technical diving courses I did. In other words, I do not care at all which rule is implemented in Subsurface, as I do not believe that ICD is relevant to any TX diving to (lets say) 100m depth. So, I understand your remark about "the community", but I do not believe there is one.

@glance-

This comment has been minimized.

Collaborator

glance- commented Mar 8, 2018

I completely agree with @janmulder here.

core/deco.c Outdated
{
(void) sac;
int ci;
struct gas_pressures pressures;
bool icd = false;

This comment has been minimized.

@glance-

glance- Mar 8, 2018

Collaborator

I'd prefer it named icd_warning or something.

core/deco.c Outdated
@@ -477,11 +477,12 @@ void calc_crushing_pressure(struct deco_state *ds, double pressure)
}
/* add period_in_seconds at the given pressure and gas to the deco calculation */
void add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive, int sac)
bool add_segment(struct deco_state *ds, double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive, int sac)

This comment has been minimized.

@glance-

glance- Mar 8, 2018

Collaborator

Encoding the icd warning as return value isn't the prettiest solution. What about adding a icd_warning to the struct deco_state instead?

Or even turning it into its own helper, which just checks for the icd warning conditions. Maybee its just a huge overlap with what's already happening in add_segment...

This comment has been minimized.

@atdotde

atdotde Mar 8, 2018

Collaborator

including it in deco_state is actually a good idea. Will do that.

I had started out writing an independent helper function but then realised that so much of the calculation is the same as done in add_segment. So in order in minimise the computational footprint I went for the solution of placing it there.

@willemferguson

This comment has been minimized.

Contributor

willemferguson commented Mar 8, 2018

At least, the view of the "diving community" is reflected by existing literature, its training manuals and the articles (popular and scientific) that have arisen. With respect to ICD this goes back at least to Sheck Exley and, apart from the DIR group, I do not know of any agency that has explicitly rejected measures to avoid ICD.

@atdotde

This comment has been minimized.

Collaborator

atdotde commented Mar 8, 2018

Regarding "the community": I have done a bit of online research. And what I found was a general uneasiness with the 1:5 rule (that can be traced back to a not very convincing argument by an engineer).

To me, it seems, the only advantage of that rule is that it is so simple that it can be checked by a mental calculation. Which is probably why it is taught. I have no problem with Subsurface checking the 1:5 rule so people can relate to what they learned in training.

But I think if we have something at least potentially better we should do that as well.

And, did I mention, H&W also used the 1:5 rule initially but then gave up on it as they were unhappy with the outcome and ended up with something that is very similar to what I implemented here (after peeking at their source code of course).

@willemferguson

This comment has been minimized.

Contributor

willemferguson commented Mar 8, 2018

I would agree 200% with your view, above.

@sfuchs79

This comment has been minimized.

Contributor

sfuchs79 commented Mar 10, 2018

@atdotde
I don't want to question the idea for the criterion but I have doubts regarding the implementation:
The segments do have very different length! That in my opinion leads to this effects:

  • In logged dives segments are very short. Here there can be small ascent segments (only going up a few meters) during bottom time where the criterion is hit. Little bit of He is off-gassing, N2 is still on-gassing. But the duration and amount is very small. Here currently this implementation gives a (false?!) alert.
  • In planned dives segments are very long. So it could be that at the beginning even during some minutes of a long segment the criterion would be fulfilled. But for the overall segment the criterion is not hit. Here currently this implementation doesn't give an alert.
@willemferguson

This comment has been minimized.

Contributor

willemferguson commented Mar 20, 2018

I am not sure if the icd calculations are done on whole long segments. The dive plan segments of the dive planner are plotted in shorter segments of not longer than 10s at a time. So, a dive with 5 minutes bottom time is likely to have more than 50 plot segments, reflected by the plot_info structures. Robert, you should understand this better. If you say "at start of the segment" do you mean a diveplan segment or a plot_info segment? If the icd violations are not for longer than a minute, perhaps that means the dive was not so badly planned. But I admit talking about H-W features that I have never seen in action.

@atdotde

This comment has been minimized.

Collaborator

atdotde commented Mar 21, 2018

This is used in the profile where the segments are 1 or 10 seconds. So, I don't think @sfuchs79 's concern is really relevant.

I thought a bit more about if the n2_f and he_f factors (that give the exponential decay in time) should be included or not. Including them means that the "overall ongasing" criterium applies to the whole segment or just initially (given that the half times of He are shorter than the ones for N2). Again, since the segments are much shorter than halft-times the distinction is not really relevant but given the concerns and that we would display the warning for the full segment I decided for including the factors.

@atdotde

This comment has been minimized.

Collaborator

atdotde commented Mar 21, 2018

Ah, and if there is no further concern, I would suggest to merge this.

@dirkhh

This comment has been minimized.

Collaborator

dirkhh commented Mar 21, 2018

looks like we once again have issues with libdc being out of sync. This bugs me. The whole point of the submodule was for this not to happen. Did you manually rebase this onto a newer version of master maybe?

Besides this - as far as I am concerned you (@atdotde) are the maintainer of the whole plan / deco / random weird semi partial closed please kill me now devices support. I don't use that code (or those devices) so I really have no opinion if this should be merged or shouldn't be merged.

@sfuchs79

This comment has been minimized.

Contributor

sfuchs79 commented Mar 21, 2018

@atdotde
Can you show example dives (logged dives and ones from the planner) where this implementation shows results which fit together with what we would expect that could happen in reality? When I tested this once, the results were really strange. But maybe this changed with the small modification?

@atdotde

This comment has been minimized.

Collaborator

atdotde commented Mar 24, 2018

OK, I have been looking a bit more into the numbers. Turns out, it is really hard to trigger this ICD criterium: In particular, the "dangerous" gas changes don't easily trigger it since even if He is off-gassing while N2 is on-gassing, the net effect tends to be still off-gassing.

But what does trigger it is going to 60m for 20min on 18/45: At the end of the bottom phase, in the leading tissue number 1, He is almost saturated while N2 has still a way to go. So once the ascent starts, He starts off-gassing while N2 is still going up (since even slightly above the bottom, N2 is still way below ambient pressure). And all this without a gas change. So I am confused: This criterium seems to be much better motivated but it triggers in unexpected places.

Could somebody suggest me a dive plan that should be problematic for the point of ICD? Then we could try to adopt this criterium. Maybe @willemferguson ?

How shall we proceed?

@glance-

This comment has been minimized.

Collaborator

glance- commented Mar 24, 2018

I haven't read them that carefully, but on a quick google two articles showed up:
http://www.advanceddivermagazine.com/articles/icd/icd.html
https://www.scubaengineer.com/isobaric_counter_diffusion.htm

As usual, my takeaway is: "Air is a bad".

@atdotde

This comment has been minimized.

Collaborator

atdotde commented Mar 24, 2018

Thanks for the links Anton.

The first mainly discusses the opposite direction: Starting a dive on nitrox (or air for that matter) up to significant tissue loadings and then switching to trimix: Then the He goes into the tissue faster than the N2 can get out and thus there is a net build up. But why on earth would anybody do that?

The second is the origin of the 20% rule that Willem implemented and I have already raised my concerns here: https://thetheoreticaldiver.org/wordpress/index.php/2018/01/24/isobaric-counter-diffusion-criteria/#respond My current attempt is to use something more reasonable than the approach.

@willemferguson

This comment has been minimized.

Contributor

willemferguson commented Mar 25, 2018

atdotde added some commits Apr 10, 2018

Look for actual isobaric counter diffusion
Identify segements that fullfill the folllowing criteria for
the leading compartment:

He is off-gasing while N2 is on-gasing
Overall there is on-gasing

Add a line to the info box for those segments

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Add a paragraph to the user manual about ICD in infobox
Signed-off-by: Robert C. Helling <helling@atdotde.de>

@atdotde atdotde merged commit ac2ceea into Subsurface-divelog:master Apr 11, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment