]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGState.h
"make dist" fixes.
[flightgear.git] / src / FDM / JSBSim / FGState.h
index d1150ee057106ad08803e0c82316a4fd1e6329d3..d1ca3d74ff7a803faf7cbb24facb44cbe13212fa 100644 (file)
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
  Header:       FGState.h
  Author:       Jon S. Berndt
  ------------- 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
+ the terms of the GNU Lesser 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
+ FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
  details.
 
- You should have received a copy of the GNU General Public License along with
+ You should have received a copy of the GNU Lesser 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
+ Further information about the GNU Lesser 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
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #ifndef FGSTATE_H
 #define FGSTATE_H
 
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 INCLUDES
-*******************************************************************************/
-
-#ifdef FGFS
-#  include <Include/compiler.h>
-#  include STL_STRING
-#  ifdef FG_HAVE_STD_INCLUDES
-#    include <fstream>
-#  else
-#    include <fstream.h>
-#  endif
-   FG_USING_STD(string);
-#else
-#  include <string>
-#  include <fstream>
-#endif
-
-#include "FGDefs.h"
-
-/*******************************************************************************
-DEFINES
-*******************************************************************************/
-
-using namespace std;
-
-/*******************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#include <fstream>
+#include <string>
+#include <map>
+#include "FGJSBBase.h"
+#include <initialization/FGInitialCondition.h>
+#include <math/FGColumnVector3.h>
+#include <math/FGQuaternion.h>
+#include "FGFDMExec.h"
+#include <models/FGAtmosphere.h>
+#include <models/FGFCS.h>
+#include <models/FGPropagate.h>
+#include <models/FGAuxiliary.h>
+#include <models/FGAerodynamics.h>
+#include <models/FGAircraft.h>
+#include <models/FGGroundReactions.h>
+#include <models/FGPropulsion.h>
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+#define ID_STATE "$Id$"
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+namespace JSBSim {
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates the calculation of aircraft state.
+    <h3>Properties</h3>
+    @property sim-time-sec (read only) cumulative simulation in seconds.
+    @author Jon S. Berndt
+    @version $Revision$
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-class FGFDMExec;
-class FGState
+class FGState : public FGJSBBase
 {
 public:
-   FGState(FGFDMExec*);
-  ~FGState(void);
-
-  bool Reset(string, string);
-  void Initialize(float, float, float, float, float, float, float, float, float);
-  bool StoreData(string);
-  bool DumpData(string);
-  bool DisplayData(void);
-
-  inline float GetVt(void) {return Vt;}
-
-  inline float Getlatitude(void) {return latitude;}
-  inline float Getlongitude(void) {return longitude;}
-  inline float GetGeodeticLat(void) {return GeodeticLat;}
-
-  inline float Getadot(void) {return adot;}
-  inline float Getbdot(void) {return bdot;}
-
-  inline float Geth(void) {return h;}
-  inline float Geta(void) {return a;}
-  inline float GetMach(void) {return Mach;}
-
-  inline float Getsim_time(void) {return sim_time;}
-  inline float Getdt(void) {return dt;}
-
-  inline float Getqbar(void) {return qbar;}
-
-  inline void SetVt(float tt) {Vt = tt;}
-
-  inline void Setlatitude(float tt) {latitude = tt;}
-  inline void Setlongitude(float tt) {longitude = tt;}
-  inline void SetGeodeticLat(float tt) {GeodeticLat = tt;}
-
-  inline void Setadot(float tt) {adot = tt;}
-  inline void Setbdot(float tt) {bdot = tt;}
-
-  inline void Setqbar(float tt) {qbar = tt;}
-
-  inline void Seth(float tt) {h = tt;}
-  inline void Seta(float tt) {a = tt;}
-  inline void SetMach(float tt) {Mach = tt;}
-
-  inline float Setsim_time(float tt) {sim_time = tt; return sim_time;}
-  inline void  Setdt(float tt) {dt = tt;}
-
-  inline float IncrTime(void) {sim_time+=dt;return sim_time;}
+  /** Constructor
+      @param Executive a pointer to the parent executive object */
+  FGState(FGFDMExec*);
+  /// Destructor
+  ~FGState();
+
+  /** 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);
+
+  /// Returns the cumulative 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 SuspendIntegration(void) {saved_dt = dt; dt = 0.0;}
+
+  /// Resumes the simulation by resetting delta T to the correct value.
+  inline void ResumeIntegration(void)  {dt = saved_dt;}
+
+  /** Returns the simulation suspension state.
+      @return true if suspended, false if executing  */
+  bool IntegrationSuspended(void) {return dt == 0.0;}
+
+  /** Sets the current sim time.
+      @param cur_time the current time
+      @return the current simulation time.      */
+  inline double Setsim_time(double cur_time) {
+    sim_time = cur_time;
+    return sim_time;
+  }
+
+  /** 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; }
+
+  /** Increments the simulation time.
+      @return the new simulation time.     */
+  inline double IncrTime(void) {
+    sim_time+=dt;
+    return sim_time;
+  }
+
+  /** Prints a summary of simulator state (speed, altitude,
+      configuration, etc.)  */
+//  void ReportState(void);
 
 private:
-
-  float Vt;                         // Total velocity
-  float latitude, longitude;        // position
-  float GeodeticLat;                // Geodetic Latitude
-  float adot, bdot;                 // alpha dot and beta dot
-  float h, a;                       // altitude above sea level, speed of sound
-  float qbar;                       // dynamic pressure
-  float sim_time, dt;
-  float Mach;                       // Mach number
+  double sim_time, dt;
+  double saved_dt;
 
   FGFDMExec* FDMExec;
 
-protected:
+  FGAircraft* Aircraft;
+  FGPropagate* Propagate;
+  FGAtmosphere* Atmosphere;
+  FGFCS* FCS;
+  FGAerodynamics* Aerodynamics;
+  FGGroundReactions* GroundReactions;
+  FGPropulsion* Propulsion;
+  FGAuxiliary* Auxiliary;
+  FGPropertyManager* PropertyManager;
 
+  void bind();
+
+  void Debug(int from);
 };
+}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 
-/******************************************************************************/
 #endif
+