Aircraft simulation using MATLAB and Python

avion dock
12 May 202015:45

Summary

TLDRThis tutorial offers an in-depth look at longitudinal flight simulation using MATLAB and Python, focusing on the Convair 880 aircraft. It delves into estimating aerodynamic forces and coefficients, exploring the aircraft's longitudinal equations of motion, and solving them with both MATLAB and Python scripts. The study includes a steady-state condition and a disturbance scenario, showcasing the aircraft's response to a pitch rate disturbance. The tutorial provides access to the scripts and NASA's 1972 report on the Convair 880, offering a comprehensive guide for those interested in flight dynamics.

Takeaways

  • 😀 The tutorial focuses on longitudinal flight simulation using MATLAB and Python.
  • 🚀 The aircraft model used for the study is the Convair 880, a narrow-body jet airliner from the United States.
  • ✈️ The Convair 880's aerodynamic and geometric data are sourced from a NASA 1972 report, available online.
  • 📐 Understanding frames of reference is crucial for studying aircraft motion about the pitch axis.
  • 🔍 The tutorial covers the translational and rotational dynamics of the aircraft using Newton's second law and torque equations.
  • 📉 Six longitudinal equations of motion are discussed, which include forward and vertical velocity, pitch rate, pitch angle, and X and Z location.
  • 💻 MATLAB and Python scripts are provided to solve the differential equations representing the aircraft's motion.
  • 📚 MATLAB uses the ODE45 solver, while Python uses the `odeint` function from the `scipy.integrate` module.
  • 📊 The tutorial demonstrates how to plot the simulation results to visualize the aircraft's state variables over time.
  • 🔧 The aerodynamic forces and moments acting on the aircraft are defined using a linearized force model for the trim condition.
  • 🔗 Links to the program files and the NASA report are provided in the GitHub account and video description.

Q & A

  • What is the main focus of the tutorial video?

    -The tutorial focuses on longitudinal flight simulation using MATLAB and Python, specifically estimating aerodynamic forces and coefficients, and solving the longitudinal equations of motion for an aircraft.

  • Which aircraft model is used for the study in the video?

    -The Convair 880 aircraft is used for the study, a narrow-body jet airliner that originated in the United States and had its first flight in 1959.

  • Why was the Convair 880 chosen for the study?

    -The Convair 880 was chosen because the data for this aircraft was available on the internet in a NASA 1972 report.

  • What are the frames of reference discussed in the video?

    -The video discusses the inertial frame of reference and the body-attached coordinate frame of the aircraft, which are important for transforming accelerations to the inertial frame.

  • What are the longitudinal equations of motion?

    -The longitudinal equations of motion are a set of six equations that define the forward and vertical velocity, pitch rate, pitch angle, and the X and Z location of the aircraft over time.

  • How are the aerodynamic forces and moments on the aircraft defined in the video?

    -The aerodynamic forces and moments are defined using a linearized force model for the trim condition of the aircraft.

  • What software is used to solve the differential equations in the MATLAB script?

    -In the MATLAB script, the OD45 function is used to solve the differential equations representing the longitudinal equations of motion.

  • How does the Python script differ from the MATLAB approach for solving the equations of motion?

    -In the Python script, the differential equations are integrated using a function called 'odeint' from the 'scipy.integrate' module, instead of using MATLAB's OD45 function.

  • What are the two different initial conditions considered for solving the equations of motion?

    -The two initial conditions are a steady-state condition with no disturbance and a condition where a disturbance of 0.1 Radian per second is injected in pitch rate.

  • What is the significance of the results shown with an initial pitch disturbance?

    -The results with an initial pitch disturbance demonstrate the oscillatory behavior of the aircraft, which converges over time, exhibiting the long period mode or the phugoid mode.

  • Where can the program files and MATLAB scripts related to the tutorial be found?

    -The program files and MATLAB scripts can be found on the presenter's GitHub account, with links provided in the description of the video.

Outlines

00:00

🛫 Introduction to Longitudinal Flight Simulation

