⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fginitialcondition.h

📁 6 DOF Missle Simulation
💻 H
📖 第 1 页 / 共 2 页
字号:
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Header:       FGInitialCondition.h Author:       Tony Peden Date started: 7/1/99 ------------- Copyright (C) 1999  Anthony K. Peden (apeden@earthlink.net) ------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on the world wide web at http://www.gnu.org. HISTORY--------------------------------------------------------------------------------7/1/99   TP   CreatedFUNCTIONAL DESCRIPTION--------------------------------------------------------------------------------The purpose of this class is to take a set of initial conditions and providea kinematically consistent set of body axis velocity components, eulerangles, and altitude.  This class does not attempt to trim the model i.e.the sim will most likely start in a very dynamic state (unless, of course,you have chosen your IC's wisely) even after setting it up with this class.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%SENTRY%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/#ifndef FGINITIALCONDITION_H#define FGINITIALCONDITION_H/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%INCLUDES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/#include <FGFDMExec.h>#include <FGJSBBase.h>#include <math/FGColumnVector3.h>#include <input_output/FGXMLFileRead.h>/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%DEFINITIONS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/#define ID_INITIALCONDITION "$Id$"/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%FORWARD DECLARATIONS%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/namespace JSBSim {typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;typedef enum { setwned, setwmd, setwhc } windset;/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CLASS DOCUMENTATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*//** Initializes the simulation run.    Takes a set of initial conditions (IC) and provide a kinematically consistent set    of body axis velocity components, euler angles, and altitude.  This class    does not attempt to trim the model i.e. the sim will most likely start in a    very dynamic state (unless, of course, you have chosen your IC's wisely, or    started on the ground) even after setting it up with this class.   <h3>Usage Notes</h3>   With a valid object of FGFDMExec and an aircraft model loaded:   @code   FGInitialCondition fgic=new FGInitialCondition(FDMExec);   fgic->SetVcalibratedKtsIC()   fgic->SetAltitudeFtIC();   // directly into Run   FDMExec->GetState()->Initialize(fgic)   delete fgic;   FDMExec->Run()   //or to loop the sim w/o integrating   FDMExec->RunIC(fgic)   @endcode   <h3>Speed</h3>   Since vc, ve, vt, and mach all represent speed, the remaining   three are recalculated each time one of them is set (using the   current altitude).  The most recent speed set is remembered so   that if and when altitude is reset, the last set speed is used   to recalculate the remaining three. Setting any of the body   components forces a recalculation of vt and vt then becomes the   most recent speed set.   <h3>Alpha,Gamma, and Theta</h3>   This class assumes that it will be used to set up the sim for a   steady, zero pitch rate condition. Since any two of those angles   specifies the third gamma (flight path angle) is favored when setting   alpha and theta and alpha is favored when setting gamma. i.e.   - set alpha : recalculate theta using gamma as currently set   - set theta : recalculate alpha using gamma as currently set   - set gamma : recalculate theta using alpha as currently set   The idea being that gamma is most interesting to pilots (since it   is indicative of climb rate).   Setting climb rate is, for the purpose of this discussion,   considered equivalent to setting gamma.   These are the items that can be set in an initialization file:   - ubody (velocity, ft/sec)   - vbody (velocity, ft/sec)   - wbody (velocity, ft/sec)   - vnorth (velocity, ft/sec)   - veast (velocity, ft/sec)   - vdown (velocity, ft/sec)   - latitude (position, degrees)   - longitude (position, degrees)   - phi (orientation, degrees)   - theta (orientation, degrees)   - psi (orientation, degrees)   - alpha (angle, degrees)   - beta (angle, degrees)   - gamma (angle, degrees)   - roc (vertical velocity, ft/sec)   - altitude (altitude, ft)   - winddir (wind from-angle, degrees)   - vwind (magnitude wind speed, ft/sec)   - hwind (headwind speed, knots)   - xwind (crosswind speed, knots)   - vc (calibrated airspeed, ft/sec)   - mach (mach)   - vground (ground speed, ft/sec)   - running (0 or 1)   <h3>Properties</h3>   @property ic/vc-kts (read/write) Calibrated airspeed initial condition in knots   @property ic/ve-kts (read/write) Knots equivalent airspeed initial condition   @property ic/vg-kts (read/write) Ground speed initial condition in knots   @property ic/vt-kts (read/write) True airspeed initial condition in knots   @property ic/mach (read/write) Mach initial condition   @property ic/roc-fpm (read/write) Rate of climb initial condition in feet/minute   @property ic/gamma-deg (read/write) Flightpath angle initial condition in degrees   @property ic/alpha-deg (read/write) Angle of attack initial condition in degrees   @property ic/beta-deg (read/write) Angle of sideslip initial condition in degrees   @property ic/theta-deg (read/write) Pitch angle initial condition in degrees   @property ic/phi-deg (read/write) Roll angle initial condition in degrees   @property ic/psi-true-deg (read/write) Heading angle initial condition in degrees   @property ic/lat-gc-deg (read/write) Latitude initial condition in degrees   @property ic/long-gc-deg (read/write) Longitude initial condition in degrees   @property ic/h-sl-ft (read/write) Height above sea level initial condition in feet   @property ic/h-agl-ft (read/write) Height above ground level initial condition in feet   @property ic/sea-level-radius-ft (read/write) Radius of planet at sea level in feet   @property ic/terrain-altitude-ft (read/write) Terrain elevation above sea level in feet   @property ic/vg-fps (read/write) Ground speed initial condition in feet/second   @property ic/vt-fps (read/write) True airspeed initial condition in feet/second   @property ic/vw-bx-fps (read/write) Wind velocity initial condition in Body X frame in feet/second   @property ic/vw-by-fps (read/write) Wind velocity initial condition in Body Y frame in feet/second   @property ic/vw-bz-fps (read/write) Wind velocity initial condition in Body Z frame in feet/second   @property ic/vw-north-fps (read/write) Wind northward velocity initial condition in feet/second   @property ic/vw-east-fps (read/write) Wind eastward velocity initial condition in feet/second   @property ic/vw-down-fps (read/write) Wind downward velocity initial condition in feet/second   @property ic/vw-mag-fps (read/write) Wind velocity magnitude initial condition in feet/sec.   @property ic/vw-dir-deg (read/write) Wind direction initial condition, in degrees from north   @property ic/roc-fps (read/write) Rate of climb initial condition, in feet/second   @property ic/u-fps (read/write) Body frame x-axis velocity initial condition in feet/second   @property ic/v-fps (read/write) Body frame y-axis velocity initial condition in feet/second   @property ic/w-fps (read/write) Body frame z-axis velocity initial condition in feet/second   @property ic/vn-fps (read/write) Local frame x-axis (north) velocity initial condition in feet/second   @property ic/ve-fps (read/write) Local frame y-axis (east) velocity initial condition in feet/second   @property ic/vd-fps (read/write) Local frame z-axis (down) velocity initial condition in feet/second   @property ic/gamma-rad (read/write) Flight path angle initial condition in radians   @property ic/alpha-rad (read/write) Angle of attack initial condition in radians   @property ic/theta-rad (read/write) Pitch angle initial condition in radians   @property ic/beta-rad (read/write) Angle of sideslip initial condition in radians   @property ic/phi-rad (read/write) Roll angle initial condition in radians   @property ic/psi-true-rad (read/write) Heading angle initial condition in radians   @property ic/lat-gc-rad (read/write) Geocentric latitude initial condition in radians   @property ic/long-gc-rad (read/write) Longitude initial condition in radians   @property ic/p-rad_sec (read/write) Roll rate initial condition in radians/second   @property ic/q-rad_sec (read/write) Pitch rate initial condition in radians/second   @property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second   @author Tony Peden   @version "$Id$"*//*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%CLASS DECLARATION%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/class FGInitialCondition : public FGJSBBase, public FGXMLFileRead{public:  /// Constructor  FGInitialCondition(FGFDMExec *fdmex);  /// Destructor  ~FGInitialCondition();  /** Set calibrated airspeed initial condition in knots.      @param vc Calibrated airspeed in knots  */  void SetVcalibratedKtsIC(double vc);  /** Set equivalent airspeed initial condition in knots.      @param ve Equivalent airspeed in knots  */  void SetVequivalentKtsIC(double ve);  /** Set true airspeed initial condition in knots.      @param vt True airspeed in knots  */  inline void SetVtrueKtsIC(double vt)   { SetVtrueFpsIC(vt*ktstofps);   }  /** Set ground speed initial condition in knots.      @param vg Ground speed in knots  */  inline void SetVgroundKtsIC(double vg) { SetVgroundFpsIC(vg*ktstofps); }  /** Set mach initial condition.      @param mach Mach number  */  void SetMachIC(double mach);  /** Sets angle of attack initial condition in degrees.      @param a Alpha in degrees */  inline void SetAlphaDegIC(double a)      { SetAlphaRadIC(a*degtorad); }  /** Sets angle of sideslip initial condition in degrees.      @param B Beta in degrees */  inline void SetBetaDegIC(double B)       { SetBetaRadIC(B*degtorad);}  /** Sets pitch angle initial condition in degrees.      @param theta Theta (pitch) angle in degrees */  inline void SetThetaDegIC(double theta) { SetThetaRadIC(theta*degtorad); }  /** Resets the IC data structure to new values      @param u, v, w, ... **/  void ResetIC(double u0, double v0, double w0, double p0, double q0, double r0,               double alpha0, double beta0, double phi0, double theta0, double psi0,               double latitudeRad0, double longitudeRad0, double altitudeAGL0,               double gamma0);  /** Sets the roll angle initial condition in degrees.      @param phi roll angle in degrees */  inline void SetPhiDegIC(double phi)  { SetPhiRadIC(phi*degtorad);}  /** Sets the heading angle initial condition in degrees.      @param psi Heading angle in degrees */  inline void SetPsiDegIC(double psi){ SetPsiRadIC(psi*degtorad); }  /** Sets the climb rate initial condition in feet/minute.      @param roc Rate of Climb in feet/minute  */  void SetClimbRateFpmIC(double roc);  /** Sets the flight path angle initial condition in degrees.      @param gamma Flight path angle in degrees  */  inline void SetFlightPathAngleDegIC(double gamma) { SetFlightPathAngleRadIC(gamma*degtorad); }  /** Sets the altitude initial condition in feet.      @param alt Altitude in feet */  void SetAltitudeFtIC(double alt);  /** Sets the initial Altitude above ground level.      @param agl Altitude above ground level in feet */  void SetAltitudeAGLFtIC(double agl);  /** Sets the initial sea level radius from planet center      @param sl_rad sea level radius in feet */  void SetSeaLevelRadiusFtIC(double sl_rad);  /** Sets the initial terrain elevation.      @param elev Initial terrain elevation in feet */  void SetTerrainAltitudeFtIC(double elev);  /** Sets the initial latitude.      @param lat Initial latitude in degrees */  inline void SetLatitudeDegIC(double lat)  { latitude=lat*degtorad; }  /** Sets the initial longitude.      @param lon Initial longitude in degrees */  inline void SetLongitudeDegIC(double lon) { longitude=lon*degtorad; }  /** Gets the initial calibrated airspeed.      @return Initial calibrated airspeed in knots */  inline double GetVcalibratedKtsIC(void) const { return vc*fpstokts; }  /** Gets the initial equivalent airspeed.      @return Initial equivalent airspeed in knots */  inline double GetVequivalentKtsIC(void) const { return ve*fpstokts; }  /** Gets the initial ground speed.      @return Initial ground speed in knots */  inline double GetVgroundKtsIC(void) const { return vg*fpstokts; }  /** Gets the initial true velocity.      @return Initial true airspeed in knots. */  inline double GetVtrueKtsIC(void) const { return vt*fpstokts; }  /** Gets the initial mach.      @return Initial mach number */  inline double GetMachIC(void) const { return mach; }  /** Gets the initial climb rate.      @return Initial climb rate in feet/minute */  inline double GetClimbRateFpmIC(void) const { return hdot*60; }  /** Gets the initial flight path angle.      @return Initial flight path angle in degrees */  inline double GetFlightPathAngleDegIC(void)const  { return gamma*radtodeg; }  /** Gets the initial angle of attack.      @return Initial alpha in degrees */  inline double GetAlphaDegIC(void) const { return alpha*radtodeg; }  /** Gets the initial sideslip angle.      @return Initial beta in degrees */  inline double GetBetaDegIC(void) const  { return beta*radtodeg; }  /** Gets the initial pitch angle.      @return Initial pitch angle in degrees */  inline double GetThetaDegIC(void) const { return theta*radtodeg; }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -