aeromcp-engineering 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. aeromcp_engineering/__init__.py +11 -0
  2. aeromcp_engineering/__main__.py +8 -0
  3. aeromcp_engineering/aerodynamics/__init__.py +41 -0
  4. aeromcp_engineering/aerodynamics/airfoil.py +25 -0
  5. aeromcp_engineering/aerodynamics/calculations.py +227 -0
  6. aeromcp_engineering/aerodynamics/wings.py +123 -0
  7. aeromcp_engineering/aircraft_design/__init__.py +23 -0
  8. aeromcp_engineering/aircraft_design/preliminary_design.py +45 -0
  9. aeromcp_engineering/aircraft_design/wing_sizing.py +28 -0
  10. aeromcp_engineering/astrodynamics/__init__.py +45 -0
  11. aeromcp_engineering/astrodynamics/anomalies.py +74 -0
  12. aeromcp_engineering/astrodynamics/orbital.py +233 -0
  13. aeromcp_engineering/astrodynamics/perturbations.py +48 -0
  14. aeromcp_engineering/astrodynamics/propagation.py +47 -0
  15. aeromcp_engineering/astrodynamics/transformations.py +102 -0
  16. aeromcp_engineering/atmosphere/__init__.py +27 -0
  17. aeromcp_engineering/atmosphere/isa.py +114 -0
  18. aeromcp_engineering/atmosphere/properties.py +142 -0
  19. aeromcp_engineering/atmosphere/viscosity.py +27 -0
  20. aeromcp_engineering/compressible_flow/__init__.py +33 -0
  21. aeromcp_engineering/compressible_flow/area_mach.py +51 -0
  22. aeromcp_engineering/compressible_flow/fanno.py +34 -0
  23. aeromcp_engineering/compressible_flow/isentropic.py +46 -0
  24. aeromcp_engineering/compressible_flow/normal_shock.py +45 -0
  25. aeromcp_engineering/compressible_flow/oblique_shock.py +91 -0
  26. aeromcp_engineering/compressible_flow/prandtl_meyer.py +49 -0
  27. aeromcp_engineering/compressible_flow/rayleigh.py +30 -0
  28. aeromcp_engineering/core/__init__.py +41 -0
  29. aeromcp_engineering/core/constants.py +42 -0
  30. aeromcp_engineering/core/errors.py +15 -0
  31. aeromcp_engineering/core/numerical_methods.py +198 -0
  32. aeromcp_engineering/core/results.py +33 -0
  33. aeromcp_engineering/core/units.py +109 -0
  34. aeromcp_engineering/core/validation.py +137 -0
  35. aeromcp_engineering/flight_mechanics/__init__.py +27 -0
  36. aeromcp_engineering/flight_mechanics/performance.py +135 -0
  37. aeromcp_engineering/flight_mechanics/stability.py +33 -0
  38. aeromcp_engineering/gnc/__init__.py +24 -0
  39. aeromcp_engineering/gnc/controllers.py +50 -0
  40. aeromcp_engineering/gnc/coordinates.py +60 -0
  41. aeromcp_engineering/gnc/estimation.py +34 -0
  42. aeromcp_engineering/gnc/quaternions.py +74 -0
  43. aeromcp_engineering/mission_analysis/__init__.py +11 -0
  44. aeromcp_engineering/mission_analysis/mission_budget.py +23 -0
  45. aeromcp_engineering/mission_analysis/trajectories.py +52 -0
  46. aeromcp_engineering/prompts.py +102 -0
  47. aeromcp_engineering/propulsion/__init__.py +41 -0
  48. aeromcp_engineering/propulsion/engines.py +67 -0
  49. aeromcp_engineering/propulsion/nozzles.py +79 -0
  50. aeromcp_engineering/propulsion/propellers.py +41 -0
  51. aeromcp_engineering/propulsion/rockets.py +130 -0
  52. aeromcp_engineering/propulsion/rotors.py +62 -0
  53. aeromcp_engineering/resources/__init__.py +141 -0
  54. aeromcp_engineering/server.py +481 -0
  55. aeromcp_engineering/structures/__init__.py +27 -0
  56. aeromcp_engineering/structures/axial.py +26 -0
  57. aeromcp_engineering/structures/beams.py +46 -0
  58. aeromcp_engineering/structures/buckling.py +21 -0
  59. aeromcp_engineering/structures/failure.py +41 -0
  60. aeromcp_engineering/structures/torsion.py +26 -0
  61. aeromcp_engineering/thermal/__init__.py +23 -0
  62. aeromcp_engineering/thermal/aerospace_heating.py +52 -0
  63. aeromcp_engineering/thermal/conduction.py +36 -0
  64. aeromcp_engineering/thermal/convection.py +19 -0
  65. aeromcp_engineering/thermal/radiation.py +24 -0
  66. aeromcp_engineering/tools/__init__.py +32 -0
  67. aeromcp_engineering/tools/aerodynamics.py +236 -0
  68. aeromcp_engineering/tools/aircraft_design.py +110 -0
  69. aeromcp_engineering/tools/astrodynamics.py +192 -0
  70. aeromcp_engineering/tools/atmosphere.py +104 -0
  71. aeromcp_engineering/tools/compressible_flow.py +200 -0
  72. aeromcp_engineering/tools/flight_mechanics.py +238 -0
  73. aeromcp_engineering/tools/gnc.py +168 -0
  74. aeromcp_engineering/tools/mission_analysis.py +87 -0
  75. aeromcp_engineering/tools/propulsion.py +330 -0
  76. aeromcp_engineering/tools/structures.py +242 -0
  77. aeromcp_engineering/tools/thermal.py +157 -0
  78. aeromcp_engineering-0.3.0.dist-info/METADATA +370 -0
  79. aeromcp_engineering-0.3.0.dist-info/RECORD +82 -0
  80. aeromcp_engineering-0.3.0.dist-info/WHEEL +5 -0
  81. aeromcp_engineering-0.3.0.dist-info/licenses/LICENSE +21 -0
  82. aeromcp_engineering-0.3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,11 @@
