]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGPropulsion.h
JSBSim updates. This update changes the file format, so an update of the base
[flightgear.git] / src / FDM / JSBSim / FGPropulsion.h
index f5405a29fe187db347113a0a0fcedc0a4c7557e8..56eecf4c3cdbeb867562fb4f4e6c711a0a64f2b3 100644 (file)
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-\r
- Header:       FGPropulsion.h\r
- Author:       Jon S. Berndt\r
- Date started: 08/20/00\r
\r
- ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------\r
\r
- This program is free software; you can redistribute it and/or modify it under\r
- the terms of the GNU General Public License as published by the Free Software\r
- Foundation; either version 2 of the License, or (at your option) any later\r
- version.\r
\r
- This program is distributed in the hope that it will be useful, but WITHOUT\r
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
- FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
- details.\r
\r
- You should have received a copy of the GNU General Public License along with\r
- this program; if not, write to the Free Software Foundation, Inc., 59 Temple\r
- Place - Suite 330, Boston, MA  02111-1307, USA.\r
\r
- Further information about the GNU General Public License can also be found on\r
- the world wide web at http://www.gnu.org.\r
\r
-HISTORY\r
---------------------------------------------------------------------------------\r
-08/20/00   JSB   Created\r
\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-SENTRY\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#ifndef FGPROPULSION_H\r
-#define FGPROPULSION_H\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-INCLUDES\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#ifdef FGFS\r
-#  include <simgear/compiler.h>\r
-#  ifdef SG_HAVE_STD_INCLUDES\r
-#    include <vector>\r
-#    include <iterator>\r
-#  else\r
-#    include <vector.h>\r
-#    include <iterator.h>\r
-#  endif\r
-#else\r
-#  include <vector>\r
-#  include <iterator>\r
-#endif\r
-\r
-#include "FGModel.h"\r
-\r
-#include "FGRocket.h"\r
-#include "FGPiston.h"\r
-#include "FGTurboShaft.h"\r
-#include "FGTurboJet.h"\r
-#include "FGTurboProp.h"\r
-#include "FGTank.h"\r
-#include "FGPropeller.h"\r
-#include "FGNozzle.h"\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-DEFINITIONS\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-#define ID_PROPULSION "$Id$"\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-FORWARD DECLARATIONS\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-CLASS DOCUMENTATION\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-/** Propulsion management class.\r
-    FGPropulsion manages all aspects of propulsive force generation, including\r
-    containment of engines, tanks, and thruster class instances in STL vectors,\r
-    and the interaction and communication between them.\r
-    @author Jon S. Berndt\r
-    @version $Id$\r
-    @see FGEngine\r
-    @see FGTank\r
-    @see FGThruster\r
-    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropulsion.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">\r
-         Header File </a>\r
-    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropulsion.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">\r
-         Source File </a>\r
-*/\r
-\r
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-CLASS DECLARATION\r
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
-\r
-class FGPropulsion : public FGModel\r
-{\r
-public:\r
-  /// Constructor\r
-  FGPropulsion(FGFDMExec*);\r
-  /// Destructor\r
-  ~FGPropulsion();\r
-\r
-  /** Executes the propulsion model.\r
-      The initial plan for the FGPropulsion class calls for Run() to be executed,\r
-      performing the following tasks:\r
-      <ol>\r
-  <li>Determine the drag - or power required - for the attached thrust effector\r
-      for this engine so that any feedback to the engine can be performed. This\r
-      is done by calling FGThruster::CalculatePReq()</li>\r
-  <li>Given 1, above, calculate the power available from the engine. This is\r
-      done by calling FGEngine::CalculatePAvail()</li>\r
-  <li>Next, calculate the thrust output from the thruster model given the power\r
-      available and the power required. This may also result in new performance\r
-      numbers for the thruster in the case of the propeller, at least. This\r
-      result is returned from a call to Calculate().</li></ol>\r
-\r
-      [Note: Should we be checking the Starved flag here?] */\r
-  bool Run(void);\r
-\r
-  /** Loads the propulsion system (engine[s], tank[s], thruster[s]).\r
-      Characteristics of the propulsion system are read in from the config file.\r
-      @param AC_cfg pointer to the config file instance that describes the\r
-             aircraft being modeled.\r
-      @return true if successfully loaded, otherwise false */\r
-  bool Load(FGConfigFile* AC_cfg);\r
-\r
-  /// Retrieves the number of engines defined for the aircraft.\r
-  inline unsigned int GetNumEngines(void) const {return Engines.size();}\r
-\r
-  /** Retrieves an engine object pointer from the list of engines.\r
-      @param index the engine index within the vector container\r
-      @return the address of the specific engine, or zero if no such engine is\r
-              available */\r
-  inline FGEngine* GetEngine(unsigned int index) {\r
-                      if (index <= Engines.size()-1) return Engines[index];\r
-                      else                           return 0L;      }\r
-\r
-  // Retrieves the number of tanks defined for the aircraft.\r
-  inline unsigned int GetNumTanks(void) const {return Tanks.size();}\r
-\r
-  /** Retrieves a tank object pointer from the list of tanks.\r
-      @param index the tank index within the vector container\r
-      @return the address of the specific tank, or zero if no such tank is\r
-              available */\r
-  inline FGTank* GetTank(unsigned int index) {\r
-                      if (index <= Tanks.size()-1) return Tanks[index];\r
-                      else                         return 0L;        }\r
-\r
-  /** Retrieves a thruster object pointer from the list of thrusters.\r
-      @param index the thruster index within the vector container\r
-      @return the address of the specific thruster, or zero if no such thruster is\r
-              available */\r
-  inline FGThruster* GetThruster(unsigned int index) {\r
-                      if (index <= Thrusters.size()-1) return Thrusters[index];\r
-                      else                             return 0L;    }\r
-\r
-  /** Returns the number of fuel tanks currently actively supplying fuel */\r
-  inline int GetnumSelectedFuelTanks(void) const {return numSelectedFuelTanks;}\r
-\r
-  /** Returns the number of oxidizer tanks currently actively supplying oxidizer */\r
-  inline int GetnumSelectedOxiTanks(void) const {return numSelectedOxiTanks;}\r
-\r
-  /** Loops the engines/thrusters until thrust output steady (used for trimming) */\r
-  bool GetSteadyState(void);\r
-  \r
-  /** starts the engines in IC mode (dt=0).  All engine-specific setup must\r
-      be done before calling this (i.e. magnetos, starter engage, etc.) */\r
-  bool ICEngineStart(void);\r
-  \r
-  string GetPropulsionStrings(void);\r
-  string GetPropulsionValues(void);\r
-\r
-  inline FGColumnVector3& GetForces(void)  {return vForces; }\r
-  inline double GetForces(int n) const { return vForces(n);}\r
-  inline FGColumnVector3& GetMoments(void) {return vMoments;}\r
-  inline double GetMoments(int n) const {return vMoments(n);}\r
-  \r
-  FGColumnVector3& GetTanksMoment(void);\r
-  double GetTanksWeight(void);\r
-\r
-  double GetTanksIxx(const FGColumnVector3& vXYZcg);\r
-  double GetTanksIyy(const FGColumnVector3& vXYZcg);\r
-  double GetTanksIzz(const FGColumnVector3& vXYZcg);\r
-  double GetTanksIxz(const FGColumnVector3& vXYZcg);\r
-  double GetTanksIxy(const FGColumnVector3& vXYZcg);\r
-  \r
-  void SetMagnetos(int setting);\r
-  void SetStarter(int setting);\r
-  void SetActiveEngine(int engine);\r
-  \r
-  void bind();\r
-  void unbind();\r
-   \r
-private:\r
-  vector <FGEngine*>   Engines;\r
-  vector <FGTank*>     Tanks;\r
-  vector <FGTank*>::iterator iTank;\r
-  vector <FGThruster*> Thrusters;\r
-  unsigned int numSelectedFuelTanks;\r
-  unsigned int numSelectedOxiTanks;\r
-  unsigned int numFuelTanks;\r
-  unsigned int numOxiTanks;\r
-  unsigned int numEngines;\r
-  unsigned int numTanks;\r
-  unsigned int numThrusters;\r
-  int ActiveEngine;\r
-  double dt;\r
-  FGColumnVector3 vForces;\r
-  FGColumnVector3 vMoments;\r
-  FGColumnVector3 vXYZtank;\r
-  void Debug(int from);\r
-};\r
-\r
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
-#endif\r
-\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ Header:       FGPropulsion.h
+ Author:       Jon S. Berndt
+ Date started: 08/20/00
+ ------------- 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
+--------------------------------------------------------------------------------
+08/20/00   JSB   Created
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+SENTRY
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#ifndef FGPROPULSION_H
+#define FGPROPULSION_H
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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 "FGModel.h"
+
+#include "FGRocket.h"
+#include "FGPiston.h"
+#include "FGTurbine.h"
+#include "FGTank.h"
+#include "FGPropeller.h"
+#include "FGNozzle.h"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_PROPULSION "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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.
+    @author Jon S. Berndt
+    @version $Id$
+    @see FGEngine
+    @see FGTank
+    @see FGThruster
+    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropulsion.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/FGPropulsion.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+         Source File </a>
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+class FGPropulsion : public FGModel
+{
+public:
+  /// Constructor
+  FGPropulsion(FGFDMExec*);
+  /// Destructor
+  ~FGPropulsion();
+
+  /** Executes the propulsion model.
+      The initial plan for the FGPropulsion class calls for Run() to be executed,
+      performing the following tasks:
+      <ol>
+  <li>Determine the drag - or power required - for the attached thrust effector
+      for this engine so that any feedback to the engine can be performed. This
+      is done by calling FGThruster::CalculatePReq()</li>
+  <li>Given 1, above, calculate the power available from the engine. This is
+      done by calling FGEngine::CalculatePAvail()</li>
+  <li>Next, calculate the thrust output from the thruster model given the power
+      available and the power required. This may also result in new performance
+      numbers for the thruster in the case of the propeller, at least. This
+      result is returned from a call to Calculate().</li></ol>
+
+      [Note: Should we be checking the Starved flag here?] */
+  bool Run(void);
+
+  /** Loads the propulsion system (engine[s], tank[s], thruster[s]).
+      Characteristics of the propulsion system are read in from the config file.
+      @param AC_cfg pointer to the config file instance that describes the
+             aircraft being modeled.
+      @return true if successfully loaded, otherwise false */
+  bool Load(FGConfigFile* AC_cfg);
+
+  /// Retrieves the number of engines defined for the aircraft.
+  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
+      @return the address of the specific engine, or zero if no such engine is
+              available */
+  inline FGEngine* GetEngine(unsigned int index) {
+                      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
+              available */
+  inline FGTank* GetTank(unsigned int index) {
+                      if (index <= Tanks.size()-1) return Tanks[index];
+                      else                         return 0L;        }
+
+  /** Retrieves a thruster object pointer from the list of thrusters.
+      @param index the thruster index within the vector container
+      @return the address of the specific thruster, or zero if no such thruster is
+              available */
+  inline FGThruster* GetThruster(unsigned int index) {
+                      if (index <= Thrusters.size()-1) return Thrusters[index];
+                      else                             return 0L;    }
+
+  /** Returns the number of fuel tanks currently actively supplying fuel */
+  inline int GetnumSelectedFuelTanks(void) const {return numSelectedFuelTanks;}
+
+  /** Returns the number of oxidizer tanks currently actively supplying oxidizer */
+  inline int GetnumSelectedOxiTanks(void) const {return numSelectedOxiTanks;}
+
+  /** Loops the engines/thrusters until thrust output steady (used for trimming) */
+  bool GetSteadyState(void);
+  
+  /** starts the engines in IC mode (dt=0).  All engine-specific setup must
+      be done before calling this (i.e. magnetos, starter engage, etc.) */
+  bool ICEngineStart(void);
+  
+  string GetPropulsionStrings(void);
+  string GetPropulsionValues(void);
+
+  inline FGColumnVector3& GetForces(void)  {return vForces; }
+  inline double GetForces(int n) const { return vForces(n);}
+  inline FGColumnVector3& GetMoments(void) {return vMoments;}
+  inline double GetMoments(int n) const {return vMoments(n);}
+  
+  FGColumnVector3& GetTanksMoment(void);
+  double GetTanksWeight(void);
+
+  double GetTanksIxx(const FGColumnVector3& vXYZcg);
+  double GetTanksIyy(const FGColumnVector3& vXYZcg);
+  double GetTanksIzz(const FGColumnVector3& vXYZcg);
+  double GetTanksIxz(const FGColumnVector3& vXYZcg);
+  double GetTanksIxy(const FGColumnVector3& vXYZcg);
+  
+  void SetMagnetos(int setting);
+  void SetStarter(int setting);
+  void SetActiveEngine(int engine);
+  
+  void bind();
+  void unbind();
+   
+private:
+  vector <FGEngine*>   Engines;
+  vector <FGTank*>     Tanks;
+  vector <FGTank*>::iterator iTank;
+  vector <FGThruster*> Thrusters;
+  unsigned int numSelectedFuelTanks;
+  unsigned int numSelectedOxiTanks;
+  unsigned int numFuelTanks;
+  unsigned int numOxiTanks;
+  unsigned int numEngines;
+  unsigned int numTanks;
+  unsigned int numThrusters;
+  int ActiveEngine;
+  double dt;
+  FGColumnVector3 vForces;
+  FGColumnVector3 vMoments;
+  FGColumnVector3 vXYZtank;
+  void Debug(int from);
+};
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+#endif
+