]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGLGear.cpp
Fix stall widths for the "auxilliary" (reverse flow) stalls so they
[flightgear.git] / src / FDM / JSBSim / FGLGear.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGLGear.cpp
4  Author:       Jon S. Berndt
5                Norman H. Princen
6  Date started: 11/18/99
7  Purpose:      Encapsulates the landing gear elements
8  Called by:    FGAircraft
9
10  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
11
12  This program is free software; you can redistribute it and/or modify it under
13  the terms of the GNU General Public License as published by the Free Software
14  Foundation; either version 2 of the License, or (at your option) any later
15  version.
16
17  This program is distributed in the hope that it will be useful, but WITHOUT
18  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
20  details.
21
22  You should have received a copy of the GNU General Public License along with
23  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
24  Place - Suite 330, Boston, MA  02111-1307, USA.
25
26  Further information about the GNU General Public License can also be found on
27  the world wide web at http://www.gnu.org.
28
29 FUNCTIONAL DESCRIPTION
30 --------------------------------------------------------------------------------
31
32 HISTORY
33 --------------------------------------------------------------------------------
34 11/18/99   JSB   Created
35 01/30/01   NHP   Extended gear model to properly simulate steering and braking
36
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include "FGLGear.h"
42
43 namespace JSBSim {
44
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 DEFINITIONS
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50 GLOBAL DATA
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
52
53 static const char *IdSrc = "$Id$";
54 static const char *IdHdr = ID_LGEAR;
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS IMPLEMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60 FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex, int number) : Exec(fdmex)
61 {
62   GearNumber = number;
63
64   *AC_cfg >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3)
65             >> kSpring >> bDamp>> dynamicFCoeff >> staticFCoeff
66                   >> rollingFCoeff >> sSteerType >> sBrakeGroup
67                      >> maxSteerAngle >> sRetractable;
68
69   if      (sBrakeGroup == "LEFT"  ) eBrakeGrp = bgLeft;
70   else if (sBrakeGroup == "RIGHT" ) eBrakeGrp = bgRight;
71   else if (sBrakeGroup == "CENTER") eBrakeGrp = bgCenter;
72   else if (sBrakeGroup == "NOSE"  ) eBrakeGrp = bgNose;
73   else if (sBrakeGroup == "TAIL"  ) eBrakeGrp = bgTail;
74   else if (sBrakeGroup == "NONE"  ) eBrakeGrp = bgNone;
75   else {
76     cerr << "Improper braking group specification in config file: "
77          << sBrakeGroup << " is undefined." << endl;
78   }
79
80   if      (sSteerType == "STEERABLE") eSteerType = stSteer;
81   else if (sSteerType == "FIXED"    ) eSteerType = stFixed;
82   else if (sSteerType == "CASTERED" ) eSteerType = stCaster;
83   else {
84     cerr << "Improper steering type specification in config file: "
85          << sSteerType << " is undefined." << endl;
86   }
87
88   if ( sRetractable == "RETRACT" ) {
89     isRetractable = true;
90   } else  {
91     isRetractable = false;
92   }
93
94   GearUp = false;
95   GearDown = true;
96   Servicable = true;
97
98 // Add some AI here to determine if gear is located properly according to its
99 // brake group type ??
100
101   State       = Exec->GetState();
102   Aircraft    = Exec->GetAircraft();
103   Propagate   = Exec->GetPropagate();
104   Auxiliary   = Exec->GetAuxiliary();
105   FCS         = Exec->GetFCS();
106   MassBalance = Exec->GetMassBalance();
107
108   WOW = lastWOW = true; // should the value be initialized to true?
109   ReportEnable = true;
110   FirstContact = false;
111   StartedGroundRun = false;
112   TakeoffReported = LandingReported = false;
113   LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
114   MaximumStrutForce = MaximumStrutTravel = 0.0;
115   SideForce = RollingForce = 0.0;
116   SinkRate = GroundSpeed = 0.0;
117
118   vWhlBodyVec = MassBalance->StructuralToBody(vXYZ);
119
120   vLocalGear = Propagate->GetTb2l() * vWhlBodyVec;
121
122   compressLength  = 0.0;
123   compressSpeed   = 0.0;
124   brakePct        = 0.0;
125   maxCompLen      = 0.0;
126
127   WheelSlip = lastWheelSlip = 0.0;
128
129   compressLength  = 0.0;
130   compressSpeed   = 0.0;
131   brakePct        = 0.0;
132   maxCompLen      = 0.0;
133
134   TirePressureNorm = 1.0;
135
136   Debug(0);
137 }
138
139 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
140
141 FGLGear::FGLGear(const FGLGear& lgear)
142 {
143   GearNumber = lgear.GearNumber;
144
145   State    = lgear.State;
146   Aircraft = lgear.Aircraft;
147   Propagate = lgear.Propagate;
148   Auxiliary = lgear.Auxiliary;
149   Exec     = lgear.Exec;
150   FCS      = lgear.FCS;
151   MassBalance = lgear.MassBalance;
152
153   vXYZ = lgear.vXYZ;
154   vMoment = lgear.vMoment;
155   vWhlBodyVec = lgear.vWhlBodyVec;
156   vLocalGear = lgear.vLocalGear;
157
158   WOW                = lgear.WOW;
159   lastWOW            = lgear.lastWOW;
160   ReportEnable       = lgear.ReportEnable;
161   FirstContact       = lgear.FirstContact;
162   StartedGroundRun   = lgear.StartedGroundRun;
163   LandingDistanceTraveled   = lgear.LandingDistanceTraveled;
164   TakeoffDistanceTraveled   = lgear.TakeoffDistanceTraveled;
165   TakeoffDistanceTraveled50ft   = lgear.TakeoffDistanceTraveled50ft;
166   MaximumStrutForce  = lgear.MaximumStrutForce;
167   MaximumStrutTravel = lgear.MaximumStrutTravel;
168   SideForce          = lgear.SideForce;
169   RollingForce       = lgear.RollingForce;
170
171   kSpring         = lgear.kSpring;
172   bDamp           = lgear.bDamp;
173   compressLength  = lgear.compressLength;
174   compressSpeed   = lgear.compressSpeed;
175   staticFCoeff    = lgear.staticFCoeff;
176   dynamicFCoeff   = lgear.dynamicFCoeff;
177   rollingFCoeff   = lgear.rollingFCoeff;
178   brakePct        = lgear.brakePct;
179   maxCompLen      = lgear.maxCompLen;
180   SinkRate        = lgear.SinkRate;
181   GroundSpeed     = lgear.GroundSpeed;
182   LandingReported = lgear.LandingReported;
183   TakeoffReported = lgear.TakeoffReported;
184   name            = lgear.name;
185   sSteerType      = lgear.sSteerType;
186   sRetractable    = lgear.sRetractable;
187   eSteerType      = lgear.eSteerType;
188   sBrakeGroup     = lgear.sBrakeGroup;
189   eBrakeGrp       = lgear.eBrakeGrp;
190   maxSteerAngle   = lgear.maxSteerAngle;
191   isRetractable   = lgear.isRetractable;
192   GearUp          = lgear.GearUp;
193   GearDown        = lgear.GearDown;
194   WheelSlip       = lgear.WheelSlip;
195   lastWheelSlip   = lgear.lastWheelSlip;
196   TirePressureNorm = lgear.TirePressureNorm;
197   Servicable      = lgear.Servicable;
198 }
199
200 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
201
202 FGLGear::~FGLGear()
203 {
204   Debug(1);
205 }
206
207 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
208
209 FGColumnVector3& FGLGear::Force(void)
210 {
211   double SinWheel, CosWheel;
212   double deltaT = State->Getdt()*Exec->GetGroundReactions()->GetRate();
213
214   vForce.InitMatrix();
215   vMoment.InitMatrix();
216
217   if (isRetractable) {
218     if (FCS->GetGearPos() < 0.01) {
219       GearUp   = true;
220       GearDown = false;
221      } else if (FCS->GetGearPos() > 0.99) {
222       GearDown = true;
223       GearUp   = false;
224      } else {
225       GearUp   = false;
226       GearDown = false;
227      }
228   } else {
229       GearUp   = false;
230       GearDown = true;
231   }
232
233   // Compute the steering angle in any case.
234   // Will make shure that animations will look right.
235   switch (eSteerType) {
236   case stSteer:
237     SteerAngle = degtorad * FCS->GetSteerPosDeg(GearNumber);
238     break;
239   case stFixed:
240     SteerAngle = 0.0;
241     break;
242   case stCaster:
243     // Note to Jon: This is not correct for castering gear.  I'll fix it later.
244     SteerAngle = 0.0;
245     break;
246   default:
247     cerr << "Improper steering type membership detected for this gear." << endl;
248     break;
249   }
250
251   if (GearDown) {
252     double t = Exec->GetState()->Getsim_time();
253
254     vWhlBodyVec = MassBalance->StructuralToBody(vXYZ);
255
256 // vWhlBodyVec now stores the vector from the cg to this wheel
257
258     vLocalGear = Propagate->GetTb2l() * vWhlBodyVec;
259
260 // vLocalGear now stores the vector from the cg to the wheel in local coords.
261
262     FGColumnVector3 normal, cvel;
263     FGLocation contact;
264     FGLocation gearLoc = Propagate->GetLocation().LocalToLocation(vLocalGear);
265     compressLength = - Exec->GetGroundCallback()->GetAGLevel(t, gearLoc, contact, normal, cvel);
266
267 // The compression length is currently measured in the Z-axis, only, at this time.
268 // It should be measured along the strut axis. If the local-frame gear position
269 // "hangs down" below the CG greater than the altitude, then the compressLength
270 // will be positive - i.e. the gear will have made contact.
271
272     if (compressLength > 0.00) {
273
274       WOW = true; // Weight-On-Wheels is true
275
276 // The next equation should really use the vector to the contact patch of the tire
277 // including the strut compression and not vWhlBodyVec.  Will fix this later.
278 // As it stands, now, the following equation takes the aircraft body-frame
279 // rotational rate and calculates the cross-product with the vector from the CG
280 // to the wheel, thus producing the instantaneous velocity vector of the tire
281 // in Body coords. The frame is also converted to local coordinates. When the
282 // aircraft local-frame velocity is added to this quantity, the total velocity of
283 // the wheel in local frame is then known. Subsequently, the compression speed
284 // (used for calculating damping force) is found by taking the Z-component of the
285 // wheel velocity.
286
287       vWhlVelVec      =  Propagate->GetTb2l() * (Propagate->GetPQR() * vWhlBodyVec);
288       vWhlVelVec     +=  Propagate->GetVel() - cvel;
289       compressSpeed   =  vWhlVelVec(eZ);
290
291 // If this is the first time the wheel has made contact, remember some values
292 // for later printout.
293
294       if (!FirstContact) {
295         FirstContact  = true;
296         SinkRate      =  compressSpeed;
297         GroundSpeed   =  Propagate->GetVel().Magnitude();
298         TakeoffReported = false;
299       }
300
301 // If the takeoff run is starting, initialize.
302
303       if ((Propagate->GetVel().Magnitude() > 0.1) &&
304           (FCS->GetBrake(bgLeft) == 0) &&
305           (FCS->GetBrake(bgRight) == 0) &&
306           (FCS->GetThrottlePos(0) == 1) && !StartedGroundRun)
307       {
308         TakeoffDistanceTraveled = 0;
309         TakeoffDistanceTraveled50ft = 0;
310         StartedGroundRun = true;
311       }
312
313 // The following needs work regarding friction coefficients and braking and
314 // steering The BrakeFCoeff formula assumes that an anti-skid system is used.
315 // It also assumes that we won't be turning and braking at the same time.
316 // Will fix this later.
317 // [JSB] The braking force coefficients include normal rolling coefficient +
318 // a percentage of the static friction coefficient based on braking applied.
319
320       switch (eBrakeGrp) {
321       case bgLeft:
322          BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) +
323                         staticFCoeff*FCS->GetBrake(bgLeft) );
324         break;
325       case bgRight:
326         BrakeFCoeff =  ( rollingFCoeff*(1.0 - FCS->GetBrake(bgRight)) +
327                          staticFCoeff*FCS->GetBrake(bgRight) );
328         break;
329       case bgCenter:
330         BrakeFCoeff =  ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
331                          staticFCoeff*FCS->GetBrake(bgCenter) );
332         break;
333       case bgNose:
334         BrakeFCoeff =  ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
335                          staticFCoeff*FCS->GetBrake(bgCenter) );
336         break;
337       case bgTail:
338         BrakeFCoeff =  ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
339                          staticFCoeff*FCS->GetBrake(bgCenter) );
340         break;
341       case bgNone:
342         BrakeFCoeff =  rollingFCoeff;
343         break;
344       default:
345         cerr << "Improper brake group membership detected for this gear." << endl;
346         break;
347       }
348
349 // Transform the wheel velocities from the local axis system to the wheel axis system.
350 // For now, steering angle is assumed to happen in the Local Z axis,
351 // not the strut axis as it should be.  Will fix this later.
352
353       SinWheel      = sin(Propagate->GetEuler(ePsi) + SteerAngle);
354       CosWheel      = cos(Propagate->GetEuler(ePsi) + SteerAngle);
355       RollingWhlVel = vWhlVelVec(eX)*CosWheel + vWhlVelVec(eY)*SinWheel;
356       SideWhlVel    = vWhlVelVec(eY)*CosWheel - vWhlVelVec(eX)*SinWheel;
357
358 // Calculate tire slip angle.
359
360       if (RollingWhlVel == 0.0 && SideWhlVel == 0.0) {
361         WheelSlip = 0.0;
362       } else if (fabs(RollingWhlVel) < 1.0) {
363         WheelSlip = 0.05*radtodeg*atan2(SideWhlVel, fabs(RollingWhlVel)) + 0.95*WheelSlip;
364       } else {
365         WheelSlip = radtodeg*atan2(SideWhlVel, fabs(RollingWhlVel));
366       }
367 /*
368       double maxdeltaSlip = 0.5*deltaT;
369
370       if (RollingWhlVel == 0.0 && SideWhlVel == 0.0) {
371         WheelSlip = 0.0;
372       } else if (RollingWhlVel < 1.0) {
373         WheelSlip = radtodeg*atan2(SideWhlVel, RollingWhlVel);
374         deltaSlip = WheelSlip - lastWheelSlip;
375         if (fabs(deltaSlip) > maxdeltaSlip) {
376           if (WheelSlip > lastWheelSlip) {
377             WheelSlip = lastWheelSlip + maxdeltaSlip;
378           } else if (WheelSlip < lastWheelSlip) {
379             WheelSlip = lastWheelSlip - maxdeltaSlip;
380           }
381         }
382       } else {
383         WheelSlip = radtodeg*atan2(SideWhlVel, RollingWhlVel);
384       }
385
386       if ((WheelSlip < 0.0 && lastWheelSlip > 0.0) ||
387           (WheelSlip > 0.0 && lastWheelSlip < 0.0))
388       {
389         WheelSlip = 0.0;
390       }
391 */
392       lastWheelSlip = WheelSlip;
393
394 // Compute the sideforce coefficients using similar assumptions to LaRCSim for now.
395 // Allow a maximum of 10 degrees tire slip angle before wheel slides.  At that point,
396 // transition from static to dynamic friction.  There are more complicated formulations
397 // of this that avoid the discrete jump (similar to Pacejka).  Will fix this later.
398
399       if (fabs(WheelSlip) <= 20.0) {
400         FCoeff = staticFCoeff*WheelSlip/20.0;
401       } else if (fabs(WheelSlip) <= 40.0) {
402 //        FCoeff = dynamicFCoeff*fabs(WheelSlip)/WheelSlip;
403         FCoeff = (dynamicFCoeff*(fabs(WheelSlip) - 20.0)/20.0 +
404                   staticFCoeff*(40.0 - fabs(WheelSlip))/20.0)*fabs(WheelSlip)/WheelSlip;
405       } else {
406         FCoeff = dynamicFCoeff*fabs(WheelSlip)/WheelSlip;
407       }
408
409 // Compute the vertical force on the wheel using square-law damping (per comment
410 // in paper AIAA-2000-4303 - see header prologue comments). We might consider
411 // allowing for both square and linear damping force calculation. Also need to
412 // possibly give a "rebound damping factor" that differs from the compression
413 // case.
414
415       vLocalForce(eZ) =  min(-compressLength * kSpring
416                              - compressSpeed * bDamp, (double)0.0);
417
418       MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ)));
419       MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength));
420
421 // Compute the forces in the wheel ground plane.
422
423       RollingForce = 0;
424       if (fabs(RollingWhlVel) > 1E-3) {
425         double badPresResis = (1.0 - TirePressureNorm) * 30;
426         RollingForce = (badPresResis * min(fabs(RollingWhlVel), 1.0)
427                         + vLocalForce(eZ) * BrakeFCoeff)
428                         * fabs(RollingWhlVel)/RollingWhlVel;
429       }
430       SideForce    = vLocalForce(eZ) * FCoeff;
431
432 // Transform these forces back to the local reference frame.
433
434       vLocalForce(eX) = RollingForce*CosWheel - SideForce*SinWheel;
435       vLocalForce(eY) = SideForce*CosWheel    + RollingForce*SinWheel;
436
437 // Note to Jon: At this point the forces will be too big when the airplane is
438 // stopped or rolling to a stop.  We need to make sure that the gear forces just
439 // balance out the non-gear forces when the airplane is stopped.  That way the
440 // airplane won't start to accelerate until the non-gear/ forces are larger than
441 // the gear forces.  I think that the proper fix should go into FGAircraft::FMGear.
442 // This routine would only compute the local strut forces and return them to
443 // FMGear. All of the gear forces would get adjusted in FMGear using the total
444 // non-gear forces. Then the gear moments would be calculated. If strange things
445 // start happening to the airplane during testing as it rolls to a stop, then we
446 // need to implement this change.  I ran out of time to do it now but have the
447 // equations.
448
449 // Transform the forces back to the body frame and compute the moment.
450
451       vForce  = Propagate->GetTl2b() * vLocalForce;
452       vMoment = vWhlBodyVec * vForce;
453
454     } else { // Gear is NOT compressed
455
456       WOW = false;
457
458       // Return to neutral position between 1.0 and 0.8 gear pos.
459       SteerAngle *= max(FCS->GetGearPos()-0.8, 0.0)/0.2;
460
461       if (Propagate->GetDistanceAGL() > 200.0) {
462         FirstContact = false;
463         StartedGroundRun = false;
464         LandingReported = false;
465         LandingDistanceTraveled = 0.0;
466         MaximumStrutForce = MaximumStrutTravel = 0.0;
467       }
468
469       compressLength = 0.0; // reset compressLength to zero for data output validity
470     }
471
472     if (FirstContact) LandingDistanceTraveled += Auxiliary->GetVground()*deltaT;
473
474     if (StartedGroundRun) {
475        TakeoffDistanceTraveled50ft += Auxiliary->GetVground()*deltaT;
476       if (WOW) TakeoffDistanceTraveled += Auxiliary->GetVground()*deltaT;
477     }
478
479     if (ReportEnable && Auxiliary->GetVground() <= 0.05 && !LandingReported) {
480       if (debug_lvl > 0) Report(erLand);
481     }
482
483     if (ReportEnable && !TakeoffReported &&
484        (vLocalGear(eZ) - Propagate->GetDistanceAGL()) < -50.0)
485     {
486       if (debug_lvl > 0) Report(erTakeoff);
487     }
488
489     if (lastWOW != WOW) {
490       PutMessage("GEAR_CONTACT: " + name, WOW);
491     }
492
493     lastWOW = WOW;
494
495 // Crash detection logic (really out-of-bounds detection)
496
497     if (compressLength > 500.0 ||
498         vForce.Magnitude() > 100000000.0 ||
499         vMoment.Magnitude() > 5000000000.0 ||
500         SinkRate > 1.4666*30)
501     {
502       PutMessage("Crash Detected: Simulation FREEZE.");
503       Exec->Freeze();
504     }
505   }
506   return vForce;
507 }
508
509 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
510
511 void FGLGear::Report(ReportType repType)
512 {
513   switch(repType) {
514   case erLand:
515     cout << endl << "Touchdown report for " << name << endl;
516     cout << "  Sink rate at contact:  " << SinkRate                << " fps,    "
517                                 << SinkRate*0.3048          << " mps"     << endl;
518     cout << "  Contact ground speed:  " << GroundSpeed*.5925       << " knots,  "
519                                 << GroundSpeed*0.3048       << " mps"     << endl;
520     cout << "  Maximum contact force: " << MaximumStrutForce       << " lbs,    "
521                                 << MaximumStrutForce*4.448  << " Newtons" << endl;
522     cout << "  Maximum strut travel:  " << MaximumStrutTravel*12.0 << " inches, "
523                                 << MaximumStrutTravel*30.48 << " cm"      << endl;
524     cout << "  Distance traveled:     " << LandingDistanceTraveled        << " ft,     "
525                                 << LandingDistanceTraveled*0.3048  << " meters"  << endl;
526     LandingReported = true;
527     break;
528   case erTakeoff:
529     cout << endl << "Takeoff report for " << name << endl;
530     cout << "  Distance traveled:                " << TakeoffDistanceTraveled
531          << " ft,     " << TakeoffDistanceTraveled*0.3048  << " meters"  << endl;
532     cout << "  Distance traveled (over 50'):     " << TakeoffDistanceTraveled50ft
533          << " ft,     " << TakeoffDistanceTraveled50ft*0.3048 << " meters" << endl;
534     TakeoffReported = true;
535     break;
536   }
537 }
538
539 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
540 //    The bitmasked value choices are as follows:
541 //    unset: In this case (the default) JSBSim would only print
542 //       out the normally expected messages, essentially echoing
543 //       the config files as they are read. If the environment
544 //       variable is not set, debug_lvl is set to 1 internally
545 //    0: This requests JSBSim not to output any messages
546 //       whatsoever.
547 //    1: This value explicity requests the normal JSBSim
548 //       startup messages
549 //    2: This value asks for a message to be printed out when
550 //       a class is instantiated
551 //    4: When this value is set, a message is displayed when a
552 //       FGModel object executes its Run() method
553 //    8: When this value is set, various runtime state variables
554 //       are printed out periodically
555 //    16: When set various parameters are sanity checked and
556 //       a message is printed out when they go out of bounds
557
558 void FGLGear::Debug(int from)
559 {
560   if (debug_lvl <= 0) return;
561
562   if (debug_lvl & 1) { // Standard console startup message output
563     if (from == 0) { // Constructor
564       cout << "    Name: "               << name          << endl;
565       cout << "      Location: "         << vXYZ          << endl;
566       cout << "      Spring Constant:  " << kSpring       << endl;
567       cout << "      Damping Constant: " << bDamp         << endl;
568       cout << "      Dynamic Friction: " << dynamicFCoeff << endl;
569       cout << "      Static Friction:  " << staticFCoeff  << endl;
570       cout << "      Rolling Friction: " << rollingFCoeff << endl;
571       cout << "      Steering Type:    " << sSteerType    << endl;
572       cout << "      Grouping:         " << sBrakeGroup   << endl;
573       cout << "      Max Steer Angle:  " << maxSteerAngle << endl;
574       cout << "      Retractable:      " << sRetractable  << endl;
575     }
576   }
577   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
578     if (from == 0) cout << "Instantiated: FGLGear" << endl;
579     if (from == 1) cout << "Destroyed:    FGLGear" << endl;
580   }
581   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
582   }
583   if (debug_lvl & 8 ) { // Runtime state variables
584   }
585   if (debug_lvl & 16) { // Sanity checking
586   }
587   if (debug_lvl & 64) {
588     if (from == 0) { // Constructor
589       cout << IdSrc << endl;
590       cout << IdHdr << endl;
591     }
592   }
593 }
594
595 } // namespace JSBSim
596