Subsurface deco calculations

Miika Turkia miika.turkia at gmail.com
Wed Feb 8 07:24:07 PST 2017


On Sun, Feb 5, 2017 at 2:31 AM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
> On Sat, Feb 4, 2017 at 4:07 AM, Anton Lundin <glance at acc.umu.se> wrote:
>>
>> Linus did change the gasmix / gaschange code not to long ago, there
>> might be a bug there.
>>
>> Verify that your libdivecomputer and subsurface code are in sync, there
>> where some incompabilities around that code from what I remembered.
>
> Well, the incompatibilities should eb fixed as long as you upgraded
> libdivecomputer and subsurface in sync. And honestly, if you don't, at
> worst I think you'd just see doubled-up cylinder change events. So it
> shouldn't cause the problems Miika sees.
>
> But quite aside from the incompatibility, the big change was that
> upstream libdivecomputer got rid of the deprecated events entirely,
> and we now use the DC_SAMPLE_GASMIX sample data instead.
>
> And the DC_SAMPLE_GASMIX data has obviously never been tested before.
> In particular, the 'gasmix' data is *supposed to be zero-based (ie in
> the range 0..ngasmixes-1), but I could easily see that some
> libdivecomputer backend would end up using a 1-based index (ie
> 1..ngasmixes).
>
> Before, we just got the gas mix itself, not the cylinder number, and
> we then figured it out from that. That sucked in other ways (ie
> multiple cylinders with the same gas were ambiguous), but it was less
> likely to have _this_ particular problem.
>
> The OSTC parser seems to be correctly zero-based, though, both for the
> initial index (which is a special case) and for the other ones.
>
> Miika, can you do a re-download of that dive just from the OSTC into
> an empty xml file, just to see whether the index comes from the actual
> download, or from some merging issue?

Now I had a change to download the OSTC to an empty log file. Looks
like the index and gas mixes are correct in this case:
---8<---
<dive number='1' date='2017-02-01' time='15:00:00' duration='71:58 min'>
  <cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
  <cylinder size='11.094 l' workpressure='206.843 bar'
description='AL80' o2='32.0%' />
  <cylinder size='11.094 l' workpressure='206.843 bar'
description='AL80' o2='31.0%' />
  <cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
  <cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' />
  <divecomputer model='Heinrichs Weikamp OSTC Sport'
deviceid='ae480b5b' diveid='ce655d8f'>
...
    <event time='0:02 min' type='25' flags='2' name='gaschange'
cylinder='1' o2='32.0%' />
---8<---

So the index used is correctly 1 with o2 32%. Only used cylinder was
that 32% as I find it easier to choose one of the common mixes than
adjusting the mix for first cylinder. However, with Vyper the used
cylinder index was 0 as that was the 32% mix in that computer. And
that is the only cylinder stored in the log in my original DL.

Should we do the merge more intelligently mapping the cylinder indexes
to match the gas mixes, or should I start using same cylinder indexes
on different DCs?

miika


More information about the subsurface mailing list