1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
23 Further information about the GNU General Public License can also be found on
24 the world wide web at http://www.gnu.org.
27 --------------------------------------------------------------------------------
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 # include <simgear/compiler.h>
46 #include "FGConfigFile.h"
48 #include "FGFDMExec.h"
50 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54 #define ID_LGEAR "$Id$"
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
75 /** Landing gear model.
76 Calculates forces and moments due to landing gear reactions. This is done in
77 several steps, and is dependent on what kind of gear is being modeled. Here
78 are the parameters that can be specified in the config file for modeling
81 <b><u>Physical Characteristics</u></b><br>
83 <li>X, Y, Z location, in inches in structural coordinate frame</li>
84 <li>Spring constant, in lbs/ft</li>
85 <li>Damping coefficient, in lbs/ft/sec</li>
86 <li>Dynamic Friction Coefficient</li>
87 <li>Static Friction Coefficient</li>
89 <b><u>Operational Properties</b></u><br>
92 <li>Steerability attribute {one of STEERABLE | FIXED | CASTERED}</li>
93 <li>Brake Group Membership {one of LEFT | CENTER | RIGHT | NOSE | TAIL | NONE}</li>
94 <li>Max Steer Angle, in degrees</li>
97 <b><u>Algorithm and Approach to Modeling</u></b><br>
99 <li>Find the location of the uncompressed landing gear relative to the CG of
100 the aircraft. Remember, the structural coordinate frame that the aircraft is
101 defined in is: X positive towards the tail, Y positive out the right side, Z
102 positive upwards. The locations of the various parts are given in inches in
103 the config file.</li>
104 <li>The vector giving the location of the gear (relative to the cg) is
105 rotated 180 degrees about the Y axis to put the coordinates in body frame (X
106 positive forwards, Y positive out the right side, Z positive downwards, with
107 the origin at the cg). The lengths are also now given in feet.</li>
108 <li>The new gear location is now transformed to the local coordinate frame
109 using the body-to-local matrix. (Mb2l).</li>
110 <li>Knowing the location of the center of gravity relative to the ground
111 (height above ground level or AGL) now enables gear deflection to be
112 calculated. The gear compression value is the local frame gear Z location
113 value minus the height AGL. [Currently, we make the assumption that the gear
114 is oriented - and the deflection occurs in - the Z axis only. Additionally,
115 the vector to the landing gear is currently not modified - which would
116 (correctly) move the point of contact to the actual compressed-gear point of
117 contact. Eventually, articulated gear may be modeled, but initially an
118 effort must be made to model a generic system.] As an example, say the
119 aircraft left main gear location (in local coordinates) is Z = 3 feet
120 (positive) and the height AGL is 2 feet. This tells us that the gear is
121 compressed 1 foot.</li>
122 <li>If the gear is compressed, a Weight-On-Wheels (WOW) flag is set.</li>
123 <li>With the compression length calculated, the compression velocity may now
124 be calculated. This will be used to determine the damping force in the
125 strut. The aircraft rotational rate is multiplied by the vector to the wheel
126 to get a wheel velocity in body frame. That velocity vector is then
127 transformed into the local coordinate frame.</li>
128 <li>The aircraft cg velocity in the local frame is added to the
129 just-calculated wheel velocity (due to rotation) to get a total wheel
130 velocity in the local frame.</li>
131 <li>The compression speed is the Z-component of the vector.</li>
132 <li>With the wheel velocity vector no longer needed, it is normalized and
133 multiplied by a -1 to reverse it. This will be used in the friction force
135 <li>Since the friction force takes place solely in the runway plane, the Z
136 coordinate of the normalized wheel velocity vector is set to zero.</li>
137 <li>The gear deflection force (the force on the aircraft acting along the
138 local frame Z axis) is now calculated given the spring and damper
139 coefficients, and the gear deflection speed and stroke length. Keep in mind
140 that gear forces always act in the negative direction (in both local and
141 body frames), and are not capable of generating a force in the positive
142 sense (one that would attract the aircraft to the ground). So, the gear
143 forces are always negative - they are limited to values of zero or less. The
144 gear force is simply the negative of the sum of the spring compression
145 length times the spring coefficient and the gear velocity times the damping
147 <li>The lateral/directional force acting on the aircraft through the landing
149 gear (along the local frame X and Y axes) is calculated next. First, the
150 friction coefficient is multiplied by the recently calculated Z-force. This
151 is the friction force. It must be given direction in addition to magnitude.
152 We want the components in the local frame X and Y axes. From step 9, above,
153 the conditioned wheel velocity vector is taken and the X and Y parts are
154 multiplied by the friction force to get the X and Y components of friction.
156 <li>The wheel force in local frame is next converted to body frame.</li>
157 <li>The moment due to the gear force is calculated by multiplying r x F
158 (radius to wheel crossed into the wheel force). Both of these operands are
161 @author Jon S. Berndt
163 @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
164 NASA-Ames", NASA CR-2497, January 1975
165 @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
166 Wiley & Sons, 1979 ISBN 0-471-03032-5
167 @see W. A. Ragsdale, "A Generic Landing Gear Dynamics Model for LASRS++",
171 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
173 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
178 /// Brake grouping enumerators
179 enum BrakeGroup {bgNone=0, bgLeft, bgRight, bgCenter, bgNose, bgTail };
180 /// Steering group membership enumerators
181 enum SteerType {stSteer, stFixed, stCaster};
183 @param Executive a pointer to the parent executive object
184 @param File a pointer to the config file instance */
185 FGLGear(FGConfigFile* File, FGFDMExec* Executive);
187 @param lgear a reference to an existing FGLGear object */
188 FGLGear(const FGLGear& lgear);
193 /// The Force vector for this gear
194 FGColumnVector Force(void);
195 /// The Moment vector for this gear
196 FGColumnVector Moment(void) {return vMoment;}
198 /// Gets the location of the gear in Body axes
199 FGColumnVector GetBodyLocation(void) { return vWhlBodyVec; }
200 float GetBodyLocation(int idx) { return vWhlBodyVec(idx); }
202 FGColumnVector GetLocalGear(void) { return vLocalGear; }
203 float GetLocalGear(int idx) { return vLocalGear(idx); }
205 /// Gets the name of the gear
206 inline string GetName(void) {return name; }
207 /// Gets the Weight On Wheels flag value
208 inline bool GetWOW(void) {return WOW; }
209 /// Gets the current compressed length of the gear in feet
210 inline float GetCompLen(void) {return compressLength;}
211 /// Gets the current gear compression velocity in ft/sec
212 inline float GetCompVel(void) {return compressSpeed; }
213 /// Gets the gear compression force in pounds
214 inline float GetCompForce(void) {return Force()(3); }
216 /// Sets the brake value in percent (0 - 100)
217 inline void SetBrake(double bp) {brakePct = bp;}
219 /** Set the console touchdown reporting feature
220 @param flag true turns on touchdown reporting, false turns it off */
221 inline void SetReport(bool flag) { ReportEnable = flag; }
222 /** Get the console touchdown reporting feature
223 @return true if reporting is turned on */
224 inline bool GetReport(void) { return ReportEnable; }
229 FGColumnVector vMoment;
230 FGColumnVector vWhlBodyVec;
231 FGColumnVector vLocalGear;
234 float compressLength;
236 float staticFCoeff, dynamicFCoeff, rollingFCoeff;
241 double DistanceTraveled;
242 double MaximumStrutForce;
243 double MaximumStrutTravel;
251 BrakeGroup eBrakeGrp;
252 SteerType eSteerType;
257 FGAircraft* Aircraft;
258 FGPosition* Position;
259 FGRotation* Rotation;
261 FGMassBalance* MassBalance;
267 #include "FGAircraft.h"
268 #include "FGPosition.h"
269 #include "FGRotation.h"
271 #include "FGMassBalance.h"
273 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%