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