]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGAircraft.h
Updated to match changes in radiostack.[ch]xx
[flightgear.git] / src / FDM / JSBSim / FGAircraft.h
index 9e3fe974cce73b77f0bec929f00ee2cb358ea0ac..7d4b0be6145d63e3f5c992c776b4e54653b460d9 100644 (file)
-/*******************************************************************************
-
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  Header:       FGAircraft.h
  Author:       Jon S. Berndt
  Date started: 12/12/98
-
  ------------- 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
 --------------------------------------------------------------------------------
 12/12/98   JSB   Created
-
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifndef FGAIRCRAFT_H
 #define FGAIRCRAFT_H
 
-/*******************************************************************************
-COMMENTS, REFERENCES,  and NOTES
-*******************************************************************************/
-/*
-The aerodynamic coefficients used in this model typically are:
-
-Longitudinal
-  CL0 - Reference lift at zero alpha
-  CD0 - Reference drag at zero alpha
-  CDM - Drag due to Mach
-  CLa - Lift curve slope (w.r.t. alpha)
-  CDa - Drag curve slope (w.r.t. alpha)
-  CLq - Lift due to pitch rate
-  CLM - Lift due to Mach
-  CLadt - Lift due to alpha rate
-
-  Cmadt - Pitching Moment due to alpha rate
-  Cm0 - Reference Pitching moment at zero alpha
-  Cma - Pitching moment slope (w.r.t. alpha)
-  Cmq - Pitch damping (pitch moment due to pitch rate)
-  CmM - Pitch Moment due to Mach
-
-Lateral
-  Cyb - Side force due to sideslip
-  Cyr - Side force due to yaw rate
-
-  Clb - Dihedral effect (roll moment due to sideslip)
-  Clp - Roll damping (roll moment due to roll rate)
-  Clr - Roll moment due to yaw rate
-  Cnb - Weathercocking stability (yaw moment due to sideslip)
-  Cnp - Rudder adverse yaw (yaw moment due to roll rate)
-  Cnr - Yaw damping (yaw moment due to yaw rate)
-
-Control
-  CLDe - Lift due to elevator
-  CDDe - Drag due to elevator
-  CyDr - Side force due to rudder
-  CyDa - Side force due to aileron
-
-  CmDe - Pitch moment due to elevator
-  ClDa - Roll moment due to aileron
-  ClDr - Roll moment due to rudder
-  CnDr - Yaw moment due to rudder
-  CnDa - Yaw moment due to aileron
-
-[1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
-        Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
-        School, January 1994
-[2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
-        JSC 12960, July 1977
-[3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
-        NASA-Ames", NASA CR-2497, January 1975
-[4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
-        Wiley & Sons, 1979 ISBN 0-471-03032-5
-[5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
-        1982 ISBN 0-471-08936-2
-*/
-
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifdef FGFS
-#  include <Include/compiler.h>
-#  ifdef FG_HAVE_STD_INCLUDES
-#    include <fstream>
+#  include <simgear/compiler.h>
+#  ifdef SG_HAVE_STD_INCLUDES
+#    include <vector>
+#    include <iterator>
 #  else
-#    include <fstream.h>
+#    include <vector.h>
+#    include <iterator.h>
 #  endif
 #else
-#  include <fstream>
+#  include <vector>
+#  include <iterator>
 #endif
 
 #include "FGModel.h"
