]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGAircraft.h
Make yasim accept the launchbar and hook properties. They are not tied to anything...
[flightgear.git] / src / FDM / JSBSim / FGAircraft.h
index 05c9de0b4cec5b6846c2af737a6f123e64090029..acf0b54e37f95ab7d97f1e6fb1038ce96797c219 100644 (file)
@@ -19,7 +19,7 @@
  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.
  
@@ -40,42 +40,33 @@ INCLUDES
 
 #ifdef FGFS
 #  include <simgear/compiler.h>
-#  ifdef FG_HAVE_STD_INCLUDES
+#  ifdef SG_HAVE_STD_INCLUDES
 #    include <vector>
 #    include <iterator>
-#    include <map>
 #  else
 #    include <vector.h>
 #    include <iterator.h>
-#    include <map.h>
 #  endif
 #else
 #  include <vector>
 #  include <iterator>
-#  include <map>
 #endif
 
 #include "FGModel.h"
-#include "FGCoefficient.h"
-#include "FGEngine.h"
-#include "FGTank.h"
-#include "FGLGear.h"
 #include "FGConfigFile.h"
-#include "FGMatrix.h"
+#include "FGColumnVector3.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_AIRCRAFT "$Header$"
+#define ID_AIRCRAFT "$Id$"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
@@ -89,18 +80,17 @@ CLASS DOCUMENTATION
     for retrieving their force and moment contributions falls to FGAircraft.
     @author Jon S. Berndt
     @version $Id$
