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

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.

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 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.

/Michael


_______________________________________________
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to