]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGState.h
Updated to match changes in radiostack.[ch]xx
[flightgear.git] / src / FDM / JSBSim / FGState.h
index c9ab9d48ca2789ad5657b4f671dd5f696a0cd529..5d7b70dcdef868a70a7c26e946c0486862e7a9f1 100644 (file)
@@ -58,7 +58,6 @@ INCLUDES
 
 #include <string>
 #include <map>
-#include "FGDefs.h"
 #include "FGJSBBase.h"
 #include "FGInitialCondition.h"
 #include "FGMatrix33.h"
@@ -96,6 +95,10 @@ CLASS DOCUMENTATION
 /** Encapsulates the calculation of aircraft state.
     @author Jon S. Berndt
     @version $Id$
+    @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGState.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/FGState.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
+         Source File </a>
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -148,18 +151,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.
@@ -167,56 +170,29 @@ public:
       */
   void Initialize(FGInitialCondition *FGIC);
 
-  /** Stores state data in the supplied file name.
-      @param filename the file to store the data in.
-      @return true if successful.
-      */
-  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) const { 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;}
   /// Resumes the simulation by resetting delta T to the correct value.
   inline void Resume(void)  {dt = saved_dt;}
 
-  /** Retrieves a parameter.
-      The parameters that can be retrieved are enumerated in FGDefs.h.
-      @param val_idx one of the enumerated JSBSim parameters.
-      @return the value of the parameter.
-      */
-  float GetParameter(eParam val_idx);
-
-  /** Retrieves a parameter.
-      The parameters that can be retrieved are enumerated in FGDefs.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);
-
-  /** Retrieves the JSBSim parameter enumerated item given the text string.
-      @param val_string the parameter string, i.e. "FG_QBAR".
-      @return the JSBSim parameter index (an enumerated type) for the supplied string.
-      */
-  eParam GetParameterIndex(string val_string);
-
   /** 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; }
 
   /** 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;
   }
@@ -224,18 +200,12 @@ 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; }
-
-  /** 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);
+  inline void  Setdt(double delta_t) { dt = delta_t; }
 
   /** Increments the simulation time.
       @return the new simulation time.
       */
-  inline float IncrTime(void) {
+  inline double IncrTime(void) {
     sim_time+=dt;
     return sim_time;
   }
@@ -245,7 +215,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.
       */
@@ -266,11 +236,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.
@@ -282,7 +255,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.
@@ -294,32 +267,37 @@ 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;
+  
+  inline string GetPropertyName(string prm) { return ParamNameToProp[prm]; }
+  //inline string GetPropertyName(eParam prm) { return ParamIdxToProp[prm]; }
+  //inline eParam GetParam(string property) { return PropToParam[property]; }
+  
+  void bind();
+  void unbind();
 
 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;
 
@@ -333,11 +311,27 @@ private:
   FGAerodynamics* Aerodynamics;
   FGGroundReactions* GroundReactions;
   FGPropulsion* Propulsion;
+  FGPropertyManager* PropertyManager;
 
-  typedef map<string, eParam> CoeffMap;
/*  typedef map<string, eParam> CoeffMap;
   CoeffMap coeffdef;
-  void Debug(void);
+
+  typedef map<eParam, string> ParamMap;
+  //ParamMap paramdef; */
+
+  
+  typedef map<string,string> ParamNameMap;
+  ParamNameMap ParamNameToProp;
+  
+  typedef map<eParam,string> ParamIdxMap;
+  ParamIdxMap ParamIdxToProp;
+  //CoeffMap PropToParam;
+
   int ActiveEngine;
+  
+  void InitPropertyMaps(void);
+  
+  void Debug(int from);
 };
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%