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"
47 #include "FGMatrix33.h"
48 #include "FGColumnVector3.h"
49 #include "FGColumnVector4.h"
50 #include "FGFDMExec.h"
51 #include "FGJSBBase.h"
53 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57 #define ID_LGEAR "$Id$"
59 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
72 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
73 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
80 /** Landing gear model.
81 Calculates forces and moments due to landing gear reactions. This is done in
82 several steps, and is dependent on what kind of gear is being modeled. Here
83 are the parameters that can be specified in the config file for modeling
86 <b><u>Physical Characteristics</u></b><br>
88 <li>X, Y, Z location, in inches in structural coordinate frame</li>
89 <li>Spring constant, in lbs/ft</li>
90 <li>Damping coefficient, in lbs/ft/sec</li>
91 <li>Dynamic Friction Coefficient</li>
92 <li>Static Friction Coefficient</li>
94 <b><u>Operational Properties</b></u><br>
97 <li>Steerability attribute {one of STEERABLE | FIXED | CASTERED}</li>
98 <li>Brake Group Membership {one of LEFT | CENTER | RIGHT | NOSE | TAIL | NONE}</li>
99 <li>Max Steer Angle, in degrees</li>
102 <b><u>Algorithm and Approach to Modeling</u></b><br>
104 <li>Find the location of the uncompressed landing gear relative to the CG of
105 the aircraft. Remember, the structural coordinate frame that the aircraft is
106 defined in is: X positive towards the tail, Y positive out the right side, Z
107 positive upwards. The locations of the various parts are given in inches in
108 the config file.</li>
109 <li>The vector giving the location of the gear (relative to the cg) is
110 rotated 180 degrees about the Y axis to put the coordinates in body frame (X
111 positive forwards, Y positive out the right side, Z positive downwards, with
112 the origin at the cg). The lengths are also now given in feet.</li>
113 <li>The new gear location is now transformed to the local coordinate frame
114 using the body-to-local matrix. (Mb2l).</li>
115 <li>Knowing the location of the center of gravity relative to the ground
116 (height above ground level or AGL) now enables gear deflection to be
117 calculated. The gear compression value is the local frame gear Z location
118 value minus the height AGL. [Currently, we make the assumption that the gear
119 is oriented - and the deflection occurs in - the Z axis only. Additionally,
120 the vector to the landing gear is currently not modified - which would
121 (correctly) move the point of contact to the actual compressed-gear point of
122 contact. Eventually, articulated gear may be modeled, but initially an
123 effort must be made to model a generic system.] As an example, say the
124 aircraft left main gear location (in local coordinates) is Z = 3 feet
125 (positive) and the height AGL is 2 feet. This tells us that the gear is
126 compressed 1 foot.</li>
127 <li>If the gear is compressed, a Weight-On-Wheels (WOW) flag is set.</li>
128 <li>With the compression length calculated, the compression velocity may now
129 be calculated. This will be used to determine the damping force in the
130 strut. The aircraft rotational rate is multiplied by the vector to the wheel
131 to get a wheel velocity in body frame. That velocity vector is then
132 transformed into the local coordinate frame.</li>
133 <li>The aircraft cg velocity in the local frame is added to the
134 just-calculated wheel velocity (due to rotation) to get a total wheel
135 velocity in the local frame.</li>
136 <li>The compression speed is the Z-component of the vector.</li>
137 <li>With the wheel velocity vector no longer needed, it is normalized and
138 multiplied by a -1 to reverse it. This will be used in the friction force
140 <li>Since the friction force takes place solely in the runway plane, the Z
141 coordinate of the normalized wheel velocity vector is set to zero.</li>
142 <li>The gear deflection force (the force on the aircraft acting along the
143 local frame Z axis) is now calculated given the spring and damper
144 coefficients, and the gear deflection speed and stroke length. Keep in mind
145 that gear forces always act in the negative direction (in both local and
146 body frames), and are not capable of generating a force in the positive
147 sense (one that would attract the aircraft to the ground). So, the gear
148 forces are always negative - they are limited to values of zero or less. The
149 gear force is simply the negative of the sum of the spring compression
150 length times the spring coefficient and the gear velocity times the damping
152 <li>The lateral/directional force acting on the aircraft through the landing
154 gear (along the local frame X and Y axes) is calculated next. First, the
155 friction coefficient is multiplied by the recently calculated Z-force. This
156 is the friction force. It must be given direction in addition to magnitude.
157 We want the components in the local frame X and Y axes. From step 9, above,
158 the conditioned wheel velocity vector is taken and the X and Y parts are
159 multiplied by the friction force to get the X and Y components of friction.
161 <li>The wheel force in local frame is next converted to body frame.</li>
162 <li>The moment due to the gear force is calculated by multiplying r x F
163 (radius to wheel crossed into the wheel force). Both of these operands are
166 @author Jon S. Berndt
168 @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
169 NASA-Ames", NASA CR-2497, January 1975
170 @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
171 Wiley & Sons, 1979 ISBN 0-471-03032-5
172 @see W. A. Ragsdale, "A Generic Landing Gear Dynamics Model for LASRS++",
174 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGLGear.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
176 @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGLGear.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
180 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
182 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
184 class FGLGear : public FGJSBBase
187 /// Brake grouping enumerators
188 enum BrakeGroup {bgNone=0, bgLeft, bgRight, bgCenter, bgNose, bgTail };
189 /// Steering group membership enumerators
190 enum SteerType {stSteer, stFixed, stCaster};
191 /// Report type enumerators
192 enum ReportType {erNone=0, erTakeoff, erLand};
194 @param Executive a pointer to the parent executive object
195 @param File a pointer to the config file instance */
196 FGLGear(FGConfigFile* File, FGFDMExec* Executive);
198 @param lgear a reference to an existing FGLGear object */
199 FGLGear(const FGLGear& lgear);
204 /// The Force vector for this gear
205 FGColumnVector3& Force(void);
206 /// The Moment vector for this gear
207 FGColumnVector3& Moment(void) {return vMoment;}
209 /// Gets the location of the gear in Body axes
210 FGColumnVector3& GetBodyLocation(void) { return vWhlBodyVec; }
211 double GetBodyLocation(int idx) { return vWhlBodyVec(idx); }
213 FGColumnVector3& GetLocalGear(void) { return vLocalGear; }
214 double GetLocalGear(int idx) { return vLocalGear(idx); }
216 /// Gets the name of the gear
217 inline string GetName(void) {return name; }
218 /// Gets the Weight On Wheels flag value
219 inline bool GetWOW(void) {return WOW; }
220 /// Gets the current compressed length of the gear in feet
221 inline double GetCompLen(void) {return compressLength;}
222 /// Gets the current gear compression velocity in ft/sec
223 inline double GetCompVel(void) {return compressSpeed; }
224 /// Gets the gear compression force in pounds
225 inline double GetCompForce(void) {return Force()(3); }
226 inline double GetBrakeFCoeff(void) {return BrakeFCoeff;}
228 /// Sets the brake value in percent (0 - 100)
229 inline void SetBrake(double bp) {brakePct = bp;}
231 /** Set the console touchdown reporting feature
232 @param flag true turns on touchdown reporting, false turns it off */
233 inline void SetReport(bool flag) { ReportEnable = flag; }
234 /** Get the console touchdown reporting feature
235 @return true if reporting is turned on */
236 inline bool GetReport(void) { return ReportEnable; }
237 inline double GetSteerAngle(void) { return SteerAngle;}
238 inline double GetstaticFCoeff(void) { return staticFCoeff;}
240 inline int GetBrakeGroup(void) { return (int)eBrakeGrp; }
241 inline int GetSteerType(void) { return (int)eSteerType; }
243 inline bool GetRetractable(void) { return isRetractable; }
244 inline bool GetGearUnitUp(void) { return GearUp; }
245 inline bool GetGearUnitDown(void) { return GearDown; }
246 inline double GetWheelSideForce(void) { return SideForce; }
247 inline double GetWheelRollForce(void) { return RollingForce; }
248 inline double GetBodyXForce(void) { return vLocalForce(eX); }
249 inline double GetBodyYForce(void) { return vLocalForce(eY); }
250 inline double GetWheelSlipAngle(void) { return WheelSlip; }
251 double GetWheelVel(int axis) { return vWhlVelVec(axis);}
254 FGColumnVector3 vXYZ;
255 FGColumnVector3 vMoment;
256 FGColumnVector3 vWhlBodyVec;
257 FGColumnVector3 vLocalGear;
258 FGColumnVector3 vForce;
259 FGColumnVector3 vLocalForce;
260 FGColumnVector3 vWhlVelVec; // Velocity of this wheel (Local)
264 double compressLength;
265 double compressSpeed;
266 double staticFCoeff, dynamicFCoeff, rollingFCoeff;
272 double TakeoffDistanceTraveled;
273 double TakeoffDistanceTraveled50ft;
274 double LandingDistanceTraveled;
275 double MaximumStrutForce;
276 double MaximumStrutTravel;
277 double SideWhlVel, RollingWhlVel;
278 double RollingForce, SideForce, FCoeff;
280 double lastWheelSlip;
284 bool StartedGroundRun;
285 bool LandingReported;
286 bool TakeoffReported;
289 bool GearUp, GearDown;
295 BrakeGroup eBrakeGrp;
296 SteerType eSteerType;
297 double maxSteerAngle;
301 FGAircraft* Aircraft;
302 FGPosition* Position;
303 FGRotation* Rotation;
305 FGMassBalance* MassBalance;
307 void Report(ReportType rt);
308 void Debug(int from);
311 #include "FGAircraft.h"
312 #include "FGPosition.h"
313 #include "FGRotation.h"
315 #include "FGMassBalance.h"
317 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%