]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGPropulsion.h
Encapsulate the interpolstion version of FGEnvironment and fix some bugs
[flightgear.git] / src / FDM / JSBSim / FGPropulsion.h
index 6072da1b1f19b79061fda1df8094eb299cc558be..e392fc3d8f66c2b0bfb584cbb0cf2350b1685ec6 100644 (file)
@@ -56,9 +56,8 @@ INCLUDES
 
 #include "FGRocket.h"
 #include "FGPiston.h"
-#include "FGTurboShaft.h"
-#include "FGTurboJet.h"
-#include "FGTurboProp.h"
+#include "FGTurbine.h"
+#include "FGSimTurbine.h"
 #include "FGTank.h"
 #include "FGPropeller.h"
 #include "FGNozzle.h"
@@ -73,32 +72,47 @@ DEFINITIONS
 FORWARD DECLARATIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 /** Propulsion management class.
-    FGPropulsion manages all aspects of propulsive force generation, including
-    containment of engines, tanks, and thruster class instances in STL vectors,
-    and the interaction and communication between them.
+    The Propulsion class is the container for the entire propulsion system, which is
+    comprised of engines, tanks, and "thrusters" (the device that transforms the
+    engine power into a force that acts on the aircraft, such as a nozzle or
+    propeller). Once the Propulsion class gets the config file, it reads in
+    information which is specific to a type of engine. Then:
+
+    -# The appropriate engine type instance is created
+    -# A thruster object is instantiated, and is linked to the engine
+    -# At least one tank object is created, and is linked to an engine.
+
+    At Run time each engines Calculate() method is called to return the excess power
+    generated during that iteration. The drag from the previous iteration is sub-
+    tracted to give the excess power available for thrust this pass. That quantity
+    is passed to the thrusters associated with a particular engine - perhaps with a
+    scaling mechanism (gearing?) to allow the engine to give its associated thrust-
+    ers specific distributed portions of the excess power.
     @author Jon S. Berndt
     @version $Id$
-    @see FGEngine
-    @see FGTank
-    @see FGThruster
+    @see
+    FGEngine
+    FGTank
+    FGThruster
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGPropulsion : public FGModel {
+class FGPropulsion : public FGModel
+{
 public:
+  /// Constructor
   FGPropulsion(FGFDMExec*);
+  /// Destructor
   ~FGPropulsion();
 
   /** Executes the propulsion model.
@@ -126,7 +140,7 @@ public:
   bool Load(FGConfigFile* AC_cfg);
 
   /// Retrieves the number of engines defined for the aircraft.
-  inline unsigned int GetNumEngines(void) {return Engines.size();}
+  inline unsigned int GetNumEngines(void) const {return Engines.size();}
 
   /** Retrieves an engine object pointer from the list of engines.
       @param index the engine index within the vector container
@@ -136,6 +150,9 @@ public:
                       if (index <= Engines.size()-1) return Engines[index];
                       else                           return 0L;      }
 
+  /// Retrieves the number of tanks defined for the aircraft.
+  inline unsigned int GetNumTanks(void) const {return Tanks.size();}
+
   /** Retrieves a tank object pointer from the list of tanks.
       @param index the tank index within the vector container
       @return the address of the specific tank, or zero if no such tank is
@@ -153,10 +170,10 @@ public:
                       else                             return 0L;    }
 
   /** Returns the number of fuel tanks currently actively supplying fuel */
-  inline int GetnumSelectedFuelTanks(void) {return numSelectedFuelTanks;}
+  inline int GetnumSelectedFuelTanks(void) const {return numSelectedFuelTanks;}
 
   /** Returns the number of oxidizer tanks currently actively supplying oxidizer */
-  inline int GetnumSelectedOxiTanks(void)  {return numSelectedOxiTanks;}
+  inline int GetnumSelectedOxiTanks(void) const {return numSelectedOxiTanks;}
 
   /** Loops the engines/thrusters until thrust output steady (used for trimming) */
   bool GetSteadyState(void);
@@ -169,11 +186,11 @@ public:
   string GetPropulsionValues(void);
 
   inline FGColumnVector3& GetForces(void)  {return vForces; }
-  inline double GetForces(int n) { return vForces(n);}
+  inline double GetForces(int n) const { return vForces(n);}
   inline FGColumnVector3& GetMoments(void) {return vMoments;}
-  inline double GetMoments(int n) {return vMoments(n);}
+  inline double GetMoments(int n) const {return vMoments(n);}
   
-  FGColumnVector3& GetTanksCG(void);
+  FGColumnVector3& GetTanksMoment(void);
   double GetTanksWeight(void);
 
   double GetTanksIxx(const FGColumnVector3& vXYZcg);
@@ -182,6 +199,21 @@ public:
   double GetTanksIxz(const FGColumnVector3& vXYZcg);
   double GetTanksIxy(const FGColumnVector3& vXYZcg);
 
+  inline int GetActiveEngine(void) const
+  {
+    return ActiveEngine;
+  }
+
+  inline int GetActiveEngine(void);
+
+  void SetMagnetos(int setting);
+  void SetStarter(int setting);
+  void SetCutoff(int setting=0);
+  void SetActiveEngine(int engine);
+  
+  void bind();
+  void unbind();
+   
 private:
   vector <FGEngine*>   Engines;
   vector <FGTank*>     Tanks;
@@ -194,13 +226,14 @@ private:
   unsigned int numEngines;
   unsigned int numTanks;
   unsigned int numThrusters;
+  int ActiveEngine;
   double dt;
   FGColumnVector3 vForces;
   FGColumnVector3 vMoments;
   FGColumnVector3 vXYZtank;
   void Debug(int from);
 };
-
+}
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 #endif