]> git.mxchange.org Git - flightgear.git/commitdiff
Sync with JSBSim again: remove a lot of unused trimming code
authorErik Hofman <erik@ehofman.com>
Tue, 15 Dec 2015 08:47:08 +0000 (09:47 +0100)
committerErik Hofman <erik@ehofman.com>
Tue, 15 Dec 2015 08:47:08 +0000 (09:47 +0100)
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/FGFDMExec.h
src/FDM/JSBSim/initialization/FGInitialCondition.cpp
src/FDM/JSBSim/initialization/FGTrim.cpp
src/FDM/JSBSim/models/FGAccelerations.cpp
src/FDM/JSBSim/models/FGMassBalance.cpp
src/FDM/JSBSim/models/propulsion/FGPropeller.cpp
src/FDM/JSBSim/models/propulsion/FGPropeller.h
src/FDM/JSBSim/models/propulsion/FGTank.h

index f0226850b62c8266d6bdd6ad80ce273c37cfccc3..928595695dd3bba79ac14869ab125bb8d9abf3c6 100644 (file)
@@ -45,6 +45,7 @@ INCLUDES
 #include <iostream>
 #include <iterator>
 #include <cstdlib>
+#include <iomanip>
 
 #include "FGFDMExec.h"
 #include "models/atmosphere/FGStandardAtmosphere.h"
@@ -64,8 +65,6 @@ INCLUDES
 #include "models/FGInput.h"
 #include "models/FGOutput.h"
 #include "initialization/FGTrim.h"
-#include "initialization/FGSimplexTrim.h"
-#include "initialization/FGLinearization.h"
 #include "input_output/FGScript.h"
 #include "input_output/FGXMLFileRead.h"
 
@@ -73,7 +72,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.182 2015/11/24 13:06:24 ehofman Exp $");
+IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.185 2015/12/13 08:01:50 bcoconni Exp $");
 IDENT(IdHdr,ID_FDMEXEC);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -100,6 +99,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
   Terminate = false;
   StandAlone = false;
   ResetMode = 0;
+  RandomSeed = 0;
 
   IncrementThenHolding = false;  // increment then hold is off by default
   TimeStepsUntilHold = -1;
@@ -152,7 +152,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
   // this is to catch errors in binding member functions to the property tree.
   try {
     Allocate();
-  } catch ( string msg ) {
+  } catch (const string& msg ) {
     cout << "Caught error: " << msg << endl;
     exit(1);
   }
@@ -163,13 +163,10 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
 
   Constructing = true;
   typedef int (FGFDMExec::*iPMF)(void) const;
-//  instance->Tie("simulation/do_trim_analysis", this, (iPMF)0, &FGFDMExec::DoTrimAnalysis, false);
   instance->Tie("simulation/do_simple_trim", this, (iPMF)0, &FGFDMExec::DoTrim, false);
-  instance->Tie("simulation/do_simplex_trim", this, (iPMF)0, &FGFDMExec::DoSimplexTrim);
-  instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
   instance->Tie("simulation/reset", this, (iPMF)0, &FGFDMExec::ResetToInitialConditions, false);
   instance->Tie("simulation/disperse", this, &FGFDMExec::GetDisperse);
-  instance->Tie("simulation/randomseed", this, (iPMF)0, &FGFDMExec::SRand, false);
+  instance->Tie("simulation/randomseed", this, (iPMF)&FGFDMExec::SRand, &FGFDMExec::SRand, false);
   instance->Tie("simulation/terminate", (int *)&Terminate);
   instance->Tie("simulation/sim-time-sec", this, &FGFDMExec::GetSimTime);
   instance->Tie("simulation/dt", this, &FGFDMExec::GetDeltaT);
@@ -177,48 +174,6 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
   instance->Tie("simulation/frame", (int *)&Frame, false);
   instance->Tie("simulation/trim-completed", (int *)&trim_completed, false);
 
