]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGState.h
Moved JSBSim.hxx to src/FDM/JSBSim/
[flightgear.git] / src / FDM / JSBSim / FGState.h
index 6e24822b1318916cdd25491ce91ebd745e268b82..05c9a6025dccbff1065d2333a504f6ccacc1baf4 100644 (file)
@@ -58,7 +58,6 @@ INCLUDES
 
 #include <string>
 #include <map>
-#include "FGDefs.h"
 #include "FGJSBBase.h"
 #include "FGInitialCondition.h"
 #include "FGMatrix33.h"
@@ -83,6 +82,7 @@ class FGOutput;
 class FGPosition;
 class FGFDMExec;
 class FGGroundReactions;
+class FGPropulsion;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
@@ -147,18 +147,18 @@ public:
       @param weast eastward velocity in feet per second
       @param wdown downward velocity in feet per second
       */
-  void Initialize(float U,
-                  float V,
-                  float W,
-                  float lat,
-                  float lon,
-                  float phi,
-                  float tht,
-                  float psi,
-                  float h,
-                  float wnorth,
-                  float weast,
-                  float wdown);
+  void Initialize(double U,
+                  double V,
+                  double W,
+                  double lat,
+                  double lon,
+                  double phi,
+                  double tht,
+                  double psi,
+                  double h,
+                  double wnorth,
+                  double weast,
+                  double wdown);
 
   /** Initializes the simulation state based on parameters from an Initial Conditions object.
       @param FGIC pointer to an initial conditions object.
@@ -173,12 +173,12 @@ public:
   bool StoreData(string filename);
 
   /// returns the speed of sound in feet per second.
-  inline float Geta(void) { return a; }
+  inline double Geta(void) { return a; }
 
   /// Returns the simulation time in seconds.
-  inline float Getsim_time(void) { return sim_time; }
+  inline double Getsim_time(void) { return sim_time; }
   /// Returns the simulation delta T.
-  inline float Getdt(void) { return dt; }
+  inline double Getdt(void) { return dt; }
 
   /// Suspends the simulation and sets the delta T to zero.
   inline void Suspend(void) {saved_dt = dt; dt = 0.0;}
@@ -186,19 +186,19 @@ public:
   inline void Resume(void)  {dt = saved_dt;}
 
   /** Retrieves a parameter.
-      The parameters that can be retrieved are enumerated in FGDefs.h.
+      The parameters that can be retrieved are enumerated in FGJSBBase.h.
       @param val_idx one of the enumerated JSBSim parameters.
       @return the value of the parameter.
       */
-  float GetParameter(eParam val_idx);
+  double GetParameter(eParam val_idx);
 
   /** Retrieves a parameter.
-      The parameters that can be retrieved are enumerated in FGDefs.h.
+      The parameters that can be retrieved are enumerated in FGJSBBase.h.
       @param val_string a string representing one of the enumerated JSBSim parameters,
              i.e. "FG_QBAR".
       @return the value of the parameter.
       */
-  float GetParameter(string val_string);
+  double GetParameter(string val_string);
 
   /** Retrieves the JSBSim parameter enumerated item given the text string.
       @param val_string the parameter string, i.e. "FG_QBAR".
@@ -209,13 +209,19 @@ public:
   /** Sets the speed of sound.
       @param speed the speed of sound in feet per second.
       */
-  inline void Seta(float speed) { a = speed; }
+  inline void Seta(double speed) { a = speed; }
 
+  /** Gets the name of the parameter given the index.
+      @param val_idx one of the enumerated JSBSim parameters.
+      @return the name of the parameter pointed to by the index.
+      */
+  string GetParameterName(eParam val_idx) {return paramdef[val_idx];}
+  
   /** Sets the current sim time.
       @param cur_time the current time
       @return the current time.
       */
