Sync with JSBSim again: remove a lot of unused trimming code
This commit is contained in:
parent
ff33aa038e
commit
64b80b4dab
9 changed files with 55 additions and 126 deletions
|
@ -45,6 +45,7 @@ INCLUDES
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
#include "FGFDMExec.h"
|
#include "FGFDMExec.h"
|
||||||
#include "models/atmosphere/FGStandardAtmosphere.h"
|
#include "models/atmosphere/FGStandardAtmosphere.h"
|
||||||
|
@ -64,8 +65,6 @@ INCLUDES
|
||||||
#include "models/FGInput.h"
|
#include "models/FGInput.h"
|
||||||
#include "models/FGOutput.h"
|
#include "models/FGOutput.h"
|
||||||
#include "initialization/FGTrim.h"
|
#include "initialization/FGTrim.h"
|
||||||
#include "initialization/FGSimplexTrim.h"
|
|
||||||
#include "initialization/FGLinearization.h"
|
|
||||||
#include "input_output/FGScript.h"
|
#include "input_output/FGScript.h"
|
||||||
#include "input_output/FGXMLFileRead.h"
|
#include "input_output/FGXMLFileRead.h"
|
||||||
|
|
||||||
|
@ -73,7 +72,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
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);
|
IDENT(IdHdr,ID_FDMEXEC);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -100,6 +99,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
|
||||||
Terminate = false;
|
Terminate = false;
|
||||||
StandAlone = false;
|
StandAlone = false;
|
||||||
ResetMode = 0;
|
ResetMode = 0;
|
||||||
|
RandomSeed = 0;
|
||||||
|
|
||||||
IncrementThenHolding = false; // increment then hold is off by default
|
IncrementThenHolding = false; // increment then hold is off by default
|
||||||
TimeStepsUntilHold = -1;
|
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.
|
// this is to catch errors in binding member functions to the property tree.
|
||||||
try {
|
try {
|
||||||
Allocate();
|
Allocate();
|
||||||
} catch ( string msg ) {
|
} catch (const string& msg ) {
|
||||||
cout << "Caught error: " << msg << endl;
|
cout << "Caught error: " << msg << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -163,13 +163,10 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
|
||||||
|
|
||||||
Constructing = true;
|
Constructing = true;
|
||||||
typedef int (FGFDMExec::*iPMF)(void) const;
|
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_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/reset", this, (iPMF)0, &FGFDMExec::ResetToInitialConditions, false);
|
||||||
instance->Tie("simulation/disperse", this, &FGFDMExec::GetDisperse);
|
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/terminate", (int *)&Terminate);
|
||||||
instance->Tie("simulation/sim-time-sec", this, &FGFDMExec::GetSimTime);
|
instance->Tie("simulation/sim-time-sec", this, &FGFDMExec::GetSimTime);
|
||||||
instance->Tie("simulation/dt", this, &FGFDMExec::GetDeltaT);
|
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/frame", (int *)&Frame, false);
|
||||||
instance->Tie("simulation/trim-completed", (int *)&trim_completed, 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;
|
Constructing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +198,7 @@ FGFDMExec::~FGFDMExec()
|
||||||
FDMctr = 0;
|
FDMctr = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch ( string msg ) {
|
} catch (const string& msg ) {
|
||||||
cout << "Caught error: " << msg << endl;
|
cout << "Caught error: " << msg << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -614,14 +569,14 @@ bool FGFDMExec::RunIC(void)
|
||||||
cout << endl << fgblue << highint
|
cout << endl << fgblue << highint
|
||||||
<< "End of vehicle configuration loading." << endl
|
<< "End of vehicle configuration loading." << endl
|
||||||
<< "-------------------------------------------------------------------------------"
|
<< "-------------------------------------------------------------------------------"
|
||||||
<< reset << setprecision(6) << endl;
|
<< reset << std::setprecision(6) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int n=0; n < propulsion->GetNumEngines(); ++n) {
|
for (unsigned int n=0; n < propulsion->GetNumEngines(); ++n) {
|
||||||
if (IC->IsEngineRunning(n)) {
|
if (IC->IsEngineRunning(n)) {
|
||||||
try {
|
try {
|
||||||
propulsion->InitRunning(n);
|
propulsion->InitRunning(n);
|
||||||
} catch (string str) {
|
} catch (const string& str) {
|
||||||
cerr << str << endl;
|
cerr << str << endl;
|
||||||
return false;
|
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;
|
bool result;
|
||||||
|
|
||||||
|
@ -709,9 +664,7 @@ bool FGFDMExec::LoadModel(const string& AircraftPath, const string& EnginePath,
|
||||||
|
|
||||||
bool FGFDMExec::LoadModel(const string& model, bool addModelToPath)
|
bool FGFDMExec::LoadModel(const string& model, bool addModelToPath)
|
||||||
{
|
{
|
||||||
string token;
|
|
||||||
string aircraftCfgFileName;
|
string aircraftCfgFileName;
|
||||||
Element* element = 0L;
|
|
||||||
bool result = false; // initialize result to false, indicating input file not yet read
|
bool result = false; // initialize result to false, indicating input file not yet read
|
||||||
|
|
||||||
modelName = model; // Set the class modelName attribute
|
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;
|
if (IsChild) debug_lvl = saved_debug_lvl;
|
||||||
|
|
||||||
// Process the fileheader element in the aircraft config file. This element is OPTIONAL.
|
// Process the fileheader element in the aircraft config file. This element is OPTIONAL.
|
||||||
element = document->FindElement("fileheader");
|
Element* element = document->FindElement("fileheader");
|
||||||
if (element) {
|
if (element) {
|
||||||
result = ReadFileHeader(element);
|
result = ReadFileHeader(element);
|
||||||
if (!result) {
|
if (!result) {
|
||||||
|
@ -936,12 +889,11 @@ string FGFDMExec::GetPropulsionTankReport()
|
||||||
void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs)
|
void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs)
|
||||||
{
|
{
|
||||||
struct PropertyCatalogStructure* pcsNew = new struct PropertyCatalogStructure;
|
struct PropertyCatalogStructure* pcsNew = new struct PropertyCatalogStructure;
|
||||||
int node_idx = 0;
|
|
||||||
|
|
||||||
for (int i=0; i<pcs->node->nChildren(); i++) {
|
for (int i=0; i<pcs->node->nChildren(); i++) {
|
||||||
string access="";
|
string access="";
|
||||||
pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getName();
|
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) {
|
if (node_idx != 0) {
|
||||||
pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
|
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
|
// Load the model given the aircraft name
|
||||||
// reset debug level to prior setting
|
// reset debug level to prior setting
|
||||||
|
|
||||||
string token;
|
|
||||||
|
|
||||||
struct childData* child = new childData;
|
struct childData* child = new childData;
|
||||||
|
|
||||||
child->exec = new FGFDMExec(Root, FDMctr);
|
child->exec = new FGFDMExec(Root, FDMctr);
|
||||||
|
@ -1175,55 +1125,26 @@ void FGFDMExec::DoTrim(int mode)
|
||||||
{
|
{
|
||||||
if (Constructing) return;
|
if (Constructing) return;
|
||||||
|
|
||||||
if (mode < 0 || mode > JSBSim::tNone) {
|
if (mode < 0 || mode > JSBSim::tNone)
|
||||||
throw("Illegal trimming mode!");
|
throw("Illegal trimming mode!");
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
FGTrim trim(this, (JSBSim::TrimMode)mode);
|
FGTrim trim(this, (JSBSim::TrimMode)mode);
|
||||||
if ( !trim.DoTrim() ) {
|
bool success = trim.DoTrim();
|
||||||
throw("Trim Failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
trim.Report();
|
trim.Report();
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
throw("Trim Failed");
|
||||||
|
|
||||||
trim_completed = 1;
|
trim_completed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
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)
|
void FGFDMExec::SRand(int sr)
|
||||||
{
|
{
|
||||||
|
RandomSeed = sr;
|
||||||
gaussian_random_number_phase = 0;
|
gaussian_random_number_phase = 0;
|
||||||
srand(sr);
|
srand(RandomSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -54,7 +54,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
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
|
FORWARD DECLARATIONS
|
||||||
|
@ -178,7 +178,7 @@ CLASS DOCUMENTATION
|
||||||
property actually maps toa function call of DoTrim().
|
property actually maps toa function call of DoTrim().
|
||||||
|
|
||||||
@author Jon S. Berndt
|
@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.
|
is not given in either place, an error will result.
|
||||||
@return true if successfully loads; false otherwise. */
|
@return true if successfully loads; false otherwise. */
|
||||||
bool LoadScript(const std::string& Script, double deltaT=0.0,
|
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.
|
/** Sets the path to the engine config file directories.
|
||||||
@param path path to the directory under which engine config
|
@param path path to the directory under which engine config
|
||||||
|
@ -459,12 +459,6 @@ public:
|
||||||
* - tTurn
|
* - tTurn
|
||||||
* - tNone */
|
* - tNone */
|
||||||
void DoTrim(int mode);
|
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.
|
/// Disables data logging to all outputs.
|
||||||
void DisableOutput(void) { Output->Disable(); }
|
void DisableOutput(void) { Output->Disable(); }
|
||||||
|
@ -596,6 +590,7 @@ private:
|
||||||
bool holding;
|
bool holding;
|
||||||
bool IncrementThenHolding;
|
bool IncrementThenHolding;
|
||||||
int TimeStepsUntilHold;
|
int TimeStepsUntilHold;
|
||||||
|
int RandomSeed;
|
||||||
bool Constructing;
|
bool Constructing;
|
||||||
bool modelLoaded;
|
bool modelLoaded;
|
||||||
bool IsChild;
|
bool IsChild;
|
||||||
|
@ -649,6 +644,7 @@ private:
|
||||||
bool ReadChild(Element*);
|
bool ReadChild(Element*);
|
||||||
bool ReadPrologue(Element*);
|
bool ReadPrologue(Element*);
|
||||||
void SRand(int sr);
|
void SRand(int sr);
|
||||||
|
int SRand(void) const {return RandomSeed;}
|
||||||
void LoadInputs(unsigned int idx);
|
void LoadInputs(unsigned int idx);
|
||||||
void LoadPlanetConstants(void);
|
void LoadPlanetConstants(void);
|
||||||
void LoadModelConstants(void);
|
void LoadModelConstants(void);
|
||||||
|
|
|
@ -57,7 +57,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
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);
|
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
|
// Check to see if any engines are specified to be initialized in a running state
|
||||||
Element* running_elements = document->FindElement("running");
|
Element* running_elements = document->FindElement("running");
|
||||||
while (running_elements) {
|
while (running_elements) {
|
||||||
enginesRunning &= 1 << int(running_elements->GetDataAsNumber());
|
enginesRunning |= 1 << int(running_elements->GetDataAsNumber());
|
||||||
running_elements = document->FindNextElement("running");
|
running_elements = document->FindNextElement("running");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
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);
|
IDENT(IdHdr,ID_TRIM);
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -786,6 +786,7 @@ void FGTrim::setDebug(FGTrimAxis& axis) {
|
||||||
|
|
||||||
void FGTrim::SetMode(TrimMode tt) {
|
void FGTrim::SetMode(TrimMode tt) {
|
||||||
ClearStates();
|
ClearStates();
|
||||||
|
fdmex->GetPropagate()->SetInitialState(&fgic);
|
||||||
mode=tt;
|
mode=tt;
|
||||||
switch(tt) {
|
switch(tt) {
|
||||||
case tFull:
|
case tFull:
|
||||||
|
|
|
@ -60,7 +60,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
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);
|
IDENT(IdHdr,ID_ACCELERATIONS);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -157,7 +157,8 @@ void FGAccelerations::CalculatePQRdot(void)
|
||||||
// Compute body frame rotational accelerations based on the current body
|
// Compute body frame rotational accelerations based on the current body
|
||||||
// moments and the total inertial angular velocity expressed in the body
|
// moments and the total inertial angular velocity expressed in the body
|
||||||
// frame.
|
// frame.
|
||||||
if (HoldDown && !FDMExec->GetTrimStatus()) {
|
// if (HoldDown && !FDMExec->GetTrimStatus()) {
|
||||||
|
if (HoldDown) {
|
||||||
// The rotational acceleration in ECI is calculated so that the rotational
|
// The rotational acceleration in ECI is calculated so that the rotational
|
||||||
// acceleration is zero in the body frame.
|
// acceleration is zero in the body frame.
|
||||||
vPQRdot.InitMatrix();
|
vPQRdot.InitMatrix();
|
||||||
|
|
|
@ -51,7 +51,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
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);
|
IDENT(IdHdr,ID_MASSBALANCE);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -435,12 +435,14 @@ void FGMassBalance::GetMassPropertiesReport(int i)
|
||||||
<< " Mass Properties Report (English units: lbf, in, slug-ft^2)"
|
<< " Mass Properties Report (English units: lbf, in, slug-ft^2)"
|
||||||
<< reset << endl;
|
<< reset << endl;
|
||||||
cout << " " << underon << " Weight CG-X CG-Y"
|
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.precision(1);
|
||||||
cout << highint << setw(34) << left << " Base Vehicle " << normint
|
cout << highint << setw(34) << left << " Base Vehicle " << normint
|
||||||
<< right << setw(10) << EmptyWeight << setw(8) << vbaseXYZcg(eX) << setw(8)
|
<< right << setw(10) << EmptyWeight
|
||||||
<< vbaseXYZcg(eY) << setw(8) << vbaseXYZcg(eZ) << setw(12) << baseJ(1,1)
|
<< setw(8) << vbaseXYZcg(eX) << setw(8) << vbaseXYZcg(eY) << setw(8) << vbaseXYZcg(eZ)
|
||||||
<< setw(12) << baseJ(2,2) << setw(12) << baseJ(3,3) << endl;
|
<< 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++) {
|
for (unsigned int i=0;i<PointMasses.size();i++) {
|
||||||
PointMass* pm = PointMasses[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
|
cout << highint << left << setw(4) << i << setw(30) << pm->GetName() << normint
|
||||||
<< right << setw(10) << pmweight << setw(8) << pm->GetLocation()(eX)
|
<< right << setw(10) << pmweight << setw(8) << pm->GetLocation()(eX)
|
||||||
<< setw(8) << pm->GetLocation()(eY) << setw(8) << pm->GetLocation()(eZ)
|
<< 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(1,1) << setw(12) << pm->GetPointMassMoI(2,2) << setw(12) << pm->GetPointMassMoI(3,3)
|
||||||
<< setw(12) << pm->GetPointMassMoI(3,3) << endl;
|
<< setw(12) << pm->GetPointMassMoI(1,2) << setw(12) << pm->GetPointMassMoI(1,3) << setw(12) << pm->GetPointMassMoI(2,3) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << FDMExec->GetPropulsionTankReport();
|
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
|
cout << highint << left << setw(30) << " Total: " << right << setw(14) << Weight
|
||||||
<< setw(8) << vXYZcg(eX)
|
<< setw(8) << vXYZcg(eX)
|
||||||
<< setw(8) << vXYZcg(eY)
|
<< setw(8) << vXYZcg(eY)
|
||||||
|
@ -462,6 +464,9 @@ void FGMassBalance::GetMassPropertiesReport(int i)
|
||||||
<< setw(12) << mJ(1,1)
|
<< setw(12) << mJ(1,1)
|
||||||
<< setw(12) << mJ(2,2)
|
<< setw(12) << mJ(2,2)
|
||||||
<< setw(12) << mJ(3,3)
|
<< setw(12) << mJ(3,3)
|
||||||
|
<< setw(12) << mJ(1,2)
|
||||||
|
<< setw(12) << mJ(1,3)
|
||||||
|
<< setw(12) << mJ(2,3)
|
||||||
<< normint << endl;
|
<< normint << endl;
|
||||||
|
|
||||||
cout.setf(ios_base::fixed);
|
cout.setf(ios_base::fixed);
|
||||||
|
|
|
@ -45,7 +45,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
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);
|
IDENT(IdHdr,ID_PROPELLER);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -205,6 +205,9 @@ double FGPropeller::Calculate(double EnginePower)
|
||||||
double Vel = localAeroVel(eU) + Vinduced;
|
double Vel = localAeroVel(eU) + Vinduced;
|
||||||
double rho = in.Density;
|
double rho = in.Density;
|
||||||
double RPS = RPM/60.0;
|
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
|
// Calculate helical tip Mach
|
||||||
double Area = 0.25*Diameter*Diameter*M_PI;
|
double Area = 0.25*Diameter*Diameter*M_PI;
|
||||||
|
@ -285,7 +288,7 @@ double FGPropeller::Calculate(double EnginePower)
|
||||||
if (omega > 0.0) ExcessTorque = PowerAvailable / omega;
|
if (omega > 0.0) ExcessTorque = PowerAvailable / omega;
|
||||||
else ExcessTorque = PowerAvailable / 1.0;
|
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
|
if (RPM < 0.0) RPM = 0.0; // Engine won't turn backwards
|
||||||
|
|
||||||
|
@ -326,7 +329,7 @@ double FGPropeller::GetPowerRequired(void)
|
||||||
double dRPM = rpmReq - RPM;
|
double dRPM = rpmReq - RPM;
|
||||||
// The pitch of a variable propeller cannot be changed when the RPMs are
|
// The pitch of a variable propeller cannot be changed when the RPMs are
|
||||||
// too low - the oil pump does not work.
|
// 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;
|
if (Pitch < MinPitch) Pitch = MinPitch;
|
||||||
else if (Pitch > MaxPitch) Pitch = MaxPitch;
|
else if (Pitch > MaxPitch) Pitch = MaxPitch;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
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
|
FORWARD DECLARATIONS
|
||||||
|
@ -142,7 +142,7 @@ CLASS DOCUMENTATION
|
||||||
<li>Various NACA Technical Notes and Reports</li>
|
<li>Various NACA Technical Notes and Reports</li>
|
||||||
</ul>
|
</ul>
|
||||||
@author Jon S. Berndt
|
@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 FGEngine
|
||||||
@see FGThruster
|
@see FGThruster
|
||||||
*/
|
*/
|
||||||
|
@ -303,6 +303,7 @@ private:
|
||||||
bool Reversed; // true, when propeller is reversed
|
bool Reversed; // true, when propeller is reversed
|
||||||
double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
|
double Reverse_coef; // 0 - 1 defines AdvancePitch (0=MIN_PITCH 1=REVERSE_PITCH)
|
||||||
bool Feathered; // true, if feather command
|
bool Feathered; // true, if feather command
|
||||||
|
double deltaT; // Time step
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -53,7 +53,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
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
|
FORWARD DECLARATIONS
|
||||||
|
@ -135,6 +135,7 @@ CLASS DOCUMENTATION
|
||||||
</drain_location>
|
</drain_location>
|
||||||
<radius unit="{IN | FT | M}"> {number} </radius>
|
<radius unit="{IN | FT | M}"> {number} </radius>
|
||||||
<capacity unit="{LBS | KG}"> {number} </capacity>
|
<capacity unit="{LBS | KG}"> {number} </capacity>
|
||||||
|
<inertia_factor> {number:0-1} </inertia_factor>
|
||||||
<contents unit="{LBS | KG}"> {number} </contents>
|
<contents unit="{LBS | KG}"> {number} </contents>
|
||||||
<temperature> {number} </temperature> <!-- must be degrees fahrenheit -->
|
<temperature> {number} </temperature> <!-- must be degrees fahrenheit -->
|
||||||
<standpipe unit="{LBS | KG"}> {number} </standpipe>
|
<standpipe unit="{LBS | KG"}> {number} </standpipe>
|
||||||
|
|
Loading…
Reference in a new issue