On Thursday 28 April 2022 16:31:06 CEST Dirk Hohndel wrote: > > 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.
I don't have a real dive, since my current setup has two sensors attached to two different dive computers. It took some time to understand the model when I did the sensor move work. I've attached a small manual dive that I've added sensor data to, which shows the above behavior. > 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. I noticed that too, but in most places it checks if the pressure is 0 to determine if it is actually used or not. There are also some places that relies on sensor[1] not being -1 when unused, like deciding if the legacy or new format for pressure is used. It'll likely need some care, but would probably be worth it. > > 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. I realized that the o2pressure is only a separate member in the plot_entry struct. And it doesn't actually seem to use sensor[1], so I'm still confused about how this works. If it's actually cylinder pressure then maybe we could always save in the new format and only support the legacy format when parsing? > > Willem?
<divelog program='subsurface' version='3'> <settings> </settings> <divesites> </divesites> <dives> <dive number='1' otu='3' cns='4%' date='2022-04-28' time='18:00:51' duration='40:00 min'> <cylinder size='12.0 l' workpressure='232.0 bar' description='12ℓ 232 bar' depth='65.697 m' /> <cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' depth='39.651 m' /> <cylinder size='11.094 l' workpressure='206.843 bar' description='AL80' depth='39.651 m' /> <divecomputer model='manually added dive' last-manual-time='40:00 min'> <depth max='15.0 m' mean='12.999 m' /> <sample time='0:00 min' pressure0="100.0 bar" pressure1="200.0 bar" depth='0.0 m' /> <sample time='5:00 min' pressure1="200.0 bar" pressure2="300.0 bar" depth='15.0 m' /> <sample time='18:00 min' pressure0="100.0 bar" pressure2="300.0 bar" depth='15.0 m' /> <sample time='26:00 min' pressure1="200.0 bar" pressure2="300.0 bar"depth='15.0 m' /> <sample time='34:30 min' depth='15.0 m' /> <sample time='37:51 min' depth='4.95 m' /> <sample time='38:21 min' depth='4.95 m' /> <sample time='40:00 min' depth='0.0 m' /> </divecomputer> </dive> </dives> </divelog>
_______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface