Skip to main content
GameDev.net gamedev.net
🔒 Locked

flight sim physics

Started by testyturtle Jul 25, 2007 at 9:04 PM 14 replies 14.5k views
Original Post
testyturtle
testyturtle
Does anyone have any good reference material for simple flight dynamics? Of course at the very basic level you have thrust and drag opposing on the longitudinal axis of the aircraft, and lift/mass opposing on the vertical axis (although the lift vector rotates with the airplane). I am having some problems with my sim. First of all, assuming you use the following equation for lift: lift = 0.5 * CoL * rho * speed^2 * wingarea; CoL = coefficient of lift rho = air density it is difficult to balance the lift with the gravitational force acting on the plane. Would you vary CoL with speed to keep these closely balanced? At higher speeds, choose a CoL so the wing produces slightly more lift than the gravitation force, and vice versa at low speeds? I know in the real world CoL varies with angle of attack for a particular airfoil, but i'm trying to keep it simple where possible. And how about this situation: Let's say a plane pulls hard on the elevator and goes into a vertical climb. In a real airplane (fighter jet for example) they will climb straight up when you do this. But in the simulation, the plane will start to move very fast horizontally (in the direction the top of the wing is facing) due to the lift vector, in addition to the climb. Or how about when a plane is inverted? Same problem. Now the gravitation and lift double up and the plane hurtles toward the ground. This isn't what happens in the real world. I would appreciate any help. Thanks everyone.
y2kiah
y2kiah
CL is based on the design of the wing and does not vary with speed (not directly, at least). CL actually varies with angle of attack (alpha), and in fact you can probably find the CL - alpha curve, either in equation form or as a table, for most NACA airfoils.

So, when you simplify the lift equation by disregarding the values that are essentially constant, you get L = CL * v^2, or L=AoA*v^2. This, of course, is not what you would use to actually compute the lift force, but can be used to explain the characteristics of a typical airplane.

Now here is a statement that, when considered, will actually solve many of the "problems" that you have mentioned, including flying straight up and down, or upside down, etc. A dynamically stable airplane will continuously develop forces in an attempt to restore the airplane to a state of equilibrium. Equilibrium is when the airplane has no unbalanced forces (e.g. no acceleration). This does not mean an airplane has to be straight and level, on the contrary and airplane may be at equilibrium in a climb or descent, as long as the speed or direction are not changing with respect to time, the airplane is not accelerating.

Also, remember this rule. Lift always acts perpendicular to the relative wind. Relative wind is the opposite of the direction of flight through the airmass. So, lift is a right angle to the direction of flight, not perpendicular to the wing's surface. In a fast climb straight up (in equilibrium assuming the airplane has at least a 1:1 thrust to weight ratio) the wings actually fly at ZERO angle of attack (this is also known as BALISTIC) meaning they don't produce any lift in that horizontal direction.