This paragraph introduces a tutorial focused on longitudinal flight simulation using MATLAB and Python. The tutorial aims to estimate aerodynamic forces and coefficients for a specific aircraft, the Convair 880, using longitudinal equations of motion. The aircraft, a narrow-body jet airliner from the U.S. with a top speed of 600 mph, is chosen due to available data from a 1972 NASA report. The tutorial will cover the importance of understanding frames of reference, particularly the pitch axis, and the transformation of accelerations using rotation matrices. The script and data will be accessible through the presenter's GitHub account, with links provided in the description.

05:00

🔍 Exploring Longitudinal Equations of Motion

The second paragraph delves into the translational and rotational dynamics of the aircraft, as defined by Newton's second law and torque equations. It explains how to calculate the forward and vertical velocities, pitch rate, and pitch angle using aerodynamic and propulsion forces, gravity, and rate of descent. The paragraph also discusses the process of transforming body frame velocities to an inertial frame using rotation matrices. The six longitudinal equations of motion are summarized, focusing on variables such as velocity components, pitch rate, pitch angle, and the aircraft's X and Z positions over time. The paragraph concludes with the mention of solving differential equations using initial conditions and a linearized force model for the aircraft in trim condition.

10:13

📝 Implementing Simulation Scripts in MATLAB and Python

This paragraph outlines the process of implementing the longitudinal equations of motion in MATLAB and Python. In MATLAB, the OD45 function is used to solve the differential equations, with a general syntax provided. The Python script, on the other hand, uses the ODint function for integration. The paragraph details the steps involved in setting up the simulation in Python, including importing necessary modules, defining aerodynamic coefficients and geometric data, and initializing variables for the simulation. It also describes defining the simulation time, initial conditions, and the OD integration function, culminating in plotting the results using subplots to visualize different state variables.

15:14

📈 Analyzing Simulation Results and Conclusion

The final paragraph presents the simulation results from both MATLAB and Python, comparing the steady-state condition without disturbances and the scenario with an initial pitch disturbance. The results demonstrate the aircraft's behavior, including the short period mode and the long period mode, known as the phugoid mode. The paragraph concludes the tutorial and invites viewers to find the program files on the presenter's GitHub account and to subscribe to the channel for more such content.

Mindmap

Keywords

💡Longitudinal Flight Simulation

Longitudinal flight simulation refers to the process of modeling and analyzing an aircraft's motion along its lengthwise axis, focusing on the vertical and forward movements. In the video, this concept is central as the tutorial aims to estimate aerodynamic forces and coefficients for a specific aircraft, the Convair 880, using MATLAB and Python.

💡Aerodynamic Forces and Coefficients

Aerodynamic forces are the forces exerted on an aircraft by the air, including lift, drag, and thrust, which are crucial for flight performance. Coefficients quantify these forces relative to the aircraft's size and speed. The script discusses estimating these to understand the aircraft's behavior during the simulation.

💡Equations of Motion

Equations of motion are fundamental in physics and describe the movement of an object under the influence of external forces. In the context of the video, they are used to model the aircraft's path in space, including both translational (forward and vertical velocity) and rotational dynamics (pitch rate and angle).

💡Convair 880

The Convair 880 is a specific aircraft model used in the video's study. It is a narrow-body jet airliner from the United States with its first flight in 1959. The choice of this aircraft for the simulation is due to the availability of data from a NASA report, which provides the necessary aerodynamic and geometric data for the simulation.

💡Frames of Reference

