After some intense weeks of coding and reading papers and research notes on anything that involves flight dynamics and flight simulation I’m now happy to announce that the new High Fidelity Flight Dynamics Model for the F-16 flight simulator is up and running! It’s interesting to look at all the math and equations and then look at the math and physics classes from back in college. Much of the stuff we learned back then is being used in a project like this. Vectors and matrices aren’t new since I don’t think you can write any 3D game without dealing with them but quaternions are not used nearly as much. They do come in very handy in flight simulators though when you want to orient the airplane in the world. The usual Euler angles, roll, pitch and yaw, suffer from the gimbal lock problem where you get undefined angles when pitch is at positive or negative 90 degrees. Using quaternions in the rotational equations solves this problem.
Had I known when I was in college what I know now, I would have paid much more attention to the math classes. Ok, it’s not that I didn’t pay attention but it was all just theory and I could not at the time see any real practical use for all those dot products, cross products, matrices, eigen values etc and that made it much less interesting to learn. Now years later after having developed some games I realize what they are good for! But I have to say one such item that really seemed like it was purely for theoretical use was the Laplace transform. I remember we worked with them and that I could not wait to leave them behind and never have to see again. Well, as irony would have it, Laplace transforms are used a lot when it comes to flight control so now I see a practical use for them also. I guess the lesson to be learned is that when you are reading about something in school or college that seems like completely useless theory, you never know when you might need to know all about it.
So back the the F-16 flight model. Flight simulators are not new and the math and equations behind them have been research a lot and are well known to people in the field. I had some previous knowledge about the subject but I have had to learn and understand it in much more detail in getting this one to take off. This is especially true when you end up having some small bug in the code that’s causing the whole thing to go crazy. I have found that it’s then you really learn how it all works. In order to find and fix that bug you have to really understand it so you can track down where it’s going wrong.
The flight model is built on the standard nonlinear six-degree-of-freedom (6 DOF) rigid body equations. The aerodynamic force and moment coefficients are built up with a number of equations that take aerodynamic data as input based on control surface deflections, angle of attack, sideslip etc. The aerodynamic data consists of over 40 tables of data that were derived from wind-tunnel tests conducted with subscale models of the F-16.
As I said, the flight model is up and running but there are still a lot of pieces and details that need to be connected and then fine tuned. The end result will hopefully be a flight simulator that behaves as close to a real F-16 as possible based on the data and information available. This is of course a huge project, one that has been on the drawing board for many years and no doubt will take many more years before it will resemble something one could call finished. Of course, it will never be truly finished since there are always things that can be improved and fine tuned.
I will probably take a break from all the math for a while and try to make some progress on the visible parts of the simulator. Although you sit in the cockpit when you fly an airplane, a flight simulator still needs nice looking airplane models and they always make for good looking screenshots. With that in mind I hope to have a nice looking F-16 model in the sim next time.