So, in equilibrium, the airplane will only develop enough lift to support the weight of the airplane. (** this is actually untrue, the total upward forces combine to counter the total downward forces. In a fast climb, a large component of thrust actually acts in the vertical direction helping lift, so the wings don't need to "work as hard" to keep the airplane aloft. Drag also acts opposite the direction of flight, so a component of drag would act in the downward direction as well). This is why an airplane with a 1:1 thrust to weight ratio can stand on its tail in the air, hovering using only thrust. The only forces are weight and thrust in this case, since the airplane has zero velocity (no lift and no drag).

So, since the weight is also constant, then an airplane in equilibrium will fly with a constant lift force. It's the WAY that the lift is created that matters. Holding L constant, if we increase speed, lift would vary by v^2, so the force due to AoA (aka CL) MUST decrease. And this is true in real life, at a higher airspeed, the wing will fly at a lower angle of attack, which equates to a lower CL, and contributes less to total lift. If the velocity is decreased, the airplane needs to fly at a higher angle of attack (for a greater CL) to make up for the loss of lift due to airspeed.

To break it down, low airspeed, high AOA, high CL. High airspeed, low AOA, low CL.

To actually compute this relationship, don't use something like if (speed == ??) then AoA = blah. Instead you want to continuously solve for AoA by actually subtracting the airplane's physical direction, and its actual velocity. The dot product of those two vectors can be used to find this angle. By allowing the integration of forces to constantly solve for the velocity of your airplane, and incorporating some elements of stability and control (to handle trim and other flight characteristics) you will find that the Aoa to velocity relationship will take care of itself, and the airplane will naturally want to fly the way it does is real life.

Keep in mind things don't happen instantaneously, so any sudden acceleration (adding power or pitching up are accelerations) would take the airplane out of its state of equilibrium and begin developing unbalanced forces in an effort to get back to equilibrium. It is possible that during this acceleration, some excess lift could contribute to the climbing of an airplane... but as a general rule an airplane does not climb because of lift, it climbs due to EXCESS thrust (or power). Think of it this way, energy cannot be created or destroyed, only converted. How does an airplane, sitting on the runway, with zero potential and zero kinetic energy get up to 10,000 ft. and 200 KIAS with lots of potential and kinetic energy? Lift is only produced as a result of the airplane having velocity. All of the energy comes from fuel being converted into an explosion blah blah blah eventually into thrust.

Oh, the flying upside down thing. Wings are perfectly capable of producing lift in the opposite direction than they are designed to. A wing with a high camber will be terrible at flying these "negative angles of attack." Most fighters that have to fly upside down have a symmetric airfoils, with no camber. They produce lift just as efficiently upside down as right side up. A wing with camber will produce some lift in the upward direction at zero AoA, whereas a symmetric airfoil needs an angle of attack to produce lift. Just remember, in equilibrium lift opposes weight, and gravity always acts straight down toward the center of the earth.

This is getting long and it's really all hard to explain and visualize without diagrams or graphs or pictures. Hopefully this has explained a couple of things and wasn't too poorly written. Let me know if I can help any more.
testyturtle
testyturtle
Hi y2kiah,

Thanks very much for the reply. Tons of great information in there! One particularly useful tip is the one about constantly calculating AoA, and then doing a table lookup or similar to get CoL (and CoD too I guess). I'll implement that later tonight. Oh and also the part about lift acting perpendicular to the relative airflow instead of perpendicular to the wing. Didn't know that (and i'm training for my pilot's license right now so THX!)

One thing that still confuses me is Lift = 0 in a vertical climb. At zero angle of attack, the wing still produces lift doesn't it? (I believe at AoA = 0 it is common for CoL to be in the neighborhood of 0.5 - 0.6) Anyway, I am sure you are right -- just trying to understand better.

Basically what I am trying to figure out is how to incorporate the lift vector into my force equations when the airplane is at some pitch != 0. Do you reduce it gradually as the plane pitches up? What about if the plane banks 90 degrees, does the lift similarly go to zero?

Thanks for taking the time to help y2kiah! You're really saving my sanity. :)



chipmeisterc
chipmeisterc
Quote:

One thing that still confuses me is Lift = 0 in a vertical climb


In a vertical climb you wings generate 0 lift, the reason you go up is due to thrust and internia, hence you will stall very quickly unless you have a pair of afterburners behind you :P

chipmeisterc
chipmeisterc
How are you calculating your lift equations.
If you are using vectors then you can simply use Dot Product to calculate how much lift to apply based on your angle of attack etc.



rk_simul
rk_simul
Quote:
Original post by testyturtle
One thing that still confuses me is Lift = 0 in a vertical climb. At zero angle of attack, the wing still produces lift doesn't it? (I believe at AoA = 0 it is common for CoL to be in the neighborhood of 0.5 - 0.6)


Lift is always the same function of AoA and elevator deflection. In a vertical climb you'd just trim the elevators and AoA to give zero lift, even if this means a slight negative AoA.
tetractys
tetractys
Quote:
Original post by testyturtle
Does anyone have any good reference material for simple flight dynamics?

I have written a basic flight simulator in Lua. The demo is available here (the source is in the file with "lua" extension)
http://apocalyx.sourceforge.net/demos.php#zekeonyoursix

I used informations found in a page that is no longer available but I have cached it somewhere.

To see the demo you need the runtime of the engine (APOCALYX 3D Engine) available here:
http://apocalyx.sourceforge.net/downloads.php#engine
testyturtle
testyturtle

Thanks for the information guys! tetractys nice .lua sim. Very cool. :)

