Skip to content

Mission Simulation & Routing

This chapter details the time-step integrator and the core physical solver of the SPARK simulator, encapsulated in the core/mission.py module. It marries aerodynamics with electrochemistry to simulate a full flight profile.


📄 File : core/mission.py

1. General Role: This module is the master orchestrator of the physical flight. It integrates the aerodynamic drag, required thrust, and energy consumption dynamically across all flight phases (taxi, takeoff, climb, cruise, descent, holding, and reserve). Its most critical function is to resolve the "snowball effect" of aircraft mass using an iterative numerical solver.

2. Exhaustive Technical Analysis:

  • Mass Convergence Loop (for _ in range(iter_max)):

    • Scientific Rationale: In aviation, the "snowball effect" dictates that carrying energy (fuel or batteries) adds mass. This extra mass requires more lift, which induces more drag (\(C_D \propto C_L^2\)). More drag requires more thrust, which in turn requires more energy, adding even more mass.
    • Iterative Solver: This circular dependency cannot be solved analytically for a multi-phase dynamic mission. The solver uses a while/for loop that starts with an initial guess for battery mass (\(m_{\text{bat}}\)) and fuel mass (\(m_{\text{fuel}}\)). It simulates the entire flight, calculates the exact energy consumed, resizes the battery/fuel based on that energy, and loops until the mass stabilizes within a strict tolerance limit (conv_tol). A relaxation factor of 0.5 is applied to prevent numerical oscillations between iterations.
  • Payload Offloading:

    • Logic: The Maximum Takeoff Weight (MTOW) is a hard structural and regulatory limit. If the sum of the Operating Empty Weight (OEW), fuel, batteries, and passengers exceeds the MTOW, the aircraft is too heavy to fly legally.
    • Resolution: The solver mathematically "offloads" payload (removes passengers) until the takeoff mass exactly equals the MTOW. This triggers a financial penalty in economics.py because fewer tickets are sold.
  • Advanced Drag Calculation (Interferences):

    • Slipstream Drag: The accelerated air from the propellers blowing over the wing increases local skin friction. The added drag coefficient is proportional to the thrust coefficient \(T_c\):

      \[ \Delta C_{D\text{ slipstream}} = C_{D0} \cdot \text{blown area ratio} \cdot T_c \]
    • Thermal Management System (TMS) Cooling Drag: High electrical power generates massive heat in the battery and motor. Rejecting this heat requires opening radiators to the external airflow, inducing severe momentum drag:

      \[ \Delta C_{D\text{ cooling}} = \frac{k_{\text{cooling}} \cdot P_{\text{heat total}} \cdot 1000}{q_{\text{dyn}} \cdot V_{\text{TAS}} \cdot S} \]

      Beyond aerodynamic drag, rejecting heat requires active coolant pumping. The system calculates an electrical parasitic load (\(P_{\text{tms elec}}\)) drawn directly from the battery, proportional to the total heat rejected:

      \[ P_{\text{tms elec}} = \text{tms power ratio} \cdot P_{\text{heat total}} \]
  • Cabin Heating & Waste Heat Recovery (calculate_cabin_heating_kw):

    • Logic: At high altitudes, the outside air temperature \(T_{\text{amb}}\) is extremely cold. The cabin must be heated to 20°C.
    • Recovery: The code first credits the waste heat dissipated by the thermal engine (\(1 - \eta_{\text{thermal}}\)) and the electric motor (\(1 - \eta_{\text{motor}}\)). If this recovered heat is insufficient, the deficit is drawn directly from the battery as electrical heating power.
  • Windmilling & Regeneration in Descent:

    • Logic: During a steep descent, gravity provides excess thrust. If the raw required thrust is negative (\(T_{\text{req raw}} < 0\)), the aircraft can enter a "windmilling" state where the propellers act as turbines to recharge the battery.
    • Efficiency Cap: An aircraft propeller is aerodynamically optimized to push air (act as a fan), not to extract energy from the airflow (act as a wind turbine). Therefore, its aerodynamic efficiency in regeneration mode is strictly capped:

      \[ \eta_{\text{windmilling}} = \min(\eta_{p\text{ dynamic}}, 0.35) \]
  • Power Split (Hybridization Strategy):

    • Logic: The total required mechanical power at the propeller shaft (\(P_{\text{shaft kW}}\)) is divided between the two energy sources based on the hybridization ratio \(\alpha_p\) (where \(0.0\) is pure thermal and \(1.0\) is pure electric).

      \[ P_{\text{elec shaft}} = P_{\text{shaft kW}} \cdot \alpha_p \]
      \[ P_{\text{therm shaft}} = P_{\text{shaft kW}} \cdot (1 - \alpha_p) \]
    • Installed Power: To find the actual power drawn from the energy reserves, these shaft powers are divided by their respective drivetrain efficiencies:

      \[ P_{\text{elec installed}} = \frac{P_{\text{elec shaft}}}{\eta_{\text{motor}}} \]
      \[ P_{\text{therm installed}} = \frac{P_{\text{therm shaft}}}{\eta_{\text{gearbox}}} \]
  • simulate_mission_fuel_only (The Baseline):

    • Logic: To calculate the CO2 savings and economic viability of the hybrid aircraft, SPARK must compare it against an identical conventional aircraft.
    • Implementation: This function instantiates the LegacyAircraft class (which has an optimized OEW without electrical components) and forces all hybridization ratios (\(\alpha_p\)) to \(0.0\). This ensures a perfectly fair "apples-to-apples" baseline comparison.