]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGState.h
Make yasim accept the launchbar and hook properties. They are not tied to anything...
[flightgear.git] / src / FDM / JSBSim / FGState.h
index 4e0fcf67fd3f80c6b729215174931c23fbb14b38..8709b00b35d7418f2ea4b1252f28784eda92bd6d 100644 (file)
@@ -1,38 +1,35 @@
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
  Header:       FGState.h
  Author:       Jon S. Berndt
  Date started: 11/17/98
+
  ------------- 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.
+
 FUNCTIONAL DESCRIPTION
 --------------------------------------------------------------------------------
-Based on Flightgear code, which is based on LaRCSim. This class wraps all
-global state variables (such as velocity, position, orientation, etc.).
+
 HISTORY
 --------------------------------------------------------------------------------
 11/17/98   JSB   Created
+
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -52,93 +49,145 @@ INCLUDES
 #    include <fstream.h>
 #  endif
 #else
-#  include <fstream>
+#  if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
+#    include <fstream.h>
+#  else
+#    include <fstream>
+#  endif
 #endif
 
 #include <string>
 #include <map>
-#include "FGDefs.h"
+#include "FGJSBBase.h"
 #include "FGInitialCondition.h"
-#include "FGMatrix.h"
+#include "FGMatrix33.h"
+#include "FGColumnVector3.h"
+#include "FGQuaternion.h"
+#include "FGFDMExec.h"
+#include "FGAtmosphere.h"
+#include "FGFCS.h"
+#include "FGPropagate.h"
+#include "FGAuxiliary.h"
+#include "FGAerodynamics.h"
+#include "FGOutput.h"
+#include "FGAircraft.h"
+#include "FGGroundReactions.h"
+#include "FGPropulsion.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_STATE "$Header$"
+#define ID_STATE "$Id$"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-CLASS DECLARATION
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+namespace JSBSim {
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGFDMExec;
+/** Encapsulates the calculation of aircraft state.
+    @author Jon S. Berndt
+    @version $Id$
+*/
 
-class FGState {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+class FGState : public FGJSBBase
+{
 public:
+  /** Constructor
+      @param Executive a pointer to the parent executive object */
   FGState(FGFDMExec*);
-  ~FGState(void);
+  /// Destructor
+  ~FGState();
 
-  bool Reset(string, string, string);
-  void Initialize(float, float, float, float, float, float, float, float, float);
+  /** Initializes the simulation state based on parameters from an Initial Conditions object.
+      @param FGIC pointer to an initial conditions object.
+      @see FGInitialConditions.
+      */
   void Initialize(FGInitialCondition *FGIC);
-  bool StoreData(string);
-
-  inline float Geta(void) { return a; }
 
-  inline float Getsim_time(void) { return sim_time; }
-  inline float Getdt(void) { return dt; }
+  /// Returns the simulation time in seconds.
+  inline double Getsim_time(void) const { return sim_time; }
+  /// Returns the simulation delta T.
+  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;}
 
-  float GetParameter(eParam val_idx);
-  float GetParameter(string val_string);
-  eParam GetParameterIndex(string val_string);
-
-
-  inline void Seta(float tt) { a = tt; }
-
-  inline float Setsim_time(float tt) {
-    sim_time = tt;
+  /** Sets the current sim time.
+      @param cur_time the current time
+      @return the current time.
+      */
+  inline double Setsim_time(double cur_time) {
+    sim_time = cur_time;
     return sim_time;
   }
-  inline void  Setdt(float tt) { dt = tt; }
 
-  void SetParameter(eParam, float);
+  /** Sets the integration time step for the simulation executive.
+      @param delta_t the time step in seconds.
+      */
+  inline void  Setdt(double delta_t) { dt = delta_t; }
 
-  inline float IncrTime(void) {
+  /** Increments the simulation time.
+      @return the new simulation time.
+      */
+  inline double IncrTime(void) {
     sim_time+=dt;
     return sim_time;
   }
-  void InitMatrices(float phi, float tht, float psi);
-  void CalcMatrices(void);
-  void IntegrateQuat(FGColumnVector vPQR, int rate);
-  FGColumnVector CalcEuler(void);
-  FGMatrix GetTs2b(float alpha, float beta);
-  FGMatrix GetTl2b(void) { return mTl2b; }
-  FGMatrix GetTb2l(void) { return mTb2l; }
-  typedef map<eParam, string> ParamMap;
-  ParamMap paramdef;
 
-private:
+  /** Calculates and returns the stability-to-body axis transformation matrix.
+      @return a reference to the stability-to-body transformation matrix.
+      */
+  FGMatrix33& GetTs2b(void);
 
-  float a;                          // speed of sound
-  float sim_time, dt;
-  float saved_dt;
+  /** Calculates and returns the body-to-stability axis transformation matrix.
+      @return a reference to the stability-to-body transformation matrix.
+      */
+  FGMatrix33& GetTb2s(void);
 
-  FGFDMExec* FDMExec;
-  FGMatrix mTb2l;
-  FGMatrix mTl2b;
-  FGMatrix mTs2b;
-  FGColumnVector vQtrn;
+  /** Prints a summary of simulator state (speed, altitude,
+      configuration, etc.)
+  */
+  void ReportState(void);
 
-  typedef map<string, eParam> CoeffMap;
-  CoeffMap coeffdef;
+  void bind();
+  void unbind();
 
-protected:
-  enum {ePhi=1, eTht, ePsi};
-  enum {eP=1, eQ, eR};
-};
+private:
+  double sim_time, dt;
+  double saved_dt;
 
+  FGFDMExec* FDMExec;
+  FGMatrix33 mTs2b;
+  FGMatrix33 mTb2s;
+
+  FGAircraft* Aircraft;
+  FGPropagate* Propagate;
+  FGOutput* Output;
+  FGAtmosphere* Atmosphere;
+  FGFCS* FCS;
+  FGAerodynamics* Aerodynamics;
+  FGGroundReactions* GroundReactions;
+  FGPropulsion* Propulsion;
+  FGAuxiliary* Auxiliary;
+  FGPropertyManager* PropertyManager;
+
+  void Debug(int from);
+};
+}
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
 #endif
+