-  // simplex trim properties
-  instanceRoot->SetDouble("trim/solver/rtol",0.0001);
-  instanceRoot->SetDouble("trim/solver/speed",2);
-  instanceRoot->SetDouble("trim/solver/abstol",0.001);
-  instanceRoot->SetDouble("trim/solver/iterMax",2000);
-  instanceRoot->SetInt("trim/solver/debugLevel",0);
-  instanceRoot->SetDouble("trim/solver/random",0);
-  instanceRoot->SetBool("trim/solver/showSimplex",false);
-  instanceRoot->SetBool("trim/solver/showConvergence",false);
-  instanceRoot->SetBool("trim/solver/pause",false);
-  instanceRoot->SetBool("trim/solver/variablePropPitch",false);
-
-  instanceRoot->SetDouble("trim/solver/throttleGuess",0.50);
-  instanceRoot->SetDouble("trim/solver/throttleMin",0.0);
-  instanceRoot->SetDouble("trim/solver/throttleMax",1.0);
-  instanceRoot->SetDouble("trim/solver/throttleStep",0.1);
-
-  instanceRoot->SetDouble("trim/solver/aileronGuess",0);
-  instanceRoot->SetDouble("trim/solver/aileronMin",-1.00);
-  instanceRoot->SetDouble("trim/solver/aileronMax",1.00);
-  instanceRoot->SetDouble("trim/solver/aileronStep",0.1);
-
-  instanceRoot->SetDouble("trim/solver/rudderGuess",0);
-  instanceRoot->SetDouble("trim/solver/rudderMin",-1.00);
-  instanceRoot->SetDouble("trim/solver/rudderMax",1.00);
-  instanceRoot->SetDouble("trim/solver/rudderStep",0.1);
-
-  instanceRoot->SetDouble("trim/solver/elevatorGuess",-0.1);
-  instanceRoot->SetDouble("trim/solver/elevatorMin",-1.0);
-  instanceRoot->SetDouble("trim/solver/elevatorMax",1.0);
-  instanceRoot->SetDouble("trim/solver/elevatorStep",0.1);
-
-  instanceRoot->SetDouble("trim/solver/alphaGuess",0.05);
-  instanceRoot->SetDouble("trim/solver/alphaMin",-0.1);
-  instanceRoot->SetDouble("trim/solver/alphaMax",.18);
-  instanceRoot->SetDouble("trim/solver/alphaStep",0.05);
-
-  instanceRoot->SetDouble("trim/solver/betaGuess",0);
-  instanceRoot->SetDouble("trim/solver/betaMin",-0.1);
-  instanceRoot->SetDouble("trim/solver/betaMax",0.1);
-  instanceRoot->SetDouble("trim/solver/betaStep",0.0001);
-
   Constructing = false;
 }
 
@@ -243,7 +198,7 @@ FGFDMExec::~FGFDMExec()
          FDMctr = 0;
       }
     }
-  } catch ( string msg ) {
+  } catch (const string& msg ) {
     cout << "Caught error: " << msg << endl;
   }
 
@@ -614,14 +569,14 @@ bool FGFDMExec::RunIC(void)
     cout << endl << fgblue << highint
          << "End of vehicle configuration loading." << endl
          << "-------------------------------------------------------------------------------"
