Sunday, December 30, 2007

The target flight model

Being an aerospace engineer, I will be interested in reproducing some very faithful flight models for the aircraft in this simulation. One of the things I hate about some simulators I have seen is how artificial their flying has been. A good way to see this is on takeoffs or landings, where, more often than not, a plane will basically switch game states from "plane.state(runningDownTheRunway)" to "plane.state(liftOff)" to "plane.state(climb)". This works fine, but the visual result is the plane snapping from being straight and level, accelerating down the runway, to 10 or so degrees of nose-up, to suddenly climbing out. There's no transition in between, so it looks fake.

My aim is to actually have a somewhat detailed flight model for each aircraft, which is something the guys at Eagle Dynamics did for Lock On: Modern Air Combat. Their AI traffic actually uses a slightly dumbed down version of the highly detaild flight model the user aircraft has. That means takeoffs, landings, and every other phase of flight look very real (they even improved on this in Flaming Cliffs by pretty much using the detailed flight model from LOMAC for AI, and going even deeper for the user aircraft).

A good simulation of flight models that is out there is X-Plane. Here's how Austin Meyer describes the process:

X-Plane reads in the geometric shape of any aircraft and then figures out how that aircraft will fly. It does this by an engineering process called "blade element theory", which involves breaking the aircraft down into many small elements and then finding the forces on each little element many times per second. These forces are then converted into accelerations which are then integrated to velocities and positions... of course, all of this technical theory is completely transparent to you... you just fly! It's fun!

X-Plane goes through the following steps to propagate the flight:

1: Element Break-Down
Done only once during initialization, X-Plane breaks the wing(s), horizontal stabilizer, vertical stabilizer(s), and propeller(s) (if equipped) down into a finite number of elements. The number of elements is decided by the user in Plane-Maker. Ten elements per side per wing or stabilizer is the maximum, and studies have shown that this provides roll rates and accelerations that are very close to the values that would be found with a much larger number of elements.

2: Velocity Determination
This is done twice per cycle. The aircraft linear and angular velocities, along with the longitudinal, lateral, and vertical arms of each element are considered to find the velocity vector of each element. Downwash, propwash, and induced angle of attack from lift-augmentation devices are all considered when finding the velocity vector of each element.
Propwash is found by looking at the area of each propeller disk, and the thrust of each propeller. Using local air density, X-Plane determines the propwash required for momentum to be conserved.
Downwash is found by looking at the aspect ratio, taper ratio, and sweep of the wing, and the horizontal and vertical distance of the "washed surface" (normally the horizontal stabilizer) from the "washing surface" (normally the wing), and then going to an empirical look-up table to get the degrees of downwash generated per coefficient of lift.

3: Coefficient Determination
The airfoil data entered in Part-Maker is 2-dimensional, so X-Plane applies finite wing lift-slope reduction, finite-wing CLmax reduction, finite-wing induced drag, and finite-wing moment reduction appropriate to the aspect ratio, taper ratio, and sweep of the wing, horizontal stabilizer, vertical stabilizer, or propeller blade in question. Compressible flow effects are considered using Prandtl-Glauert, but transonic effects are not simulated other than an empirical mach-divergent drag increase. In supersonic flight, the airfoil is considered to be a diamond shape with the appropriate thickness ratio... pressures behind the shock waves are found on each of the plates in the diamond-shaped airfoil and summed to give the total pressures on the foil element.

4: Force Build-Up
Using the coefficients just determined in step 3, areas determined during step 1, and dynamic pressures (determined separately for each element based on aircraft speed, altitude, temperature, propwash and wing sweep), the forces are found and summed for the entire aircraft. Forces are then divided by the aircraft mass for linear accelerations, and moments of inertia for angular accelerations.

5: Get Back to Work
Go back to step 2 and do the whole thing over again at least 15 times per second. Aren't computers great?

This is pretty much the approach I am planning on implementing.