FMS is one of the freeware high-quality flight simulator for model
airplanes. It is written in Delphi language with some third party
components.
You can download it from http://n.ethz.ch/student/mmoeller/fms/index_e.html
My question is about the "flight dynamic model" of FMS and/or other similar
simulators.
Do you know any Delphi and/or C/C++ flight dynamics model code which takes
the rudder, elevator, throttle, aileron, airplane's position, velocity and
attitude (roll, pitch, yaw angles) as inputs and calculates the airplane's
next position, velocity and attitude?
Flight Dynamics Model :
=================INPUTS:
Time increment :
dT (delta T in milli second)
Control inputs :
Rudder
Elevator
Throttle
Aileron
Airplane's current state :
Position (in 3D. ie X,Y,Z)
Velocity (in 3D, Vx, Vy,Vz)
Attitude (in 3D, Roll, Pitch, Yaw angles)
Airplane's constants:
Wing span
Weight
????
????
etc..
OUTPUT:
Airplane's next state after dT :
Position (in 3D. ie X,Y,Z)
Velocity (in 3D, Vx, Vy,Vz)
Attitude (in 3D, Roll, Pitch, Yaw angles)
| My question is about the "flight dynamic model" of FMS and/or other similar
| simulators.
| Do you know any Delphi and/or C/C++ flight dynamics model code which takes
| the rudder, elevator, throttle, aileron, airplane's position, velocity and
| attitude (roll, pitch, yaw angles) as inputs and calculates the airplane's
| next position, velocity and attitude?
There's a few open source flight simulators out there that obviously
must do what you're referring to.
They include --
Slope Soaring Simulator -- http://www.rowlhouse.co.uk/sss /
CRRCsim -- http://groups.yahoo.com/group/crrcsim /
Flight Gear Flight Simulator --
http://seneca.flightgear.org/flightgear/links.html
And there's more, just google for 'em.
This mention on the FGFS page looks like it might be exactly what you
want --
LaRCsim - A set of ANSI C routines that implement a full set of
equations of motion for a rigid-body aircraft in atmospheric and
low-earth orbital flight, suitable for pilot-in-the-loop simulations
on a workstation-class computer.
--
Doug McLaren, snipped-for-privacy@frenzy.com
Dear Lord: Please make my words sweet and tender, for tomorrow I may
Very cool, gang, I've never done anything in Delphi, only in Fortran,
but it looks good. Looks like you stopped short of making the graphical
part (am I right here or not?). Seems like that would be a challenge,
but maybe not as hard as I think for someone familiar with it.
It looks like you're applying all the forces to the plane as a whole,
and airflow is regarded as uniform over the whole plane. Note that
without using a velocity-panel type model, where airflow is calculated
individually at each location, that you will not be able to do any
non-linear maneuvers, such as spins, snap rolls,lomcevaks, etc. but then
again, this is how many commercial flight sims are made.
Good job.
Paul
Hi Paul and Lora,
For the record, the code is in c++.
You're correct : the flight model is simple and limited, but it was the best
I could do in a couple of weeks without taking an advanced course in
aerodynamics :-)
About the graphical side : I did some work on it (using DirectX). It
actually had animated flight surfaces, smoke, shadows, sun flare, engine
noise with Doppler effect... I have put some screenshots up on
http://users.pandora.be/playinginthedark/airdancers/airdancers2.jpg
It was about a month and a half of work to get to this point. I never
finished it because - well - the fun part was done and there was still A LOT
of work left : collision model, scenery modeling, configurable controls,
network code, ...
Lora, can you let me know if you ever find a use for the code? Thanks!
Davy
Well, it's been a while, but I got a lot out of the first part of the
following paper:
http://www.movesinstitute.org/~zyda/pubs/Presence.1.4.pdf
There are two parts in the calculations : position and attitude.
Basically you calculate the forces on the aircraft (gravity, drag, lift and
thrust), say F for each of the aircraft axes. Then you calculate the
acceleration using Newton F=m*a or a = F/m. This will give you the new
position.
The hard part is the rotations. Looking back at the code, I honestly have no
idea where I got these but I remember it took me a couple of weeks to come
to these. I can't guarantee the physical soundness, but the result was
acceptable to me.
The last calculations of dX, dY and dZ are simply translation from the
aircraft axis to the world axis (some matrix math). There is also still some
debug code in there (the "if ( ) > 50") because in the beginning I had some
asymptotic behavior in some cases.
Also, never forget to take the elapsed time since the previous run into
account in the right order and places.
It's not simple and my implementation is far from perfect or finished, but
it was great fun figuring it out!
Davy
Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here.
All logos and trade names are the property of their respective owners.