On 09 Nov 2014, at 07:12, Willem Ferguson <[email protected]> wrote:
Willem,
> After a sleep I can think (I hope) more clearly. I attach a function from
> gaspressures.c (not the whole of gasspressures.c). It is possible to use a
> switch between the cylinder_use types as shown in this example. But its
> utility is limited. The interpolation requires knowledge about the specific
> cylinder that is used for a particular point on the dive profile. Think in
> terms of cylinder changes during the dive.
I have to admit, I don’t really understand what you are trying to do here. I
assume you want to compute the current (i.e. possibly interpolated pressure(s)
for a given point in the plot, i.e. for plot_info *entry. Is that indeed the
case?
I must say, what I would do is:
1) If entry->o2setpoint == 0 , i.e. this is an OC/bailout segment do the stuff
we used to do.
2) Otherwise we are in CCR mode. Then we have two cylinders in use,
entry->cylinderindex which hopefully is the diluent. This we don’t interpolate,
we use the last measured value. In addition there is the oxygen cylinder
get_cylinder_use(dive, oxygen). For that we do an interpolation as in the OC
case but with the difference that we only interpolate with time (not with
pressure_time or alternatively for the depth use the surface).
If you want, I can try to produce a patch that implements this in real (rather
than pseudo-) code.
What you sent is obviously missing parts so I am not sure what you are aiming
at.
But looking at code like
switch
(dive->cylinder[entry->cylinderindex].cylinder_use) {
case oxygen :
cylinderindex = get_cylinder_use(dive, oxygen);
break;
case diluent :
cylinderindex = get_cylinder_use(dive, diluent);
break;
case bailout :
cylinderindex = entry->cylinderindex;
break;
default ;
}
it seems to me that this is tautological: Let me translate my interoperation of
that code into words:
Look at the cylinder_use of the cylinder with index entry->cylinder index.
If it is oxygen, cylinderindex should be the index of the cylinder whose
cylinder_use is oxygen [why wouldn’t that be entry->cylinderindex ?]
If it is diluent cylinderindex should be the cylinder whose cylinder_use is
diluent [again that wouldn’t necessarily be entry->cylinderindex only if there
are several diluents]
Otherwise cylinderindex should be entry->cylinderindex.
So in total they only possibility that after that code block cylinderindex !=
entry->cylinderindex would be the weird case that there are several diluents
and even then I am not sure that the result then is what you want.
Best
Robert
--
.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oOo.oO
Robert C. Helling Elite Master Course Theoretical and Mathematical Physics
Scientific Coordinator
Ludwig Maximilians Universitaet Muenchen, Dept. Physik
print "Just another Phone: +49 89 2180-4523 Theresienstr. 39, rm. B339
stupid .sig\n"; http://www.atdotde.de
signature.asc
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ subsurface mailing list [email protected] http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
