1
0
Fork 0
flightgear/src/FDM/JSBSim/FGLGear.h

292 lines
12 KiB
C
Raw Normal View History

2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1999-12-20 20:25:13 +00:00
Header: FGLGear.h
Author: Jon S. Berndt
Date started: 11/18/99
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU General Public License can also be found on
the world wide web at http://www.gnu.org.
HISTORY
--------------------------------------------------------------------------------
11/18/99 JSB Created
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1999-12-20 20:25:13 +00:00
SENTRY
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
1999-12-20 20:25:13 +00:00
#ifndef FGLGEAR_H
#define FGLGEAR_H
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1999-12-20 20:25:13 +00:00
INCLUDES
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
1999-12-20 20:25:13 +00:00
#ifdef FGFS
2000-02-15 03:30:01 +00:00
# include <simgear/compiler.h>
1999-12-20 20:25:13 +00:00
#endif
#include <string>
2000-04-24 23:49:06 +00:00
#include "FGConfigFile.h"
#include "FGMatrix33.h"
#include "FGColumnVector3.h"
#include "FGColumnVector4.h"
#include "FGFDMExec.h"
#include "FGJSBBase.h"
2000-04-24 23:49:06 +00:00
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1999-12-20 20:25:13 +00:00
DEFINITIONS
2000-11-03 23:02:47 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
1999-12-20 20:25:13 +00:00
2001-03-30 01:04:50 +00:00
#define ID_LGEAR "$Id$"
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
1999-12-20 20:25:13 +00:00
class FGAircraft;
class FGPosition;
2000-05-27 05:48:14 +00:00
class FGRotation;
2001-03-30 01:04:50 +00:00
class FGFCS;
class FGState;
class FGMassBalance;
2000-11-03 23:02:47 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Landing gear model.
Calculates forces and moments due to landing gear reactions. This is done in
several steps, and is dependent on what kind of gear is being modeled. Here
are the parameters that can be specified in the config file for modeling
landing gear:
<p>
<b><u>Physical Characteristics</u></b><br>
<ol>
<li>X, Y, Z location, in inches in structural coordinate frame</li>
<li>Spring constant, in lbs/ft</li>
<li>Damping coefficient, in lbs/ft/sec</li>
<li>Dynamic Friction Coefficient</li>
<li>Static Friction Coefficient</li>
</ol></p><p>
<b><u>Operational Properties</b></u><br>
<ol>
<li>Name</li>
<li>Steerability attribute {one of STEERABLE | FIXED | CASTERED}</li>
<li>Brake Group Membership {one of LEFT | CENTER | RIGHT | NOSE | TAIL | NONE}</li>
<li>Max Steer Angle, in degrees</li>
</ol></p>
<p>
<b><u>Algorithm and Approach to Modeling</u></b><br>
<ol>
<li>Find the location of the uncompressed landing gear relative to the CG of
the aircraft. Remember, the structural coordinate frame that the aircraft is
defined in is: X positive towards the tail, Y positive out the right side, Z
positive upwards. The locations of the various parts are given in inches in
the config file.</li>
<li>The vector giving the location of the gear (relative to the cg) is
rotated 180 degrees about the Y axis to put the coordinates in body frame (X
positive forwards, Y positive out the right side, Z positive downwards, with
the origin at the cg). The lengths are also now given in feet.</li>
<li>The new gear location is now transformed to the local coordinate frame
using the body-to-local matrix. (Mb2l).</li>
<li>Knowing the location of the center of gravity relative to the ground
(height above ground level or AGL) now enables gear deflection to be
calculated. The gear compression value is the local frame gear Z location
value minus the height AGL. [Currently, we make the assumption that the gear
is oriented - and the deflection occurs in - the Z axis only. Additionally,
the vector to the landing gear is currently not modified - which would
(correctly) move the point of contact to the actual compressed-gear point of
contact. Eventually, articulated gear may be modeled, but initially an
effort must be made to model a generic system.] As an example, say the
aircraft left main gear location (in local coordinates) is Z = 3 feet
(positive) and the height AGL is 2 feet. This tells us that the gear is
compressed 1 foot.</li>
<li>If the gear is compressed, a Weight-On-Wheels (WOW) flag is set.</li>
<li>With the compression length calculated, the compression velocity may now
be calculated. This will be used to determine the damping force in the
strut. The aircraft rotational rate is multiplied by the vector to the wheel
to get a wheel velocity in body frame. That velocity vector is then
transformed into the local coordinate frame.</li>
<li>The aircraft cg velocity in the local frame is added to the
just-calculated wheel velocity (due to rotation) to get a total wheel
velocity in the local frame.</li>
<li>The compression speed is the Z-component of the vector.</li>
<li>With the wheel velocity vector no longer needed, it is normalized and
multiplied by a -1 to reverse it. This will be used in the friction force
calculation.</li>
<li>Since the friction force takes place solely in the runway plane, the Z
coordinate of the normalized wheel velocity vector is set to zero.</li>
<li>The gear deflection force (the force on the aircraft acting along the
local frame Z axis) is now calculated given the spring and damper
coefficients, and the gear deflection speed and stroke length. Keep in mind
that gear forces always act in the negative direction (in both local and
body frames), and are not capable of generating a force in the positive
sense (one that would attract the aircraft to the ground). So, the gear
forces are always negative - they are limited to values of zero or less. The
gear force is simply the negative of the sum of the spring compression
length times the spring coefficient and the gear velocity times the damping
coefficient.</li>
<li>The lateral/directional force acting on the aircraft through the landing
2001-03-30 01:04:50 +00:00
2000-11-03 23:02:47 +00:00
gear (along the local frame X and Y axes) is calculated next. First, the
friction coefficient is multiplied by the recently calculated Z-force. This
is the friction force. It must be given direction in addition to magnitude.
We want the components in the local frame X and Y axes. From step 9, above,
the conditioned wheel velocity vector is taken and the X and Y parts are
multiplied by the friction force to get the X and Y components of friction.
</li>
<li>The wheel force in local frame is next converted to body frame.</li>
<li>The moment due to the gear force is calculated by multiplying r x F
(radius to wheel crossed into the wheel force). Both of these operands are
in body frame.</li>
</ol>
@author Jon S. Berndt
@version $Id$
@see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
NASA-Ames", NASA CR-2497, January 1975
@see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
Wiley & Sons, 1979 ISBN 0-471-03032-5
@see W. A. Ragsdale, "A Generic Landing Gear Dynamics Model for LASRS++",
AIAA-2000-4303
2000-11-03 23:02:47 +00:00
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGLGear : public FGJSBBase
1999-12-20 20:25:13 +00:00
{
public:
2000-11-03 23:02:47 +00:00
/// Brake grouping enumerators
2001-03-30 01:04:50 +00:00
enum BrakeGroup {bgNone=0, bgLeft, bgRight, bgCenter, bgNose, bgTail };
/// Steering group membership enumerators
enum SteerType {stSteer, stFixed, stCaster};
2000-11-03 23:02:47 +00:00
/** Constructor
@param Executive a pointer to the parent executive object
@param File a pointer to the config file instance */
FGLGear(FGConfigFile* File, FGFDMExec* Executive);
/** Constructor
@param lgear a reference to an existing FGLGear object */
FGLGear(const FGLGear& lgear);
/// Destructor
2001-03-30 01:04:50 +00:00
~FGLGear();
1999-12-20 20:25:13 +00:00
2000-11-03 23:02:47 +00:00
/// The Force vector for this gear
FGColumnVector3& Force(void);
2000-11-03 23:02:47 +00:00
/// The Moment vector for this gear
FGColumnVector3& Moment(void) {return vMoment;}
2001-03-30 01:04:50 +00:00
2000-11-03 23:02:47 +00:00
/// Gets the location of the gear in Body axes
FGColumnVector3& GetBodyLocation(void) { return vWhlBodyVec; }
2001-11-20 22:34:24 +00:00
double GetBodyLocation(int idx) { return vWhlBodyVec(idx); }
FGColumnVector3& GetLocalGear(void) { return vLocalGear; }
2001-11-20 22:34:24 +00:00
double GetLocalGear(int idx) { return vLocalGear(idx); }
2000-05-27 05:48:14 +00:00
2000-11-03 23:02:47 +00:00
/// Gets the name of the gear
2000-05-27 05:48:14 +00:00
inline string GetName(void) {return name; }
2000-11-03 23:02:47 +00:00
/// Gets the Weight On Wheels flag value
2000-05-27 05:48:14 +00:00
inline bool GetWOW(void) {return WOW; }
2000-11-03 23:02:47 +00:00
/// Gets the current compressed length of the gear in feet
2001-11-20 22:34:24 +00:00
inline double GetCompLen(void) {return compressLength;}
2000-11-03 23:02:47 +00:00
/// Gets the current gear compression velocity in ft/sec
2001-11-20 22:34:24 +00:00
inline double GetCompVel(void) {return compressSpeed; }
2000-11-03 23:02:47 +00:00
/// Gets the gear compression force in pounds
2001-11-20 22:34:24 +00:00
inline double GetCompForce(void) {return Force()(3); }
inline double GetBrakeFCoeff(void) {return BrakeFCoeff;}
2000-10-02 23:07:30 +00:00
2000-11-03 23:02:47 +00:00
/// Sets the brake value in percent (0 - 100)
inline void SetBrake(double bp) {brakePct = bp;}
2000-11-03 23:02:47 +00:00
/** Set the console touchdown reporting feature
@param flag true turns on touchdown reporting, false turns it off */
inline void SetReport(bool flag) { ReportEnable = flag; }
/** Get the console touchdown reporting feature
@return true if reporting is turned on */
2000-10-02 23:07:30 +00:00
inline bool GetReport(void) { return ReportEnable; }
2001-11-20 22:34:24 +00:00
inline double GetSteerAngle(void) { return SteerAngle;}
inline double GetstaticFCoeff(void) { return staticFCoeff;}
2001-11-06 22:33:05 +00:00
inline int GetBrakeGroup(void) { return (int)eBrakeGrp; }
inline int GetSteerType(void) { return (int)eSteerType; }
1999-12-20 20:25:13 +00:00
private:
FGColumnVector3 vXYZ;
FGColumnVector3 vMoment;
FGColumnVector3 vWhlBodyVec;
FGColumnVector3 vLocalGear;
FGColumnVector3 vForce;
FGColumnVector3 vLocalForce;
FGColumnVector3 vWhlVelVec; // Velocity of this wheel (Local)
2001-11-20 22:34:24 +00:00
double SteerAngle;
double kSpring;
double bDamp;
double compressLength;
double compressSpeed;
double staticFCoeff, dynamicFCoeff, rollingFCoeff;
double brakePct;
double BrakeFCoeff;
double maxCompLen;
2000-07-06 21:02:46 +00:00
double SinkRate;
double GroundSpeed;
double DistanceTraveled;
double MaximumStrutForce;
double MaximumStrutTravel;
2000-05-27 05:48:14 +00:00
bool WOW;
2001-11-20 22:34:24 +00:00
bool lastWOW;
2000-07-06 21:02:46 +00:00
bool FirstContact;
bool Reported;
2000-10-02 23:07:30 +00:00
bool ReportEnable;
1999-12-20 20:25:13 +00:00
string name;
2001-03-30 01:04:50 +00:00
string sSteerType;
string sBrakeGroup;
BrakeGroup eBrakeGrp;
SteerType eSteerType;
2001-11-20 22:34:24 +00:00
double maxSteerAngle;
2000-05-27 05:48:14 +00:00
2001-03-30 01:04:50 +00:00
FGFDMExec* Exec;
FGState* State;
FGAircraft* Aircraft;
FGPosition* Position;
FGRotation* Rotation;
FGFCS* FCS;
FGMassBalance* MassBalance;
2000-07-06 21:02:46 +00:00
void Report(void);
2001-03-30 01:04:50 +00:00
void Debug(void);
1999-12-20 20:25:13 +00:00
};
#include "FGAircraft.h"
#include "FGPosition.h"
2000-05-27 05:48:14 +00:00
#include "FGRotation.h"
2001-03-30 01:04:50 +00:00
#include "FGFCS.h"
#include "FGMassBalance.h"
2000-11-03 23:02:47 +00:00
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#include "FGState.h"
2000-02-15 03:30:01 +00:00
#endif