Log import of Trimix dive from Shearwater Teric

Linus Torvalds torvalds at linux-foundation.org
Fri Oct 8 12:53:25 PDT 2021


On Fri, Oct 8, 2021 at 11:50 AM Attilla de Groot via subsurface
<subsurface at subsurface-divelog.org> wrote:
>
> I’ll split up the issues between logging and planning:

I'll leave the planning thing for Robert Helling, who hopefully has
input on that one.

The logging one seems to be about downloading.

Strange.

> Logging:
> - Subsurface doesn’t understand the concept of a travel gas that well (it switches with the back gas).

Heh. That example dive looks _very_ different from anything I ever did
in Bonaire.

But your data clearly has

  <cylinder size='22.2 l' workpressure='232.0 bar' description='D12
232 bar' o2='14.0%' he='49.0%' depth='65.378 m' />
  <cylinder size='4.1 l' workpressure='206.843 bar' description='AL40'
start='220.0 bar' end='140.0 bar' depth='103.075 m' />
  <cylinder size='5.547 l' workpressure='206.843 bar'
description='AL40' o2='51.0%' start='200.0 bar' end='140.0 bar'
depth='21.021 m' />
  <cylinder size='5.547 l' workpressure='206.843 bar'
description='AL40' o2='79.0%' start='175.0 bar' end='90.0 bar'
depth='10.016 m' />

  <event time='0:02 min' type='25' flags='1' name='gaschange'
cylinder='0' o2='14.0%' he='49.0%' />
  <event time='3:26 min' type='25' flags='2' name='gaschange' cylinder='1' />
  <event time='30:32 min' type='25' flags='3' name='gaschange'
cylinder='2' o2='51.0%' />
  <event time='44:40 min' type='25' flags='4' name='gaschange'
cylinder='3' o2='79.0%' />

which I agree is insane - you are going down to 82m and subsurface
thinks you're breathing air at the deepest point (and breathing that
hypoxic 49% He at the beginning shallow part).

That would be unhealthy and bad if real. I agree that clearly the two
first gases are switched.

However, subsurface thinks that because those are the gas switch events we got.

And I have to say, when I tell subsurface to use the same 55/85
Buehlmann settings that your dive computer reports it is using, the
deco that subsurface calculates isn't actually that far off from what
your Teric calculated. In fact, if anything, your Teric gave _more_
deco at the end.

That said, that can't be real, and I suspect the issue is that I only
see the one dive, and you presumably had some pre-existing deco
loading, and then subsurface getting the gases wrong just happens to
result in a fairly similar deco profile.

ANYWAY.

The gas confusion is clearly real, but I think it comes from some
cylinder numbering confusion during the download.

I *suspect* it is because libdivecomputer has this horrendous model of
"gases vs cylinders" being different. So libdivecomputer has a "gasmix
index" and a "cylinder index", and the two can be different.

Which is INCREDIBLY broken by libdvicecomputer, because it means that
if two cylinders have the same gas mix, the "gas switch" cannot tell
them apart, because it uses the "gas index".

Subsurface gets rid of that libdivecomputer confusion, and just has a
cylinder index, and each cylinder has a gas mix. Two cylinders having
the same gas isn't a problem, and isn't a reason to have a separate
"mix index" that only causes confusion.

But it's very possible that this impedance mismatch between subsurface
and libdivecomputer then causes oddities if/when libdivecomputer does
something strange.

IOW, maybe libdivecomputer called "air" gasmix 0, and your trimix is
gasmix 1. But then it puts gasmix 1 in cylinder 0 and vice versa, and
confuses subsurface that doesn't do that kind of crazy thing.

And with most people carrying just one gas, we don't see this mismatch
very much (plus it quite possibly also depends on how you defined your
gases on your teric)

I feel like a lot of the libdivecomputer interfaces are really quite
broken, and go back to how old dive computers reported the data, not
to anything that makes any real conceptual sense. So libdivecomputer
treats "gasmix" as a primary thing, because if you don't have a
pressure sensor and air integration, the only thing that matters for
deco calculations is the mix, not which cylinder it came from.

And then libdivecomputer learnt about newer dive computers where you
can set cylinder sizes, and where you can have air integration, and
suddenly it matters which _cylinder_ you breathe from, but
libdivecomputer had that insane notion of "gasmix is gasmix, not
cylinder", and then you end up with two different concepts entirely.

And the libdivecomputer interfaces are bad in another way too: the way
it reports gas changes is literally by giving that index into that
"gasmix array" it has. But the Teric doesn't report gas switches that
way: it reports them as the actual gas you switch to. So then
libdivecomputer translates the real gas mix into an index, and that
index may not be the same as the cylinder index it used elsewhere.

No wonder we get confused. But again - in most cases this won't ever
even show up.

Some of the more modern backends (eg Suunto EON Steel) avoid this
whole confusion entirely, and only have one notion of
cylinder-vs-gasmix (ie every gasmix has exactly one cylinder
associated with it, and the gasmix-vs-cylinder confusion just doesnt'
exist).

But the shearwater parser is old and crufty and has grown organically over time.

Just to give an example of *how* odd liobdivecomputer is: the
shearwater parser not only thinks that gasmixes and cylinders are
different things, you can have up to 10 gas mixes, but you can only
have up to 2 cylinders.

Just think about that kind of insanity. You can make excuses for it
("yeah, I only carried two cylinders, but I was breathing off eight
buddies"), but in the end it really is just about libdivecomputer
confusion, and often "random dive computer XYZ describes it this way,
so we'll perpetuate the confusion".

I'll think about this a bit more to see if I can come up with
something, but I hope I have explained why it can be hard due to
libdivecomputer explicitly making it hard.

                Linus


More information about the subsurface mailing list