Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


flight model programming

This topic is 5821 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everyone. This question is directed to those of you with flight model programming experience for flight simulation (so most likely an experienced veteran). I''m not looking for opinions on the matter so much, but everyone is of course welcome to share them, and maybe they''ll help me too. I have in mind 2 ways that I could program a flight model. I could use standard aerodynamic and physics equations to solve for values such as lift, drag, differential pressure, AOA, etc. and use minimal input values for specific aircraft, such as Cl, %chord and weight. OR I could use large data tables of this information and create a flight model almost solely through interpolation of the values. This would somewhat limit the scope of the model though, as would the other method. My question is, how do the pros do it? What are the standard methods in commercial simulation? Feel free to get as technical as you''d like. I''d like to know before I start coding how authentic the sim should be, or inversely, how much I can cheat...and have it still "feel" authentic. Thanks a lot to anyone who can help, I know this question sucks. Later! If you want to talk through email mine is y2kiah@hotmail.com

Share this post

Link to post
Share on other sites
Sorry if this is very long-winded. But I have a lot to say, .

I will say first that you should look in the archives here. The subject of flight model programming has been covered quite a lot in this forum, and some forum members actually have flight simulators, including code, that you can perhaps download and use. The forum archives are a GREAT resource.

Both of your approaches are valid, and both have their benefits and problems.

SIMPLE basic equations for calculating lift, drag, etc., have the flexibility that you aren''t limited to a few aircraft models----you can produce a rough model of the aerodynamics for darned near anything you want from subsonic private aircraft and transports up to fast supersonic thingies. They also have the advantage that you can calculate aerodynamic loads as continuous functions of AoA, velocity, etc. The disadvantage is that it is difficult to calculate realistic values for the loading in the case of a stall or loop or strange maneuver. You''re basically limited to very basic flying, with AoA in the range of perhaps -5 to 5 or 10 degrees. You just won''t get very realistic behavior if you are flying far from straight-and-level flight. But for true flight simulators like Microsoft Flight simulator, this approach might be fantastic.

Table lookups can give you much more accurate flight dynamics for a given aircraft, without having to go to an advanced CFD-type simulation. But the tables are difficult to create and aren''t readily available in the public domain. You''d likely only have a very few aircraft in your table. Tables are also subject to interpolation error, which, if you have just a very few points in your table, can be significant to the point of causing obviously glitches in the simulation. This method is used by quite a number, perhaps most, of the flying games out there, including fighter jet simulators. (I have a co-worker and friends who previously worked for a game company that produced flight simulators, and I''ve discussed this with them.)

I can comment on what pros do, since my background is aerospace engineering with an emphasis on airplane design. The pros do it both ways, actually. Your so-called "standard aerodynamic and physics equations to solve for values such as lift, drag,...." vary from extremely primitive equations that are just simple algebraic equations all the way up to super-advanced computational fluid dynamics (CFD). The MOST advanced techniques would calculate lift, drag, etc. using things like, for example, a detailed simulation of airflow over the entire aircraft using the Thin Layer or Parabolized Navier-Stokes (TLNS, PNS) equations and a finite volume "Essentially Non-Oscillatory" integrator [ENO, which generalizes integrators such as "Flux-Corrected-Transport" (FCT) and "Total Variation Diminishing" (TVD) ]. The integrator is based on the idea of "upwind" differencing which is required to capture shock waves and other flow discontinuities (such as contact surfaces).

Now that I''ve suitably impressed you, , and perhaps scared you off a bit, back to something more useful to you.

An example of a "simple" equation for lift is:

Lift = 0.5*air_density*relative_airspeed_squared*wing_area*CL,

where CL is lift coefficient:

CL = approximately 2*PI*AoA

with AoA in radians and PI of course being 3.14. There are variations on this that account for wing sweep, airfoil curvature, aspect ratio effects, downwash from an upstream lifting surface, upwash from a downstream lifting surface, etc. But these formulas remain EXTREMELY simple to calculate.

Typically, the way pros work is this:

a) at the conceptual design stage, before much is really known beyond approximate fuselage length, wing length, wing area and sweep, and tail location, use simple equations such as the one above to calculate the basic aerodynamic coefficients. Plug these simple analytic calculations into the equations used to analyze performance (range, turn radius, ceiling, etc.) and maybe use them also to do some very basic flight simulation. No off-design flight would be simulated. Basically, they''d be looking at takeoff distance, landing distance, turning radius, cruise range, maximum range, climb rate, things like that. No stalls or rolls or other interesting aerobatic maneuvers.

b) as the design progresses, and more details are known about the geometry of the aircraft, they might do some *basic* CFD calculations. These initial numerical calculations really just make the simple calcs above a bit more accurate. Still not complete enough to do simulation of complex flight.

c) as the design *further* progresses, and the aircraft shape comes to be a complete prototype for the external aerodynamic shape, and as they start to have an idea of the weight distribution, the designers might start to one of two things: 1) more advanced CFD that starts to calculate off-design aerodynamic loads that are suitable for interesting maneuvers; or 2) actually build a small model and put it in a wind tunnel. The wind tunnel experiments would measure the aerodynamic loads at different AoA, relative airspeed, etc. The wind tunnel measurements also are very suitable for simulating interesting (off design) maneuvers.

It is these complex CFD calcs or (more often at this stage) wind tunnel calcs that PRODUCE the lookup table that you are considering to use. Since the calcs and experiments are expensive and done on proprietary models, no wonder aircraft manufacturers and designers don''t want to give away the data!

The results of the initial tests produces a table of so-called "stability derivatives" that can be used for simulation. The stability derivatives are the things that your table might contain as well for your game.

d) Once the table of stability derivatives has enough information, the designers will start to actually do simulations, much as you want to do but they do not usually look at the same types of interesting maneuvers as a game would. They definitely would look at off-design situations (stall, spin divergence), but not totally aerobatic stuff that you might be interested in.

e) Eventually, the simulations might be move onto a full 6-degree-of-freedom moving hydraulic platform so that actual pilots can practice flying the still-being-designed airplane. This is done since it is cheaper and safer and faster than building a fully operational prototype aircraft. (They often do that eventually, but not until very late in the design.)

f) Longer down the road, the CFD calcs will start to look at specific, localized problems, such as the airflow around the joint between the wing and fuselage. These calcs would be VERY detailed, and wouldn''t produce stability derivatives useful for flight simulation. They''re just looking to solve very specific detailed flow problems now.

g) Once lots of the specific flow problems are resolved, they''d rerun the calcs to update the stability derivative table. And then rerun simulations.

h) Depending on the scope of the project, a radio controlled "drop model" might be produced. This is a glorified radio controlled airplane. The differences are that the model is balanced to match (in a scaled down way) the inertia tensor of the airplane being designed----so that the radio controlled model will behave dynamically just like the airplane they want to build. These are called drop models since they are often dropped from helicopters rather than taking off from a runway.

i) It goes on, but this should give you a feel for the steps pros go through.

One source for stability derivatives that does not require you access proprietary information is to look at NASA technical reports. NASA has done a great many wind tunnel, CFD, and flight tests, and they usually publish this information. The reports usually have XY plots of, say, CL or CM vs. alpha (lift and pitching moment vs. AoA), CN vs. beta (yawing moment vs. sideslip angle), etc. You might have to digitize the plots to build your table. But it is a source. You can do a search and download some papers here:


Look specifically in the Langley, Dryden, Ames, and NACA report areas. Keywords might be things like "flight dynamics", "flight stability," etc.

Hope that helps!

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!