I'll post back with results later.
freakchild
freakchild
Quote:
Original post by chipmeisterc
Quote:

One thing that still confuses me is Lift = 0 in a vertical climb


In a vertical climb you wings generate 0 lift, the reason you go up is due to thrust and internia, hence you will stall very quickly unless you have a pair of afterburners behind you :P


The airfoils don't care which way they are facing in order to produce lift. As long as air particles are going over them (within the angle of attack, that if exceeded induces the wing to stall) then the wings are producing lift. In the case of a vertical climb, the issue is that the lift is not pointing upwards.

The described behavior of the simulator having the aircraft move horizontally while in a climb is because lift isn't zero, I think folk understand that already. It may seem to move horizontal at an abnormal rate but the angle of the lifting force is now perpendicular to the gravity so the two are not opposing each other (well, the vertical component of lift is still opposing gravity, if there is any).

A pilot would pitch forward to cancel out the lift. It probably wouldn't take much elevator movement to do it hence why an aircraft in a vertical climb really does look like it is pointing up.
grhodes_at_work
grhodes_at_work
Quote:
Original post by chipmeisterc
Quote:

One thing that still confuses me is Lift = 0 in a vertical climb


In a vertical climb you wings generate 0 lift, the reason you go up is due to thrust and internia, hence you will stall very quickly unless you have a pair of afterburners behind you :P