-    @see
-     <ol><li>Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
+    @see 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>
+          School, January 1994
+    @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
+     JSC 12960, July 1977
+    @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 Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
+     1982 ISBN 0-471-08936-2
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -108,18 +98,13 @@ CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 class FGAircraft : public FGModel {
-  enum {eL=1, eM, eN};
-  enum {eX=1, eY, eZ};
-  enum {eP=1, eQ, eR};
-  enum {ePhi=1, eTht, ePsi};
-
 public:
   /** Constructor
       @param Executive a pointer to the parent executive object */
   FGAircraft(FGFDMExec *Executive);
   
   /// Destructor
-  ~FGAircraft(void);
+  ~FGAircraft();
 
   /** Runs the Aircraft model; called by the Executive
       @see JSBSim.cpp documentation
@@ -128,138 +113,72 @@ public:
   
   /** Loads the aircraft.
       The executive calls this method to load the aircraft into JSBSim.
-      @param apath path to the aircraft files (e.g. "aircraft/X15/")
-      @param epath path to engine files (e.g. "engine/")
-      @param acname name of aircraft (e.g. "X15")
-      @return true if succesful */
-  bool LoadAircraft(string apath, string epath, string acname);
+      @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 gear status
-      @return true if gear is not deployed */
-  inline bool GetGearUp(void) { return GearUp; }
-  /** Gets the number of gear units defined for the aircraft
-      @return number of gear units defined */
-  inline int GetNumGearUnits(void) { return lGear.size(); }
-  /** Gets a gear instance
-      @param gear index of gear instance
-      @return a pointer to the FGLGear instance of the gear unit requested */
-  inline FGLGear* GetGearUnit(int gear) { return &(lGear[gear]); }
   /// Gets the wing area
-  inline float GetWingArea(void) { return WingArea; }
+  double GetWingArea(void) const { return WingArea; }
   /// Gets the wing span
-  inline float GetWingSpan(void) { return WingSpan; }
+  double GetWingSpan(void) const { return WingSpan; }
   /// Gets the average wing chord
-  inline float Getcbar(void) { return cbar; }
-  /** Gets an engine instance.
-      @param engine index of the engine instance
-      @return a pointer to the FGEngine instance of the requested engine */
-  inline FGEngine* GetEngine(int engine) { return Engine[engine]; }
-  /** Gets a tank instance.
-      @param tank index of the tank instance
-      @return a pointer to the FGTank instance of the requested tank */
-  inline FGTank* GetTank(int tank) { return Tank[tank]; }
-  inline float GetWeight(void) { return Weight; }
-  inline float GetMass(void) { return Mass; }
-  inline FGColumnVector GetMoments(void) { return vMoments; }
-  inline FGColumnVector GetForces(void) { return vForces; }
-  inline FGColumnVector GetvFs(void) { return vFs; }
-  inline float GetIxx(void) { return Ixx; }
-  inline float GetIyy(void) { return Iyy; }
-  inline float GetIzz(void) { return Izz; }
-  inline float GetIxz(void) { return Ixz; }
-  inline unsigned int GetNumEngines(void) { return numEngines; }
-  inline FGColumnVector GetXYZcg(void) { return vXYZcg; }
-  inline FGColumnVector GetXYZrp(void) { return vXYZrp; }
-  inline FGColumnVector GetXYZep(void) { return vXYZep; }
-  inline float GetNlf(void) { return nlf; }
-  inline float GetAlphaCLMax(void) { return alphaclmax; }
-  inline float GetAlphaCLMin(void) { return alphaclmin; }
-
-  inline void SetGearUp(bool tt) { GearUp = tt; }
-  inline void SetAlphaCLMax(float tt) { alphaclmax=tt; }
-  inline void SetAlphaCLMin(float tt) { alphaclmin=tt; }
-
-  inline FGCoefficient* GetCoeff(int axis, int idx) { return Coeff[axis][idx]; }
-  string GetCoefficientStrings(void);
-  string GetCoefficientValues(void);
-  string GetGroundReactionStrings(void);
-  string GetGroundReactionValues(void);
-
-  /// Subsystem types for specifying which will be output in the FDM data logging
-  enum  SubSystems {
-    /** Subsystem: Simulation (= 1)          */ ssSimulation      = 1,
-    /** Subsystem: Aerosurfaces (= 2)        */ ssAerosurfaces    = 2,
-    /** Subsystem: Body rates (= 4)          */ ssRates           = 4,
-    /** Subsystem: Velocities (= 8)          */ ssVelocities      = 8,
-    /** Subsystem: Forces (= 16)             */ ssForces          = 16,
-    /** Subsystem: Moments (= 32)            */ ssMoments         = 32,
-    /** Subsystem: Atmosphere (= 64)         */ ssAtmosphere      = 64,
-    /** Subsystem: Mass Properties (= 128)   */ ssMassProps       = 128,
-    /** Subsystem: Coefficients (= 256)      */ ssCoefficients    = 256,
-    /** Subsystem: Position (= 512)          */ ssPosition        = 512,
-    /** Subsystem: Ground Reactions (= 1024) */ ssGroundReactions = 1024
-  } subsystems;
+  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 double GetBodyAccel(int idx) { return vBodyAccel(idx); }
+  inline FGColumnVector3& GetNcg   (void)  { return vNcg; }
+  inline double GetNcg(int idx)  { return vNcg(idx); }
+  inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
+  inline FGColumnVector3& GetXYZvrp(void) { return vXYZvrp; }
+  inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
+  inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
+  inline double GetXYZvrp(int idx) const { return vXYZvrp(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 FMAero(void);
-  void FMGear(void);
-  void FMMass(void);
-  void FMProp(void);
-  void MassChange(void);
-  FGColumnVector vMoments;
-  FGColumnVector vForces;
-  FGColumnVector vFs;
-  FGColumnVector vXYZrp;
-  FGColumnVector vbaseXYZcg;
-  FGColumnVector vXYZcg;
-  FGColumnVector vXYZep;
-  FGColumnVector vEuler;
-  float baseIxx, baseIyy, baseIzz, baseIxz, EmptyMass, Mass;
-  float Ixx, Iyy, Izz, Ixz;
-  float alpha, beta;
-  float WingArea, WingSpan, cbar;
-  float Weight, EmptyWeight;
-  float nlf,alphaclmax,alphaclmin;
-  float dt;
-  string CFGVersion;
+  FGColumnVector3 vMoments;
+  FGColumnVector3 vForces;
+  FGColumnVector3 vXYZrp;
+  FGColumnVector3 vXYZvrp;
+  FGColumnVector3 vXYZep;
+  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;
 
-  unsigned int numTanks;
-  unsigned int numEngines;
-  unsigned int numSelectedOxiTanks;
-  unsigned int numSelectedFuelTanks;
-  FGTank* Tank[MAX_TANKS];           // need to make a vector
-  FGEngine *Engine[MAX_ENGINES];     // need to make a vector
-
-  typedef map<string,int> AxisIndex;
-  AxisIndex AxisIdx;
-
-  typedef vector<FGCoefficient*> CoeffArray;
-  
-  CoeffArray* Coeff;
-
-  void DisplayCoeffFactors(vector <eParam> multipliers);
-
-  bool GearUp;
-
-  string Axis[6];
-  vector <FGLGear> lGear;
-
-  string AircraftPath;
-  string EnginePath;
-  void ReadMetrics(FGConfigFile*);
-  void ReadPropulsion(FGConfigFile*);
-  void ReadFlightControls(FGConfigFile*);
-  void ReadAerodynamics(FGConfigFile*);
-  void ReadUndercarriage(FGConfigFile*);
-  void ReadPrologue(FGConfigFile*);
-  void ReadOutput(FGConfigFile*);
+  void Debug(int from);
 };
 
+} // namespace JSBSim
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif
+