1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
/* SPDX-License-Identifier: MIT-0 */
#ifndef DECO_H
#define DECO_H
#include <stddef.h>
#include "gas.h"
#define max(X, Y) (((X) > (Y)) ? (X) : (Y))
#define min(X, Y) (((X) < (Y)) ? (X) : (Y))
#define len(X) (sizeof(X) / sizeof((X)[0]))
#define P_WV_BUHL 0.0627 /* Buhlmann value, Rq = 1.0, least conservative */
#define P_WV_NAVY 0.0567 /* US. Navy value, Rq = 0.9 */
#define P_WV_SCHR 0.0493 /* Schreiner value, Rq = 0.8, most conservative */
#define ALGO_VER_DEFAULT ZHL_16C
#define UNITS_DEFAULT METRIC
#define SURFACE_PRESSURE_DEFAULT 1.01325
#define P_WV_DEFAULT P_WV_BUHL
/* types */
enum UNITS {
METRIC,
IMPERIAL,
};
enum ALGO {
ZHL_16A = 0,
ZHL_16B = 1,
ZHL_16C = 2,
};
typedef struct decostate_t {
double pn2[16];
double phe[16];
unsigned char gflo;
unsigned char gfhi;
double firststop;
double max_depth;
double ceil_multiple;
const gas_t *gas;
double depth;
double runtime;
} decostate_t;
/* global variables */
extern enum ALGO ALGO_VER;
extern enum UNITS UNITS;
extern double SURFACE_PRESSURE;
extern double P_WV;
extern double PO2_MAX;
extern double END_MAX;
/* functions */
double bar_to_msw(double bar);
double msw_to_bar(double msw);
double bar_to_fsw(double bar);
double fsw_to_bar(double msw);
double msw_or_fsw(double msw, double fsw);
double xsw_to_bar(double xsw);
double bar_to_xsw(double bar);
double abs_depth(double gd);
double gauge_depth(double ad);
void add_segment_ascdec(decostate_t *ds, double dstart, double dend, double time, const gas_t *gas);
void add_segment_const(decostate_t *ds, double depth, double time, const gas_t *gas);
double get_gf(const decostate_t *ds, double depth);
double ceiling(const decostate_t *ds, double gf);
double gf99(const decostate_t *ds, double depth);
void init_decostate(decostate_t *ds, unsigned char gflo, unsigned char gfhi, double ceil_multiple);
double ppO2(double depth, const gas_t *gas);
double end(double depth, const gas_t *gas);
double ead(double depth, const gas_t *gas);
#endif /* end of include guard: DECO_H */
|