understanding the sensor values in our samples

Dirk Hohndel dirk at hohndel.org
Thu Apr 28 07:31:06 PDT 2022


Hi Michael

> On Apr 28, 2022, at 12:05 AM, Michael wrote:
> 
> On Wednesday 27 April 2022 23:27:43 CEST Dirk Hohndel via subsurface wrote:
>> 
>> I am trying to track down an issue where Subsurface thinks that a cylinder is used that clearly isn't used.
>> This got me back to looking at our handling of cylinders and sensors and ... oh my.
>> 
> [snip]
>> 
>> Yeah, this is not doing what it should be doing.
>> At first I was trying to figure out all these complicated ways how to deal with the second sensor value. But then I thought... for an OC dive we should completely ignore sensor[1]... there is no O2 cylinder in use... - that seems the easiest fix.
>> 
>> Thoughts?
> 
> Since I've been messing in this area recently, here is my understanding.
> 
> The sensor[] array has slightly different usage for OC and CCR dives. For OC dives it's not that sensor[0] is the main tank/diluent and sensor[1] is O2. Instead, we support for up to two pressure samples per sample. So sensor[0] says which tank pressure[0] is attached to and sensor[1] says which tank pressure[1] is attached to. And with 3 sensors you can end up with something like this:
> 
> sample1 sensor[0]=0 sensor[1]=1 pressure[0]=100.0 pressure[1]=200.0
> sample2 sensor[0]=2 sensor[1]=1 pressure[0]=300.0 pressure[1]=200.0
> sample3 sensor[0]=0 sensor[1]=2 pressure[0]=100.0 pressure[1]=300.0
> sample4 sensor[0]=1 sensor[1]=2 pressure[0]=200.0 pressure[1]=300.0

Fascinating. Do you have a dive you could point me at in cloud storage or export as .XML that shows this?
Because my understanding of the git and xml parsing code says that it does not do what it should be doing if that is indeed the idea here.
But then it's always possible that I ended up confusing myself... so having a working example would be neat.

The one thing that I /can/ say with confidence is that the fact that for a case with just a single active sensor, the current code creates two "used" sensor entries - and that can't be right.

> It tries to reuse the index for the same cylinder, but if the cylinder isn't in the previous sample then it picks the first index that doesn't (yet) have a pressure for this sample. So ignoring sensor[1] is not right solution for OC dives. For these I think the real solution is to ensure that unused sensor[n] is set to NO_SENSOR.

There are at least three places in the code where that definitely doesn't happen.

> However, I don't really understand the special CCR O2 handling. There is a lot of odd handling, including picking the format to use for saving the pressure samples, so the change to have unsed sensor[n] as NO_SENSOR might have a bigger impact.

I don't fully understand that code, either. I've never used anything but OC - so this code was mostly written by others.

> I wonder how much of that special CCR O2 handling is actually needed and how much is just there because of history. Why do we save o2pressure in pressure[1] when there is already a separate o2pressure? Especially since o2pressure seems to be partial pressure and not cylinder pressure.

Willem?

/D


More information about the subsurface mailing list