]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGAircraft.h
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / FGAircraft.h
index f62ef276a5c56ba306c1ae110ccab040b94268b0..13a499bd54a693d790e1c25db3045ee86716364d 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon S. Berndt
  Date started: 12/12/98
 
- ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) -------------
 
  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
@@ -38,29 +38,19 @@ SENTRY
 INCLUDES
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#ifdef FGFS
-#  include <simgear/compiler.h>
-#  ifdef SG_HAVE_STD_INCLUDES
-#    include <vector>
-#    include <iterator>
-#  else
-#    include <vector.h>
-#    include <iterator.h>
-#  endif
-#else
-#  include <vector>
-#  include <iterator>
-#endif
+#include <string>
+#include <vector>
 
 #include "FGModel.h"
-#include <input_output/FGXMLElement.h>
-#include <math/FGColumnVector3.h>
+#include "input_output/FGXMLElement.h"
+#include "math/FGColumnVector3.h"
+#include "math/FGMatrix33.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_AIRCRAFT "$Id$"
+#define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -73,16 +63,38 @@ CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 /** Encapsulates an Aircraft and its systems.
-    Owns all the parts (other classes) which make up this aircraft. This includes
+<p> 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.
+<p> The \<metrics> section of the aircraft configuration file is read here, and
+    the metrical information is held by this class.
+<h3>Configuration File Format for \<metrics> Section:</h3>
+@code
+    <metrics>
+        <wingarea unit="{FT2 | M2}"> {number} </wingarea>
+        <wingspan unit="{FT | M}"> {number} </wingspan>
+        <chord unit="{FT | M}"> {number} </chord>
+        <htailarea unit="{FT2 | M2}"> {number} </htailarea>
+        <htailarm unit="{FT | M}"> {number} </htailarm>
+        <vtailarea unit="{FT2 | M}"> {number} </vtailarea>
+        <vtailarm unit="{FT | M}"> {number} </vtailarm>
+        <wing_incidence unit="{RAD | DEG}"> {number} </wing_incidence>
+        <location name="{AERORP | EYEPOINT | VRP}" unit="{IN | M}">
+            <x> {number} </x>
+            <y> {number} </y>
+            <z> {number} </z>
+        </location>
+        {other location blocks}
+    </metrics>
+@endcode
+
     @author Jon S. Berndt
-    @version $Id$
+    @version $Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $
     @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
+     Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
+     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
@@ -107,9 +119,16 @@ public:
   ~FGAircraft();
 
   /** Runs the Aircraft model; called by the Executive
+      Can pass in a value indicating if the executive is directing the simulation to Hold.
+      @param Holding if true, the executive has been directed to hold the sim from 
+                     advancing time. Some models may ignore this flag, such as the Input
+                     model, which may need to be active to listen on a socket for the
+                     "Resume" command to be given.
       @see JSBSim.cpp documentation
       @return false if no error */
-  bool Run(void);
+  bool Run(bool Holding);
+
+  bool InitModel(void);
 
   /** Loads the aircraft.
       The executive calls this method to load the aircraft into JSBSim.
@@ -119,7 +138,7 @@ public:
 
   /** Gets the aircraft name
       @return the name of the aircraft as a string type */
-  inline string GetAircraftName(void) { return AircraftName; }
+  const std::string& GetAircraftName(void) const { return AircraftName; }
 
   /// Gets the wing area
   double GetWingArea(void) const { return WingArea; }
@@ -127,42 +146,52 @@ public:
   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 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;}
-  inline void SetHoldDown(int hd) {HoldDown = hd;}
-  inline int GetHoldDown(void) const {return HoldDown;}
+  double GetWingIncidence(void) const { return WingIncidence; }
+  double GetWingIncidenceDeg(void) const { return WingIncidence*radtodeg; }
+  double GetHTailArea(void) const { return HTailArea; }
+  double GetHTailArm(void)  const { return HTailArm; }
+  double GetVTailArea(void) const { return VTailArea; }
+  double GetVTailArm(void)  const { return VTailArm; }
+  double Getlbarh(void) const { return lbarh; } // HTailArm / cbar
+  double Getlbarv(void) const { return lbarv; } // VTailArm / cbar
+  double Getvbarh(void) const { return vbarh; } // H. Tail Volume
+  double Getvbarv(void) const { return vbarv; } // V. Tail Volume
+  const FGColumnVector3& GetMoments(void) const { return vMoments; }
+  double GetMoments(int idx) const { return vMoments(idx); }
+  const FGColumnVector3& GetForces(void) const { return vForces; }
+  double GetForces(int idx) const { return vForces(idx); }
+  const FGColumnVector3& GetXYZrp(void) const { return vXYZrp; }
+  const FGColumnVector3& GetXYZvrp(void) const { return vXYZvrp; }
+  const FGColumnVector3& GetXYZep(void) const { return vXYZep; }
+  double GetXYZrp(int idx) const { return vXYZrp(idx); }
+  double GetXYZvrp(int idx) const { return vXYZvrp(idx); }
+  double GetXYZep(int idx) const { return vXYZep(idx); }
+  void SetAircraftName(const std::string& name) {AircraftName = name;}
+  void SetHoldDown(int hd) {HoldDown = hd;}
+  int GetHoldDown(void) const {return HoldDown;}
 
   void SetXYZrp(int idx, double value) {vXYZrp(idx) = value;}
 
-  double GetNlf(void);
-
-  inline FGColumnVector3& GetNwcg(void) { return vNwcg; }
+  void SetWingArea(double S) {WingArea = S;}
 
   void bind(void);
   void unbind(void);
 
+  struct Inputs {
+    FGColumnVector3 AeroForce;
+    FGColumnVector3 PropForce;
+    FGColumnVector3 GroundForce;
+    FGColumnVector3 ExternalForce;
+    FGColumnVector3 BuoyantForce;
+    FGColumnVector3 AeroMoment;
+    FGColumnVector3 PropMoment;
+    FGColumnVector3 GroundMoment;
+    FGColumnVector3 ExternalMoment;
+    FGColumnVector3 BuoyantMoment;
+    FGMatrix33 Tl2b;
+    double Weight;
+  } in;
+
 private:
   FGColumnVector3 vMoments;
   FGColumnVector3 vForces;
@@ -170,15 +199,12 @@ private:
   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;
   int HoldDown;
-  string AircraftName;
+  std::string AircraftName;
 
   void Debug(int from);
 };