1 /*******************************************************************************
6 Purpose: Encapsulates the landing gear elements
9 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU General Public License as published by the Free Software
13 Foundation; either version 2 of the License, or (at your option) any later
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21 You should have received a copy of the GNU General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23 Place - Suite 330, Boston, MA 02111-1307, USA.
25 Further information about the GNU General Public License can also be found on
26 the world wide web at http://www.gnu.org.
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
32 --------------------------------------------------------------------------------
35 ********************************************************************************
37 *******************************************************************************/
42 /*******************************************************************************
43 ************************************ CODE **************************************
44 *******************************************************************************/
47 FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : vXYZ(3),
53 *AC_cfg >> tmp >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3)
54 >> kSpring >> bDamp >> statFCoeff >> brakeCoeff;
57 cout << " Name: " << name << endl;
58 cout << " Location: " << vXYZ << endl;
59 cout << " Spring Constant: " << kSpring << endl;
60 cout << " Damping Constant: " << bDamp << endl;
61 cout << " Rolling Resistance: " << statFCoeff << endl;
62 cout << " Braking Coeff: " << brakeCoeff << endl;
64 State = Exec->GetState();
65 Aircraft = Exec->GetAircraft();
66 Position = Exec->GetPosition();
67 Rotation = Exec->GetRotation();
74 DistanceTraveled = 0.0;
75 MaximumStrutForce = MaximumStrutTravel = 0.0;
79 /******************************************************************************/
81 FGLGear::~FGLGear(void)
85 /******************************************************************************/
87 FGColumnVector FGLGear::Force(void)
89 FGColumnVector vForce(3);
90 FGColumnVector vLocalForce(3);
91 FGColumnVector vLocalGear(3); // Vector: CG to this wheel (Local)
92 FGColumnVector vWhlVelVec(3); // Velocity of this wheel (Local)
94 vWhlBodyVec = (vXYZ - Aircraft->GetXYZcg()) / 12.0;
95 vWhlBodyVec(eX) = -vWhlBodyVec(eX);
96 vWhlBodyVec(eZ) = -vWhlBodyVec(eZ);
98 vLocalGear = State->GetTb2l() * vWhlBodyVec;
100 compressLength = vLocalGear(eZ) - Position->GetDistanceAGL();
102 if (compressLength > 0.00) {
105 vWhlVelVec = State->GetTb2l() * (Rotation->GetPQR() * vWhlBodyVec);
106 vWhlVelVec += Position->GetVel();
108 compressSpeed = vWhlVelVec(eZ);
112 SinkRate = compressSpeed;
113 GroundSpeed = Position->GetVel().Magnitude();
116 vWhlVelVec = -1.0 * vWhlVelVec.Normalize();
117 vWhlVelVec(eZ) = 0.00;
119 vLocalForce(eZ) = min(-compressLength * kSpring - compressSpeed * bDamp, (float)0.0);
120 vLocalForce(eX) = fabs(vLocalForce(eZ) * statFCoeff) * vWhlVelVec(eX);
121 vLocalForce(eY) = fabs(vLocalForce(eZ) * statFCoeff) * vWhlVelVec(eY);
123 MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ)));
124 MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength));
126 vForce = State->GetTl2b() * vLocalForce ;
127 vMoment = vWhlBodyVec * vForce;
128 cout << " Force: " << vForce << endl;
129 cout << " Moment: " << vMoment << endl;
136 if (Position->GetDistanceAGL() > 200.0) {
137 FirstContact = false;
139 DistanceTraveled = 0.0;
140 MaximumStrutForce = MaximumStrutTravel = 0.0;
144 vMoment.InitMatrix();
148 DistanceTraveled += Position->GetVel().Magnitude()*State->Getdt()*Aircraft->GetRate();
151 if (ReportEnable && Position->GetVel().Magnitude() <= 0.05 && !Reported) {
157 /******************************************************************************/
159 void FGLGear::Report(void)
161 cout << endl << "Touchdown report for " << name << endl;
162 cout << " Sink rate at contact: " << SinkRate << " fps, "
163 << SinkRate*0.3408 << " mps" << endl;
164 cout << " Contact ground speed: " << GroundSpeed*.5925 << " knots, "
165 << GroundSpeed*0.3408 << " mps" << endl;
166 cout << " Maximum contact force: " << MaximumStrutForce << " lbs, "
167 << MaximumStrutForce*4.448 << " Newtons" << endl;
168 cout << " Maximum strut travel: " << MaximumStrutTravel*12.0 << " inches, "
169 << MaximumStrutTravel*30.48 << " cm" << endl;
170 cout << " Distance traveled: " << DistanceTraveled << " ft, "
171 << DistanceTraveled*0.3408 << " meters" << endl;