-  inline float Setsim_time(float cur_time) {
+  inline double Setsim_time(double cur_time) {
     sim_time = cur_time;
     return sim_time;
   }
@@ -223,18 +229,18 @@ public:
   /** Sets the integration time step for the simulation executive.
       @param delta_t the time step in seconds.
       */
-  inline void  Setdt(float delta_t) { dt = delta_t; }
+  inline void  Setdt(double delta_t) { dt = delta_t; }
 
   /** Sets the JSBSim parameter to the supplied value.
       @param prm the JSBSim parameter to set, i.e. FG_RUDDER_POS.
       @param val the value to give the parameter.
       */
-  void SetParameter(eParam prm, float val);
+  void SetParameter(eParam prm, double val);
 
   /** Increments the simulation time.
       @return the new simulation time.
       */
-  inline float IncrTime(void) {
+  inline double IncrTime(void) {
     sim_time+=dt;
     return sim_time;
   }
@@ -244,7 +250,7 @@ public:
       @param tht the pitch angle in radians.
       @param psi the heading angle in radians
       */
-  void InitMatrices(float phi, float tht, float psi);
+  void InitMatrices(double phi, double tht, double psi);
 
   /** Calculates the local-to-body and body-to-local conversion matrices.
       */
@@ -265,11 +271,14 @@ public:
   FGColumnVector3& CalcEuler(void);
 
   /** Calculates and returns the stability-to-body axis transformation matrix.
-      @param alpha angle of attack in radians.
-      @param beta angle of sideslip in radians.
       @return a reference to the stability-to-body transformation matrix.
       */
-  FGMatrix33& GetTs2b(float alpha, float beta);
+  FGMatrix33& GetTs2b(void);
+  
+  /** Calculates and returns the body-to-stability axis transformation matrix.
+      @return a reference to the stability-to-body transformation matrix.
+      */
+  FGMatrix33& GetTb2s(void);
 
   /** Retrieves the local-to-body transformation matrix.
       @return a reference to the local-to-body transformation matrix.
@@ -281,7 +290,7 @@ public:
       @param c matrix column index.
       @return the matrix element described by the row and column supplied.
       */
-  float GetTl2b(int r, int c) { return mTl2b(r,c);}
+  double GetTl2b(int r, int c) { return mTl2b(r,c);}
 
   /** Retrieves the body-to-local transformation matrix.
       @return a reference to the body-to-local matrix.
@@ -293,32 +302,30 @@ public:
       @param c matrix column index.
       @return the matrix element described by the row and column supplied.
       */
-  float GetTb2l(int i, int j) { return mTb2l(i,j);}
+  double GetTb2l(int i, int j) { return mTb2l(i,j);}
   
   /** Prints a summary of simulator state (speed, altitude, 
       configuration, etc.)
   */
   void ReportState(void);
 
-
-  typedef map<eParam, string> ParamMap;
-  ParamMap paramdef;
-
 private:
-  float a;                          // speed of sound
-  float sim_time, dt;
-  float saved_dt;
+  double a;                          // speed of sound
+  double sim_time, dt;
+  double saved_dt;
 
   FGFDMExec* FDMExec;
   FGMatrix33 mTb2l;
   FGMatrix33 mTl2b;
   FGMatrix33 mTs2b;
+  FGMatrix33 mTb2s;
   FGColumnVector4 vQtrn;
   FGColumnVector4 vlastQdot;
+  FGColumnVector4 vQdot;
   FGColumnVector3 vUVW;
   FGColumnVector3 vLocalVelNED;
   FGColumnVector3 vLocalEuler;
-  FGColumnVector4 vQdot;
+  
   FGColumnVector4 vTmp;
   FGColumnVector3 vEuler;
 
@@ -331,11 +338,16 @@ private:
   FGFCS* FCS;
   FGAerodynamics* Aerodynamics;
   FGGroundReactions* GroundReactions;
+  FGPropulsion* Propulsion;
 
   typedef map<string, eParam> CoeffMap;
   CoeffMap coeffdef;
-  void Debug(void);
+
+  typedef map<eParam, string> ParamMap;
+  ParamMap paramdef;
+
   int ActiveEngine;
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -350,6 +362,7 @@ private:
 #include "FGOutput.h"
 #include "FGAircraft.h"
 #include "FGGroundReactions.h"
+#include "FGPropulsion.h"
 
 #endif