Incorporate bailout events in CCR & PSCR gas calculations.

This is a first step to interpret bailout events.
1) The event structures have a new attribute: divemode.
   Currently interpreted dive modes are OC, CCR, PSCR.
2) When doing fill_pressures(), the calculation is aware
   of divemode. When divemode is OC (==bailout), then
   the appropriate calculations of gas pressures are done.
3) Two new functions get_next_divemodechange() and
   get_divemode_at_time() are created to find divemode
   changes in the events linked list and to determine
   the dive mode at any point during the dive.
4) fill_pressures gets a small amendment to facilitate
   the correct calculations, depending on divemode.
The cases where fill_pressures() is used *outside the planner*
are changed. The result is that, for dives with bailout, the
correct gas pressures are shown on the dive profile. The
deco for bailout dives is not yet correct. This is the
next step.

Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
This commit is contained in:
Willem Ferguson 2018-04-02 17:16:07 +02:00 committed by Lubomir I. Ivanov
parent 9b4728c7a9
commit cf377beb2e
5 changed files with 90 additions and 9 deletions

View file

@ -14,7 +14,6 @@
#include <string.h>
#include <sys/stat.h>
#include "divesite.h"
#include <libxml/tree.h>
#include <libxslt/transform.h>
#include <libxslt/xsltutils.h>
@ -92,6 +91,7 @@ struct event {
* case, the get_cylinder_index() function will give the best
* match with the cylinders in the dive based on gasmix.
*/
enum dive_comp_type divemode;
struct {
int index;
struct gasmix mix;
@ -364,6 +364,9 @@ struct dive_components {
unsigned int weights : 1;
};
extern struct event *get_next_divemodechange(struct event **evd);
extern enum dive_comp_type get_divemode_at_time(struct divecomputer *dc, int dtime, struct event **ev_dmc);
/* picture list and methods related to dive picture handling */
struct picture {
char *filename;