]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGModel.cpp
JSBSim tweaks.
[flightgear.git] / src / FDM / JSBSim / FGModel.cpp
index dc0a9d998a14b077283cff852aaa44c992dc25b7..7006b1d0bb2711893d2d1cf266ad71697a3f9aad 100644 (file)
@@ -43,6 +43,10 @@ INCLUDES
 #include "FGFDMExec.h"
 #include "FGAtmosphere.h"
 #include "FGFCS.h"
+#include "FGPropulsion.h"
+#include "FGMassBalance.h"
+#include "FGAerodynamics.h"
+#include "FGInertial.h"
 #include "FGAircraft.h"
 #include "FGTranslation.h"
 #include "FGRotation.h"
@@ -50,9 +54,15 @@ INCLUDES
 #include "FGAuxiliary.h"
 #include "FGOutput.h"
 
-static const char *IdSrc = "$Header$";
+static const char *IdSrc = "$Id$";
 static const char *IdHdr = ID_MODEL;
 
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+GLOBAL DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+extern short debug_lvl;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS IMPLEMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -61,41 +71,58 @@ FGModel::FGModel(FGFDMExec* fdmex)
 {
   FDMExec     = fdmex;
   NextModel   = 0L;
-  
-  State       = 0;
-  Atmosphere  = 0;
-  FCS         = 0;
-  Aircraft    = 0;
-  Translation = 0;
-  Rotation    = 0;
-  Position    = 0;
-  Auxiliary   = 0;
-  Output      = 0;
+
+  State        = 0;
+  Atmosphere   = 0;
+  FCS          = 0;
+  Propulsion   = 0;
+  MassBalance  = 0;
+  Aerodynamics = 0;
+  Inertial     = 0;
+  Aircraft     = 0;
+  Translation  = 0;
+  Rotation     = 0;
+  Position     = 0;
+  Auxiliary    = 0;
+  Output       = 0;
 
   exe_ctr     = 1;
+
+  if (debug_lvl & 2) cout << "              FGModel Base Class" << endl;
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 FGModel::~FGModel()
 {
+  if (debug_lvl & 2) cout << "Destroyed:    FGModel" << endl;
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 bool FGModel::InitModel(void)
 {
-  State       = FDMExec->GetState();
-  Atmosphere  = FDMExec->GetAtmosphere();
-  FCS         = FDMExec->GetFCS();
-  Aircraft    = FDMExec->GetAircraft();
-  Translation = FDMExec->GetTranslation();
-  Rotation    = FDMExec->GetRotation();
-  Position    = FDMExec->GetPosition();
-  Auxiliary   = FDMExec->GetAuxiliary();
-  Output      = FDMExec->GetOutput();
+  State        = FDMExec->GetState();
+  Atmosphere   = FDMExec->GetAtmosphere();
+  FCS          = FDMExec->GetFCS();
+  Propulsion   = FDMExec->GetPropulsion();
+  MassBalance  = FDMExec->GetMassBalance();
+  Aerodynamics = FDMExec->GetAerodynamics();
+  Inertial     = FDMExec->GetInertial();
+  Aircraft     = FDMExec->GetAircraft();
+  Translation  = FDMExec->GetTranslation();
+  Rotation     = FDMExec->GetRotation();
+  Position     = FDMExec->GetPosition();
+  Auxiliary    = FDMExec->GetAuxiliary();
+  Output       = FDMExec->GetOutput();
 
   if (!State ||
       !Atmosphere ||
       !FCS ||
+      !Propulsion ||
+      !MassBalance ||
+      !Aerodynamics ||
+      !Inertial ||
       !Aircraft ||
       !Translation ||
       !Rotation ||
@@ -105,9 +132,12 @@ bool FGModel::InitModel(void)
   else return(true);
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 bool FGModel::Run()
 {
+  if (debug_lvl & 4) cout << "Entering Run() for model " << Name << endl;
+
   if (exe_ctr == 1) {
     if (exe_ctr++ >= rate) exe_ctr = 1;
     return false;
@@ -117,4 +147,10 @@ bool FGModel::Run()
   }
 }
 
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+void FGModel::Debug(void)
+{
+    //TODO: Add your source code here
+}