Frames of reference are used to describe the position and motion of objects. In the script, the distinction is made between an inertial frame (observer's frame) and a body frame (attached to the aircraft). Understanding these is essential for transforming accelerations from the aircraft's body frame to the inertial frame.

💡Rotation Matrices

Rotation matrices are mathematical tools used to convert the orientation of vectors from one coordinate system to another. In the video, they are used to transform the body translational and angular accelerations into the inertial frame of reference, which is necessary for the simulation.

💡Translational Dynamics

Translational dynamics deals with the motion of an object along a straight path. In the video, it is defined by Newton's second law, where the rate of change of forward and vertical velocities (U and W) are calculated as the sum of forces from aerodynamics, propulsion, gravity, and rate down.

💡Rotational Dynamics

Rotational dynamics involves the study of rotational motion, in this case, around the center of gravity of the aircraft. The script describes how torque, the product of force and distance, relates to angular acceleration through the formula torque equals inertia times angular acceleration.

💡MATLAB and Python Scripts

The video mentions the use of MATLAB and Python for solving the longitudinal equations of motion. MATLAB uses the OD45 function for solving differential equations, while Python uses the 'odeint' function from the 'scipy' library for integration, demonstrating two different approaches to the same problem.

💡Linearized Force Model

A linearized force model simplifies the complex nonlinear relationships between forces and aircraft parameters by approximating them as linear around a trim condition. This model is used in the script to define the aerodynamic forces and moments acting on the aircraft during the simulation.

💡Trim Condition

The trim condition is a state of an aircraft where the forces and moments are balanced, resulting in a steady flight without any control deflections. The script uses this condition as a reference for defining the initial flight parameters and for linearizing the aerodynamic model.

💡Disturbance

In the context of the video, a disturbance refers to an initial pitch rate disturbance of 0.1 radian per second, which is used to analyze the aircraft's response and stability. The script discusses observing the oscillatory behavior and its convergence over time, which is indicative of the aircraft's dynamic modes.

Highlights

The tutorial covers longitudinal flight simulation using MATLAB and Python.

The study focuses on estimating aerodynamic forces and coefficients for the Convair 880 aircraft.

The Convair 880 is a narrow-body jet airliner with its first flight in 1959 and a top speed of 600 miles per hour.

Data for the Convair 880 is sourced from a NASA 1972 report available online.

Understanding frames of reference is crucial for studying aircraft motion about the pitch axis.

Appropriate rotation matrices are used to transform accelerations from the body to the inertial frame of reference.

Longitudinal equations of motion are defined by Newton's second law and rotational dynamics.

Six longitudinal equations of motion describe the evolution of velocity components, pitch rate, angle, and location.

Two different initial conditions are considered: steady state and a disturbance in pitch rate.

A linearized force model for the trim condition is used to define aerodynamic forces and moments.

MATLAB uses OD45 to solve differential equations, while Python uses an OD integration function.

Required modules for the Python script include numpy and scipy.integrate.

Aerodynamic coefficients and geometric data of the aircraft are defined in the script.

Reference states for the aircraft's trim condition are set in the simulation.

The function for the linear approximated aerodynamic model is defined in the script.

Simulation time period and initial conditions are set for both MATLAB and Python scripts.

Results from the simulation show the aircraft's response to initial conditions and disturbances.

The tutorial concludes with a comparison of simulation results from both MATLAB and Python.

Links to the program files and resources are provided on the presenter's GitHub account.

Transcripts

play00:00

welcome to this tutorial on longitudinal

play00:02

flight simulation using MATLAB and

play00:04

Python so in this video we will look at

play00:08

a particular aircraft and study and try

play00:13

to estimate the aerodynamic forces and

play00:15

the coefficients then we look at the

play00:18

longitudinal equations of motion that

play00:20

described the path traced out by the

play00:23

aircraft in space and then we solve

play00:26

these equations of motion using both

play00:29

MATLAB and Python so you will have

play00:32

access to both of these scripts in my

play00:34

github account and I will be posting the

play00:38

links below the aircraft that I have

play00:41

taken for the study is the convair 880

play00:44

aircraft this is a narrow-body jet

play00:46

airliner originated in the United States

play00:49

and its first flight took place in 1959

play00:52

and it had a top speed of 600 miles per

play00:55

hour the airline never became widely

play00:59

used and the production line shut down

play01:01

after only three years I have used this

play01:05

aircraft since the data was available on

play01:07

the internet in a NASA 1972 report the

play01:11

link to this report can be found in the

play01:13

description below

play01:15

here we have three buda drawing of the

play01:18

convair aircraft and the aerodynamic and

play01:20

geometric data used in the current

play01:22

flight simulation before starting off

play01:25

our simulation it is important to

play01:27

understand frames of reference so here

play01:30

in this particular study we are studying

play01:33

the aircraft motion about the pitch axis

play01:35

that is the axis that passes through the

play01:37

wing of the aircraft so we have an

play01:40

observer that is on the inertial frame

play01:43

and another coordinate frame that's

play01:45

attached to the body of the aircraft the

play01:48

body translational accelerations and the

play01:50

angular accelerations must be

play01:52

transformed to be expressed in the

play01:55

inertial frame of reference this is done

play01:57

by use of appropriate rotation matrices

play01:59

which we will see in the later slides

play02:04

so let us now look at the longitudinal

play02:08

equations of motion so the translational

play02:10

dynamics is defined by Newton's second

play02:13

law that has force equals to the mass

play02:15

times the acceleration so we have the

play02:18

rate of change of forward velocity that

play02:20

is U and rate of change of vertical

play02:23

velocity that is W so we estimate these

play02:26

accelerations as the sum of the force

play02:29

terms which is made out of aerodynamics

play02:31

and the propulsion system influence then

play02:34

we have the gravity term and then

play02:36

finally the rate down so these are the

play02:38

first two equations that define the

play02:40

forward and the vertical velocity of the

play02:43

flight next we look at rotational

play02:46

dynamics that is the talk that acts

play02:48

about the center of gravity of the

play02:49

aircraft so torque is the inertia times

play02:53

the angular acceleration so how we

play02:56

arrive at this formula is that we know

play02:58

the torque acting about a point is the

play03:00

product of the force and the distance

play03:02

from the point to the application of the

play03:05

force so on simplifying that we get the

play03:09

angular acceleration

play03:11

times the radius is the translational

play03:13

oxidation and that's how we arrived at

play03:15

torque equals inertia times the angular

play03:18

acceleration so this gives us the next

play03:22

two equations that is the rate of change

play03:24

of pitch rate and the change in pitch

play03:27

angle that is M by I YY and the equation

play03:31

number four finally we need to estimate

play03:33

what is the acceleration in the inertial

play03:36

frame and there we use the U and W

play03:40

component of velocity in the body frame

play03:42

and multiply it by appropriate rotation

play03:46

matrix to obtain the positions in the

play03:51

observer frame so to sum it up here we

play03:54

have the six longitudinal equations of

play03:56

motion so the variables of interest that

play03:59

we would like to study is the evolution

play04:01

of the U and W velocity components pitch

play04:05

rate pitch angle X and Z location over a

play04:10

period of time so to solve this

play04:12

differential equation we have we look at

play04:15

two different initial conditions so one

play04:18

is a steady state condition where there

play04:19

is no kind of disturbance that's acting

play04:22

on the aircraft and the second initial

play04:24

condition where we inject a disturbance

play04:27

in pitch rate of 0.1 Radian per second

play04:31

to define the aerodynamic forces and

play04:34

moments are act on aircraft we use a

play04:36

linearized force model for the trim

play04:38

condition and we will be implementing

play04:41

these equations in python and matlab and

play04:45

let us look at

play04:46

how this is done so to solve these

play04:51

differential equations MATLAB uses OD 45

play04:55

to solve this so here is a general

play04:57

syntax so we have the output state

play05:00

variables that is defined as the output

play05:03

of a function where it is the arguments

play05:07

that is taken in is the differential

play05:09

equations the time period for which the

play05:11

simulation is run and also the initial

play05:13

conditions the difference in the Python

play05:16

script is that instead of using OD 45 we

play05:19

integrate these equations by using a

play05:22

function called OD int and then we're on

play05:25

we use the arguments such as the

play05:27

differential equation the initial

play05:29

conditions and the time period in a new

play05:33

Python script we will first call all of

play05:35

the required modules for our operations

play05:39

especially the numpy module and the

play05:43

Skippy dot integrate because we will be

play05:45

performing some integration on the

play05:48

differential equations and then on we

play05:51

define our variables that are relating

play05:54

to the aerodynamic coefficients as well

play05:56

as the geometric data of the aircraft

play06:10

you

play07:06

after defining the geometry date of the

play07:09

aircraft Phoenix move on to define the

play07:11

reference states that we are going to

play07:15

use which is the trim condition of the

play07:17

aircraft namely u 0 Q 0 V 0 theta 0 x 0

play07:24

and z 0 next we will start defining our

play07:27

function wherein we write down our

play07:31

linear approximated aerodynamic model

play07:35

before that let us rename all of the

play07:37

states that would be fed in

play07:55

here we have defined our force equations

play07:58

which are linearized about the Trib

play08:01

condition next we define the equations

play08:03

of motion so which is written as the

play08:07

derivative of the velocity the pitch

play08:11

rate pitch angle the x and z position

play08:16

finally we will save all of these

play08:18

outputs into an array

play08:21

and and by returning the results of the

play08:24

function

play08:38

next we define the time period of the

play08:41

simulation which is range from 0 to 400

play08:45

and we want to populate this time period

play08:48

with 10000 points next we define the

play08:53

initialization conditions that is the

play08:55

initial value of the variables at the

play08:58

start of the simulation

play09:03

next in order to store all of these

play09:05

state variables that are outputted from

play09:07

the function file we define an empty

play09:11

array and also assign the state

play09:14

variables to the actual state names

play09:22

next we define the OD integration

play09:26

function and then rename the outputs

play09:30

since the output of the OD integrated

play09:34

function is a matrix with the number of

play09:37

columns equal to the number of state

play09:39

variables next finally we start to plot

play09:43

our results by using a subplot where we

play09:46

can have visualization of all the

play09:50

different state variables within the

play09:51

same graph

play10:13

next we define a similar program in the

play10:16

MATLAB workspace first we clear all of

play10:19

the variables then define the aircraft

play10:22

geometric and operational parameters

play10:37

next we define the initial flight

play10:39

conditions for the holy 45 function

play11:07

next we define the simulation time that

play11:11

is we are going to see the simulation

play11:13

for 400 seconds

play11:25

next we're going to define the OD 45

play11:28

function within which we shall define

play11:31

the other remaining aircraft variables

play11:37

so here the arguments for the function

play11:40

are the time period and also the initial

play11:43

conditions

play11:47

so in the same script we will be also

play11:49

defining the function that contains the

play11:51

longitudinal equations of motion we call

play11:55

that 2d equations of motion that is 2d

play11:57

EOM

play12:09

then we define all of the variables

play12:10

within this function

play12:29

to define the inputs for the linear

play12:31

aerodynamic model

play12:33

we'll also define the reference flight

play12:36

conditions

play13:09

[Music]

play13:25

[Music]

play13:42

as the last step of our program we will

play13:44

next block the state variables of

play13:47

interest by creating our paper with

play13:50

subplots within the same plot

play14:09

all right so here we have the results

play14:13

from the simulation with the initial

play14:16

term condition so since there is no kind

play14:19

of disturbance at the beginning

play14:23

the reference values are at the trim

play14:25

stage so we get basically flight that's

play14:29

moving at constant velocity

play14:33

and at the constant altitude we see the

play14:37

same with the output from the MATLAB

play14:41

script is essentially the same because

play14:44

we have the same trim settings

play14:48

next year we can see the variation in

play14:53

the state variables when there is an

play14:55

initial pitch disturbance of 0.1 Radian

play14:58

per second and you see that there is

play15:00

this oscillatory behavior that converges

play15:03

over time and so essentially this is the

play15:06

exhibition of the long period mode or

play15:10

the Foo guide mode so

play15:13

and this is the output in the MATLAB

play15:16

simulation so the initial transient that

play15:20

you see here is the short period mode

play15:22

and then the much longer period mode

play15:25

that dams out or over 400 seconds is the

play15:29

provider so that is the end of this

play15:33

tutorial you can find the links to the

play15:36

Program Files on my github account and

play15:39

if you like such videos please subscribe

play15:43

to my channel

Rate This

5.0 / 5 (0 votes)

相关标签
Flight SimulationMATLABPythonAerodynamicsConvair 880NASA ReportLongitudinal DynamicsEquations of MotionAircraft ModelingSimulation Tutorial
您是否需要英文摘要?