summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--include/ace.h17
-rw-r--r--include/atragmx.h9
-rw-r--r--include/ballistics.h16
-rw-r--r--include/constants.h13
-rw-r--r--include/context.h86
5 files changed, 121 insertions, 20 deletions
diff --git a/include/ace.h b/include/ace.h
new file mode 100644
index 0000000..90b1996
--- /dev/null
+++ b/include/ace.h
@@ -0,0 +1,17 @@
+#ifndef ACE_H
+#define ACE_H
+
+#include <stdbool.h>
+
+typedef struct ace_ballistics ace_ballistics;
+
+typedef struct {
+ ace_ballistics *ballistics;
+} ace_config;
+extern ace_config *ace;
+
+struct ace_ballistics {
+ bool enabled;
+};
+
+#endif
diff --git a/include/atragmx.h b/include/atragmx.h
new file mode 100644
index 0000000..8e6c1e0
--- /dev/null
+++ b/include/atragmx.h
@@ -0,0 +1,9 @@
+#ifndef ATRAGMX_H
+#define ATRAGMX_H
+
+#include "ace.h"
+#include "context.h"
+
+ATragMXSolution *ATragMXCalcSolution(ATragMXContext *, ace_config *);
+
+#endif
diff --git a/include/ballistics.h b/include/ballistics.h
new file mode 100644
index 0000000..470c7a6
--- /dev/null
+++ b/include/ballistics.h
@@ -0,0 +1,16 @@
+#ifndef ACE_BALLISTICS_H
+#define ACE_BALLISTICS_H
+
+#include "context.h"
+
+double atmospheric_correction(double ballistic_coefficient,
+ double temperature,
+ double pressure,
+ double relative_humidity,
+ AtmosphereModel atmosphere_model);
+
+double calculate_air_density(double temperature,
+ double pressure,
+ double relative_humidity);
+
+#endif
diff --git a/include/constants.h b/include/constants.h
new file mode 100644
index 0000000..cfc9c80
--- /dev/null
+++ b/include/constants.h
@@ -0,0 +1,13 @@
+#ifndef CONST_H
+#define CONST_H
+
+static const double GRAVITY = 9.80665;
+
+static const double DRY_AIR_MOLAR_MASS = 0.028964;
+static const double WATOR_VAPOR_MOLAR_MASS = 0.018016;
+static const double UNIVERSAL_GAS_CONSTANT = 8.31432;
+static const double SPECIFIC_GAST_CONSTANT_DRY_AIR = 287.057036320950;
+static const double STD_AIR_DENSITY_ICAO = 1.22498;
+static const double STD_AIR_DENSITY_ASM = 1.20886;
+
+#endif
diff --git a/include/context.h b/include/context.h
index 95580ee..a2f651f 100644
--- a/include/context.h
+++ b/include/context.h
@@ -1,34 +1,80 @@
+#ifndef CONTEXT_H
+#define CONTEXT_H
+
+#include <stddef.h>
#include <stdlib.h>
+#include <stdbool.h>
+
+#include "ace.h"
typedef enum {
- ATM_1,
- ATM_2
-} ATM_MODEL;
+ BC_UNKNOWN = 0,
+ BC_G1,
+ BC_G2,
+ BC_G3,
+ BC_G4,
+ BC_G5,
+ BC_G6,
+ BC_G7,
+} BallisticModel;
+
+typedef enum {
+ ICAO,
+ ASM,
+} AtmosphereModel;
typedef struct {
- float scope_angle;
- float bullet_mass;
- float bore_height;
- float muzzle_vel;
- float ballistic_coef;
+ double scope_angle;
+ double bullet_mass;
+ double bore_height;
+ double muzzle_velocity;
+ double ballistic_coef;
size_t drag_model;
- float twist_dir;
-} gun_config;
+ double twist_dir;
+} GunConfig;
typedef struct {
- float termperature;
- float bar_pressure;
- float rel_humidity;
- float wind_speed;
+ double temperature;
+ double barometric_pressure;
+ double relative_humidity;
+ double wind_speed[2];
size_t wind_dir;
- ATM_MODEL atmosphere_model;
-} atmo_context;
+ AtmosphereModel atmosphere_model;
+} AtmoContext;
typedef struct {
- float target_speed;
- float target_range;
-} target_context;
+ double speed;
+ double range;
+ double inclination_angle;
+ double latitude;
+ size_t direction;
+} TargetContext;
typedef struct {
- gun_config gun;
+ GunConfig gun;
+ TargetContext target;
+ AtmoContext atmosphere;
+ size_t sim_steps;
+ bool store_range_card;
+ size_t stability_factor;
+} ATragMXContext;
+
+typedef struct {
+ double w1;
+ double w2;
+} Windage;
+
+typedef struct {
+ double elev;
+ Windage windage;
+ double lead;
+ double time_of_flight;
+ double remaining_velocity;
+ double remaining_energy;
+ double coriolis_vdrift;
+ double coriolis_hdrift;
+ double spin_drift;
+ double *range_card;
} ATragMXSolution;
+
+#endif