以下介绍的是怎么计算
Some sources of simulator code
last page update Dec. 2003
For a complete \'scientific\' simulation I imagine one needs to work from calculated forces on each main surface, the moments of inertia around the centre of mass, the damping of rotation, the effects of incidence and speed on the wings given their section and planform ... etc etc. Some modern commercial sims seem to have a complex flight model that matches most of these parameters, and the users seem to want such realism.
It seems to me , that for complete realism you need more than the standard approach. A real plane has a lot of subtle variation in the the flight surface reaction at different speeds and flight angles. It is not just a linear reaction but a curved and variable one. One surface interferes with another if the slipstream is altered .. etc.
The most subtle and accurate flight model I have seen so far, is used in a Radio controlled model slope soaring simulator. Apparently the essential flight code is public domain, from an opengl program called \'crrsim\'. Anyway, you can read about it and download the quite small program and optional files at > http://www.rowlhouse.co.uk/sss/index.html
-------------------------------------------------------------
And if you want an idea of how normal flight simulation is done, here is a page in quaint english, but by a very willing and open person. Taken from - glhorizon at :- http://www.web-discovery.net/links
Introduction
I received lot of emails asking me how to build a realistic flight model. First af all i want to make it clear that i\'m not a physics or aerodynamic specialist, and all i\'ve learnt is from documents and precious help i found searching on the web and asking to people which actually pointed at me the right answers. And i experimented a lot, really a lot, to achieve what i believe, now, to be a quite realistic flight model.
Just to help everybody willing to build his own flight simulation, I wrote this document which explain, quite in detail, how to build a flight model starting from user input and aircraft carachteristics, calculating all the forces, moments acting on the aircraft, and translating angular and linear velocities in aircraft angles and position updates.
This paper doesn\'t explain the theory of flight, so if you don\'t know absolutely anything about that i suggest you study some theory of flight first, otherwise what you\'ll read below here will be quite no-sense.
U,V,W are the aircraft linear velocities along X,Y,Z axis in feet/sec
P,Q,R are the aircraft angular velocities around X,Y,Z axis in radians/sec
Ua,Va,Wa are the aircraft linear accelerations along X,Y,Z axis in feet/sec2
Pa,Qa,Ra are the aircraft angular accelerations around X,Y,Z axis in radians/sec2
Fx,Fy,Fz are the forces acting on aircraft
L,M,N are the moments about the X,Y,Z axis
alpha is the angle of attack (AOA)
beta is the angle of sideslip
elevator, aileron and rudder are the control deflections that pilot commence through the stick and are expressed in radians (of course you\'ve to build you\'re own joystick or keyboard routine to simulate the pilot stick)
thrust is the engine power that pilot commence through the throttle control
b is the wing span in feet
S is the wing surface area in feet2
c is the chord length in feet
Very important is to define the specific aircraft parameters, since every aircraft has its own inertial and aerodynamic coefficients, weight, dimensions, mass properties etc. Finding these parameters might not be easy, but there are some informations available on the web. I\'m collecting data in a database which i\'ll publish soon, but as you\'ll see lot of stuff is missing, if somebody can help email me !
gravitational_acceleration = 32.174 ft/s2
aircraft_mass = weight/gravitational acceleration
speed = sqrt (U2 + V2 + W2)
alpha = atan(W/U) alpha is 0 when W velocity (i.e. vertical velocity) is equal to 0
beta = atan(V/U) beta is 0 when V velocity (i.e. side velocity) is equal to 0
beta can be calculated also as asin(V/speed)
Now is time to calculate lift and drag
lift_coefficient = CLo + CLa*alpha + CLde*elevator
CLo is the reference lift at zero angle of attack
CLa is the lift curve slope
CLde is the lift due to elevator
drag_coefficient = CDo + CDa*alpha + CDde*elevator
CDo is the reference drag at zero angle of attack
CDa is the drag curve slope
CDde is the drag due to elevator
Calculation of lift and drag coefficients takes into account also other parameters, which i avoided to mention to simplify this paper and because their effect is quite minimal: but if you want to make a very very realistic simulation, you have to include them. I suggest you study this document
Lift = lift_coefficient * qbarS
Drag = drag_coefficient * qbarS
where qbarS is the dynamic pressure and is defined as ( rho * speed2 * S / 2 )
and, in detail, speed is the aircraft speed, rho is the air density at a certain altitude and S is the wing area surface in feet2
Calculating aero forces
Fx = lift*sin(alpha) - drag*cos(alpha) + thrust;
Fz = -lift*cos(alpha) - drag*sin(alpha);
Fy = (CYb*beta + CYdr*rudder)*qbarS;
Calculating linear accelerations
Ua = V*R - W*Q - gravitational_ acceleration * sin(theta) + Fx/slugs;
Wa = U*Q - V*P + gravitational_ acceleration * cos(phi)*cos(theta) + Fz/aircraft_mass;
Va = W*P - U*R + gravitational_ acceleration * sin(phi)*cos(theta) + Fy/aircraft_mass;
Calculate linear velocities
U= U + Ua;
W=W + Wa;
V= V + Va;
Calculate moments
L = (CLb*beta + CLp*P*b/(adjust*speed)+CLr*R*b/(speed)+Clda*aileron+CLdr*rudder)*qbarS*b; // Roll
M = (CMo + CMa*alpha+CMq*Q*c/(speed)+CMde*elevator)*qbarS*c; // Pitch
N = (CNb*beta + CNp*P*b/(speed) + CNr*R*b/(speed) + CNda*aileron + CNdr*rudder)*qbarS*b; // Yaw
CLb is the dihedral effect
CLp is roll damping
CLr is the roll due to yaw rate
Clda is the roll due to aileron
CLdr is the roll due to rudder
CMo is the pitch moment coefficient
CMa is the pitch moment coefficient due to angle of attack
CMq is the pitch moment coefficient due to picth rate
CMde is the pitch coefficient due to elevator
CNb is the weather cocking stability
CNp is the rudder adverse yaw
CNr is the yaw damping
CNda is the yaw due to aileron
CNdr is the yaw due to rudder
One note: you understand that it is extremely important to know all the coefficients of the aircraft you want to simulate. I started with the coefficients of the A-4 Sparrow, but then i was lucky to find a software of aerodynamics calculations ( check www.darcorp.com ) where i found the F22 Raptor ones. As i told before, i\'d like to build a reference database with all the known coefficients and parameters of all aircrafts.it\'s quite utopistic i know, but let\'s just start and see.
Calculate the rotational body axis accelerations
Just assuming that :
Ixx is the roll inertia in slug/feet2
Iyy is the pitch inertia in slug/feet2
Izz is the yaw inertia in slug/feet2
Ixz is the overall inertia along the trasversal Y-Z in slug/feet2
If fuel consumption or weapon drops are to be simulated, the previous inertial parameters and the mass of the aircraft should be updated in each loop.
Now we will arrange the inertial parameters and combine them to calculate the aircraft angular accelerations:
ixz2 = Ixz*Ixz
cc[0] = 1/(Ixx*Izz - ixz2)
cc[1] = cc[0]*((Iyy-Izz)*Izz - ixz2)
cc[2] = cc[0]*Ixz*(Ixx - Iyy + Izz)
cc[3] = cc[0]*Izz
cc[4] = cc[0]*Ixz
cc[7] = 1/Iyy
cc[5] = cc[7]*(Izz - Ixx)
cc[6] = cc[7]*Ixz
cc[8] = cc[0]*((Ixx - Iyy)*Ixx + ixz2)
cc[9] = cc[0]*Ixz*(Iyy - Izz - Ixx)
cc[10] = cc[0]*Ixx
Pa = (cc[1]*R + cc[2]*P)*Q + cc[3]*L + cc[4]*N
Qa = cc[5]*R*P + cc[6]*(R*R - P*P) + cc[7]*M
Ra = (cc[8]*P + cc[9]*R)*Q + cc[4]*L + cc[10]*N
Pa,Qa,Ra are the aircraft angular accelerations expressed in rad/sec2 about the X,Y,Z axis
From these we can calculate the aircraft rotational velocities down here:
P = P + (3*Pa - vlastPdot)
Q = Q + (3*Qa - vlastQdot)
R = R + (3*Ra - vlastRdot)
where vlastPdot,vlastQdot,vlastRdot are the previous values of Pa, Qa, Ra (that you get at the end of the main loop) |