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),
52 *AC_cfg >> tmp >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3) >> kSpring >> bDamp
53 >> statFCoeff >> brakeCoeff;
54 State = Exec->GetState();
55 Aircraft = Exec->GetAircraft();
56 Position = Exec->GetPosition();
57 Rotation = Exec->GetRotation();
63 /******************************************************************************/
65 FGLGear::~FGLGear(void)
69 /******************************************************************************/
71 FGColumnVector FGLGear::Force(void)
73 static FGColumnVector vForce(3);
74 static FGColumnVector vLocalForce(3);
75 static FGColumnVector vLocalGear(3);
76 static FGColumnVector vWhlBodyVec(3);
77 static FGColumnVector vWhlVelVec(3);
79 vWhlBodyVec = vXYZ - Aircraft->GetXYZcg();
80 vWhlBodyVec(eX) = -vWhlBodyVec(eX);
81 vWhlBodyVec(eZ) = -vWhlBodyVec(eZ);
82 vWhlBodyVec = vWhlBodyVec/12.0;
84 vLocalGear = State->GetTb2l() * vWhlBodyVec;
86 compressLength = vLocalGear(eZ) - Position->GetDistanceAGL();
88 if (compressLength > 0.00) {
92 vWhlVelVec = State->GetTb2l() * (Rotation->GetPQR() * vWhlBodyVec);
93 compressSpeed = vWhlVelVec(eZ) + Position->GetVd();
95 vLocalForce(eZ) = min(-compressLength * kSpring - compressSpeed * bDamp, (float)0.0);
97 vForce = State->GetTl2b() * vLocalForce ;
99 // currently only aircraft body axis Z-force modeled
100 vMoment(eX) = vForce(eZ) * vWhlBodyVec(eY);
101 vMoment(eY) = -vForce(eZ) * vWhlBodyVec(eX);
108 vMoment.InitMatrix();
115 /******************************************************************************/