FLIGHT.m is a tutorial program, heavily commented to make interpretation easy. It provides a full six-degree-of-freedom simulation of an aircraft, as well as trimming calculations and the generation of a linearized model at any flight condition chosen by the user [1]. Changes to aircraft control histories, initial conditions, flag settings, and other program control actions are made by changing the numbers contained in the code; there is no separate user interface. The code has been designed for simplicity and clarity not for speed of execution, leaving a challenge to the reader to find ways to make the program run faster. Numerous additions could be made to the code, including implementation of feedback control logic, simulation of random turbulence or microburst wind shear, and interfaces for real-time execution. No explicit or implicit warranties are made regarding the accuracy or correctness of the computer code.
FLIGHT.m is the script that calls program functions. Initial conditions are defined here, the three primary features (trim, linearization, and simulation) are enabled, and output is generated. Initial perturbations to trim state and control allow transient effects to be simulated. As shown, trimming for steady, level flight is accomplished by first defining a cost function, J, that contains elements of the state rate, then minimizing the cost using the Downhill Simplex (Nelder-Mead) algorithm contained in fminsearch. The longitudinal trimming parameters are stabilator angle, throttle setting, and pitch angle. The linear model is generated by numjac, a numerical evaluation of the Jacobian matrices associated with the equations of motion. The linear model is saved to disk files in the variables Fmodel and Gmodel. MATLAB's ode23, ode45, or ode15s integrate the equations of motion to produce the state history. The state history is displayed in time plots, with angles converted from the radians used in calculation to degrees. The reader can readily change the units of plotted quantities or add additional plots through minor modifications to the code. Any result (e.g., numerical values of the state history) can be displayed in the MATLAB Command Window simply by removing the semi-colon at the end of the line. The flag MODEL selects either a low-angle-of-attack, Mach-dependent model for BizJet A [2] or a high-angle-of-attack, low-subsonic model for Bizjet B.
FLIGHT.m is the script that calls program functions. Initial conditions are defined here, the three primary features (trim, linearization, and simulation) are enabled, and output is generated. Initial perturbations to trim state and control allow transient effects to be simulated. As shown, trimming for steady, level flight is accomplished by first defining a cost function, J, that contains elements of the state rate, then minimizing the cost using the Downhill Simplex (Nelder-Mead) algorithm contained in fminsearch. The longitudinal trimming parameters are stabilator angle, throttle setting, and pitch angle. The linear model is generated by numjac, a numerical evaluation of the Jacobian matrices associated with the equations of motion. The linear model is saved to disk files in the variables Fmodel and Gmodel. MATLAB's ode23, ode45, or ode15s integrate the equations of motion to produce the state history. The state history is displayed in time plots, with angles converted from the radians used in calculation to degrees. The reader can readily change the units of plotted quantities or add additional plots through minor modifications to the code. Any result (e.g., numerical values of the state history) can be displayed in the MATLAB Command Window simply by removing the semi-colon at the end of the line. The flag MODEL selects either a low-angle-of-attack, Mach-dependent model for BizJet A [2] or a high-angle-of-attack, low-subsonic model for Bizjet B.
MODELING EXAMPLE OF A SIMPLE 3-D AIRCRAFT. Nonlinear six degree-of-freedom simulations for a variety of aircraft were created.
![System System](https://d3i71xaburhd42.cloudfront.net/36330d9db7e9cc644e4022d5278ebb92512bda62/5-Figure2-1.png)
AeroModelMach.m uses aerodynamic and dimensional data contained in [2] with estimates of inertial properties of the generic business jet. Details of the configuration, such as sweep and aspect ratio of the wing and tail, are used in the estimates of Mach effects. Estimates of Mach effects are based on the Prandtl factor or the modified Helmbold equation. AeroModelAlpha.m for BizJet B is derived using handbook methods for estimating geometric, inertial, and aerodynamic characteristics. The model is first built using GeoMassAero.m, which saves three .mat files describing the airplane: InerGeo.mat, DataTable.mat, and RotCont.mat. AeroModelAlpha.m loads the .mat files for use in FLIGHT.m. The angle-of attack range extends from -10 to 90 deg based on conventional low-alpha and Newtonian high-alpha estimates. No Mach, landing gear, spoiler, or flap effects are considered.
The equations of motion for EoM.m are written using the flat-earth assumption [1]. An ad hoc limit on the cosine of the pitch angle is imposed to prevent singular calculations in near-vertical flight. This expediency introduces a small error when the pitch angle is near +/-90 deg. The function event.m specifies a stopping condition that terminates the simulation before the final time if the altitude goes below zero.
Trim control settings are calculated by minimizing a quadratic function of longitudinal accelerations (i.e., rates of change of axial velocity, normal velocity, and pitch rate) contained in TrimCost.m [1]. TrimCost.m calls EoM.m to generate the needed accelerations. The direction-cosine (or rotation) matrix is implemented in the function DCM.m [1]. The matrix transforms vectors from the earth-relative frame of reference to the body-axis frame. LinModel.m produces state and control Jacobian matrices for a linear, time-invariant model at the trim setting. the Jacobian matrix evaluated at the nominal values of state and control. WindField.m produces a three-component wind vector as a function of altitude, with linear interpolation between tabulated points [1]. 1976 U.S. Standard Atmosphere air density, air pressure, air temperature, and sound speed are generated as functions of altitude by Atmos.m.
[1] Stengel, Flight Dynamics, Princeton University Press, Princeton, 2004.
[2] Soderman, P. T., and Aiken, T. N., 'Full-Scale Wind-Tunnel Tests of a Small Unpowered Jet Aircraft with a T-Tail,' NASA TN D-6573, Washington, DC, Nov. 1971.
[2] Soderman, P. T., and Aiken, T. N., 'Full-Scale Wind-Tunnel Tests of a Small Unpowered Jet Aircraft with a T-Tail,' NASA TN D-6573, Washington, DC, Nov. 1971.
This project shows how to model NASA's HL-20 lifting body with Simulink®, Stateflow® and Aerospace Blockset™ software. The vehicle model includes the aerodynamics, control logic, fault management systems (FDIR), and engine controls (FADEC). It also includes effects of the environment, such as wind profiles for the landing phase. The entire model simulates approach and landing flight phases using an auto-landing controller. To analyze the effects of actuator failures and wind gust variation on the stability of the vehicle, use the 'Run Failure Analysis in Parallel' project shortcut. If Parallel Computing Toolbox™ is installed, the analysis is run in parallel. If Parallel Computing Toolbox™ is not installed, the analysis is run in serial. Visualization for this model is done via an interface to FlightGear, an open source flight simulator package. If the FlightGear interface is unavailable, you can simulate the model by closing the loop using the alternative data sources provided in the Variant block. In this block, you can choose a previously saved data file, a Signal Editor block, or a set of constant values. This example requires Control System Toolbox™.