diff options
author | Tim Segers <tsegers@pm.me> | 2022-09-29 19:12:32 +0200 |
---|---|---|
committer | Tim Segers <tsegers@pm.me> | 2022-09-30 11:35:37 +0200 |
commit | b5dfedd376c2ac89f7c3d14a6f5db0b5ca1d994d (patch) | |
tree | debac6d237969a0d2fa09fb5b0544714d902760c /schedule.h | |
parent | 98d9fc18c782d8fe78e4cd45d807da10ffd0e15d (diff) | |
download | opendeco-b5dfedd376c2ac89f7c3d14a6f5db0b5ca1d994d.tar.gz |
Initial commitv0.1
Diffstat (limited to 'schedule.h')
-rw-r--r-- | schedule.h | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/schedule.h b/schedule.h new file mode 100644 index 0000000..b1703d7 --- /dev/null +++ b/schedule.h @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: MIT-0 */ + +#ifndef SCHEDULE_H +#define SCHEDULE_H + +#include "deco.h" + +typedef struct waypoint_t { + double depth; + double time; + const gas_t *gas; +} waypoint_t; + +typedef struct decoinfo_t { + double ndl; + double tts; +} decoinfo_t; + +typedef enum segtype_t { + SEG_DECO_STOP, + SEG_DIVE, + SEG_GAS_SWITCH, + SEG_NDL, + SEG_SAFETY_STOP, + SEG_SURFACE, + SEG_TRAVEL, +} segtype_t; + +typedef void (*segment_callback_t)(const waypoint_t, const segtype_t); + +const gas_t *best_gas(const double depth, const gas_t *gasses, const int nof_gasses); +const gas_t *next_gas(const double depth, const gas_t *gasses, const int nof_gasses); + +int direct_ascent(const decostate_t *ds, const double depth, const double time, const gas_t *gas); +double calc_ndl(decostate_t *ds, const double depth, const double ascrate, const gas_t *gas); + +void simulate_dive(decostate_t *ds, waypoint_t *waypoints, const int nof_waypoints, segment_callback_t seg_cb); + +decoinfo_t calc_deco(decostate_t *ds, const double start_depth, const gas_t *start_gas, const gas_t *deco_gasses, + const int nof_gasses, segment_callback_t seg_cb); + +#endif /* end of include guard: SCHEDULE_H */ |