[PATCH] Add a simple table-based otu-calculator
Dirk Hohndel
dirk at hohndel.org
Wed Apr 3 11:22:28 PDT 2013
On Apr 2, 2013, at 10:59 PM, Anton Lundin wrote:
> On 02 April, 2013 - Dirk Hohndel wrote:
>
>> Anton Lundin <glance at acc.umu.se> writes:
>>
>>> For dives where divecomputers haven't provided us with a maxCNS, we
>>> calculate our cns accumulated during that dive based on a simple table.
>>
>> This doesn't take multiple dives into account at all.
>>
>> According to http://www.therebreathersite.nl/04_Links/Downloads/cns.pdf
>> it is common practice to calculate a surface decay as exponential decay
>> with a half-time of 90 minutes. Which means that in typical boat diving
>> the CNS value from the previous dive will have significant impact on the
>> next dive.
>
> ( And now to the whole list.. )
>
> Yep.
>
> This patch was more in the area of RFC, sorry for not putting that in
> subject.
Ahh. OK.
Which reminds me. The commit message talks about OTUs. This is CNS, not OTU.
> I started out with single dive calculations, and currently trying
> to figure out where to store the CNS information, so we can propagate it
> in-between the dives.
> My current guess is to shoe-horn it into init_decompression somehow, or
> trying to propagate it in fill_dive_list.
> Does those sound like a acceptable ideas?
Definitely don't shoe-horn into init_decompression.
I actually wonder if it's even worth propagating. A 12h interval basically resets things back to zero (at a half-time of 90min 12h give you a residual of 0.4% of the last CNS value).
So simply walk back the dive list and recalculate on the fly until you hit a gap of more than 12h.
But we already have a cns member in the dive struct - this was put there to hold the ending cns value (and then I never finished that code). Please look around, but I think it is currently unused :-(
You could simply populate this the first time we walk the divelist (either from the last sample, or by doing the calculation).
/D
More information about the subsurface
mailing list