1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7 Purpose: Encapsulates the landing gear elements
10 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
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
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
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.
26 Further information about the GNU General Public License can also be found on
27 the world wide web at http://www.gnu.org.
29 FUNCTIONAL DESCRIPTION
30 --------------------------------------------------------------------------------
33 --------------------------------------------------------------------------------
35 01/30/01 NHP Extended gear model to properly simulate steering and braking
37 /%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
53 static const char *IdSrc = "$Id$";
54 static const char *IdHdr = ID_LGEAR;
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number) : Exec(fdmex),
63 Element *force_table=0;
66 kSpring = bDamp = bDampRebound = dynamicFCoeff = staticFCoeff = rollingFCoeff = maxSteerAngle = 0;
67 sSteerType = sBrakeGroup = sSteerType = "";
70 name = el->GetAttributeValue("name");
71 sContactType = el->GetAttributeValue("type");
72 if (el->FindElement("spring_coeff"))
73 kSpring = el->FindElementValueAsNumberConvertTo("spring_coeff", "LBS/FT");
74 if (el->FindElement("damping_coeff"))
75 bDamp = el->FindElementValueAsNumberConvertTo("damping_coeff", "LBS/FT/SEC");
77 if (el->FindElement("damping_coeff_rebound"))
78 bDampRebound = el->FindElementValueAsNumberConvertTo("damping_coeff_rebound", "LBS/FT/SEC");
82 if (el->FindElement("dynamic_friction"))
83 dynamicFCoeff = el->FindElementValueAsNumber("dynamic_friction");
84 if (el->FindElement("static_friction"))
85 staticFCoeff = el->FindElementValueAsNumber("static_friction");
86 if (el->FindElement("rolling_friction"))
87 rollingFCoeff = el->FindElementValueAsNumber("rolling_friction");
88 if (el->FindElement("max_steer"))
89 maxSteerAngle = el->FindElementValueAsNumberConvertTo("max_steer", "DEG");
90 if (el->FindElement("retractable"))
91 isRetractable = (int)el->FindElementValueAsNumber("retractable");
94 force_table = el->FindElement("table");
96 force_type = force_table->GetAttributeValue("type");
97 if (force_type == "CORNERING_COEFF") {
98 ForceY_Table = new FGTable(Exec->GetPropertyManager(), force_table);
100 cerr << "Undefined force table for " << name << " contact point" << endl;
102 force_table = el->FindNextElement("table");
105 sBrakeGroup = el->FindElementValue("brake_group");
107 if (maxSteerAngle == 360) sSteerType = "CASTERED";
108 else if (maxSteerAngle == 0.0) sSteerType = "FIXED";
109 else sSteerType = "STEERABLE";
111 Element* element = el->FindElement("location");
112 if (element) vXYZ = element->FindElementTripletConvertTo("IN");
113 else {cerr << "No location given for contact " << name << endl; exit(-1);}
115 if (sBrakeGroup == "LEFT" ) eBrakeGrp = bgLeft;
116 else if (sBrakeGroup == "RIGHT" ) eBrakeGrp = bgRight;
117 else if (sBrakeGroup == "CENTER") eBrakeGrp = bgCenter;
118 else if (sBrakeGroup == "NOSE" ) eBrakeGrp = bgNose;
119 else if (sBrakeGroup == "TAIL" ) eBrakeGrp = bgTail;
120 else if (sBrakeGroup == "NONE" ) eBrakeGrp = bgNone;
121 else if (sBrakeGroup.empty() ) {eBrakeGrp = bgNone;
122 sBrakeGroup = "NONE (defaulted)";}
124 cerr << "Improper braking group specification in config file: "
125 << sBrakeGroup << " is undefined." << endl;
128 if (sSteerType == "STEERABLE") eSteerType = stSteer;
129 else if (sSteerType == "FIXED" ) eSteerType = stFixed;
130 else if (sSteerType == "CASTERED" ) eSteerType = stCaster;
131 else if (sSteerType.empty() ) {eSteerType = stFixed;
132 sSteerType = "FIXED (defaulted)";}
134 cerr << "Improper steering type specification in config file: "
135 << sSteerType << " is undefined." << endl;
142 // Add some AI here to determine if gear is located properly according to its
143 // brake group type ??
145 State = Exec->GetState();
146 Aircraft = Exec->GetAircraft();
147 Propagate = Exec->GetPropagate();
148 Auxiliary = Exec->GetAuxiliary();
149 FCS = Exec->GetFCS();
150 MassBalance = Exec->GetMassBalance();
152 WOW = lastWOW = true; // should the value be initialized to true?
154 FirstContact = false;
155 StartedGroundRun = false;
156 TakeoffReported = LandingReported = false;
157 LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
158 MaximumStrutForce = MaximumStrutTravel = 0.0;
159 SideForce = RollingForce = 0.0;
160 SinkRate = GroundSpeed = 0.0;
162 vWhlBodyVec = MassBalance->StructuralToBody(vXYZ);
164 vLocalGear = Propagate->GetTb2l() * vWhlBodyVec;
166 compressLength = 0.0;
171 WheelSlip = last_WheelSlip = 0.0;
172 slipIn = last_SlipIn = 0;
173 TirePressureNorm = 1.0;
178 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 FGLGear::FGLGear(const FGLGear& lgear)
182 GearNumber = lgear.GearNumber;
184 Aircraft = lgear.Aircraft;
185 Propagate = lgear.Propagate;
186 Auxiliary = lgear.Auxiliary;
189 MassBalance = lgear.MassBalance;
192 vMoment = lgear.vMoment;
193 vWhlBodyVec = lgear.vWhlBodyVec;
194 vLocalGear = lgear.vLocalGear;
197 lastWOW = lgear.lastWOW;
198 ReportEnable = lgear.ReportEnable;
199 FirstContact = lgear.FirstContact;
200 StartedGroundRun = lgear.StartedGroundRun;
201 LandingDistanceTraveled = lgear.LandingDistanceTraveled;
202 TakeoffDistanceTraveled = lgear.TakeoffDistanceTraveled;
203 TakeoffDistanceTraveled50ft = lgear.TakeoffDistanceTraveled50ft;
204 MaximumStrutForce = lgear.MaximumStrutForce;
205 MaximumStrutTravel = lgear.MaximumStrutTravel;
206 SideForce = lgear.SideForce;
207 RollingForce = lgear.RollingForce;
209 kSpring = lgear.kSpring;
211 bDampRebound = lgear.bDampRebound;
212 compressLength = lgear.compressLength;
213 compressSpeed = lgear.compressSpeed;
214 staticFCoeff = lgear.staticFCoeff;
215 dynamicFCoeff = lgear.dynamicFCoeff;
216 rollingFCoeff = lgear.rollingFCoeff;
217 brakePct = lgear.brakePct;
218 maxCompLen = lgear.maxCompLen;
219 SinkRate = lgear.SinkRate;
220 GroundSpeed = lgear.GroundSpeed;
221 LandingReported = lgear.LandingReported;
222 TakeoffReported = lgear.TakeoffReported;
224 sSteerType = lgear.sSteerType;
225 sRetractable = lgear.sRetractable;
226 sContactType = lgear.sContactType;
227 sBrakeGroup = lgear.sBrakeGroup;
228 eSteerType = lgear.eSteerType;
229 eBrakeGrp = lgear.eBrakeGrp;
230 maxSteerAngle = lgear.maxSteerAngle;
231 isRetractable = lgear.isRetractable;
232 GearUp = lgear.GearUp;
233 GearDown = lgear.GearDown;
234 WheelSlip = lgear.WheelSlip;
235 TirePressureNorm = lgear.TirePressureNorm;
236 Servicable = lgear.Servicable;
237 ForceY_Table = lgear.ForceY_Table;
238 CosWheel = lgear.CosWheel;
239 SinWheel = lgear.SinWheel;
241 prevIn = lgear.prevIn;
242 prevOut = lgear.prevOut;
243 slipIn = lgear.slipIn;
244 last_SlipIn = lgear.last_SlipIn;
245 last_WheelSlip = lgear.last_WheelSlip;
248 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
255 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
257 FGColumnVector3& FGLGear::Force(void)
259 FGColumnVector3 normal, cvel;
260 FGLocation contact, gearLoc;
261 double t = Exec->GetState()->Getsim_time();
264 vMoment.InitMatrix();
266 if (isRetractable) ComputeRetractionState();
268 if (GearUp) return vForce;
270 vWhlBodyVec = MassBalance->StructuralToBody(vXYZ); // Get wheel in body frame
271 vLocalGear = Propagate->GetTb2l() * vWhlBodyVec; // Get local frame wheel location
273 gearLoc = Propagate->GetLocation().LocalToLocation(vLocalGear);
274 compressLength = -Exec->GetGroundCallback()->GetAGLevel(t, gearLoc, contact, normal, cvel);
276 // The compression length is measured in the Z-axis, only, at this time.
278 if (compressLength > 0.00) {
282 // [The next equation should really use the vector to the contact patch of
283 // the tire including the strut compression and not the original vWhlBodyVec.]
285 vWhlVelVec = Propagate->GetTb2l() * (Propagate->GetPQR() * vWhlBodyVec);
286 vWhlVelVec += Propagate->GetVel() - cvel;
287 compressSpeed = vWhlVelVec(eZ);
289 InitializeReporting();
290 ComputeBrakeForceCoefficient();
291 ComputeSteeringAngle();
293 ComputeSideForceCoefficient();
294 ComputeVerticalStrutForce();
296 // Compute the forces in the wheel ground plane.
298 RollingForce = (1.0 - TirePressureNorm) * 30
299 + vLocalForce(eZ) * BrakeFCoeff * (RollingWhlVel>=0?1.0:-1.0);
300 SideForce = vLocalForce(eZ) * FCoeff;
302 // Transform these forces back to the local reference frame.
304 vLocalForce(eX) = RollingForce*CosWheel - SideForce*SinWheel;
305 vLocalForce(eY) = SideForce*CosWheel + RollingForce*SinWheel;
307 // Transform the forces back to the body frame and compute the moment.
309 vForce = Propagate->GetTl2b() * vLocalForce;
311 // Lag and attenuate the XY-plane forces dependent on velocity
313 double RFRV = 0.015; // Rolling force relaxation velocity
314 double SFRV = 0.25; // Side force relaxation velocity
315 double dT = State->Getdt()*Exec->GetGroundReactions()->GetRate();
318 vForce(eX) = (0.25)*(In(eX) + prevIn(eX)) + (0.50)*prevOut(eX);
319 vForce(eY) = (0.15)*(In(eY) + prevIn(eY)) + (0.70)*prevOut(eY);
323 if (fabs(RollingWhlVel) <= RFRV) vForce(eX) *= fabs(RollingWhlVel)/RFRV;
324 if (fabs(SideWhlVel) <= SFRV) vForce(eY) *= fabs(SideWhlVel)/SFRV;
326 vMoment = vWhlBodyVec * vForce;
328 } else { // Gear is NOT compressed
331 compressLength = 0.0;
333 // Return to neutral position between 1.0 and 0.8 gear pos.
334 SteerAngle *= max(FCS->GetGearPos()-0.8, 0.0)/0.2;
339 ReportTakeoffOrLanding();
345 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
347 void FGLGear::ComputeRetractionState(void)
349 if (FCS->GetGearPos() < 0.01) {
352 } else if (FCS->GetGearPos() > 0.99) {
361 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
363 void FGLGear::ComputeSlipAngle(void)
365 double dT = State->Getdt()*Exec->GetGroundReactions()->GetRate();
367 // Transform the wheel velocities from the local axis system to the wheel axis system.
369 RollingWhlVel = vWhlVelVec(eX)*CosWheel + vWhlVelVec(eY)*SinWheel;
370 SideWhlVel = vWhlVelVec(eY)*CosWheel - vWhlVelVec(eX)*SinWheel;
372 // Calculate tire slip angle.
374 if (fabs(RollingWhlVel) < 0.1 && fabs(SideWhlVel) < 0.01) {
375 WheelSlip = -SteerAngle*radtodeg;
377 WheelSlip = atan2(SideWhlVel, fabs(RollingWhlVel))*radtodeg;
380 WheelSlip = (0.46)*(slipIn + last_SlipIn) + (0.08)*last_WheelSlip;
381 last_WheelSlip = WheelSlip;
382 last_SlipIn = slipIn;
385 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
386 // Compute the steering angle in any case.
387 // This will also make sure that animations will look right.
389 void FGLGear::ComputeSteeringAngle(void)
391 switch (eSteerType) {
393 SteerAngle = degtorad * FCS->GetSteerPosDeg(GearNumber);
399 // This is not correct for castering gear. Should make steer angle parallel
400 // to the actual velocity vector of the wheel, given aircraft velocity vector
405 cerr << "Improper steering type membership detected for this gear." << endl;
409 SinWheel = sin(Propagate->GetEuler(ePsi) + SteerAngle);
410 CosWheel = cos(Propagate->GetEuler(ePsi) + SteerAngle);
413 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
414 // Reset reporting functionality after takeoff
416 void FGLGear::ResetReporting(void)
418 if (Propagate->GetDistanceAGL() > 200.0) {
419 FirstContact = false;
420 StartedGroundRun = false;
421 LandingReported = false;
422 LandingDistanceTraveled = 0.0;
423 MaximumStrutForce = MaximumStrutTravel = 0.0;
427 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
429 void FGLGear::InitializeReporting(void)
431 // If this is the first time the wheel has made contact, remember some values
432 // for later printout.
436 SinkRate = compressSpeed;
437 GroundSpeed = Propagate->GetVel().Magnitude();
438 TakeoffReported = false;
441 // If the takeoff run is starting, initialize.
443 if ((Propagate->GetVel().Magnitude() > 0.1) &&
444 (FCS->GetBrake(bgLeft) == 0) &&
445 (FCS->GetBrake(bgRight) == 0) &&
446 (FCS->GetThrottlePos(0) == 1) && !StartedGroundRun)
448 TakeoffDistanceTraveled = 0;
449 TakeoffDistanceTraveled50ft = 0;
450 StartedGroundRun = true;
454 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
455 // Takeoff and landing reporting functionality
457 void FGLGear::ReportTakeoffOrLanding(void)
459 double deltaT = State->Getdt()*Exec->GetGroundReactions()->GetRate();
461 if (FirstContact) LandingDistanceTraveled += Auxiliary->GetVground()*deltaT;
463 if (StartedGroundRun) {
464 TakeoffDistanceTraveled50ft += Auxiliary->GetVground()*deltaT;
465 if (WOW) TakeoffDistanceTraveled += Auxiliary->GetVground()*deltaT;
468 if (ReportEnable && Auxiliary->GetVground() <= 0.05 && !LandingReported) {
469 if (debug_lvl > 0) Report(erLand);
472 if (ReportEnable && !TakeoffReported &&
473 (vLocalGear(eZ) - Propagate->GetDistanceAGL()) < -50.0)
475 if (debug_lvl > 0) Report(erTakeoff);
478 if (lastWOW != WOW) PutMessage("GEAR_CONTACT: " + name, WOW);
482 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
483 // Crash detection logic (really out-of-bounds detection)
485 void FGLGear::CrashDetect(void)
487 if (compressLength > 500.0 ||
488 vForce.Magnitude() > 100000000.0 ||
489 vMoment.Magnitude() > 5000000000.0 ||
490 SinkRate > 1.4666*30)
492 PutMessage("Crash Detected: Simulation FREEZE.");
493 State->SuspendIntegration();
497 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
498 // The following needs work regarding friction coefficients and braking and
499 // steering The BrakeFCoeff formula assumes that an anti-skid system is used.
500 // It also assumes that we won't be turning and braking at the same time.
501 // Will fix this later.
502 // [JSB] The braking force coefficients include normal rolling coefficient +
503 // a percentage of the static friction coefficient based on braking applied.
505 void FGLGear::ComputeBrakeForceCoefficient(void)
509 BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) +
510 staticFCoeff*FCS->GetBrake(bgLeft) );
513 BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgRight)) +
514 staticFCoeff*FCS->GetBrake(bgRight) );
517 BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
518 staticFCoeff*FCS->GetBrake(bgCenter) );
521 BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
522 staticFCoeff*FCS->GetBrake(bgCenter) );
525 BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
526 staticFCoeff*FCS->GetBrake(bgCenter) );
529 BrakeFCoeff = rollingFCoeff;
532 cerr << "Improper brake group membership detected for this gear." << endl;
537 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
538 // Compute the sideforce coefficients using similar assumptions to LaRCSim for now.
539 // Allow a maximum of 10 degrees tire slip angle before wheel slides. At that point,
540 // transition from static to dynamic friction. There are more complicated formulations
541 // of this that avoid the discrete jump (similar to Pacejka). Will fix this later.
543 void FGLGear::ComputeSideForceCoefficient(void)
547 FCoeff = ForceY_Table->GetValue(WheelSlip);
551 if (fabs(WheelSlip) <= 10.0) {
552 FCoeff = staticFCoeff*WheelSlip/10.0;
553 } else if (fabs(WheelSlip) <= 40.0) {
554 FCoeff = (dynamicFCoeff*(fabs(WheelSlip) - 10.0)/10.0
555 + staticFCoeff*(40.0 - fabs(WheelSlip))/10.0)*(WheelSlip>=0?1.0:-1.0);
557 FCoeff = dynamicFCoeff*(WheelSlip>=0?1.0:-1.0);
562 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
563 // Compute the vertical force on the wheel using square-law damping (per comment
564 // in paper AIAA-2000-4303 - see header prologue comments). We might consider
565 // allowing for both square and linear damping force calculation. Also need to
566 // possibly give a "rebound damping factor" that differs from the compression
569 void FGLGear::ComputeVerticalStrutForce(void)
571 double springForce = 0;
572 double dampForce = 0;
574 springForce = -compressLength * kSpring;
576 if (compressSpeed >= 0.0) {
577 dampForce = -compressSpeed * bDamp;
579 dampForce = -compressSpeed * bDampRebound;
581 vLocalForce(eZ) = min(springForce + dampForce, (double)0.0);
583 // Remember these values for reporting
584 MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ)));
585 MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength));
588 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
590 void FGLGear::bind(void)
592 char property_name[80];
593 snprintf(property_name, 80, "gear/unit[%d]/slip-angle-deg", GearNumber);
594 Exec->GetPropertyManager()->Tie( property_name, &WheelSlip );
597 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
599 void FGLGear::unbind(void)
601 char property_name[80];
602 snprintf(property_name, 80, "gear/unit[%d]/slip-angle-deg", GearNumber);
603 Exec->GetPropertyManager()->Untie( property_name );
606 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
608 void FGLGear::Report(ReportType repType)
612 cout << endl << "Touchdown report for " << name << endl;
613 cout << " Sink rate at contact: " << SinkRate << " fps, "
614 << SinkRate*0.3048 << " mps" << endl;
615 cout << " Contact ground speed: " << GroundSpeed*.5925 << " knots, "
616 << GroundSpeed*0.3048 << " mps" << endl;
617 cout << " Maximum contact force: " << MaximumStrutForce << " lbs, "
618 << MaximumStrutForce*4.448 << " Newtons" << endl;
619 cout << " Maximum strut travel: " << MaximumStrutTravel*12.0 << " inches, "
620 << MaximumStrutTravel*30.48 << " cm" << endl;
621 cout << " Distance traveled: " << LandingDistanceTraveled << " ft, "
622 << LandingDistanceTraveled*0.3048 << " meters" << endl;
623 LandingReported = true;
626 cout << endl << "Takeoff report for " << name << endl;
627 cout << " Distance traveled: " << TakeoffDistanceTraveled
628 << " ft, " << TakeoffDistanceTraveled*0.3048 << " meters" << endl;
629 cout << " Distance traveled (over 50'): " << TakeoffDistanceTraveled50ft
630 << " ft, " << TakeoffDistanceTraveled50ft*0.3048 << " meters" << endl;
631 TakeoffReported = true;
636 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
637 // The bitmasked value choices are as follows:
638 // unset: In this case (the default) JSBSim would only print
639 // out the normally expected messages, essentially echoing
640 // the config files as they are read. If the environment
641 // variable is not set, debug_lvl is set to 1 internally
642 // 0: This requests JSBSim not to output any messages
644 // 1: This value explicity requests the normal JSBSim
646 // 2: This value asks for a message to be printed out when
647 // a class is instantiated
648 // 4: When this value is set, a message is displayed when a
649 // FGModel object executes its Run() method
650 // 8: When this value is set, various runtime state variables
651 // are printed out periodically
652 // 16: When set various parameters are sanity checked and
653 // a message is printed out when they go out of bounds
655 void FGLGear::Debug(int from)
657 if (debug_lvl <= 0) return;
659 if (debug_lvl & 1) { // Standard console startup message output
660 if (from == 0) { // Constructor - loading and initialization
661 cout << " " << sContactType << " " << name << endl;
662 cout << " Location: " << vXYZ << endl;
663 cout << " Spring Constant: " << kSpring << endl;
664 cout << " Damping Constant: " << bDamp << endl;
665 cout << " Dynamic Friction: " << dynamicFCoeff << endl;
666 cout << " Static Friction: " << staticFCoeff << endl;
667 if (sContactType == "BOGEY") {
668 cout << " Rolling Friction: " << rollingFCoeff << endl;
669 cout << " Steering Type: " << sSteerType << endl;
670 cout << " Grouping: " << sBrakeGroup << endl;
671 cout << " Max Steer Angle: " << maxSteerAngle << endl;
672 cout << " Retractable: " << isRetractable << endl;
676 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
677 if (from == 0) cout << "Instantiated: FGLGear" << endl;
678 if (from == 1) cout << "Destroyed: FGLGear" << endl;
680 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
682 if (debug_lvl & 8 ) { // Runtime state variables
684 if (debug_lvl & 16) { // Sanity checking
686 if (debug_lvl & 64) {
687 if (from == 0) { // Constructor
688 cout << IdSrc << endl;
689 cout << IdHdr << endl;
694 } // namespace JSBSim