1
+ """AeroMCP - Aerospace Engineering Model Context Protocol.
2
+
3
+ AeroMCP is an independent aerospace engineering computation library with an MCP
4
+ server interface. Engineering calculations work independently of AI applications;
5
+ MCP exposes these calculations as tools to compatible AI clients.
6
+
7
+ This package is scaffolding only. Engineering calculations and MCP server
8
+ functionality are not yet implemented.
9
+ """
10
+
11
+ __version__ = "0.3.0"
@@ -0,0 +1,8 @@
1
+ """Module entrypoint for `python -m aeromcp_engineering`."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from aeromcp_engineering.server import main
6
+
7
+ if __name__ == "__main__":
8
+ main()
@@ -0,0 +1,41 @@
1
+ """Aerodynamics engineering calculations for AeroMCP."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from aeromcp_engineering.aerodynamics.airfoil import thin_airfoil_lift_coefficient
6
+ from aeromcp_engineering.aerodynamics.calculations import (
7
+ drag_force,
8
+ dynamic_pressure,
9
+ lift_coefficient,
10
+ lift_force,
11
+ reynolds_number,
12
+ )
13
+ from aeromcp_engineering.aerodynamics.wings import (
14
+ aerodynamic_force_decomposition,
15
+ aspect_ratio,
16
+ finite_wing_lift_slope,
17
+ induced_drag_coefficient,
18
+ induced_drag_force,
19
+ lift_to_drag_ratio,
20
+ mach_number,
21
+ stall_speed,
22
+ wing_loading,
23
+ )
24
+
25
+ __all__ = [
26
+ "aerodynamic_force_decomposition",
27
+ "aspect_ratio",
28
+ "drag_force",
29
+ "dynamic_pressure",
30
+ "finite_wing_lift_slope",
31
+ "induced_drag_coefficient",
32
+ "induced_drag_force",
33
+ "lift_coefficient",
34
+ "lift_force",
35
+ "lift_to_drag_ratio",
36
+ "mach_number",
37
+ "reynolds_number",
38
+ "stall_speed",
39
+ "thin_airfoil_lift_coefficient",
40
+ "wing_loading",
41
+ ]
@@ -0,0 +1,25 @@
1
+ """Thin-airfoil theoretical approximations (SI / radians).
2
+
3
+ Note: Thin-airfoil theory assumes inviscid, incompressible, 2D potential flow
4
+ at small angles of attack and does not account for viscous separation, stall,
5
+ or compressibility. It is not a substitute for experimental or CFD airfoil polars.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import math
11
+
12
+ from aeromcp_engineering.core.validation import validate_finite
13
+
14
+
15
+ def thin_airfoil_lift_coefficient(
16
+ angle_of_attack_rad: float,
17
+ zero_lift_angle_rad: float = 0.0,
18
+ ) -> float:
19
+ """Compute thin-airfoil lift coefficient.
20
+
21
+ Equation: cl = 2*pi*(alpha - alpha_0)
22
+ """
23
+ alpha = validate_finite(angle_of_attack_rad, "angle_of_attack_rad")
24
+ alpha_0 = validate_finite(zero_lift_angle_rad, "zero_lift_angle_rad")
25
+ return 2.0 * math.pi * (alpha - alpha_0)
@@ -0,0 +1,227 @@
1
+ """Aerodynamics engineering calculations for AeroMCP.
2
+
3
+ This module implements five fundamental aerospace engineering calculation
4
+ functions using SI units. All functions are independent of the Model Context
5
+ Protocol (MCP) and can be used directly in any Python program.
6
+
7
+ Governing equations:
8
+
9
+ * Dynamic pressure: q = 0.5 * density * velocity**2
10
+ * Lift force: L = q * S * CL
11
+ * Drag force: D = q * S * CD
12
+ * Lift coefficient: CL = L / (0.5 * density * velocity**2 * area)
13
+ * Reynolds number: Re = density * velocity * length / viscosity
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ from aeromcp_engineering.core.validation import (
19
+ validate_finite,
20
+ validate_non_negative,
21
+ validate_positive,
22
+ )
23
+
24
+
25
+ def dynamic_pressure(density_kg_m3: float, velocity_m_s: float) -> float:
26
+ """Compute dynamic pressure.
27
+
28
+ Equation:
29
+ q = 0.5 * density * velocity**2
30
+
31
+ Parameters
32
+ ----------
33
+ density_kg_m3:
34
+ Air density in kilograms per cubic metre (kg/m^3). Must be strictly
35
+ positive.
36
+ velocity_m_s:
37
+ Flow velocity in metres per second (m/s). Must be non-negative.
38
+
39
+ Returns
40
+ -------
41
+ float
42
+ Dynamic pressure in pascals (Pa).
43
+
44
+ Raises
45
+ ------
46
+ TypeError
47
+ If either input is not a real number or is a boolean.
48
+ ValueError
49
+ If either input is NaN or infinite, if density is not strictly
50
+ positive, or if velocity is negative.
51
+ """
52
+ density = validate_positive(density_kg_m3, "density_kg_m3")
53
+ velocity = validate_non_negative(velocity_m_s, "velocity_m_s")
54
+ return 0.5 * density * velocity**2
55
+
56
+
57
+ def lift_force(
58
+ density_kg_m3: float,
59
+ velocity_m_s: float,
60
+ reference_area_m2: float,
61
+ lift_coefficient: float,
62
+ ) -> float:
63
+ """Compute lift force.
64
+
65
+ Equation:
66
+ L = q * S * CL = 0.5 * density * velocity**2 * area * CL
67
+
68
+ Parameters
69
+ ----------
70
+ density_kg_m3:
71
+ Air density in kg/m^3. Must be strictly positive.
72
+ velocity_m_s:
73
+ Flow velocity in m/s. Must be non-negative.
74
+ reference_area_m2:
75
+ Reference area in square metres (m^2). Must be strictly positive.
76
+ lift_coefficient:
77
+ Dimensionless lift coefficient. May be negative, zero, or positive,
78
+ but must be finite.
79
+
80
+ Returns
81
+ -------
82
+ float
83
+ Lift force in newtons (N).
84
+
85
+ Raises
86
+ ------
87
+ TypeError
88
+ If any input is not a real number or is a boolean.
89
+ ValueError
90
+ If any input is NaN or infinite, if density/area are not strictly
91
+ positive, if velocity is negative.
92
+ """
93
+ density = validate_positive(density_kg_m3, "density_kg_m3")
94
+ velocity = validate_non_negative(velocity_m_s, "velocity_m_s")
95
+ area = validate_positive(reference_area_m2, "reference_area_m2")
96
+ cl = validate_finite(lift_coefficient, "lift_coefficient")
97
+ q = 0.5 * density * velocity**2
98
+ return q * area * cl
99
+
100
+
101
+ def drag_force(
102
+ density_kg_m3: float,
103
+ velocity_m_s: float,
104
+ reference_area_m2: float,
105
+ drag_coefficient: float,
106
+ ) -> float:
107
+ """Compute drag force.
108
+
109
+ Equation:
110
+ D = q * S * CD = 0.5 * density * velocity**2 * area * CD
111
+
112
+ Parameters
113
+ ----------
114
+ density_kg_m3:
115
+ Air density in kg/m^3. Must be strictly positive.
116
+ velocity_m_s:
117
+ Flow velocity in m/s. Must be non-negative.
118
+ reference_area_m2:
119
+ Reference area in square metres (m^2). Must be strictly positive.
120
+ drag_coefficient:
121
+ Dimensionless drag coefficient. Must be finite and non-negative.
122
+
123
+ Returns
124
+ -------
125
+ float
126
+ Drag force in newtons (N).
127
+
128
+ Raises
129
+ ------
130
+ TypeError
131
+ If any input is not a real number or is a boolean.
132
+ ValueError
133
+ If any input is NaN or infinite, if density/area are not strictly
134
+ positive, if velocity is negative, or if drag coefficient is negative.
135
+ """
136
+ density = validate_positive(density_kg_m3, "density_kg_m3")
137
+ velocity = validate_non_negative(velocity_m_s, "velocity_m_s")
138
+ area = validate_positive(reference_area_m2, "reference_area_m2")
139
+ cd = validate_non_negative(drag_coefficient, "drag_coefficient")
140
+ q = 0.5 * density * velocity**2
141
+ return q * area * cd
142
+
143
+
144
+ def lift_coefficient(
145
+ lift_force_n: float,
146
+ density_kg_m3: float,
147
+ velocity_m_s: float,
148
+ reference_area_m2: float,
149
+ ) -> float:
150
+ """Compute dimensionless lift coefficient.
151
+
152
+ Equation:
153
+ CL = L / (0.5 * density * velocity**2 * area)
154
+
155
+ Parameters
156
+ ----------
157
+ lift_force_n:
158
+ Lift force in newtons (N). Must be finite; may be negative or zero.
159
+ density_kg_m3:
160
+ Air density in kg/m^3. Must be strictly positive.
161
+ velocity_m_s:
162
+ Flow velocity in m/s. Must be strictly positive (zero velocity would
163
+ make the denominator zero).
164
+ reference_area_m2:
165
+ Reference area in square metres (m^2). Must be strictly positive.
166
+
167
+ Returns
168
+ -------
169
+ float
170
+ Dimensionless lift coefficient.
171
+
172
+ Raises
173
+ ------
174
+ TypeError
175
+ If any input is not a real number or is a boolean.
176
+ ValueError
177
+ If any input is NaN or infinite, if density/velocity/area are not
178
+ strictly positive.
179
+ """
180
+ lift = validate_finite(lift_force_n, "lift_force_n")
181
+ density = validate_positive(density_kg_m3, "density_kg_m3")
182
+ velocity = validate_positive(velocity_m_s, "velocity_m_s")
183
+ area = validate_positive(reference_area_m2, "reference_area_m2")
184
+ q = 0.5 * density * velocity**2
185
+ return lift / (q * area)
186
+
187
+
188
+ def reynolds_number(
189
+ density_kg_m3: float,
190
+ velocity_m_s: float,
191
+ characteristic_length_m: float,
192
+ dynamic_viscosity_pa_s: float,
193
+ ) -> float:
194
+ """Compute dimensionless Reynolds number.
195
+
196
+ Equation:
197
+ Re = density * velocity * characteristic_length / dynamic_viscosity
198
+
199
+ Parameters
200
+ ----------
201
+ density_kg_m3:
202
+ Air density in kg/m^3. Must be strictly positive.
203
+ velocity_m_s:
204
+ Flow velocity in m/s. Must be non-negative.
205
+ characteristic_length_m:
206
+ Characteristic length in metres (m). Must be strictly positive.
207
+ dynamic_viscosity_pa_s:
208
+ Dynamic viscosity in pascal-seconds (Pa*s). Must be strictly positive.
209
+
210
+ Returns
211
+ -------
212
+ float
213
+ Dimensionless Reynolds number.
214
+
215
+ Raises
216
+ ------
217
+ TypeError
218
+ If any input is not a real number or is a boolean.
219
+ ValueError
220
+ If any input is NaN or infinite, if density/length/viscosity are not
221
+ strictly positive, or if velocity is negative.
222
+ """
223
+ density = validate_positive(density_kg_m3, "density_kg_m3")
224
+ velocity = validate_non_negative(velocity_m_s, "velocity_m_s")
225
+ length = validate_positive(characteristic_length_m, "characteristic_length_m")
226
+ viscosity = validate_positive(dynamic_viscosity_pa_s, "dynamic_viscosity_pa_s")
227
+ return density * velocity * length / viscosity
@@ -0,0 +1,123 @@
1
+ """Finite-wing and aircraft aerodynamics calculations (SI units)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import math
6
+
7
+ from aeromcp_engineering.aerodynamics.calculations import dynamic_pressure
8
+ from aeromcp_engineering.core.validation import (
9
+ validate_finite,
10
+ validate_non_negative,
11
+ validate_positive,
12
+ )
13
+
14
+
15
+ def mach_number(velocity_m_s: float, speed_of_sound_m_s: float) -> float:
16
+ """Compute Mach number M = V / a."""
17
+ v = validate_non_negative(velocity_m_s, "velocity_m_s")
18
+ a = validate_positive(speed_of_sound_m_s, "speed_of_sound_m_s")
19
+ return v / a
20
+
21
+
22
+ def lift_to_drag_ratio(lift_n: float, drag_n: float) -> float:
23
+ """Compute lift-to-drag ratio L / D."""
24
+ lift = validate_finite(lift_n, "lift_n")
25
+ drag = validate_positive(drag_n, "drag_n")
26
+ return lift / drag
27
+
28
+
29
+ def wing_loading(weight_n: float, wing_area_m2: float) -> float:
30
+ """Compute wing loading W / S in N/m^2 (Pa)."""
31
+ w = validate_positive(weight_n, "weight_n")
32
+ s = validate_positive(wing_area_m2, "wing_area_m2")
33
+ return w / s
34
+
35
+
36
+ def aspect_ratio(wingspan_m: float, wing_area_m2: float) -> float:
37
+ """Compute wing aspect ratio AR = b^2 / S."""
38
+ b = validate_positive(wingspan_m, "wingspan_m")
39
+ s = validate_positive(wing_area_m2, "wing_area_m2")
40
+ return (b * b) / s
41
+
42
+
43
+ def induced_drag_coefficient(
44
+ lift_coefficient: float,
45
+ aspect_ratio_val: float,
46
+ oswald_efficiency: float,
47
+ ) -> float:
48
+ """Compute induced drag coefficient CDi = CL^2 / (pi * AR * e)."""
49
+ cl = validate_finite(lift_coefficient, "lift_coefficient")
50
+ ar = validate_positive(aspect_ratio_val, "aspect_ratio_val")
51
+ e = validate_positive(oswald_efficiency, "oswald_efficiency")
52
+ if e > 1.0:
53
+ raise ValueError(f"oswald_efficiency must be <= 1.0. Got {e!r}.")
54
+ return (cl * cl) / (math.pi * ar * e)
55
+
56
+
57
+ def induced_drag_force(
58
+ density_kg_m3: float,
59
+ velocity_m_s: float,
60
+ wing_area_m2: float,
61
+ lift_coefficient: float,
62
+ aspect_ratio_val: float,
63
+ oswald_efficiency: float,
64
+ ) -> float:
65
+ """Compute induced drag force Di = q * S * CDi in newtons (N)."""
66
+ q = dynamic_pressure(density_kg_m3, velocity_m_s)
67
+ s = validate_positive(wing_area_m2, "wing_area_m2")
68
+ cdi = induced_drag_coefficient(
69
+ lift_coefficient, aspect_ratio_val, oswald_efficiency
70
+ )
71
+ return q * s * cdi
72
+
73
+
74
+ def stall_speed(
75
+ weight_n: float,
76
+ density_kg_m3: float,
77
+ wing_area_m2: float,
78
+ cl_max: float,
79
+ ) -> float:
80
+ """Compute steady level-flight stall speed Vs = sqrt(2*W / (rho*S*CLmax)) in m/s."""
81
+ w = validate_positive(weight_n, "weight_n")
82
+ rho = validate_positive(density_kg_m3, "density_kg_m3")
83
+ s = validate_positive(wing_area_m2, "wing_area_m2")
84
+ clm = validate_positive(cl_max, "cl_max")
85
+ return math.sqrt((2.0 * w) / (rho * s * clm))
86
+
87
+
88
+ def finite_wing_lift_slope(
89
+ airfoil_lift_slope_per_rad: float,
90
+ aspect_ratio_val: float,
91
+ oswald_efficiency: float = 1.0,
92
+ ) -> float:
93
+ """Compute Prandtl lifting-line finite-wing lift-curve slope (per rad).
94
+
95
+ a = a0 / (1 + a0 / (pi * AR * e))
96
+ """
97
+ a0 = validate_positive(airfoil_lift_slope_per_rad, "airfoil_lift_slope_per_rad")
98
+ ar = validate_positive(aspect_ratio_val, "aspect_ratio_val")
99
+ e = validate_positive(oswald_efficiency, "oswald_efficiency")
100
+ if e > 1.0:
101
+ raise ValueError(f"oswald_efficiency must be <= 1.0. Got {e!r}.")
102
+ return a0 / (1.0 + a0 / (math.pi * ar * e))
103
+
104
+
105
+ def aerodynamic_force_decomposition(
106
+ normal_force_n: float,
107
+ axial_force_n: float,
108
+ angle_of_attack_rad: float,
109
+ ) -> dict[str, float]:
110
+ """Decompose body-frame normal (N) and axial (A) forces into Lift and Drag.
111
+
112
+ L = N * cos(alpha) - A * sin(alpha)
113
+ D = N * sin(alpha) + A * cos(alpha)
114
+ """
115
+ n_f = validate_finite(normal_force_n, "normal_force_n")
116
+ a_f = validate_finite(axial_force_n, "axial_force_n")
117
+ alpha = validate_finite(angle_of_attack_rad, "angle_of_attack_rad")
118
+ ca = math.cos(alpha)
119
+ sa = math.sin(alpha)
120
+ return {
121
+ "lift_n": n_f * ca - a_f * sa,
122
+ "drag_n": n_f * sa + a_f * ca,
123
+ }
@@ -0,0 +1,23 @@
1
+ """Aircraft and UAV preliminary design calculations for AeroMCP."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from aeromcp_engineering.aircraft_design.preliminary_design import (
6
+ electric_uav_endurance,
7
+ power_to_weight_ratio,
8
+ thrust_to_weight_ratio,
9
+ )
10
+ from aeromcp_engineering.aircraft_design.wing_sizing import (
11
+ rectangular_wing_mac,
12
+ wing_area_from_loading,
13
+ wingspan_from_aspect_ratio,
14
+ )
15
+
16
+ __all__ = [
17
+ "electric_uav_endurance",
18
+ "power_to_weight_ratio",
19
+ "rectangular_wing_mac",
20
+ "thrust_to_weight_ratio",
21
+ "wing_area_from_loading",
22
+ "wingspan_from_aspect_ratio",
23
+ ]
@@ -0,0 +1,45 @@
1
+ """Preliminary aircraft and electric UAV sizing calculations (SI units)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from aeromcp_engineering.core.validation import validate_positive
6
+
7
+
8
+ def thrust_to_weight_ratio(thrust_n: float, weight_n: float) -> float:
9
+ """Compute thrust-to-weight ratio T / W (dimensionless)."""
10
+ t = validate_positive(thrust_n, "thrust_n")
11
+ w = validate_positive(weight_n, "weight_n")
12
+ return t / w
13
+
14
+
15
+ def power_to_weight_ratio(power_w: float, weight_n: float) -> float:
16
+ """Compute power-to-weight ratio P / W in W/N."""
17
+ p = validate_positive(power_w, "power_w")
18
+ w = validate_positive(weight_n, "weight_n")
19
+ return p / w
20
+
21
+
22
+ def electric_uav_endurance(
23
+ battery_energy_wh: float,
24
+ usable_fraction: float,
25
+ power_draw_w: float,
26
+ propulsion_efficiency: float = 0.75,
27
+ ) -> dict[str, float]:
28
+ """Estimate electric UAV endurance (s and hours) from battery energy \
29
+ and power draw."""
30
+ e_wh = validate_positive(battery_energy_wh, "battery_energy_wh")
31
+ frac = validate_positive(usable_fraction, "usable_fraction")
32
+ if frac > 1.0:
33
+ raise ValueError("usable_fraction must be <= 1.0.")
34
+ p_draw = validate_positive(power_draw_w, "power_draw_w")
35
+ eta = validate_positive(propulsion_efficiency, "propulsion_efficiency")
36
+ if eta > 1.0:
37
+ raise ValueError("propulsion_efficiency must be <= 1.0.")
38
+
39
+ usable_j = e_wh * 3600.0 * frac * eta
40
+ endurance_s = usable_j / p_draw
41
+ return {
42
+ "usable_energy_j": usable_j,
43
+ "endurance_s": endurance_s,
44
+ "endurance_hr": endurance_s / 3600.0,
45
+ }
@@ -0,0 +1,28 @@
1
+ """Preliminary aircraft wing sizing calculations (SI units)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import math
6
+
7
+ from aeromcp_engineering.core.validation import validate_positive
8
+
9
+
10
+ def wing_area_from_loading(weight_n: float, wing_loading_n_m2: float) -> float:
11
+ """Compute required wing area S = W / (W/S) in m^2."""
12
+ w = validate_positive(weight_n, "weight_n")
13
+ ws = validate_positive(wing_loading_n_m2, "wing_loading_n_m2")
14
+ return w / ws
15
+
16
+
17
+ def wingspan_from_aspect_ratio(aspect_ratio_val: float, wing_area_m2: float) -> float:
18
+ """Compute wingspan b = sqrt(AR * S) in m."""
19
+ ar = validate_positive(aspect_ratio_val, "aspect_ratio_val")
20
+ s = validate_positive(wing_area_m2, "wing_area_m2")
21
+ return math.sqrt(ar * s)
22
+
23
+
24
+ def rectangular_wing_mac(wing_area_m2: float, wingspan_m: float) -> float:
25
+ """Compute mean aerodynamic chord c_bar = S / b for a rectangular wing (m)."""
26
+ s = validate_positive(wing_area_m2, "wing_area_m2")
27
+ b = validate_positive(wingspan_m, "wingspan_m")
28
+ return s / b
@@ -0,0 +1,45 @@
1
+ """Astrodynamics engineering calculations for AeroMCP."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from aeromcp_engineering.astrodynamics.anomalies import (
6
+ eccentric_to_true_anomaly,
7
+ mean_to_true_anomaly,
8
+ solve_kepler_elliptic,
9
+ true_to_eccentric_anomaly,
10
+ true_to_mean_anomaly,
11
+ )
12
+ from aeromcp_engineering.astrodynamics.orbital import (
13
+ circular_orbital_velocity,
14
+ escape_velocity,
15
+ hohmann_transfer,
16
+ orbital_period,
17
+ )
18
+ from aeromcp_engineering.astrodynamics.perturbations import j2_secular_rates
19
+ from aeromcp_engineering.astrodynamics.propagation import propagate_two_body_rk4
20
+ from aeromcp_engineering.astrodynamics.transformations import (
21
+ c3_energy,
22
+ coe_to_rv,
23
+ hyperbolic_excess_velocity,
24
+ periapsis_apoapsis,
25
+ vis_viva_velocity,
26
+ )
27
+
28
+ __all__ = [
29
+ "c3_energy",
30
+ "circular_orbital_velocity",
31
+ "coe_to_rv",
32
+ "eccentric_to_true_anomaly",
33
+ "escape_velocity",
34
+ "hohmann_transfer",
35
+ "hyperbolic_excess_velocity",
36
+ "j2_secular_rates",
37
+ "mean_to_true_anomaly",
38
+ "orbital_period",
39
+ "periapsis_apoapsis",
40
+ "propagate_two_body_rk4",
41
+ "solve_kepler_elliptic",
42
+ "true_to_eccentric_anomaly",
43
+ "true_to_mean_anomaly",
44
+ "vis_viva_velocity",
45
+ ]
@@ -0,0 +1,74 @@
1
+ """Orbital anomaly conversions and Kepler equation solver (radians)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import math
6
+
7
+ from aeromcp_engineering.core.numerical_methods import safeguarded_newton
8
+ from aeromcp_engineering.core.validation import validate_finite, validate_non_negative
9
+
10
+
11
+ def _validate_elliptic_eccentricity(eccentricity: float) -> float:
12
+ e = validate_non_negative(eccentricity, "eccentricity")
13
+ if e >= 1.0:
14
+ raise ValueError(f"Elliptic orbit requires 0 <= e < 1.0. Got {e!r}.")
15
+ return e
16
+
17
+
18
+ def solve_kepler_elliptic(
19
+ mean_anomaly_rad: float,
20
+ eccentricity: float,
21
+ tol: float = 1e-12,
22
+ ) -> float:
23
+ """Solve Kepler's equation M = E - e*sin(E) for eccentric anomaly E (rad)."""
24
+ m_raw = validate_finite(mean_anomaly_rad, "mean_anomaly_rad")
25
+ e = _validate_elliptic_eccentricity(eccentricity)
26
+ m = m_raw % (2.0 * math.pi)
27
+ if e == 0.0:
28
+ return m
29
+
30
+ def f(ecc_anom: float) -> float:
31
+ return ecc_anom - e * math.sin(ecc_anom) - m
32
+
33
+ def df(ecc_anom: float) -> float:
34
+ return 1.0 - e * math.cos(ecc_anom)
35
+
36
+ res = safeguarded_newton(f, df, 0.0, 2.0 * math.pi, x0=m, tol=tol)
37
+ return res.root
38
+
39
+
40
+ def eccentric_to_true_anomaly(
41
+ eccentric_anomaly_rad: float, eccentricity: float
42
+ ) -> float:
43
+ """Convert eccentric anomaly E (rad) to true anomaly nu (rad) in [0, 2*pi)."""
44
+ e_anom = validate_finite(eccentric_anomaly_rad, "eccentric_anomaly_rad")
45
+ e = _validate_elliptic_eccentricity(eccentricity)
46
+ nu = 2.0 * math.atan2(
47
+ math.sqrt(1.0 + e) * math.sin(0.5 * e_anom),
48
+ math.sqrt(1.0 - e) * math.cos(0.5 * e_anom),
49
+ )
50
+ return nu % (2.0 * math.pi)
51
+
52
+
53
+ def true_to_eccentric_anomaly(true_anomaly_rad: float, eccentricity: float) -> float:
54
+ """Convert true anomaly nu (rad) to eccentric anomaly E (rad) in [0, 2*pi)."""
55
+ nu = validate_finite(true_anomaly_rad, "true_anomaly_rad")
56
+ e = _validate_elliptic_eccentricity(eccentricity)
57
+ e_anom = 2.0 * math.atan2(
58
+ math.sqrt(1.0 - e) * math.sin(0.5 * nu),
59
+ math.sqrt(1.0 + e) * math.cos(0.5 * nu),
60
+ )
61
+ return e_anom % (2.0 * math.pi)
62
+
63
+
64
+ def mean_to_true_anomaly(mean_anomaly_rad: float, eccentricity: float) -> float:
65
+ """Convert mean anomaly M (rad) to true anomaly nu (rad)."""
66
+ e_anom = solve_kepler_elliptic(mean_anomaly_rad, eccentricity)
67
+ return eccentric_to_true_anomaly(e_anom, eccentricity)
68
+
69
+
70
+ def true_to_mean_anomaly(true_anomaly_rad: float, eccentricity: float) -> float:
71
+ """Convert true anomaly nu (rad) to mean anomaly M (rad)."""
72
+ e = _validate_elliptic_eccentricity(eccentricity)
73
+ e_anom = true_to_eccentric_anomaly(true_anomaly_rad, e)
74
+ return (e_anom - e * math.sin(e_anom)) % (2.0 * math.pi)