/* SPDX-License-Identifier: MIT-0 */ #ifndef DECO_H #define DECO_H #include #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 P_WV_DEFAULT P_WV_BUHL /* types */ 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 double P_WV; extern double PO2_MAX; extern double END_MAX; /* functions */ 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 */