Sync w/ JSBSim (use SGPath to manage file names)
This commit is contained in:
parent
006ca7186b
commit
7cbdc8b923
30 changed files with 252 additions and 222 deletions
|
@ -72,7 +72,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.191 2016/05/16 18:19:57 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.193 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_FDMEXEC);
|
IDENT(IdHdr,ID_FDMEXEC);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -650,24 +650,26 @@ vector <string> FGFDMExec::EnumerateFDMs(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGFDMExec::LoadScript(const string& script, double deltaT, const string& initfile)
|
bool FGFDMExec::LoadScript(const SGPath& script, double deltaT,
|
||||||
|
const SGPath& initfile)
|
||||||
{
|
{
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
Script = new FGScript(this);
|
Script = new FGScript(this);
|
||||||
result = Script->LoadScript(RootDir + script, deltaT, initfile);
|
result = Script->LoadScript(GetFullPath(script), deltaT, initfile);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGFDMExec::LoadModel(const string& AircraftPath, const string& EnginePath, const string& SystemsPath,
|
bool FGFDMExec::LoadModel(const SGPath& AircraftPath, const SGPath& EnginePath,
|
||||||
const string& model, bool addModelToPath)
|
const SGPath& SystemsPath, const string& model,
|
||||||
|
bool addModelToPath)
|
||||||
{
|
{
|
||||||
FGFDMExec::AircraftPath = RootDir + AircraftPath;
|
FGFDMExec::AircraftPath = GetFullPath(AircraftPath);
|
||||||
FGFDMExec::EnginePath = RootDir + EnginePath;
|
FGFDMExec::EnginePath = GetFullPath(EnginePath);
|
||||||
FGFDMExec::SystemsPath = RootDir + SystemsPath;
|
FGFDMExec::SystemsPath = GetFullPath(SystemsPath);
|
||||||
|
|
||||||
return LoadModel(model, addModelToPath);
|
return LoadModel(model, addModelToPath);
|
||||||
}
|
}
|
||||||
|
@ -676,20 +678,20 @@ 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 aircraftCfgFileName;
|
SGPath aircraftCfgFileName;
|
||||||
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
|
||||||
|
|
||||||
if( AircraftPath.empty() || EnginePath.empty() || SystemsPath.empty()) {
|
if( AircraftPath.isNull() || EnginePath.isNull() || SystemsPath.isNull()) {
|
||||||
cerr << "Error: attempted to load aircraft with undefined ";
|
cerr << "Error: attempted to load aircraft with undefined ";
|
||||||
cerr << "aircraft, engine, and system paths" << endl;
|
cerr << "aircraft, engine, and system paths" << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FullAircraftPath = AircraftPath;
|
FullAircraftPath = AircraftPath;
|
||||||
if (addModelToPath) FullAircraftPath += "/" + model;
|
if (addModelToPath) FullAircraftPath.append(model);
|
||||||
aircraftCfgFileName = FullAircraftPath + "/" + model + ".xml";
|
aircraftCfgFileName = FullAircraftPath/(model + ".xml");
|
||||||
|
|
||||||
if (modelLoaded) {
|
if (modelLoaded) {
|
||||||
DeAllocate();
|
DeAllocate();
|
||||||
|
|
|
@ -49,12 +49,13 @@ INCLUDES
|
||||||
#include "models/FGPropagate.h"
|
#include "models/FGPropagate.h"
|
||||||
#include "math/FGColumnVector3.h"
|
#include "math/FGColumnVector3.h"
|
||||||
#include "models/FGOutput.h"
|
#include "models/FGOutput.h"
|
||||||
|
#include "simgear/misc/sg_path.hxx"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.105 2016/04/16 12:24:39 bcoconni Exp $"
|
#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.106 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -178,7 +179,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.105 $
|
@version $Revision: 1.106 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -284,8 +285,8 @@ public:
|
||||||
@param addModelToPath set to true to add the model name to the
|
@param addModelToPath set to true to add the model name to the
|
||||||
AircraftPath, defaults to true
|
AircraftPath, defaults to true
|
||||||
@return true if successful */
|
@return true if successful */
|
||||||
bool LoadModel(const std::string& AircraftPath, const std::string& EnginePath,
|
bool LoadModel(const SGPath& AircraftPath, const SGPath& EnginePath,
|
||||||
const std::string& SystemsPath, const std::string& model,
|
const SGPath& SystemsPath, const std::string& model,
|
||||||
bool addModelToPath = true);
|
bool addModelToPath = true);
|
||||||
|
|
||||||
/** Loads an aircraft model. The paths to the aircraft and engine
|
/** Loads an aircraft model. The paths to the aircraft and engine
|
||||||
|
@ -310,24 +311,33 @@ public:
|
||||||
the file specified in the script will be used. If an initialization file
|
the file specified in the script will be used. If an initialization file
|
||||||
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 SGPath& Script, double deltaT=0.0,
|
||||||
const std::string& initfile="");
|
const SGPath& initfile=SGPath());
|
||||||
|
|
||||||
/** 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
|
||||||
files are kept, for instance "engine" */
|
files are kept, for instance "engine" */
|
||||||
bool SetEnginePath(const std::string& path) { EnginePath = RootDir + path; return true; }
|
bool SetEnginePath(const SGPath& path) {
|
||||||
|
EnginePath = GetFullPath(path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/** Sets the path to the aircraft config file directories.
|
/** Sets the path to the aircraft config file directories.
|
||||||
@param path path to the aircraft directory. For instance:
|
@param path path to the aircraft directory. For instance:
|
||||||
"aircraft". Under aircraft, then, would be directories for various
|
"aircraft". Under aircraft, then, would be directories for various
|
||||||
modeled aircraft such as C172/, x15/, etc. */
|
modeled aircraft such as C172/, x15/, etc. */
|
||||||
bool SetAircraftPath(const std::string& path) { AircraftPath = RootDir + path; return true; }
|
bool SetAircraftPath(const SGPath& path) {
|
||||||
|
AircraftPath = GetFullPath(path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/** Sets the path to the systems config file directories.
|
/** Sets the path to the systems config file directories.
|
||||||
@param path path to the directory under which systems config
|
@param path path to the directory under which systems config
|
||||||
files are kept, for instance "systems" */
|
files are kept, for instance "systems" */
|
||||||
bool SetSystemsPath(const std::string& path) { SystemsPath = RootDir + path; return true; }
|
bool SetSystemsPath(const SGPath& path) {
|
||||||
|
SystemsPath = GetFullPath(path);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// @name Top-level executive State and Model retrieval mechanism
|
/// @name Top-level executive State and Model retrieval mechanism
|
||||||
///@{
|
///@{
|
||||||
|
@ -378,13 +388,13 @@ public:
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
/// Retrieves the engine path.
|
/// Retrieves the engine path.
|
||||||
const std::string& GetEnginePath(void) {return EnginePath;}
|
const SGPath& GetEnginePath(void) {return EnginePath;}
|
||||||
/// Retrieves the aircraft path.
|
/// Retrieves the aircraft path.
|
||||||
const std::string& GetAircraftPath(void) {return AircraftPath;}
|
const SGPath& GetAircraftPath(void) {return AircraftPath;}
|
||||||
/// Retrieves the systems path.
|
/// Retrieves the systems path.
|
||||||
const std::string& GetSystemsPath(void) {return SystemsPath;}
|
const SGPath& GetSystemsPath(void) {return SystemsPath;}
|
||||||
/// Retrieves the full aircraft path name.
|
/// Retrieves the full aircraft path name.
|
||||||
const std::string& GetFullAircraftPath(void) {return FullAircraftPath;}
|
const SGPath& GetFullAircraftPath(void) {return FullAircraftPath;}
|
||||||
|
|
||||||
/** Retrieves the value of a property.
|
/** Retrieves the value of a property.
|
||||||
@param property the name of the property
|
@param property the name of the property
|
||||||
|
@ -428,8 +438,8 @@ public:
|
||||||
be logged.
|
be logged.
|
||||||
@param fname the filename of an output directives file.
|
@param fname the filename of an output directives file.
|
||||||
*/
|
*/
|
||||||
bool SetOutputDirectives(const std::string& fname)
|
bool SetOutputDirectives(const SGPath& fname)
|
||||||
{return Output->SetDirectivesFile(RootDir + fname);}
|
{ return Output->SetDirectivesFile(GetFullPath(fname)); }
|
||||||
|
|
||||||
/** Forces the specified output object to print its items once */
|
/** Forces the specified output object to print its items once */
|
||||||
void ForceOutput(int idx=0) { Output->ForceOutput(idx); }
|
void ForceOutput(int idx=0) { Output->ForceOutput(idx); }
|
||||||
|
@ -550,11 +560,11 @@ public:
|
||||||
|
|
||||||
/** Sets the root directory where JSBSim starts looking for its system directories.
|
/** Sets the root directory where JSBSim starts looking for its system directories.
|
||||||
@param rootDir the string containing the root directory. */
|
@param rootDir the string containing the root directory. */
|
||||||
void SetRootDir(const std::string& rootDir) {RootDir = rootDir;}
|
void SetRootDir(const SGPath& rootDir) {RootDir = rootDir;}
|
||||||
|
|
||||||
/** Retrieves the Root Directory.
|
/** Retrieves the Root Directory.
|
||||||
@return the string representing the root (base) JSBSim directory. */
|
@return the string representing the root (base) JSBSim directory. */
|
||||||
const std::string& GetRootDir(void) const {return RootDir;}
|
const SGPath& GetRootDir(void) const {return RootDir;}
|
||||||
|
|
||||||
/** Increments the simulation time if not in Holding mode. The Frame counter
|
/** Increments the simulation time if not in Holding mode. The Frame counter
|
||||||
is also incremented.
|
is also incremented.
|
||||||
|
@ -606,13 +616,13 @@ private:
|
||||||
bool modelLoaded;
|
bool modelLoaded;
|
||||||
bool IsChild;
|
bool IsChild;
|
||||||
std::string modelName;
|
std::string modelName;
|
||||||
std::string AircraftPath;
|
SGPath AircraftPath;
|
||||||
std::string FullAircraftPath;
|
SGPath FullAircraftPath;
|
||||||
std::string EnginePath;
|
SGPath EnginePath;
|
||||||
std::string SystemsPath;
|
SGPath SystemsPath;
|
||||||
std::string CFGVersion;
|
std::string CFGVersion;
|
||||||
std::string Release;
|
std::string Release;
|
||||||
std::string RootDir;
|
SGPath RootDir;
|
||||||
|
|
||||||
// Standard Model pointers - shortcuts for internal executive use only.
|
// Standard Model pointers - shortcuts for internal executive use only.
|
||||||
FGPropagate* Propagate;
|
FGPropagate* Propagate;
|
||||||
|
@ -664,6 +674,12 @@ private:
|
||||||
bool Allocate(void);
|
bool Allocate(void);
|
||||||
bool DeAllocate(void);
|
bool DeAllocate(void);
|
||||||
int GetDisperse(void) const {return disperse;}
|
int GetDisperse(void) const {return disperse;}
|
||||||
|
SGPath GetFullPath(const SGPath& name) {
|
||||||
|
if (name.isRelative())
|
||||||
|
return RootDir/name.utf8Str();
|
||||||
|
else
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
};
|
};
|
||||||
|
|
|
@ -77,18 +77,18 @@ using JSBSim::Element;
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: JSBSim.cpp,v 1.89 2016/05/20 14:14:05 ehofman Exp $");
|
IDENT(IdSrc,"$Id: JSBSim.cpp,v 1.90 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
GLOBAL DATA
|
GLOBAL DATA
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
string RootDir = "";
|
SGPath RootDir;
|
||||||
string ScriptName;
|
SGPath ScriptName;
|
||||||
string AircraftName;
|
string AircraftName;
|
||||||
string ResetName;
|
SGPath ResetName;
|
||||||
vector <string> LogOutputName;
|
vector <string> LogOutputName;
|
||||||
vector <string> LogDirectiveName;
|
vector <SGPath> LogDirectiveName;
|
||||||
vector <string> CommandLineProperties;
|
vector <string> CommandLineProperties;
|
||||||
vector <double> CommandLinePropertyValues;
|
vector <double> CommandLinePropertyValues;
|
||||||
JSBSim::FGFDMExec* FDMExec;
|
JSBSim::FGFDMExec* FDMExec;
|
||||||
|
@ -151,28 +151,28 @@ void PrintHelp(void);
|
||||||
of file is given on the command line */
|
of file is given on the command line */
|
||||||
class XMLFile : public FGXMLFileRead {
|
class XMLFile : public FGXMLFileRead {
|
||||||
public:
|
public:
|
||||||
bool IsScriptFile(std::string filename) {
|
bool IsScriptFile(const SGPath& filename) {
|
||||||
bool result=false;
|
bool result=false;
|
||||||
Element *document = LoadXMLDocument(filename, false);
|
Element *document = LoadXMLDocument(filename, false);
|
||||||
if (document && document->GetName() == "runscript") result = true;
|
if (document && document->GetName() == "runscript") result = true;
|
||||||
ResetParser();
|
ResetParser();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
bool IsLogDirectiveFile(std::string filename) {
|
bool IsLogDirectiveFile(const SGPath& filename) {
|
||||||
bool result=false;
|
bool result=false;
|
||||||
Element *document = LoadXMLDocument(filename, false);
|
Element *document = LoadXMLDocument(filename, false);
|
||||||
if (document && document->GetName() == "output") result = true;
|
if (document && document->GetName() == "output") result = true;
|
||||||
ResetParser();
|
ResetParser();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
bool IsAircraftFile(std::string filename) {
|
bool IsAircraftFile(const SGPath& filename) {
|
||||||
bool result=false;
|
bool result=false;
|
||||||
Element* document = LoadXMLDocument(filename, false);
|
Element* document = LoadXMLDocument(filename, false);
|
||||||
if (document && document->GetName() == "fdm_config") result = true;
|
if (document && document->GetName() == "fdm_config") result = true;
|
||||||
ResetParser();
|
ResetParser();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
bool IsInitFile(std::string filename) {
|
bool IsInitFile(const SGPath& filename) {
|
||||||
bool result=false;
|
bool result=false;
|
||||||
Element *document = LoadXMLDocument(filename, false);
|
Element *document = LoadXMLDocument(filename, false);
|
||||||
if (document && document->GetName() == "initialize") result = true;
|
if (document && document->GetName() == "initialize") result = true;
|
||||||
|
@ -345,9 +345,9 @@ int real_main(int argc, char* argv[])
|
||||||
// *** SET UP JSBSIM *** //
|
// *** SET UP JSBSIM *** //
|
||||||
FDMExec = new JSBSim::FGFDMExec();
|
FDMExec = new JSBSim::FGFDMExec();
|
||||||
FDMExec->SetRootDir(RootDir);
|
FDMExec->SetRootDir(RootDir);
|
||||||
FDMExec->SetAircraftPath("aircraft");
|
FDMExec->SetAircraftPath(SGPath("aircraft"));
|
||||||
FDMExec->SetEnginePath("engine");
|
FDMExec->SetEnginePath(SGPath("engine"));
|
||||||
FDMExec->SetSystemsPath("systems");
|
FDMExec->SetSystemsPath(SGPath("systems"));
|
||||||
FDMExec->GetPropertyManager()->Tie("simulation/frame_start_time", &actual_elapsed_time);
|
FDMExec->GetPropertyManager()->Tie("simulation/frame_start_time", &actual_elapsed_time);
|
||||||
FDMExec->GetPropertyManager()->Tie("simulation/cycle_duration", &cycle_duration);
|
FDMExec->GetPropertyManager()->Tie("simulation/cycle_duration", &cycle_duration);
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ int real_main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
// *** OPTION A: LOAD A SCRIPT, WHICH LOADS EVERYTHING ELSE *** //
|
// *** OPTION A: LOAD A SCRIPT, WHICH LOADS EVERYTHING ELSE *** //
|
||||||
if (!ScriptName.empty()) {
|
if (!ScriptName.isNull()) {
|
||||||
|
|
||||||
result = FDMExec->LoadScript(ScriptName, override_sim_rate_value, ResetName);
|
result = FDMExec->LoadScript(ScriptName, override_sim_rate_value, ResetName);
|
||||||
|
|
||||||
|
@ -383,14 +383,14 @@ int real_main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
// *** OPTION B: LOAD AN AIRCRAFT AND A SET OF INITIAL CONDITIONS *** //
|
// *** OPTION B: LOAD AN AIRCRAFT AND A SET OF INITIAL CONDITIONS *** //
|
||||||
} else if (!AircraftName.empty() || !ResetName.empty()) {
|
} else if (!AircraftName.empty() || !ResetName.isNull()) {
|
||||||
|
|
||||||
if (catalog) FDMExec->SetDebugLevel(0);
|
if (catalog) FDMExec->SetDebugLevel(0);
|
||||||
|
|
||||||
if ( ! FDMExec->LoadModel( "aircraft",
|
if ( ! FDMExec->LoadModel(SGPath("aircraft"),
|
||||||
"engine",
|
SGPath("engine"),
|
||||||
"systems",
|
SGPath("systems"),
|
||||||
AircraftName)) {
|
AircraftName)) {
|
||||||
cerr << " JSBSim could not be started" << endl << endl;
|
cerr << " JSBSim could not be started" << endl << endl;
|
||||||
delete FDMExec;
|
delete FDMExec;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
|
@ -417,7 +417,7 @@ int real_main(int argc, char* argv[])
|
||||||
|
|
||||||
// Load output directives file[s], if given
|
// Load output directives file[s], if given
|
||||||
for (unsigned int i=0; i<LogDirectiveName.size(); i++) {
|
for (unsigned int i=0; i<LogDirectiveName.size(); i++) {
|
||||||
if (!LogDirectiveName[i].empty()) {
|
if (!LogDirectiveName[i].isNull()) {
|
||||||
if (!FDMExec->SetOutputDirectives(LogDirectiveName[i])) {
|
if (!FDMExec->SetOutputDirectives(LogDirectiveName[i])) {
|
||||||
cout << "Output directives not properly set in file " << LogDirectiveName[i] << endl;
|
cout << "Output directives not properly set in file " << LogDirectiveName[i] << endl;
|
||||||
delete FDMExec;
|
delete FDMExec;
|
||||||
|
@ -621,17 +621,14 @@ bool options(int count, char **arg)
|
||||||
}
|
}
|
||||||
} else if (keyword == "--logdirectivefile") {
|
} else if (keyword == "--logdirectivefile") {
|
||||||
if (n != string::npos) {
|
if (n != string::npos) {
|
||||||
LogDirectiveName.push_back(value);
|
LogDirectiveName.push_back(SGPath::fromLocal8Bit(value.c_str()));
|
||||||
} else {
|
} else {
|
||||||
gripe;
|
gripe;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else if (keyword == "--root") {
|
} else if (keyword == "--root") {
|
||||||
if (n != string::npos) {
|
if (n != string::npos) {
|
||||||
RootDir = value;
|
RootDir = SGPath::fromLocal8Bit(value.c_str());
|
||||||
if (RootDir[RootDir.length()-1] != '/') {
|
|
||||||
RootDir += '/';
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
gripe;
|
gripe;
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -645,14 +642,14 @@ bool options(int count, char **arg)
|
||||||
}
|
}
|
||||||
} else if (keyword == "--script") {
|
} else if (keyword == "--script") {
|
||||||
if (n != string::npos) {
|
if (n != string::npos) {
|
||||||
ScriptName = value;
|
ScriptName = SGPath::fromLocal8Bit(value.c_str());
|
||||||
} else {
|
} else {
|
||||||
gripe;
|
gripe;
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else if (keyword == "--initfile") {
|
} else if (keyword == "--initfile") {
|
||||||
if (n != string::npos) {
|
if (n != string::npos) {
|
||||||
ResetName = value;
|
ResetName = SGPath::fromLocal8Bit(value.c_str());
|
||||||
} else {
|
} else {
|
||||||
gripe;
|
gripe;
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -704,12 +701,13 @@ bool options(int count, char **arg)
|
||||||
// See what kind of files we are specifying on the command line
|
// See what kind of files we are specifying on the command line
|
||||||
|
|
||||||
XMLFile xmlFile;
|
XMLFile xmlFile;
|
||||||
|
SGPath path = SGPath::fromLocal8Bit(keyword.c_str());
|
||||||
|
|
||||||
if (xmlFile.IsScriptFile(keyword)) ScriptName = keyword;
|
if (xmlFile.IsScriptFile(path)) ScriptName = path;
|
||||||
else if (xmlFile.IsLogDirectiveFile(keyword)) LogDirectiveName.push_back(keyword);
|
else if (xmlFile.IsLogDirectiveFile(path)) LogDirectiveName.push_back(path);
|
||||||
else if (xmlFile.IsAircraftFile("aircraft/" + keyword + "/" + keyword)) AircraftName = keyword;
|
else if (xmlFile.IsAircraftFile(SGPath("aircraft")/keyword/keyword)) AircraftName = keyword;
|
||||||
else if (xmlFile.IsInitFile(keyword)) ResetName = keyword;
|
else if (xmlFile.IsInitFile(path)) ResetName = path;
|
||||||
else if (xmlFile.IsInitFile("aircraft/" + AircraftName + "/" + keyword)) ResetName = keyword;
|
else if (xmlFile.IsInitFile(SGPath("aircraft")/AircraftName/keyword)) ResetName = SGPath("aircraft")/AircraftName/keyword;
|
||||||
else {
|
else {
|
||||||
cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
|
cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -727,15 +725,15 @@ bool options(int count, char **arg)
|
||||||
|
|
||||||
// Post-processing for script options. check for incompatible options.
|
// Post-processing for script options. check for incompatible options.
|
||||||
|
|
||||||
if (catalog && !ScriptName.empty()) {
|
if (catalog && !ScriptName.isNull()) {
|
||||||
cerr << "Cannot specify catalog with script option" << endl << endl;
|
cerr << "Cannot specify catalog with script option" << endl << endl;
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
if (AircraftName.size() > 0 && ResetName.size() == 0 && !catalog) {
|
if (!AircraftName.empty() && ResetName.isNull() && !catalog) {
|
||||||
cerr << "You must specify an initialization file with the aircraft name." << endl << endl;
|
cerr << "You must specify an initialization file with the aircraft name." << endl << endl;
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
if (ScriptName.size() > 0 && AircraftName.size() > 0) {
|
if (!ScriptName.isNull() && !AircraftName.empty()) {
|
||||||
cerr << "You cannot specify an aircraft file with a script." << endl;
|
cerr << "You cannot specify an aircraft file with a script." << endl;
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,9 +234,7 @@ FGJSBsim::FGJSBsim( double dt )
|
||||||
|
|
||||||
fdmex->Setdt( dt );
|
fdmex->Setdt( dt );
|
||||||
|
|
||||||
result = fdmex->LoadModel( aircraft_path.local8BitStr(),
|
result = fdmex->LoadModel( aircraft_path, engine_path, systems_path,
|
||||||
engine_path.local8BitStr(),
|
|
||||||
systems_path.local8BitStr(),
|
|
||||||
fgGetString("/sim/aero"), false );
|
fgGetString("/sim/aero"), false );
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.111 2016/07/03 17:20:55 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.114 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_INITIALCONDITION);
|
IDENT(IdHdr,ID_INITIALCONDITION);
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
@ -709,10 +709,10 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
|
||||||
altitudeASL=alt;
|
altitudeASL=alt;
|
||||||
position.SetAltitudeASL(alt);
|
position.SetAltitudeASL(alt);
|
||||||
|
|
||||||
if (lastLatitudeSet == setgeod) {
|
// The call to SetAltitudeASL has most likely modified the geodetic latitude
|
||||||
double h = ComputeGeodAltitude(geodLatitude);
|
// so we need to restore it to its initial value.
|
||||||
position.SetPositionGeodetic(position.GetLongitude(), geodLatitude, h);
|
if (lastLatitudeSet == setgeod)
|
||||||
}
|
SetGeodLatitudeRadIC(geodLatitude);
|
||||||
|
|
||||||
soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
|
soundSpeed = Atmosphere->GetSoundSpeed(altitudeASL);
|
||||||
rho = Atmosphere->GetDensity(altitudeASL);
|
rho = Atmosphere->GetDensity(altitudeASL);
|
||||||
|
@ -880,11 +880,11 @@ double FGInitialCondition::GetBodyVelFpsIC(int idx) const
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
|
bool FGInitialCondition::Load(const SGPath& rstfile, bool useStoredPath)
|
||||||
{
|
{
|
||||||
string init_file_name;
|
SGPath init_file_name;
|
||||||
if( useStoredPath ) {
|
if(useStoredPath && rstfile.isRelative()) {
|
||||||
init_file_name = fdmex->GetFullAircraftPath() + "/" + rstfile + ".xml";
|
init_file_name = fdmex->GetFullAircraftPath()/rstfile.utf8Str();
|
||||||
} else {
|
} else {
|
||||||
init_file_name = rstfile;
|
init_file_name = rstfile;
|
||||||
}
|
}
|
||||||
|
@ -931,16 +931,11 @@ bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
// Given an altitude above the sea level (or a position radius which is the
|
// Given an altitude above the mean sea level (or a position radius which is the
|
||||||
// same) and a geodetic latitude, compute the geodetic altitude. It is assumed
|
// same) and a geodetic latitude, compute the geodetic altitude.
|
||||||
// that the terrain is a sphere and that the elevation is uniform all over the
|
|
||||||
// Earth. Would that assumption fail, the computation below would need to be
|
|
||||||
// adapted since the position radius would depend on the terrain elevation which
|
|
||||||
// depends itself on the latitude.
|
|
||||||
//
|
//
|
||||||
// This is an acceptable trade off because this routine is only used by
|
// TODO: extend the routine to the case where lastAltitudeSet is equal to
|
||||||
// standalone JSBSim which uses FGDefaultGroundCallback which assumes that the
|
// setagl.
|
||||||
// Earth is a sphere.
|
|
||||||
|
|
||||||
double FGInitialCondition::ComputeGeodAltitude(double geodLatitude)
|
double FGInitialCondition::ComputeGeodAltitude(double geodLatitude)
|
||||||
{
|
{
|
||||||
|
@ -978,11 +973,8 @@ bool FGInitialCondition::LoadLatitude(Element* position_el)
|
||||||
|
|
||||||
string lat_type = latitude_el->GetAttributeValue("type");
|
string lat_type = latitude_el->GetAttributeValue("type");
|
||||||
|
|
||||||
if (lat_type == "geod" || lat_type == "geodetic") {
|
if (lat_type == "geod" || lat_type == "geodetic")
|
||||||
double h = ComputeGeodAltitude(latitude);
|
SetGeodLatitudeRadIC(latitude);
|
||||||
position.SetPositionGeodetic(position.GetLongitude(), latitude, h);
|
|
||||||
lastLatitudeSet = setgeod;
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
position.SetLatitude(latitude);
|
position.SetLatitude(latitude);
|
||||||
lastLatitudeSet = setgeoc;
|
lastLatitudeSet = setgeoc;
|
||||||
|
@ -1491,10 +1483,14 @@ void FGInitialCondition::bind(FGPropertyManager* PropertyManager)
|
||||||
&FGInitialCondition::GetRRadpsIC,
|
&FGInitialCondition::GetRRadpsIC,
|
||||||
&FGInitialCondition::SetRRadpsIC,
|
&FGInitialCondition::SetRRadpsIC,
|
||||||
true);
|
true);
|
||||||
PropertyManager->Tie("ic/lat-geod-rad", &position,
|
PropertyManager->Tie("ic/lat-geod-rad", this,
|
||||||
&FGLocation::GetGeodLatitudeRad);
|
&FGInitialCondition::GetGeodLatitudeRadIC,
|
||||||
PropertyManager->Tie("ic/lat-geod-deg", &position,
|
&FGInitialCondition::SetGeodLatitudeRadIC,
|
||||||
&FGLocation::GetGeodLatitudeDeg);
|
true);
|
||||||
|
PropertyManager->Tie("ic/lat-geod-deg", this,
|
||||||
|
&FGInitialCondition::GetGeodLatitudeDegIC,
|
||||||
|
&FGInitialCondition::SetGeodLatitudeDegIC,
|
||||||
|
true);
|
||||||
PropertyManager->Tie("ic/geod-alt-ft", &position,
|
PropertyManager->Tie("ic/geod-alt-ft", &position,
|
||||||
&FGLocation::GetGeodAltitude);
|
&FGLocation::GetGeodAltitude);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,13 @@ INCLUDES
|
||||||
|
|
||||||
#include "math/FGLocation.h"
|
#include "math/FGLocation.h"
|
||||||
#include "math/FGQuaternion.h"
|
#include "math/FGQuaternion.h"
|
||||||
|
#include "simgear/misc/sg_path.hxx"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.46 2016/07/03 17:20:55 bcoconni Exp $"
|
#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.48 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -220,7 +221,7 @@ CLASS DOCUMENTATION
|
||||||
@property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
|
@property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
|
||||||
|
|
||||||
@author Tony Peden
|
@author Tony Peden
|
||||||
@version "$Id: FGInitialCondition.h,v 1.46 2016/07/03 17:20:55 bcoconni Exp $"
|
@version "$Id: FGInitialCondition.h,v 1.48 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -311,6 +312,13 @@ public:
|
||||||
@param lat Initial latitude in degrees */
|
@param lat Initial latitude in degrees */
|
||||||
void SetLatitudeDegIC(double lat) { SetLatitudeRadIC(lat*degtorad); }
|
void SetLatitudeDegIC(double lat) { SetLatitudeRadIC(lat*degtorad); }
|
||||||
|
|
||||||
|
/** Sets the initial geodetic latitude.
|
||||||
|
This method modifies the geodetic altitude in order to keep the altitude
|
||||||
|
above sea level unchanged.
|
||||||
|
@param glat Initial geodetic latitude in degrees */
|
||||||
|
void SetGeodLatitudeDegIC(double glat)
|
||||||
|
{ SetGeodLatitudeRadIC(glat*degtorad); }
|
||||||
|
|
||||||
/** Sets the initial longitude.
|
/** Sets the initial longitude.
|
||||||
@param lon Initial longitude in degrees */
|
@param lon Initial longitude in degrees */
|
||||||
void SetLongitudeDegIC(double lon) { SetLongitudeRadIC(lon*degtorad); }
|
void SetLongitudeDegIC(double lon) { SetLongitudeRadIC(lon*degtorad); }
|
||||||
|
@ -369,6 +377,11 @@ public:
|
||||||
@return Initial geocentric latitude in degrees */
|
@return Initial geocentric latitude in degrees */
|
||||||
double GetLatitudeDegIC(void) const { return position.GetLatitudeDeg(); }
|
double GetLatitudeDegIC(void) const { return position.GetLatitudeDeg(); }
|
||||||
|
|
||||||
|
/** Gets the initial geodetic latitude.
|
||||||
|
@return Initial geodetic latitude in degrees */
|
||||||
|
double GetGeodLatitudeDegIC(void) const
|
||||||
|
{ return position.GetGeodLatitudeDeg(); }
|
||||||
|
|
||||||
/** Gets the initial longitude.
|
/** Gets the initial longitude.
|
||||||
@return Initial longitude in degrees */
|
@return Initial longitude in degrees */
|
||||||
double GetLongitudeDegIC(void) const { return position.GetLongitudeDeg(); }
|
double GetLongitudeDegIC(void) const { return position.GetLongitudeDeg(); }
|
||||||
|
@ -628,6 +641,11 @@ public:
|
||||||
@return Initial latitude in radians */
|
@return Initial latitude in radians */
|
||||||
double GetLatitudeRadIC(void) const { return position.GetLatitude(); }
|
double GetLatitudeRadIC(void) const { return position.GetLatitude(); }
|
||||||
|
|
||||||
|
/** Gets the initial geodetic latitude.
|
||||||
|
@return Initial geodetic latitude in radians */
|
||||||
|
double GetGeodLatitudeRadIC(void) const
|
||||||
|
{ return position.GetGeodLatitudeRad(); }
|
||||||
|
|
||||||
/** Gets the initial longitude.
|
/** Gets the initial longitude.
|
||||||
@return Initial longitude in radians */
|
@return Initial longitude in radians */
|
||||||
double GetLongitudeRadIC(void) const { return position.GetLongitude(); }
|
double GetLongitudeRadIC(void) const { return position.GetLongitude(); }
|
||||||
|
@ -660,7 +678,7 @@ public:
|
||||||
@param rstname The name of an initial conditions file
|
@param rstname The name of an initial conditions file
|
||||||
@param useStoredPath true if the stored path to the IC file should be used
|
@param useStoredPath true if the stored path to the IC file should be used
|
||||||
@return true if successful */
|
@return true if successful */
|
||||||
bool Load(std::string rstname, bool useStoredPath = true );
|
bool Load(const SGPath& rstname, bool useStoredPath = true );
|
||||||
|
|
||||||
/** Is an engine running ?
|
/** Is an engine running ?
|
||||||
@param index of the engine to be checked
|
@param index of the engine to be checked
|
||||||
|
|
|
@ -46,7 +46,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc, "$Id: FGModelLoader.cpp,v 1.3 2015/07/12 12:41:55 bcoconni Exp $");
|
IDENT(IdSrc, "$Id: FGModelLoader.cpp,v 1.4 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
IDENT(IdHdr, ID_MODELLOADER);
|
IDENT(IdHdr, ID_MODELLOADER);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -60,28 +60,21 @@ Element_ptr FGModelLoader::Open(Element *el)
|
||||||
|
|
||||||
if (!fname.empty()) {
|
if (!fname.empty()) {
|
||||||
FGXMLFileRead XMLFileRead;
|
FGXMLFileRead XMLFileRead;
|
||||||
string file;
|
SGPath path(SGPath::fromLocal8Bit(fname.c_str()));
|
||||||
|
|
||||||
try {
|
if (path.isRelative())
|
||||||
file = model->FindFullPathName(fname);
|
path = model->FindFullPathName(path);
|
||||||
if (file.empty()) throw string("File does not exist.");
|
|
||||||
}
|
|
||||||
catch(string& e) {
|
|
||||||
cerr << endl << el->ReadFrom()
|
|
||||||
<< "Could not open file: " << fname << endl << e << endl;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CachedFiles.find(file) != CachedFiles.end())
|
if (CachedFiles.find(path.utf8Str()) != CachedFiles.end())
|
||||||
document = CachedFiles[file];
|
document = CachedFiles[path.utf8Str()];
|
||||||
else {
|
else {
|
||||||
document = XMLFileRead.LoadXMLDocument(file);
|
document = XMLFileRead.LoadXMLDocument(path);
|
||||||
if (document == 0L) {
|
if (document == 0L) {
|
||||||
cerr << endl << el->ReadFrom()
|
cerr << endl << el->ReadFrom()
|
||||||
<< "Could not open file: " << file << endl;
|
<< "Could not open file: " << path << endl;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
CachedFiles[file] = document;
|
CachedFiles[path.utf8Str()] = document;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document->GetName() != el->GetName()) {
|
if (document->GetName() != el->GetName()) {
|
||||||
|
@ -93,19 +86,12 @@ Element_ptr FGModelLoader::Open(Element *el)
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
SGPath CheckPathName(const SGPath& path, const SGPath& filename) {
|
||||||
|
SGPath fullName = path/filename.utf8Str();
|
||||||
|
|
||||||
string CheckFullPathName(const string& path, const string& fname)
|
if (fullName.extension().empty())
|
||||||
{
|
fullName.concat(".xml");
|
||||||
string name = path + "/" + fname;
|
|
||||||
|
|
||||||
if (name.length() <=4 || name.substr(name.length()-4, 4) != ".xml")
|
return fullName.exists() ? fullName : SGPath();
|
||||||
name.append(".xml");
|
|
||||||
|
|
||||||
ifstream file(name.c_str());
|
|
||||||
if (!file.is_open())
|
|
||||||
return string();
|
|
||||||
|
|
||||||
return name;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,12 +41,13 @@ INCLUDES
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "FGXMLElement.h"
|
#include "FGXMLElement.h"
|
||||||
|
#include "simgear/misc/sg_path.hxx"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_MODELLOADER "$Id: FGModelLoader.h,v 1.1 2014/06/09 11:52:06 bcoconni Exp $"
|
#define ID_MODELLOADER "$Id: FGModelLoader.h,v 1.2 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -75,7 +76,7 @@ private:
|
||||||
std::map<std::string, Element_ptr> CachedFiles;
|
std::map<std::string, Element_ptr> CachedFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::string CheckFullPathName(const std::string& path, const std::string& fname);
|
SGPath CheckPathName(const SGPath& path, const SGPath& filename);
|
||||||
}
|
}
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGOutputFile.cpp,v 1.9 2014/05/04 17:00:27 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGOutputFile.cpp,v 1.10 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_OUTPUTFILE);
|
IDENT(IdHdr,ID_OUTPUTFILE);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -65,8 +65,8 @@ FGOutputFile::FGOutputFile(FGFDMExec* fdmex) :
|
||||||
bool FGOutputFile::InitModel(void)
|
bool FGOutputFile::InitModel(void)
|
||||||
{
|
{
|
||||||
if (FGOutputType::InitModel()) {
|
if (FGOutputType::InitModel()) {
|
||||||
if (Filename.empty()) {
|
if (Filename.isNull()) {
|
||||||
Filename = Name;
|
Filename = SGPath(Name);
|
||||||
runID_postfix = 0;
|
runID_postfix = 0;
|
||||||
}
|
}
|
||||||
return OpenFile();
|
return OpenFile();
|
||||||
|
@ -87,7 +87,7 @@ void FGOutputFile::SetStartNewOutput(void)
|
||||||
} else {
|
} else {
|
||||||
buf << Name << '_' << runID_postfix++;
|
buf << Name << '_' << runID_postfix++;
|
||||||
}
|
}
|
||||||
Filename = buf.str();
|
Filename = SGPath(buf.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseFile();
|
CloseFile();
|
||||||
|
|
|
@ -45,7 +45,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_OUTPUTFILE "$Id: FGOutputFile.h,v 1.6 2014/05/04 17:00:27 bcoconni Exp $"
|
#define ID_OUTPUTFILE "$Id: FGOutputFile.h,v 1.8 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -106,9 +106,9 @@ public:
|
||||||
the next call to SetStartNewOutput().
|
the next call to SetStartNewOutput().
|
||||||
@param name new name */
|
@param name new name */
|
||||||
void SetOutputName(const std::string& fname) {
|
void SetOutputName(const std::string& fname) {
|
||||||
Name = FDMExec->GetRootDir() + fname;
|
Name = (FDMExec->GetRootDir()/fname).utf8Str();
|
||||||
runID_postfix = -1;
|
runID_postfix = -1;
|
||||||
Filename = std::string();
|
Filename = SGPath();
|
||||||
}
|
}
|
||||||
/** Generate the output. This is a pure method so it must be implemented by
|
/** Generate the output. This is a pure method so it must be implemented by
|
||||||
the classes that inherits from FGOutputFile.
|
the classes that inherits from FGOutputFile.
|
||||||
|
@ -116,7 +116,7 @@ public:
|
||||||
void Print(void) = 0;
|
void Print(void) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string Filename;
|
SGPath Filename;
|
||||||
|
|
||||||
/// Opens the file
|
/// Opens the file
|
||||||
virtual bool OpenFile(void) = 0;
|
virtual bool OpenFile(void) = 0;
|
||||||
|
|
|
@ -64,7 +64,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGOutputTextFile.cpp,v 1.12 2016/05/22 10:28:23 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGOutputTextFile.cpp,v 1.13 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_OUTPUTTEXTFILE);
|
IDENT(IdHdr,ID_OUTPUTTEXTFILE);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -96,7 +96,7 @@ bool FGOutputTextFile::Load(Element* el)
|
||||||
bool FGOutputTextFile::OpenFile(void)
|
bool FGOutputTextFile::OpenFile(void)
|
||||||
{
|
{
|
||||||
datafile.clear();
|
datafile.clear();
|
||||||
datafile.open(Filename.c_str());
|
datafile.open(Filename);
|
||||||
if (!datafile) {
|
if (!datafile) {
|
||||||
cerr << endl << fgred << highint << "ERROR: unable to open the file "
|
cerr << endl << fgred << highint << "ERROR: unable to open the file "
|
||||||
<< reset << Filename.c_str() << endl
|
<< reset << Filename.c_str() << endl
|
||||||
|
@ -261,9 +261,9 @@ bool FGOutputTextFile::OpenFile(void)
|
||||||
void FGOutputTextFile::Print(void)
|
void FGOutputTextFile::Print(void)
|
||||||
{
|
{
|
||||||
streambuf* buffer;
|
streambuf* buffer;
|
||||||
string scratch = "";
|
string scratch = Filename.utf8Str();
|
||||||
|
|
||||||
if (Filename == "COUT" || Filename == "cout") {
|
if (to_upper(scratch) == "COUT") {
|
||||||
buffer = cout.rdbuf();
|
buffer = cout.rdbuf();
|
||||||
} else {
|
} else {
|
||||||
buffer = datafile.rdbuf();
|
buffer = datafile.rdbuf();
|
||||||
|
|
|
@ -41,12 +41,13 @@ INCLUDES
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include "FGOutputFile.h"
|
#include "FGOutputFile.h"
|
||||||
|
#include "simgear/io/iostreams/sgstream.hxx"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_OUTPUTTEXTFILE "$Id: FGOutputTextFile.h,v 1.4 2012/12/15 16:13:58 bcoconni Exp $"
|
#define ID_OUTPUTTEXTFILE "$Id: FGOutputTextFile.h,v 1.5 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -89,7 +90,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string delimeter;
|
std::string delimeter;
|
||||||
std::ofstream datafile;
|
sg_ofstream datafile;
|
||||||
|
|
||||||
virtual bool OpenFile(void);
|
virtual bool OpenFile(void);
|
||||||
virtual void CloseFile(void) { if (datafile.is_open()) datafile.close(); }
|
virtual void CloseFile(void) { if (datafile.is_open()) datafile.close(); }
|
||||||
|
|
|
@ -58,7 +58,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGScript.cpp,v 1.64 2016/04/03 17:10:46 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGScript.cpp,v 1.65 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_FGSCRIPT);
|
IDENT(IdHdr,ID_FGSCRIPT);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -96,10 +96,11 @@ FGScript::~FGScript()
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGScript::LoadScript(const string& script, double default_dT,
|
bool FGScript::LoadScript(const SGPath& script, double default_dT,
|
||||||
const string& initfile)
|
const SGPath& initfile)
|
||||||
{
|
{
|
||||||
string aircraft="", initialize="", prop_name="";
|
SGPath initialize;
|
||||||
|
string aircraft="", prop_name="";
|
||||||
string notifyPropertyName="";
|
string notifyPropertyName="";
|
||||||
Element *element=0, *run_element=0, *event_element=0;
|
Element *element=0, *run_element=0, *event_element=0;
|
||||||
Element *set_element=0;
|
Element *set_element=0;
|
||||||
|
@ -171,9 +172,9 @@ bool FGScript::LoadScript(const string& script, double default_dT,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initfile.empty()) {
|
initialize = SGPath::fromLocal8Bit(element->GetAttributeValue("initialize").c_str());
|
||||||
initialize = element->GetAttributeValue("initialize");
|
if (initfile.isNull()) {
|
||||||
if (initialize.empty()) {
|
if (initialize.isNull()) {
|
||||||
cerr << "Initialization file must be specified in use element." << endl;
|
cerr << "Initialization file must be specified in use element." << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,13 @@ INCLUDES
|
||||||
#include "FGJSBBase.h"
|
#include "FGJSBBase.h"
|
||||||
#include "FGPropertyReader.h"
|
#include "FGPropertyReader.h"
|
||||||
#include "input_output/FGPropertyManager.h"
|
#include "input_output/FGPropertyManager.h"
|
||||||
|
#include "simgear/misc/sg_path.hxx"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_FGSCRIPT "$Id: FGScript.h,v 1.30 2015/09/20 16:32:11 bcoconni Exp $"
|
#define ID_FGSCRIPT "$Id: FGScript.h,v 1.31 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -161,7 +162,7 @@ CLASS DOCUMENTATION
|
||||||
comes the "run" section, where the conditions are
|
comes the "run" section, where the conditions are
|
||||||
described in "event" clauses.</p>
|
described in "event" clauses.</p>
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version "$Id: FGScript.h,v 1.30 2015/09/20 16:32:11 bcoconni Exp $"
|
@version "$Id: FGScript.h,v 1.31 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -188,8 +189,8 @@ public:
|
||||||
default. If a file name is passed in, it will override the
|
default. If a file name is passed in, it will override the
|
||||||
one present in the script.
|
one present in the script.
|
||||||
@return true if successful */
|
@return true if successful */
|
||||||
bool LoadScript(const std::string& script, double default_dT,
|
bool LoadScript(const SGPath& script, double default_dT,
|
||||||
const std::string& initfile);
|
const SGPath& initfile);
|
||||||
|
|
||||||
/** This function is called each pass through the executive Run() method IF
|
/** This function is called each pass through the executive Run() method IF
|
||||||
scripting is enabled.
|
scripting is enabled.
|
||||||
|
|
|
@ -45,7 +45,7 @@ FORWARD DECLARATIONS
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGXMLElement.cpp,v 1.55 2016/01/02 15:23:50 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGXMLElement.cpp,v 1.56 2016/09/11 11:26:04 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_XMLELEMENT);
|
IDENT(IdHdr,ID_XMLELEMENT);
|
||||||
|
|
||||||
bool Element::converterIsInitialized = false;
|
bool Element::converterIsInitialized = false;
|
||||||
|
@ -467,12 +467,14 @@ double Element::FindElementValueAsNumberConvertTo(const string& el, const string
|
||||||
|
|
||||||
// Sanity check for angular values
|
// Sanity check for angular values
|
||||||
if ((supplied_units == "RAD") && (fabs(value) > 2 * M_PI)) {
|
if ((supplied_units == "RAD") && (fabs(value) > 2 * M_PI)) {
|
||||||
cerr << element->ReadFrom() << "The value " << value
|
cerr << element->ReadFrom() << element->GetName() << " value "
|
||||||
<< " RAD is outside the range [ -2*M_PI RAD ; +2*M_PI RAD ]" << endl;
|
<< value << " RAD is outside the range [ -2*M_PI RAD ; +2*M_PI RAD ]"
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
if ((supplied_units == "DEG") && (fabs(value) > 360.0)) {
|
if ((supplied_units == "DEG") && (fabs(value) > 360.0)) {
|
||||||
cerr << element->ReadFrom() << "The value " << value
|
cerr << element->ReadFrom() << element->GetName() << " value "
|
||||||
<< " DEG is outside the range [ -360 DEG ; +360 DEG ]" << endl;
|
<< value << " DEG is outside the range [ -360 DEG ; +360 DEG ]"
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,12 +483,14 @@ double Element::FindElementValueAsNumberConvertTo(const string& el, const string
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((target_units == "RAD") && (fabs(value) > 2 * M_PI)) {
|
if ((target_units == "RAD") && (fabs(value) > 2 * M_PI)) {
|
||||||
cerr << element->ReadFrom() << "The value " << value
|
cerr << element->ReadFrom() << element->GetName() << " value "
|
||||||
<< " RAD is outside the range [ -2*M_PI RAD ; +2*M_PI RAD ]" << endl;
|
<< value << " RAD is outside the range [ -2*M_PI RAD ; +2*M_PI RAD ]"
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
if ((target_units == "DEG") && (fabs(value) > 360.0)) {
|
if ((target_units == "DEG") && (fabs(value) > 360.0)) {
|
||||||
cerr << element->ReadFrom() << "The value " << value
|
cerr << element->ReadFrom() << element->GetName() << " value "
|
||||||
<< " DEG is outside the range [ -360 DEG ; +360 DEG ]" << endl;
|
<< value << " DEG is outside the range [ -360 DEG ; +360 DEG ]"
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = DisperseValue(element, value, supplied_units, target_units);
|
value = DisperseValue(element, value, supplied_units, target_units);
|
||||||
|
|
|
@ -35,15 +35,18 @@ SENTRY
|
||||||
INCLUDES
|
INCLUDES
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#include "input_output/FGXMLParse.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
#include "input_output/FGXMLParse.h"
|
||||||
|
#include "simgear/misc/sg_path.hxx"
|
||||||
|
#include "simgear/io/iostreams/sgstream.hxx"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.9 2013/12/01 14:33:51 bcoconni Exp $"
|
#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.10 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -56,20 +59,23 @@ public:
|
||||||
FGXMLFileRead(void) {}
|
FGXMLFileRead(void) {}
|
||||||
~FGXMLFileRead(void) {}
|
~FGXMLFileRead(void) {}
|
||||||
|
|
||||||
Element* LoadXMLDocument(std::string XML_filename, bool verbose=true)
|
Element* LoadXMLDocument(const SGPath& XML_filename, bool verbose=true)
|
||||||
{
|
{
|
||||||
return LoadXMLDocument(XML_filename, file_parser, verbose);
|
return LoadXMLDocument(XML_filename, file_parser, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
Element* LoadXMLDocument(std::string XML_filename, FGXMLParse& fparse, bool verbose=true)
|
Element* LoadXMLDocument(const SGPath& XML_filename, FGXMLParse& fparse, bool verbose=true)
|
||||||
{
|
{
|
||||||
std::ifstream infile;
|
sg_ifstream infile;
|
||||||
|
SGPath filename(XML_filename);
|
||||||
|
|
||||||
if ( !XML_filename.empty() ) {
|
if (!filename.isNull()) {
|
||||||
if (XML_filename.find(".xml") == std::string::npos) XML_filename += ".xml";
|
if (filename.extension().empty())
|
||||||
infile.open(XML_filename.c_str());
|
filename.concat(".xml");
|
||||||
|
|
||||||
|
infile.open(filename);
|
||||||
if ( !infile.is_open()) {
|
if ( !infile.is_open()) {
|
||||||
if (verbose) std::cerr << "Could not open file: " << XML_filename << std::endl;
|
if (verbose) std::cerr << "Could not open file: " << filename << std::endl;
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,7 +83,7 @@ public:
|
||||||
return 0L;
|
return 0L;
|
||||||
}
|
}
|
||||||
|
|
||||||
readXML(infile, fparse, XML_filename);
|
readXML(infile, fparse, filename.utf8Str());
|
||||||
Element* document = fparse.GetDocument();
|
Element* document = fparse.GetDocument();
|
||||||
infile.close();
|
infile.close();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGFCS.cpp,v 1.95 2016/05/16 18:19:57 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGFCS.cpp,v 1.98 2017/02/25 14:23:18 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_FCS);
|
IDENT(IdHdr,ID_FCS);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -602,16 +602,15 @@ double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGFCS::FindFullPathName(const string& sysfilename) const
|
SGPath FGFCS::FindFullPathName(const SGPath& path) const
|
||||||
{
|
{
|
||||||
string name = FGModel::FindFullPathName(sysfilename);
|
SGPath name = FGModel::FindFullPathName(path);
|
||||||
|
if (systype != stSystem || !name.isNull()) return name;
|
||||||
|
|
||||||
if (systype != stSystem || !name.empty()) return name;
|
name = CheckPathName(FDMExec->GetFullAircraftPath()/string("Systems"), path);
|
||||||
|
if (!name.isNull()) return name;
|
||||||
|
|
||||||
name = CheckFullPathName(FDMExec->GetFullAircraftPath() + "/Systems", sysfilename);
|
return CheckPathName(FDMExec->GetSystemsPath(), path);
|
||||||
if (!name.empty()) return name;
|
|
||||||
|
|
||||||
return CheckFullPathName(FDMExec->GetSystemsPath(), sysfilename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -50,7 +50,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_FCS "$Id: FGFCS.h,v 1.53 2016/05/18 08:06:57 ehofman Exp $"
|
#define ID_FCS "$Id: FGFCS.h,v 1.54 2017/02/25 14:23:18 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -168,7 +168,7 @@ CLASS DOCUMENTATION
|
||||||
@property gear/tailhook-pos-norm
|
@property gear/tailhook-pos-norm
|
||||||
|
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Revision: 1.53 $
|
@version $Revision: 1.54 $
|
||||||
@see FGActuator
|
@see FGActuator
|
||||||
@see FGDeadBand
|
@see FGDeadBand
|
||||||
@see FGFCSFunction
|
@see FGFCSFunction
|
||||||
|
@ -544,7 +544,7 @@ public:
|
||||||
@return true if succesful */
|
@return true if succesful */
|
||||||
bool Load(Element* el);
|
bool Load(Element* el);
|
||||||
|
|
||||||
std::string FindFullPathName(const std::string& system_filename) const;
|
SGPath FindFullPathName(const SGPath& path) const;
|
||||||
|
|
||||||
void AddThrottle(void);
|
void AddThrottle(void);
|
||||||
double GetDt(void) const;
|
double GetDt(void) const;
|
||||||
|
|
|
@ -50,7 +50,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGInput.cpp,v 1.34 2015/08/23 09:43:31 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGInput.cpp,v 1.35 2017/02/25 14:23:19 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_INPUT);
|
IDENT(IdHdr,ID_INPUT);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -153,7 +153,7 @@ bool FGInput::Run(bool Holding)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGInput::SetDirectivesFile(const std::string& fname)
|
bool FGInput::SetDirectivesFile(const SGPath& fname)
|
||||||
{
|
{
|
||||||
FGXMLFileRead XMLFile;
|
FGXMLFileRead XMLFile;
|
||||||
Element* document = XMLFile.LoadXMLDocument(fname);
|
Element* document = XMLFile.LoadXMLDocument(fname);
|
||||||
|
|
|
@ -46,7 +46,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_INPUT "$Id: FGInput.h,v 1.13 2015/08/23 09:43:31 bcoconni Exp $"
|
#define ID_INPUT "$Id: FGInput.h,v 1.14 2017/02/25 14:23:19 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -81,7 +81,7 @@ CLASS DOCUMENTATION
|
||||||
|
|
||||||
The class FGInput is the manager of the inputs requested by the user. It
|
The class FGInput is the manager of the inputs requested by the user. It
|
||||||
manages a list of instances derived from the abstract class FGInputType.
|
manages a list of instances derived from the abstract class FGInputType.
|
||||||
@version $Id: FGInput.h,v 1.13 2015/08/23 09:43:31 bcoconni Exp $
|
@version $Id: FGInput.h,v 1.14 2017/02/25 14:23:19 bcoconni Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
@param fname the name of the file from which the ouput directives should
|
@param fname the name of the file from which the ouput directives should
|
||||||
be read.
|
be read.
|
||||||
@return true if the execution succeeded. */
|
@return true if the execution succeeded. */
|
||||||
bool SetDirectivesFile(const std::string& fname);
|
bool SetDirectivesFile(const SGPath& fname);
|
||||||
|
|
||||||
/// Enables the input generation for all input instances.
|
/// Enables the input generation for all input instances.
|
||||||
void Enable(void) { enabled = true; }
|
void Enable(void) { enabled = true; }
|
||||||
|
|
|
@ -46,7 +46,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGModel.cpp,v 1.26 2015/07/12 19:34:08 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGModel.cpp,v 1.27 2017/02/25 14:23:19 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_MODEL);
|
IDENT(IdHdr,ID_MODEL);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -103,9 +103,9 @@ bool FGModel::Run(bool Holding)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGModel::FindFullPathName(const string& fname) const
|
SGPath FGModel::FindFullPathName(const SGPath& path) const
|
||||||
{
|
{
|
||||||
return CheckFullPathName(FDMExec->GetFullAircraftPath(), fname);
|
return CheckPathName(FDMExec->GetFullAircraftPath(), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -41,12 +41,13 @@ INCLUDES
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "math/FGModelFunctions.h"
|
#include "math/FGModelFunctions.h"
|
||||||
|
#include "simgear/misc/sg_path.hxx"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_MODEL "$Id: FGModel.h,v 1.25 2015/08/16 13:19:52 bcoconni Exp $"
|
#define ID_MODEL "$Id: FGModel.h,v 1.26 2017/02/25 14:23:19 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -100,7 +101,7 @@ public:
|
||||||
FGFDMExec* GetExec(void) {return FDMExec;}
|
FGFDMExec* GetExec(void) {return FDMExec;}
|
||||||
|
|
||||||
void SetPropertyManager(FGPropertyManager *fgpm) { PropertyManager=fgpm;}
|
void SetPropertyManager(FGPropertyManager *fgpm) { PropertyManager=fgpm;}
|
||||||
virtual std::string FindFullPathName(const std::string& filename) const;
|
virtual SGPath FindFullPathName(const SGPath& path) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned int exe_ctr;
|
unsigned int exe_ctr;
|
||||||
|
@ -119,4 +120,3 @@ protected:
|
||||||
}
|
}
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGOutput.cpp,v 1.86 2015/08/23 09:43:31 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGOutput.cpp,v 1.87 2017/02/25 14:23:19 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_OUTPUT);
|
IDENT(IdHdr,ID_OUTPUT);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -182,7 +182,7 @@ string FGOutput::GetOutputName(unsigned int idx) const
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
bool FGOutput::SetDirectivesFile(const std::string& fname)
|
bool FGOutput::SetDirectivesFile(const SGPath& fname)
|
||||||
{
|
{
|
||||||
FGXMLFileRead XMLFile;
|
FGXMLFileRead XMLFile;
|
||||||
Element* document = XMLFile.LoadXMLDocument(fname);
|
Element* document = XMLFile.LoadXMLDocument(fname);
|
||||||
|
|
|
@ -47,7 +47,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_OUTPUT "$Id: FGOutput.h,v 1.33 2015/08/23 09:43:31 bcoconni Exp $"
|
#define ID_OUTPUT "$Id: FGOutput.h,v 1.34 2017/02/25 14:23:19 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -121,7 +121,7 @@ CLASS DOCUMENTATION
|
||||||
|
|
||||||
The class FGOutput is the manager of the outputs requested by the user. It
|
The class FGOutput is the manager of the outputs requested by the user. It
|
||||||
manages a list of instances derived from the abstract class FGOutputType.
|
manages a list of instances derived from the abstract class FGOutputType.
|
||||||
@version $Id: FGOutput.h,v 1.33 2015/08/23 09:43:31 bcoconni Exp $
|
@version $Id: FGOutput.h,v 1.34 2017/02/25 14:23:19 bcoconni Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -181,7 +181,7 @@ public:
|
||||||
@param fname the name of the file from which the ouput directives should
|
@param fname the name of the file from which the ouput directives should
|
||||||
be read.
|
be read.
|
||||||
@return true if the execution succeeded. */
|
@return true if the execution succeeded. */
|
||||||
bool SetDirectivesFile(const std::string& fname);
|
bool SetDirectivesFile(const SGPath& fname);
|
||||||
/// Enables the output generation for all output instances.
|
/// Enables the output generation for all output instances.
|
||||||
void Enable(void) { enabled = true; }
|
void Enable(void) { enabled = true; }
|
||||||
/// Disables the output generation for all output instances.
|
/// Disables the output generation for all output instances.
|
||||||
|
|
|
@ -67,19 +67,19 @@ INCLUDES
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#include "initialization/FGInitialCondition.h"
|
#include "initialization/FGInitialCondition.h"
|
||||||
#include "FGPropagate.h"
|
#include "FGPropagate.h"
|
||||||
#include "FGGroundReactions.h"
|
#include "FGGroundReactions.h"
|
||||||
#include "FGFDMExec.h"
|
#include "FGFDMExec.h"
|
||||||
#include "input_output/FGPropertyManager.h"
|
#include "input_output/FGPropertyManager.h"
|
||||||
|
#include "simgear/io/iostreams/sgstream.hxx"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGPropagate.cpp,v 1.131 2016/05/01 18:25:57 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGPropagate.cpp,v 1.132 2017/02/25 14:23:19 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_PROPAGATE);
|
IDENT(IdHdr,ID_PROPAGATE);
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -659,21 +659,21 @@ void FGPropagate::DumpState(void)
|
||||||
|
|
||||||
void FGPropagate::WriteStateFile(int num)
|
void FGPropagate::WriteStateFile(int num)
|
||||||
{
|
{
|
||||||
ofstream outfile;
|
sg_ofstream outfile;
|
||||||
|
|
||||||
if (num == 0) return;
|
if (num == 0) return;
|
||||||
|
|
||||||
string filename = FDMExec->GetFullAircraftPath();
|
SGPath path = FDMExec->GetFullAircraftPath();
|
||||||
|
|
||||||
if (filename.empty()) filename = "initfile.";
|
if (path.isNull()) path = SGPath("initfile.");
|
||||||
else filename.append("/initfile.");
|
else path.append("initfile.");
|
||||||
|
|
||||||
// Append sim time to the filename since there may be more than one created during a simulation run
|
// Append sim time to the filename since there may be more than one created during a simulation run
|
||||||
filename += to_string((double)FDMExec->GetSimTime())+".xml";
|
path.concat(to_string((double)FDMExec->GetSimTime())+".xml");
|
||||||
|
|
||||||
switch(num) {
|
switch(num) {
|
||||||
case 1:
|
case 1:
|
||||||
outfile.open(filename.c_str());
|
outfile.open(path);
|
||||||
if (outfile.is_open()) {
|
if (outfile.is_open()) {
|
||||||
outfile << "<?xml version=\"1.0\"?>" << endl;
|
outfile << "<?xml version=\"1.0\"?>" << endl;
|
||||||
outfile << "<initialize name=\"reset00\">" << endl;
|
outfile << "<initialize name=\"reset00\">" << endl;
|
||||||
|
@ -689,11 +689,12 @@ void FGPropagate::WriteStateFile(int num)
|
||||||
outfile << "</initialize>" << endl;
|
outfile << "</initialize>" << endl;
|
||||||
outfile.close();
|
outfile.close();
|
||||||
} else {
|
} else {
|
||||||
cerr << "Could not open and/or write the state to the initial conditions file: " << filename << endl;
|
cerr << "Could not open and/or write the state to the initial conditions file: "
|
||||||
|
<< path << endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
outfile.open(filename.c_str());
|
outfile.open(path);
|
||||||
if (outfile.is_open()) {
|
if (outfile.is_open()) {
|
||||||
outfile << "<?xml version=\"1.0\"?>" << endl;
|
outfile << "<?xml version=\"1.0\"?>" << endl;
|
||||||
outfile << "<initialize name=\"IC File\" version=\"2.0\">" << endl;
|
outfile << "<initialize name=\"IC File\" version=\"2.0\">" << endl;
|
||||||
|
@ -725,7 +726,8 @@ void FGPropagate::WriteStateFile(int num)
|
||||||
outfile << "</initialize>" << endl;
|
outfile << "</initialize>" << endl;
|
||||||
outfile.close();
|
outfile.close();
|
||||||
} else {
|
} else {
|
||||||
cerr << "Could not open and/or write the state to the initial conditions file: " << filename << endl;
|
cerr << "Could not open and/or write the state to the initial conditions file: "
|
||||||
|
<< path << endl;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -65,7 +65,7 @@ using namespace std;
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
IDENT(IdSrc,"$Id: FGPropulsion.cpp,v 1.87 2016/05/05 15:38:09 bcoconni Exp $");
|
IDENT(IdSrc,"$Id: FGPropulsion.cpp,v 1.88 2017/02/25 14:23:19 bcoconni Exp $");
|
||||||
IDENT(IdHdr,ID_PROPULSION);
|
IDENT(IdHdr,ID_PROPULSION);
|
||||||
|
|
||||||
extern short debug_lvl;
|
extern short debug_lvl;
|
||||||
|
@ -463,14 +463,15 @@ bool FGPropulsion::Load(Element* el)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPropulsion::FindFullPathName(const string& filename) const
|
SGPath FGPropulsion::FindFullPathName(const SGPath& path) const
|
||||||
{
|
{
|
||||||
if (!ReadingEngine) return FGModel::FindFullPathName(filename);
|
if (!ReadingEngine) return FGModel::FindFullPathName(path);
|
||||||
|
|
||||||
string name = CheckFullPathName(FDMExec->GetFullAircraftPath() + "/Engines", filename);
|
SGPath name = CheckPathName(FDMExec->GetFullAircraftPath()/string("Engines"),
|
||||||
if (!name.empty()) return name;
|
path);
|
||||||
|
if (!name.isNull()) return name;
|
||||||
|
|
||||||
return CheckFullPathName(FDMExec->GetEnginePath(), filename);
|
return CheckPathName(FDMExec->GetEnginePath(), path);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -50,7 +50,7 @@ INCLUDES
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_PROPULSION "$Id: FGPropulsion.h,v 1.36 2016/05/05 15:38:08 bcoconni Exp $"
|
#define ID_PROPULSION "$Id: FGPropulsion.h,v 1.37 2017/02/25 14:23:19 bcoconni Exp $"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
|
@ -93,7 +93,7 @@ CLASS DOCUMENTATION
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id: FGPropulsion.h,v 1.36 2016/05/05 15:38:08 bcoconni Exp $
|
@version $Id: FGPropulsion.h,v 1.37 2017/02/25 14:23:19 bcoconni Exp $
|
||||||
@see
|
@see
|
||||||
FGEngine
|
FGEngine
|
||||||
FGTank
|
FGTank
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
const FGColumnVector3& GetTanksMoment(void);
|
const FGColumnVector3& GetTanksMoment(void);
|
||||||
double GetTanksWeight(void) const;
|
double GetTanksWeight(void) const;
|
||||||
|
|
||||||
std::string FindFullPathName(const std::string& filename) const;
|
SGPath FindFullPathName(const SGPath& path) const;
|
||||||
inline int GetActiveEngine(void) const {return ActiveEngine;}
|
inline int GetActiveEngine(void) const {return ActiveEngine;}
|
||||||
inline bool GetFuelFreeze(void) const {return FuelFreeze;}
|
inline bool GetFuelFreeze(void) const {return FuelFreeze;}
|
||||||
|
|
||||||
|
|
0
src/FDM/JSBSim/models/flight_control/FGAngles.cpp
Executable file → Normal file
0
src/FDM/JSBSim/models/flight_control/FGAngles.cpp
Executable file → Normal file
0
src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp
Executable file → Normal file
0
src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp
Executable file → Normal file
0
src/FDM/JSBSim/models/propulsion/FGTurboProp.h
Executable file → Normal file
0
src/FDM/JSBSim/models/propulsion/FGTurboProp.h
Executable file → Normal file
Loading…
Reference in a new issue