-#include "FGCoefficient.h"
-#include "FGEngine.h"
-#include "FGTank.h"
-
-/*******************************************************************************
+#include "FGPropulsion.h"
+#include "FGConfigFile.h"
+#include "FGMatrix33.h"
+#include "FGColumnVector3.h"
+#include "FGColumnVector4.h"
+#include "FGLGear.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
-*******************************************************************************/
-
-using namespace std;
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_AIRCRAFT "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates an Aircraft and its systems.
+    Owns all the parts (other classes) which make up this aircraft. This includes
+    the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
+    landing gear, etc. These constituent parts may actually run as separate
+    JSBSim models themselves, but the responsibility for initializing them and
+    for retrieving their force and moment contributions falls to FGAircraft.<br>
+    
+    @author Jon S. Berndt
+    @version $Id$
+    @see
+     <ol><li>Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
+          Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
+          School, January 1994</li>
+     <li>D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
+     JSC 12960, July 1977</li>
+     <li>Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
+     NASA-Ames", NASA CR-2497, January 1975</li>
+     <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
+     Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
+     <li>Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
+     1982 ISBN 0-471-08936-2</li></ol>
+    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+         Header File </a>
+    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+         Source File </a>
+*/
 
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGAircraft : public FGModel
-{
+class FGAircraft : public FGModel {
 public:
-  FGAircraft(FGFDMExec*);  
-  ~FGAircraft(void);
-
+  /** Constructor
+      @param Executive a pointer to the parent executive object */
+  FGAircraft(FGFDMExec *Executive);
+  
+  /// Destructor
+  ~FGAircraft();
+
+  /** Runs the Aircraft model; called by the Executive
+      @see JSBSim.cpp documentation
+      @return false if no error */
   bool Run(void);
-  bool LoadAircraft(string, string, string);
-  inline string GetAircraftName(void) {return AircraftName;}
-  inline void SetGearUp(bool tt) {GearUp = tt;}
-  inline bool GetGearUp(void) {return GearUp;}
-  inline float GetWingArea(void) {return WingArea;}
-  inline float GetWingSpan(void) {return WingSpan;}
-  inline float Getcbar(void) {return cbar;}
-  inline FGEngine* GetEngine(int tt) {return Engine[tt];}
-  inline FGTank* GetTank(int tt) {return Tank[tt];}
-  inline float GetWeight(void) {return Weight;}
-  inline float GetMass(void) {return Mass;}
-  inline float GetL(void) {return Moments[0];}
-  inline float GetM(void) {return Moments[1];}
-  inline float GetN(void) {return Moments[2];}
-  inline float GetFx(void) {return Forces[0];}
-  inline float GetFy(void) {return Forces[1];}
-  inline float GetFz(void) {return Forces[2];}
-  inline float GetIxx(void) {return Ixx;}
-  inline float GetIyy(void) {return Iyy;}
-  inline float GetIzz(void) {return Izz;}
-  inline float GetIxz(void) {return Ixz;}
+  
+  /** Loads the aircraft.
+      The executive calls this method to load the aircraft into JSBSim.
+      @param AC_cfg a pointer to the config file instance
+      @return true if successful */
+  bool Load(FGConfigFile* AC_cfg);
+  
+  /** Gets the aircraft name
+      @return the name of the aircraft as a string type */
+  inline string GetAircraftName(void) { return AircraftName; }
+  
+  /// Gets the wing area
+  double GetWingArea(void) const { return WingArea; }
+  /// Gets the wing span
+  double GetWingSpan(void) const { return WingSpan; }
+  /// Gets the average wing chord
+  double Getcbar(void) const { return cbar; }
+  inline double GetWingIncidence(void) const { return WingIncidence; }
+  inline double GetHTailArea(void) const { return HTailArea; }
+  inline double GetHTailArm(void)  const { return HTailArm; }
+  inline double GetVTailArea(void) const { return VTailArea; }
+  inline double GetVTailArm(void)  const { return VTailArm; }
+  inline double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
+  inline double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
+  inline double Getvbarh(void) const { return vbarh; } // H. Tail Volume
+  inline double Getvbarv(void) const { return vbarv; } // V. Tail Volume
+  inline FGColumnVector3& GetMoments(void) { return vMoments; }
+  inline double GetMoments(int idx) const { return vMoments(idx); }
+  inline FGColumnVector3& GetForces(void) { return vForces; }
+  inline double GetForces(int idx) const { return vForces(idx); }
+  inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
+  inline FGColumnVector3& GetNcg   (void)  { return vNcg; }
+  inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
+  inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
+  inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
+  inline double GetXYZep(int idx) const { return vXYZep(idx); }
+  inline void SetAircraftName(string name) {AircraftName = name;}
+
+  float GetNlf(void);
+
+  inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
+
+  void bind(void);
+  void unbind(void);
 
 private:
-  void GetState(void);
-  void PutState(void);
-  void FAero(void);
-  void FGear(void);
-  void FMass(void);
-  void FProp(void);
-  void MAero(void);
-  void MGear(void);
-  void MMass(void);
-  void MProp(void);
-  void MassChange(void);
-  float Moments[3];
-  float Forces[3];
+  FGColumnVector3 vMoments;
+  FGColumnVector3 vForces;
+  FGColumnVector3 vXYZrp;
+  FGColumnVector3 vXYZep;
+  FGColumnVector3 vEuler;
+  FGColumnVector3 vDXYZcg;
+  FGColumnVector3 vBodyAccel;
+  FGColumnVector3 vNcg;
+  FGColumnVector3 vNwcg;
+
+  double WingArea, WingSpan, cbar, WingIncidence;
+  double HTailArea, VTailArea, HTailArm, VTailArm;
+  double lbarh,lbarv,vbarh,vbarv;
   string AircraftName;
-  float Ixx, Iyy, Izz, Ixz, EmptyMass, Mass;
-  float Xcg, Ycg, Zcg;
-  float Xep, Yep, Zep;
-  float rho, qbar, Vt;
-  float alpha, beta;
-  float WingArea, WingSpan, cbar;
-  float phi, tht, psi;
-  float Weight, EmptyWeight;
-  float dt;
-
-  int numTanks;
-  int numEngines;
-  int numSelectedOxiTanks;
-  int numSelectedFuelTanks;
-  FGTank* Tank[MAX_TANKS];
-  FGEngine *Engine[MAX_ENGINES];
-
-  FGCoefficient *Coeff[6][10];
-  int coeff_ctr[6];
-
-  bool GearUp;
-
-  enum Param {LiftCoeff,
-              DragCoeff,
-              SideCoeff,
-              RollCoeff,
-              PitchCoeff,
-              YawCoeff,
-              numCoeffs};
-
-  string Axis[6];
-
-protected:
 
+  void Debug(int from);
 };
 
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif
+