-         << reset << setprecision(6) << endl;
+         << reset << std::setprecision(6) << endl;
   }
 
   for (unsigned int n=0; n < propulsion->GetNumEngines(); ++n) {
     if (IC->IsEngineRunning(n)) {
       try {
         propulsion->InitRunning(n);
-      } catch (string str) {
+      } catch (const string& str) {
         cerr << str << endl;
         return false;
       }
@@ -683,7 +638,7 @@ vector <string> FGFDMExec::EnumerateFDMs(void)
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-bool FGFDMExec::LoadScript(const string& script, double deltaT, const string initfile)
+bool FGFDMExec::LoadScript(const string& script, double deltaT, const string& initfile)
 {
   bool result;
 
@@ -709,9 +664,7 @@ bool FGFDMExec::LoadModel(const string& AircraftPath, const string& EnginePath,
 
 bool FGFDMExec::LoadModel(const string& model, bool addModelToPath)
 {
-  string token;
   string aircraftCfgFileName;
-  Element* element = 0L;
   bool result = false; // initialize result to false, indicating input file not yet read
 
   modelName = model; // Set the class modelName attribute
@@ -743,7 +696,7 @@ bool FGFDMExec::LoadModel(const string& model, bool addModelToPath)
     if (IsChild) debug_lvl = saved_debug_lvl;
 
     // Process the fileheader element in the aircraft config file. This element is OPTIONAL.
-    element = document->FindElement("fileheader");
+    Element* element = document->FindElement("fileheader");
     if (element) {
       result = ReadFileHeader(element);
       if (!result) {
@@ -936,12 +889,11 @@ string FGFDMExec::GetPropulsionTankReport()
 void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs)
 {
   struct PropertyCatalogStructure* pcsNew = new struct PropertyCatalogStructure;
-  int node_idx = 0;
 
   for (int i=0; i<pcs->node->nChildren(); i++) {
     string access="";
     pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getName();
-    node_idx = pcs->node->getChild(i)->getIndex();
+    int node_idx = pcs->node->getChild(i)->getIndex();
     if (node_idx != 0) {
       pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
     }
@@ -1091,8 +1043,6 @@ bool FGFDMExec::ReadChild(Element* el)
   // Load the model given the aircraft name
   // reset debug level to prior setting
 
-  string token;
-
   struct childData* child = new childData;
 
   child->exec = new FGFDMExec(Root, FDMctr);
@@ -1175,55 +1125,26 @@ void FGFDMExec::DoTrim(int mode)
 {
   if (Constructing) return;
 
-  if (mode < 0 || mode > JSBSim::tNone) {
+  if (mode < 0 || mode > JSBSim::tNone)
     throw("Illegal trimming mode!");
-    return;
-  }
 
   FGTrim trim(this, (JSBSim::TrimMode)mode);
-  if ( !trim.DoTrim() ) {
-    throw("Trim Failed");
-    return;
-  }
+  bool success = trim.DoTrim();
   trim.Report();
-  trim_completed = 1;
-}
 
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+  if (!success)
+    throw("Trim Failed");
 
-void FGFDMExec::DoSimplexTrim(int mode)
-{
-  double saved_time;
-  if (Constructing) return;
-  if (mode < 0 || mode > JSBSim::tNone) {
-      cerr << endl << "Illegal trimming mode!" << endl << endl;
-      return;
-  }
-  saved_time = sim_time;
-  FGSimplexTrim trim(this, (JSBSim::TrimMode)mode);
-  Setsim_time(saved_time);
-  std::cout << "dT: " << dT << std::endl;
   trim_completed = 1;
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-void FGFDMExec::DoLinearization(int mode)
-{
-  double saved_time;
-  if (Constructing) return;
-  saved_time = sim_time;
-  FGLinearization lin(this,mode);
-  Setsim_time(saved_time);
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 void FGFDMExec::SRand(int sr)
 {
+  RandomSeed = sr;
   gaussian_random_number_phase = 0;
-  srand(sr);
+  srand(RandomSeed);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index c1b4fc07c42f1427f4e7ea6bf573767d09c1c132..d68a0f069cb98435b788ca06104648a9b633c97c 100644 (file)
@@ -54,7 +54,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.102 2015/10/25 21:18:29 dpculp Exp $"
+#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.104 2015/12/13 07:54:48 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -178,7 +178,7 @@ CLASS DOCUMENTATION
                                 property actually maps toa function call of DoTrim().
 
     @author Jon S. Berndt
-    @version $Revision: 1.102 $
+    @version $Revision: 1.104 $
 */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -311,7 +311,7 @@ public:
                       is not given in either place, an error will result.
       @return true if successfully loads; false otherwise. */
   bool LoadScript(const std::string& Script, double deltaT=0.0,
-                  const std::string initfile="");
+                  const std::string& initfile="");
 
   /** Sets the path to the engine config file directories.
       @param path path to the directory under which engine config
@@ -459,12 +459,6 @@ public:
   * - tTurn
   * - tNone  */
   void DoTrim(int mode);
-  void DoSimplexTrim(int mode);
-
-  /** Executes linearization with state-space output
-   * You must trim first to get an accurate state-space model
-   */
-  void DoLinearization(int mode);
 
   /// Disables data logging to all outputs.
   void DisableOutput(void) { Output->Disable(); }
@@ -596,6 +590,7 @@ private:
   bool holding;
   bool IncrementThenHolding;
   int TimeStepsUntilHold;
+  int RandomSeed;
   bool Constructing;
   bool modelLoaded;
   bool IsChild;
@@ -649,6 +644,7 @@ private:
   bool ReadChild(Element*);
   bool ReadPrologue(Element*);
   void SRand(int sr);
+  int  SRand(void) const {return RandomSeed;}
   void LoadInputs(unsigned int idx);
   void LoadPlanetConstants(void);
   void LoadModelConstants(void);
index a230d1d92c7ded1794946f722858b555047586d8..d285dd2b765bb462d7c5c25bd58db2a730e04916 100644 (file)
@@ -57,7 +57,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.101 2015/09/27 15:45:31 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.102 2015/12/13 08:16:00 bcoconni Exp $");
 IDENT(IdHdr,ID_INITIALCONDITION);
 
 //******************************************************************************
@@ -897,7 +897,7 @@ bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
   // Check to see if any engines are specified to be initialized in a running state
   Element* running_elements = document->FindElement("running");
   while (running_elements) {
-    enginesRunning &= 1 << int(running_elements->GetDataAsNumber());
+    enginesRunning |= 1 << int(running_elements->GetDataAsNumber());
     running_elements = document->FindNextElement("running");
   }
 
index dc2e2f18f070f5137588df9eb28f8b1373ba2a50..6e7f90a5598d68334ff1bcc95411c12b5206bc9a 100644 (file)
@@ -57,7 +57,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.28 2015/09/28 20:50:41 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.29 2015/12/13 08:19:57 bcoconni Exp $");
 IDENT(IdHdr,ID_TRIM);
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -786,6 +786,7 @@ void FGTrim::setDebug(FGTrimAxis& axis) {
 
 void FGTrim::SetMode(TrimMode tt) {
     ClearStates();
+    fdmex->GetPropagate()->SetInitialState(&fgic);
     mode=tt;
     switch(tt) {
       case tFull:
index 34480872c855fe96c67700aa0d20b485dc4d7906..eabc5a27c3ccb68452c0c3b4ee24d33b752573c2 100644 (file)
@@ -60,7 +60,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.24 2015/04/02 18:30:06 ehofman Exp $");
+IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.25 2015/12/09 04:28:18 jberndt Exp $");
 IDENT(IdHdr,ID_ACCELERATIONS);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -157,7 +157,8 @@ void FGAccelerations::CalculatePQRdot(void)
   // Compute body frame rotational accelerations based on the current body
   // moments and the total inertial angular velocity expressed in the body
   // frame.
-  if (HoldDown && !FDMExec->GetTrimStatus()) {
+//  if (HoldDown && !FDMExec->GetTrimStatus()) {
+  if (HoldDown) {
     // The rotational acceleration in ECI is calculated so that the rotational
     // acceleration is zero in the body frame.
     vPQRdot.InitMatrix();
index dea17e0a836820515ed6793d7abcaa76414e6c84..7c19bcdaf6c923f2ed016b1911ed9cc0d864c414 100644 (file)
@@ -51,7 +51,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.53 2015/03/28 14:49:02 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.54 2015/12/09 04:28:18 jberndt Exp $");
 IDENT(IdHdr,ID_MASSBALANCE);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -435,12 +435,14 @@ void FGMassBalance::GetMassPropertiesReport(int i)
        << "  Mass Properties Report (English units: lbf, in, slug-ft^2)"
        << reset << endl;
   cout << "                                  " << underon << "    Weight    CG-X    CG-Y"
-       << "    CG-Z         Ixx         Iyy         Izz" << underoff << endl;
+       << "    CG-Z         Ixx         Iyy         Izz" 
+       << "         Ixy         Ixz         Iyz" << underoff << endl;
   cout.precision(1);
   cout << highint << setw(34) << left << "    Base Vehicle " << normint
-       << right << setw(10) << EmptyWeight << setw(8) << vbaseXYZcg(eX) << setw(8)
-       << vbaseXYZcg(eY) << setw(8) << vbaseXYZcg(eZ) << setw(12) << baseJ(1,1)
-       << setw(12) << baseJ(2,2) << setw(12) << baseJ(3,3) << endl;
+       << right << setw(10) << EmptyWeight
+       << setw(8) << vbaseXYZcg(eX) << setw(8) << vbaseXYZcg(eY) << setw(8) << vbaseXYZcg(eZ)
+       << setw(12) << baseJ(1,1) << setw(12) << baseJ(2,2) << setw(12) << baseJ(3,3)
+       << setw(12) << baseJ(1,2) << setw(12) << baseJ(1,3) << setw(12) << baseJ(2,3) << endl;
 
   for (unsigned int i=0;i<PointMasses.size();i++) {
     PointMass* pm = PointMasses[i];
@@ -448,13 +450,13 @@ void FGMassBalance::GetMassPropertiesReport(int i)
     cout << highint << left << setw(4) << i << setw(30) << pm->GetName() << normint
          << right << setw(10) << pmweight << setw(8) << pm->GetLocation()(eX)
          << setw(8) << pm->GetLocation()(eY) << setw(8) << pm->GetLocation()(eZ)
-         << setw(12) << pm->GetPointMassMoI(1,1) << setw(12) << pm->GetPointMassMoI(2,2)
-         << setw(12) << pm->GetPointMassMoI(3,3) << endl;
+         << setw(12) << pm->GetPointMassMoI(1,1) << setw(12) << pm->GetPointMassMoI(2,2) << setw(12) << pm->GetPointMassMoI(3,3)
+         << setw(12) << pm->GetPointMassMoI(1,2) << setw(12) << pm->GetPointMassMoI(1,3) << setw(12) << pm->GetPointMassMoI(2,3) << endl;         
   }
 
   cout << FDMExec->GetPropulsionTankReport();
 
-  cout << underon << setw(104) << " " << underoff << endl;
+  cout << "    " << underon << setw(136) << " " << underoff << endl;
   cout << highint << left << setw(30) << "    Total: " << right << setw(14) << Weight 
        << setw(8) << vXYZcg(eX)
        << setw(8) << vXYZcg(eY)
@@ -462,6 +464,9 @@ void FGMassBalance::GetMassPropertiesReport(int i)
        << setw(12) << mJ(1,1)
        << setw(12) << mJ(2,2)
        << setw(12) << mJ(3,3)
+       << setw(12) << mJ(1,2)
+       << setw(12) << mJ(1,3)
+       << setw(12) << mJ(2,3)
        << normint << endl;
 
   cout.setf(ios_base::fixed);
index 510d67f0fcd377fb91932de30ce99dc921d2dbd0..81ea5b08aead0c977328c928bd4bf1f857b9bdba 100644 (file)
@@ -45,7 +45,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGPropeller.cpp,v 1.54 2015/09/27 09:29:41 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGPropeller.cpp,v 1.56 2015/12/13 08:56:06 bcoconni Exp $");
 IDENT(IdHdr,ID_PROPELLER);
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -205,6 +205,9 @@ double FGPropeller::Calculate(double EnginePower)
   double Vel = localAeroVel(eU) + Vinduced;
   double rho = in.Density;
   double RPS = RPM/60.0;
+  // The time step should not be 0 for the propeller RPM to reach a steady
+  // value during trimming.
+  deltaT = ( in.TotalDeltaT > 0.0 ) ? in.TotalDeltaT : 0.01;
 
   // Calculate helical tip Mach
   double Area = 0.25*Diameter*Diameter*M_PI;
@@ -285,7 +288,7 @@ double FGPropeller::Calculate(double EnginePower)
   if (omega > 0.0) ExcessTorque = PowerAvailable / omega;
   else             ExcessTorque = PowerAvailable / 1.0;
 
-  RPM = (RPS + ((ExcessTorque / Ixx) / (2.0 * M_PI)) * in.TotalDeltaT) * 60.0;
+  RPM = (RPS + ((ExcessTorque / Ixx) / (2.0 * M_PI)) * deltaT) * 60.0;
 
   if (RPM < 0.0) RPM = 0.0; // Engine won't turn backwards
 
@@ -326,7 +329,7 @@ double FGPropeller::GetPowerRequired(void)
           double dRPM = rpmReq - RPM;
           // The pitch of a variable propeller cannot be changed when the RPMs are
           // too low - the oil pump does not work.
-          if (RPM > 200) Pitch -= dRPM * in.TotalDeltaT;
+          if (RPM > 200) Pitch -= dRPM * deltaT;
           if (Pitch < MinPitch)       Pitch = MinPitch;
           else if (Pitch > MaxPitch)  Pitch = MaxPitch;
 
index 1927824118a36a4ca0b02b48da9e610781647583..490f87b80f8aa0e1174d20227453e3ab5d2ed1f5 100644 (file)
@@ -45,7 +45,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_PROPELLER "$Id: FGPropeller.h,v 1.22 2015/04/20 11:40:45 ehofman Exp $"
+#define ID_PROPELLER "$Id: FGPropeller.h,v 1.25 2015/12/13 08:56:06 bcoconni Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -142,7 +142,7 @@ CLASS DOCUMENTATION
     <li>Various NACA Technical Notes and Reports</li>
     </ul>
     @author Jon S. Berndt
-    @version $Id: FGPropeller.h,v 1.22 2015/04/20 11:40:45 ehofman Exp $
+    @version $Id: FGPropeller.h,v 1.25 2015/12/13 08:56:06 bcoconni Exp $
     @see FGEngine
     @see FGThruster
 */
@@ -303,6 +303,7 @@ private:
   bool   Reversed;     // true, when propeller is reversed
   double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
   bool   Feathered;    // true, if feather command
+  double deltaT;       // Time step
 };
 }
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
index ef3aeb3cfd2ecc5645d6584676e972b6f0c8974c..09f0ee9f33dee713b6eaf89a6266f3093b4c44d1 100644 (file)
@@ -53,7 +53,7 @@ INCLUDES
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_TANK "$Id: FGTank.h,v 1.30 2015/02/02 20:49:11 bcoconni Exp $"
+#define ID_TANK "$Id: FGTank.h,v 1.31 2015/12/09 04:28:18 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -135,6 +135,7 @@ CLASS DOCUMENTATION
   </drain_location>
   <radius unit="{IN | FT | M}"> {number} </radius>
   <capacity unit="{LBS | KG}"> {number} </capacity>
+  <inertia_factor> {number:0-1} </inertia_factor>
   <contents unit="{LBS | KG}"> {number} </contents>
   <temperature> {number} </temperature> <!-- must be degrees fahrenheit -->
   <standpipe unit="{LBS | KG"}> {number} </standpipe>