Subsurface minimum gas calculation - First version for review

Robert Helling helling at atdotde.de
Mon Feb 20 06:18:19 PST 2017


Stefan,

> On 20.02.2017, at 15:02, Stefan Fuchs <sfuchs at gmx.de> wrote:
> 
> Now I identified the next hurdle: Is there somewhere the curve cylinder pressure versus dive time for every specific cylinder? Or how could I create it for a specific cylinder id? I found that this is neither in struct cylinder_t, nor in dive or divecomputer. I think this somehow works with the struct sample and is created at the moment when the profile is finally created.
> What I need to do are two things:
> 1. Get the cylinder pressure for "my" "lastbottomdp" which is a struct divedatapoint *. In fact I need the pressure at time lastbottomdp.time
> 2. If this value is smaller than the minimum gas result I need to go back on the time axis and find the point in time when cylinder pressure goes below minimum gas. At this time I like to put the event/warning icon.


the problem is that for computers that don’t have gas information, the interpolation of cylinder pressures is only done at the plot stage. The information is in struct plot_data which you find in profile.h, in particular in cylinderindex and pressure[2] (to access the latter there is a macro, for usage see profile.c. Strictly speaking, that is to handle the CCR case which you want to avoid anyway but it’s better to use this as an accessor).

And as I said: I think it’s cleaner to add an event to the dive rather than plot directly to the profile. Simply use

struct event *add_event(struct divecomputer *dc, unsigned int time, int type, int flags, int value, const char *name)

from dive.c

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
                      Phone: +49 89 2180-4523  Theresienstr. 39, rm. B339
                      http://www.atdotde.de

Enhance your privacy, use cryptography! My PGP keys have fingerprints
A9D1 A01D 13A5 31FA 6515  BB44 0820 367C 36BC 0C1D    and
DCED 37B6 251C 7861 270D  5613 95C7 9D32 9A8D 9B8F





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20170220/165e5d31/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20170220/165e5d31/attachment-0001.sig>


More information about the subsurface mailing list