Flight Physics and Environment
This chapter details the assumptions, constants, and algorithms governing atmospheric physics and aircraft aerodynamics, encapsulated within the core/environment.py and core/aircraft.py modules.
๐ File : core/environment.py
1. General Role: This module models the external physical conditions that affect the aircraft's flight. It implements the International Standard Atmosphere (ISA) model to determine air temperature, pressure, and density as a function of geometric altitude. It also integrates a wind engine to simulate headwind or tailwind components (either via a static profile or live meteorological API data).
2. Strong Scientific & Economic Assumptions:
- Dry Air and Ideal Gas: Air is modeled as an ideal gas (following the law \(P = \rho R T\)), and humidity is entirely neglected (which very slightly overestimates the true density).
- Standard Atmosphere (ISA) with No Temperature Deviation: We assume there are no temperature anomalies (ISA + 0).
- Simplified 2D Wind: Vertical wind is considered to be zero. Only the longitudinal axis (Head/Tail) affects the aircraft's Ground Speed.
3. Dictionary of Constants & Parameters:
T0_K= \(288.15\) [K] : Standard temperature at sea level (\(15^\circ\text{C}\)).lapse_Kpm(\(\lambda\)) = \(0.0065\) [K/m] : Vertical thermal gradient (temperature lapse rate) in the troposphere.R= \(287.058\) [J/(kgยทK)] : Specific gas constant for dry air.p0= \(101325.0\) [Pa] : Standard atmospheric pressure at sea level.
4. Functions and Internal Logic:
-
calc_atmos(h_m)- Role: Calculate the air density \(\rho\) and temperature as a function of altitude \(h\).
- Inputs:
h_m(geometric altitude in meters). Values are rounded to the nearest integer to optimize the@lru_cache. -
Mathematics: The model divides the atmosphere into two regimes.
-
Troposphere (\(h < 11000\) m): Temperature decreases linearly.
\[ T = T_0 - \lambda \cdot h \]Pressure is derived by integrating the hydrostatic equation (\(dP = -\rho g dh\)) combined with the ideal gas law:
\[ P = P_0 \left( \frac{T}{T_0} \right)^{\frac{g}{R \lambda}} \] -
Tropopause (\(h \ge 11000\) m): Temperature is frozen at its 11 km value (\(T_{11} \approx 216.65\) K). Pressure then follows a pure exponential decay (isothermal model):
\[ P = P_{11} \cdot \exp\left( -\frac{g}{R T_{11}} (h - 11000) \right) \]Finally, for both regimes, air density is deduced from the ideal gas equation of state:
\[ \rho = \frac{P}{R T} \]
-
-
Outputs: A dictionary containing
rho[kg/mยณ] andT_C[ยฐC].
-
get_wind_ms(h_m, config_wind)- Role: Return the tailwind speed for a given altitude.
-
Internal Logic: If the mode is
"profile", the function searches for the altitude bracket \([h_0, h_1]\) containing the aircraft, then performs a strict linear interpolation of the wind:\[ V_{\text{wind}} = w_0 + (w_1 - w_0) \frac{h - h_0}{h_1 - h_0} \]If the aircraft flies higher than the last profile point, the gradient cancels out (the wind remains constant).
-
fetch_live_wind(lat, lon, bearing)- Role: Fetch real-time weather and project it onto the flight path. The live weather API queries wind data specifically at the 700 hPa pressure level, which corresponds to an altitude of approximately 3,000 meters (10,000 ft), matching the typical cruise altitude of regional turboprop aircraft.
-
Mathematics: The API provides the direction from which the wind blows (
wind_dir). The misalignment angle between the aircraft's heading (bearing) and the wind's origin is \(\theta = \text{bearing} - \text{wind direction}\). The trigonometric projection to extract the tailwind component is:\[ V_{\text{tailwind}} = - V_{\text{wind}} \cdot \cos(\theta) \](Explanation: If the wind comes from the North (\(0^\circ\)) and the aircraft flies South (\(180^\circ\)), \(\theta = 180^\circ\). The cosine is -1. With the preceding minus sign, the Tailwind is positive, meaning the aircraft is being pushed).
๐ File : core/aircraft.py
1. General Role: This module is the core of the aircraft's physics. It instantiates the airframe (mass, aerodynamics, powertrain) and provides the solver with all methods required to calculate drag forces, critical speeds (stall, max lift-to-drag), and the shaft power demanded for flight and taxi operations.
2. Strong Scientific & Economic Assumptions:
- Parabolic Drag Polar Model: Drag is modeled using a simple polar (\(C_D = C_{D0} + k \cdot C_L^2\)). Compressibility effects (Mach divergence) are ignored, which is highly justified for the studied regional aircraft flying at Mach \(< 0.5\).
- Thermal Baseline OEW: The classic thermal aircraft (
LegacyAircraft) sees its Operating Empty Weight (OEW) arbitrarily reduced by 12% (* 0.88) compared to its hybrid counterpart. This reflects the absence of heavy electric motors, power electronics, and high-voltage wiring (mass M1+M2). - Propulsive Effects (Blowing): Distributed propulsion on hybrid aircraft blows air directly over the wing's upper surface. This increases lift (an artificial \(C_{L_{max}}\)) and delays stall, but in exchange, the radiators required for electric cooling create additional parasitic drag.
3. Dictionary of Constants & Parameters:
eta_gearbox= \(0.98\) : Mechanical efficiency of the reduction gearbox.eta_motor= \(0.95\) : Electro-mechanical conversion efficiency of the motor.eta_prop_max= \(0.82\) andeta_prop_min= \(0.52\) : Bounded aerodynamic efficiencies of the propeller.k_prop_loss= \(0.30\) : Severity factor for propeller efficiency drop-off outside of the design point.k_cooling= \(0.015\) : Additional parasitic drag constant due to radiator air intakes.tms_power_ratio= \(0.04\) : Fraction of power drawn to operate the cooling pumps (Thermal Management System).blown_area_ratio= \(0.40\) : 40% of the wing area is immersed in the propeller slipstream.k_slipstream_lift= \(1.35\) : Lift multiplier due to air acceleration by leading-edge distributed propellers.
4. Functions and Internal Logic:
-
__init__(self, archetype_id)- Loads specifications from
config.py. Separates native thermal aerodynamics (baseline_CD0) from hybrid aerodynamics (hybrid_CD0). Initializes interference constants.
- Loads specifications from
-
calc_prop_efficiency(V_ms)- Role: Calculate the propeller efficiency (\(\eta_p\)).
-
Mathematics: A propeller is designed (pitch and twist) for an optimal forward speed \(V_{opt}\). If the aircraft flies slower or faster, the blade angle of attack degrades. The equation used is an inverted parabola:
\[ \eta_p = \eta_{max} - k_{loss} \left( \frac{V - V_{opt}}{V_{opt}} \right)^2 \]The efficiency is then clipped between \(\eta_{min}\) and \(\eta_{max}\).
-
CL(W_kg, V_ms, rho)andCD(cl)- Role: Calculate equilibrium aerodynamic coefficients.
-
Mathematics: In level flight, lift balances weight (\(L = mg\)). Hence, the required lift coefficient is:
\[ C_L = \frac{m g}{\frac{1}{2} \rho V^2 S} \]The drag polar is then computed analytically:
\[ C_D = C_{D0} + k \cdot C_L^2 \]
-
power_level_kw(W_kg, V_ms, h_m)andpower_taxi_kw(...)- Role: Calculate the required Shaft Power from the engines.
-
Mathematics:
- In level flight: \(P_{shaft} = \frac{D \cdot V}{\eta_p}\) where \(D = \frac{1}{2} \rho V^2 S C_D\). (Divided by 1000 to convert to kW).
- On the ground (Taxi): The power overcomes the tires' rolling resistance.
\[ P_{\text{taxi}} = \frac{C_{rr} \cdot m g \cdot V}{\eta_{\text{ground}}} \]
-
v_opt_cruise(W_kg, h_m)andv_opt_climb(...)- Role: Find the optimal flight speeds.
-
Mathematics:
- The maximum lift-to-drag ratio speed (Max L/D, optimal for range) is reached when parasitic drag equals induced drag (\(C_{D0} = k C_L^2\)). Isolating \(V\), we obtain:
\[ V_{opt} = \sqrt{\frac{2mg}{\rho S}} \left( \frac{k}{3 C_{D0}} \right)^{0.25} \](Physics Note: the factor of 3 under the 4th root is a classic approximation for the minimum required power point, which dictates endurance and is very close to max L/D). - A legal limit is applied to never fly below approximately \(1.3 V_{stall}\).
-
takeoff_performance(m_kg, h_obs_m)- Role: Solve the energy and time balance for takeoff up to clearing the regulatory obstacle (15 m / 50 ft).
-
Mathematics: Propeller slipstream blowing increases the maximum lift: \(C_{L_{\text{max blown}}} = C_{L_{\text{max}}} \times k_{\text{slipstream lift}}\). This allows the aircraft to lower its rotation/stall speed:
\[ V_{stall} = \sqrt{\frac{2mg}{\rho S C_{L_{\text{max blown}}}}} \]The takeoff speed \(V_{to}\) is defined at \(1.2 V_{stall}\). The total energetic work the engines must provide is derived from the mechanical energy theorem (change in kinetic + potential energy) divided by propulsive efficiency:
\[ E_{shaft} = \frac{\frac{1}{2} m V_{to}^2 + m g h_{obs}}{\eta_p} \]