Interestingly, if you are still moving into the wind while moving vertically upwards, the wings generate a drag force, now acting in the same direction as gravity (opposite the relative free stream), so the wings actually cause the force pulling you down to to be greater than the weight of the aircraft. (By moving "into the wind" I mean that air is passing across the surface of the airplane...the wind isn't perfectly still with respect to the airplane.)

Another thing...in reality it is quite difficult to fly perfectly vertically. The wings of most aircraft aren't symmetric (top-to-bottom through the airfoil), and neither is the freestream airflow. So, really, there will most likely be a lift force when flying vertically. But, lift is always perpendicular to the relative free stream, so when flying vertically the lift is acting horizontally! The lift can be trimmed out to be approximately zero, but it would be near impossible to maintain that for long in real life. And if you have a forward-mounted, prop-driven propulsion system, the wake from the propulsion system would mean the two wings see different angles-of-attack, and so you'd have to trim the two wings separately to balance a nonzero rolling moment as well. (Er, freakchild and rk_simul talked about this. Good info!)
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
y2kiah
y2kiah
all true... if you are in a fast, vertical climb the lift will be acting horizontally (to the earth). This is not the case if the aircraft is in a state of equilibrium, however.

In reality equilibrium never really happens for extended periods of time though. If the airplane is trimmed for 100 KIAS, straight and level flight, and the pilot pitches up to vertical, assuming the airplane can maintain 100 KIAS in this climb, there would be a constant pitch-up moment (even though while the airplane was straight and level there was no pitch-up moment). This is because gravity no longer acts along the vertical axis of the airplane, but instead acts along the longitudinal axis. So, the distance between the center of lift and the center of gravity become negligible from a longitudinal stability standpoint, and the aircraft is basically "over trimmed". You trim for longitudinal stability assuming there is gravity acting downward. (** large jets also have rudder and sometimes aileron trim, so it is possible to trim for lateral and vertical stability as well).

If the pilot does not cancel out this pitch-up tendency by adding forward pressure (or re-trimming) then the airplane will continue to pitch THROUGH vertical. It is this constant interaction of the airplane's velocity vector and its stability characteristics that prevent a huge "horizontal lift" component from actually developing in a true, constant, vertical climb.

By adding forward pressure, or trimming away the pitching moment, the pilot is effectively making it possible to climb vertically in an airplane that is designed to be stable when it is horizontal to the earth. You are trimming the airplane for zero-G. You are trimming away ALL lift created by the wings, so for a symmetric airfoil you would be at zero AoA, for an airfoil with camber you would be at a negative AoA. In aerobatics this is known as going balistic, or "unloading" the airplane.

Vertical flight is a perfect case of zero-G flight (from the airplane's perspective), but zero-G, unloaded flight can be maintained at any attitude as long as the pilot pushes forward enough for zero G. The nice thing about zero-G, unloaded flight is, if there is no lift, there is no induced drag either. This means the airplane is at a state where it can accelerate the fastest, only parasite drag holds the airplane back.

So, in true vertical, zero-G flight, an aircraft does not produce (much) induced drag in a direction parallel to gravity, just parasite drag, which means you don't need much more than 1:1 thrust to weight ratio to actually maintain true airspeed in a perfectly vertical climb. As with every attitude, the faster you go, the more thrust you need.

Interestingly, a balistic missile maintains zero G flight, and it turns out to be a perfect parabolic path over the globe. The more thrust the missile has, the farther it will go. It's like that old DOS game gorilla, except with that you just set an initial velocity and there was no thrust.

Also be aware of the difference between "zero G" from the pilot's perspective and from the airplane's perspective. Even though the airplane is zero-G, the pilot would still feel 1G acting straight through his/her chest. The only reason a person feels G's are because of contact forces with other objects. The initial stages of a freefall feel like zero-G because contact forces are taken away and you feel like floating.

You pretty much want to ignore the "pilot's perspective" of G force when modeling an airplane, unless you also want to model blackout and redout.
Prinz Eugn
Prinz Eugn
Um, NASA has a guide to aerodynamics here that we are using for a project.
-Mark the Artist

Digital Art and Technical Design
Developer Journal
y2kiah
y2kiah
To answer your last question, dealing with the lift vector is really an exercise in manipulating 3d vectors. Rotating, adding, subtracting, etc... The good thing about quaternions over combining euler angles and 3d vectors is that a quat holds the concept of "roll" along with direction. But, you can overcome this with the simple trick of using two vectors, a "look at" vector and an "up" vector.

Back to the point, as you bank the airplane toward 90 degrees, the lift force stay exactly the same in the airplanes "object space." But in earth space, you can now consider lift to have both a vertical and horizontal component. This horizontal component of lift, along with the keel effect of the rudder, allow the airplane to turn (rather than just "slide" sideways).

I honestly think that trying to design a 2d flight model is more difficult than just going all 3d. A 3d model is so much more intuitive if you are trying to incorporate elements of stability and control.
testyturtle
testyturtle
Thx for all the great replies everyone.

y2kiah,

I am doing all of this in 3D. My representation breaks forcing acting on the plane into linear and rotational components. I assume the plane is a single point mass, with all linear forces summed to induce a translation in the Cg position, and all rotational forces summed to induce a torque about some axis passing through the Cg.

sum of linear forces considers all of these acting through Cg:

lift
drag
thrust
gravity

the calculations go:

sumLinearForces() except gravity;
rotate summedForce into world space;
add gravity to linear forces;

linearAcceleration = summedForce/mass;
linearVelocity += linearAcceleration*timeStep; // linear velocity in world space
update position using linearVelocity;

sum of rotational forces considers all of these inducing rotation around Cg:

elevator
rudder
ailerons

the calculations go:

sumRotationalTorques();
rotate summedTorque into world space;
angularMomentum += summedTorque*timeStep;
angularVelocity calculated from angularMomentum and inertia tensor;
update rotation matrix using angularVelocity;


Something isn't quite correct. From what you said in your most recent post, the lift must be applied slightly forward of the Cg to facilitate a turn while banked. Does this mean it must be considered as a rotational and a translational force?

In the current program, if I give it some rudder, the airplane model rotates, but the linear velocity can't change (because the rudder doesn't affect the translational forces mentioned above). So the airplane continues flying whichever way it was facing originally.

I was trying to find a way to incorporate a centripetal force whenever the plane has some angular velocity, causing it to get 'pulled' through a turn, but I'm guessing this should happen automatically if the other forces are applied correctly. Another way would just be to manually rotate the linear velocity vector (in object-space) by the current orientation, but that doesn't seem right either.

Any idea how to model these things correctly?

thanks everyone!

[Edited by - testyturtle on July 26, 2007 8:16:53 PM]
testyturtle
testyturtle
I am pretty sure I found the paper tetractys used for his lua sim so i'm going to try and implement that. I don't think it's very easy to develop the simulation intuitively as I have been trying to do. Thx for everyone's help!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.