![]() |
JSBSim Flight Dynamics Model 1.0 (23 February 2013)
An Open Source Flight Dynamics and Control Software Library in C++
|
Encapsulates the JSBSim simulation executive. More...
#include <FGFDMExec.h>
Inheritance diagram for FGFDMExec:
Collaboration diagram for FGFDMExec:Classes | |
| struct | childData |
| struct | PropertyCatalogStructure |
Public Types | |
| enum | eModels { ePropagate = 0, eInput, eInertial, eAtmosphere, eWinds, eAuxiliary, eSystems, ePropulsion, eAerodynamics, eGroundReactions, eExternalReactions, eBuoyantForces, eMassBalance, eAircraft, eAccelerations, eOutput, eNumStandardModels } |
Public Member Functions | |
| FGFDMExec (FGPropertyManager *root=0, unsigned int *fdmctr=0) | |
| Default constructor. | |
| ~FGFDMExec () | |
| Default destructor. | |
| void | BuildPropertyCatalog (struct PropertyCatalogStructure *pcs) |
| Builds a catalog of properties. | |
| void | CheckIncrementalHold (void) |
| Checks if required to hold afer increment. | |
| void | DisableOutput (void) |
| Disables data logging to all outputs. | |
| void | DoLinearization (int mode) |
| Executes linearization with state-space output You must trim first to get an accurate state-space model. | |
| void | DoSimplexTrim (int mode) |
| void | DoTrim (int mode) |
| Executes trimming in the selected mode. | |
| void | EnableIncrementThenHold (int Timesteps) |
| Turn on hold after increment. | |
| void | EnableOutput (void) |
| Enables data logging to all outputs. | |
| vector< string > | EnumerateFDMs (void) |
| Returns a vector of strings representing the names of all loaded models (future) | |
| void | ForceOutput (int idx=0) |
| Forces the specified output object to print its items once. | |
| const string & | GetAircraftPath (void) |
| Retrieves the aircraft path. | |
| childData * | GetChildFDM (int i) const |
| Gets a particular child FDM. | |
| int | GetDebugLevel (void) const |
| Retrieves the current debug level setting. | |
| double | GetDeltaT (void) const |
| Returns the simulation delta T. | |
| const string & | GetEnginePath (void) |
| Retrieves the engine path. | |
| int | GetFDMCount (void) const |
| Gets the number of child FDMs. | |
| const string & | GetFullAircraftPath (void) |
| Retrieves the full aircraft path name. | |
| const string & | GetModelName (void) const |
| Returns the model name. | |
| string | GetOutputFileName (void) const |
| Retrieves the current output filename. | |
| vector< string > & | GetPropertyCatalog (void) |
| FGPropertyManager * | GetPropertyManager (void) |
| Returns a pointer to the property manager object. | |
| double | GetPropertyValue (const string &property) |
| Retrieves the value of a property. | |
| string | GetPropulsionTankReport () |
| const string & | GetRootDir (void) const |
| Retrieves the Root Directory. | |
| double | GetSimTime (void) const |
| Returns the cumulative simulation time in seconds. | |
| const string & | GetSystemsPath (void) |
| Retrieves the systems path. | |
| int | GetTrimMode (void) const |
| bool | GetTrimStatus (void) const |
| void | Hold (void) |
| Pauses execution by preventing time from incrementing. | |
| bool | Holding (void) |
| Returns true if the simulation is Holding (i.e. simulation time is not moving). | |
| double | IncrTime (void) |
| Increments the simulation time if not in Holding mode. | |
| void | Initialize (FGInitialCondition *FGIC) |
| Initializes the simulation with initial conditions. | |
| bool | IntegrationSuspended (void) const |
| Returns the simulation suspension state. | |
| bool | LoadModel (const string &AircraftPath, const string &EnginePath, const string &SystemsPath, const string &model, bool addModelToPath=true) |
| Loads an aircraft model. | |
| bool | LoadModel (const string &model, bool addModelToPath=true) |
| Loads an aircraft model. | |
| bool | LoadScript (const string &Script, double deltaT=0.0, const string initfile="") |
| Loads a script. | |
| void | PrintPropertyCatalog (void) |
| string | QueryPropertyCatalog (const string &check) |
| Retrieves property or properties matching the supplied string. | |
| void | ResetToInitialConditions (void) |
| Resets the initial conditions object and prepares the simulation to run again. | |
| void | Resume (void) |
| Resumes execution from a "Hold". | |
| void | ResumeIntegration (void) |
| Resumes the simulation by resetting delta T to the correct value. | |
| bool | Run (void) |
| This function executes each scheduled model in succession. | |
| bool | RunIC (void) |
| Initializes the sim from the initial condition object and executes each scheduled model without integrating i.e. | |
| void | Schedule (FGModel *model, int rate=1) |
| This routine places a model into the runlist at the specified rate. | |
| bool | SetAircraftPath (const string &path) |
| Sets the path to the aircraft config file directories. | |
| void | SetChild (bool ch) |
| Marks this instance of the Exec object as a "child" object. | |
| void | SetDebugLevel (int level) |
| Sets the debug level. | |
| void | Setdt (double delta_t) |
| Sets the integration time step for the simulation executive. | |
| bool | SetEnginePath (const string &path) |
| Sets the path to the engine config file directories. | |
| void | SetGroundCallback (FGGroundCallback *gc) |
| Sets the ground callback pointer. | |
| void | SetLoggingRate (double rate) |
| Sets the logging rate for all output objects (if any). | |
| bool | SetOutputDirectives (const string &fname) |
| Sets the output (logging) mechanism for this run. | |
| bool | SetOutputFileName (const string &fname) |
| Sets (or overrides) the output filename. | |
| void | SetPropertyValue (const string &property, double value) |
| Sets a property value. | |
| void | SetRootDir (const string &rootDir) |
| Sets the root directory where JSBSim starts looking for its system directories. | |
| double | Setsim_time (double cur_time) |
| Sets the current sim time. | |
| bool | SetSystemsPath (const string &path) |
| Sets the path to the systems config file directories. | |
| void | SetTrimMode (int mode) |
| void | SetTrimStatus (bool status) |
| void | SuspendIntegration (void) |
| Suspends the simulation and sets the delta T to zero. | |
| void | Unbind (void) |
| Unbind all tied JSBSim properties. | |
Top-level executive State and Model retrieval mechanism | |
Returns the FGAtmosphere pointer. | |
| FGAtmosphere * | GetAtmosphere (void) |
| FGAccelerations * | GetAccelerations (void) |
| Returns the FGAccelerations pointer. | |
| FGWinds * | GetWinds (void) |
| Returns the FGWinds pointer. | |
| FGFCS * | GetFCS (void) |
| Returns the FGFCS pointer. | |
| FGPropulsion * | GetPropulsion (void) |
| Returns the FGPropulsion pointer. | |
| FGMassBalance * | GetMassBalance (void) |
| Returns the FGAircraft pointer. | |
| FGAerodynamics * | GetAerodynamics (void) |
| Returns the FGAerodynamics pointer. | |
| FGInertial * | GetInertial (void) |
| Returns the FGInertial pointer. | |
| FGGroundReactions * | GetGroundReactions (void) |
| Returns the FGGroundReactions pointer. | |
| FGExternalReactions * | GetExternalReactions (void) |
| Returns the FGExternalReactions pointer. | |
| FGBuoyantForces * | GetBuoyantForces (void) |
| Returns the FGBuoyantForces pointer. | |
| FGAircraft * | GetAircraft (void) |
| Returns the FGAircraft pointer. | |
| FGPropagate * | GetPropagate (void) |
| Returns the FGPropagate pointer. | |
| FGAuxiliary * | GetAuxiliary (void) |
| Returns the FGAuxiliary pointer. | |
| FGInput * | GetInput (void) |
| Returns the FGInput pointer. | |
| FGGroundCallback * | GetGroundCallback (void) |
| Get a pointer to the ground callback currently used. | |
| FGScript * | GetScript (void) |
| Retrieves the script object. | |
| FGInitialCondition * | GetIC (void) |
| Returns a pointer to the FGInitialCondition object. | |
| FGTrim * | GetTrim (void) |
| Returns a pointer to the FGTrim object. | |
This class is the executive class through which all other simulation classes are instantiated, initialized, and run. When integrated with FlightGear (or other flight simulator) this class is typically instantiated by an interface class on the simulator side.
At the time of simulation initialization, the interface class creates an instance of this executive class. The executive is subsequently directed to load the chosen aircraft specification file:
fdmex = new FGFDMExec( ... ); result = fdmex->LoadModel( ... );
When an aircraft model is loaded, the config file is parsed and for each of the sections of the config file (propulsion, flight control, etc.) the corresponding Load() method is called (e.g. FGFCS::Load()).
Subsequent to the creation of the executive and loading of the model, initialization is performed. Initialization involves copying control inputs into the appropriate JSBSim data storage locations, configuring it for the set of user supplied initial conditions, and then copying state variables from JSBSim. The state variables are used to drive the instrument displays and to place the vehicle model in world space for visual rendering:
copy_to_JSBsim(); // copy control inputs to JSBSim fdmex->RunIC(); // loop JSBSim once w/o integrating copy_from_JSBsim(); // update the bus
Once initialization is complete, cyclic execution proceeds:
copy_to_JSBsim(); // copy control inputs to JSBSim fdmex->Run(); // execute JSBSim copy_from_JSBsim(); // update the bus
JSBSim can be used in a standalone mode by creating a compact stub program that effectively performs the same progression of steps as outlined above for the integrated version, but with two exceptions. First, the copy_to_JSBSim() and copy_from_JSBSim() functions are not used because the control inputs are handled directly by the scripting facilities and outputs are handled by the output (data logging) class. Second, the name of a script file can be supplied to the stub program. Scripting (see FGScript) provides a way to supply command inputs to the simulation:
FDMExec = new JSBSim::FGFDMExec(); FDMExec->LoadScript( ScriptName ); // the script loads the aircraft and ICs result = FDMExec->Run(); while (result) { // cyclic execution result = FDMExec->Run(); // execute JSBSim }
The standalone mode has been useful for verifying changes before committing updates to the source code repository. It is also useful for running sets of tests that reveal some aspects of simulated aircraft performance, such as range, time-to-climb, takeoff distance, etc.
This describes to any interested entity the debug level requested by setting the JSBSIM_DEBUG environment variable. The bitmasked value choices are as follows:
Definition at line 189 of file FGFDMExec.h.
| void BuildPropertyCatalog | ( | struct PropertyCatalogStructure * | pcs | ) |
This function descends the property tree and creates a list (an STL vector) containing the name and node for all properties.
| pcs | The "root" property catalog structure pointer. |
Definition at line 946 of file FGFDMExec.cpp.
References FGFDMExec::PropertyCatalogStructure::base_string, and FGFDMExec::PropertyCatalogStructure::node.
Referenced by FGFDMExec::LoadModel().
{
struct PropertyCatalogStructure* pcsNew = new struct PropertyCatalogStructure;
int node_idx = 0;
for (int i=0; i<pcs->node->nChildren(); i++) {
pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getName();
node_idx = pcs->node->getChild(i)->getIndex();
if (node_idx != 0) {
pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
}
if (pcs->node->getChild(i)->nChildren() == 0) {
if (pcsNew->base_string.substr(0,12) == string("/fdm/jsbsim/")) {
pcsNew->base_string = pcsNew->base_string.erase(0,12);
}
PropertyCatalog.push_back(pcsNew->base_string);
} else {
pcsNew->node = (FGPropertyNode*)pcs->node->getChild(i);
BuildPropertyCatalog(pcsNew);
}
}
delete pcsNew;
}
Here is the caller graph for this function:| void DoTrim | ( | int | mode | ) |
| mode | Specifies how to trim:
|
Definition at line 1170 of file FGFDMExec.cpp.
References FGTrim::DoTrim(), and FGTrim::Report().
Referenced by FGFDMExec::FGFDMExec().
{
double saved_time;
if (Constructing) return;
if (mode < 0 || mode > JSBSim::tNone) {
cerr << endl << "Illegal trimming mode!" << endl << endl;
return;
}
saved_time = sim_time;
FGTrim trim(this, (JSBSim::TrimMode)mode);
if ( !trim.DoTrim() ) cerr << endl << "Trim Failed" << endl << endl;
trim.Report();
sim_time = saved_time;
}
Here is the call graph for this function:
Here is the caller graph for this function:| int GetDebugLevel | ( | void | ) | const [inline] |
Definition at line 581 of file FGFDMExec.h.
Referenced by FGFDMExec::FGFDMExec().
{return debug_lvl;};
Here is the caller graph for this function:| FGGroundCallback* GetGroundCallback | ( | void | ) | [inline] |
It is recommanded to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
Definition at line 374 of file FGFDMExec.h.
Referenced by FGInitialCondition::SetSeaLevelRadiusFtIC(), and FGInitialCondition::SetTerrainElevationFtIC().
{return FGLocation::GetGroundCallback();}
Here is the caller graph for this function:| string GetOutputFileName | ( | void | ) | const [inline] |
Definition at line 457 of file FGFDMExec.h.
References FGOutput::GetOutputName().
{ return Output->GetOutputName(0); }
Here is the call graph for this function:| double GetPropertyValue | ( | const string & | property | ) | [inline] |
| property | the name of the property |
Definition at line 395 of file FGFDMExec.h.
References FGPropertyNode::GetDouble().
{ return instance->GetNode()->GetDouble(property); }
Here is the call graph for this function:| const string& GetRootDir | ( | void | ) | const [inline] |
Definition at line 569 of file FGFDMExec.h.
Referenced by FGOutputFile::SetOutputName().
{return RootDir;}
Here is the caller graph for this function:| double IncrTime | ( | void | ) | [inline] |
The Frame counter is also incremented.
Definition at line 574 of file FGFDMExec.h.
Referenced by FGFDMExec::Run().
{
if (!holding) sim_time += dT;
Frame++;
return sim_time;
}
Here is the caller graph for this function:| void Initialize | ( | FGInitialCondition * | FGIC | ) |
| FGIC | The initial conditions that will be passed to the simulation. |
Definition at line 608 of file FGFDMExec.cpp.
References FGInitialCondition::GetWindNEDFpsIC(), FGAuxiliary::Run(), FGAtmosphere::Run(), FGAccelerations::Run(), FGFDMExec::Setsim_time(), and FGWinds::SetWindNED().
Referenced by FGTrimAnalysisControl::initTheta(), and FGFDMExec::RunIC().
{
Setsim_time(0.0);
Propagate->SetInitialState( FGIC );
LoadInputs(eAccelerations);
Accelerations->Run(false);
LoadInputs(ePropagate);
Propagate->InitializeDerivatives();
LoadInputs(eAtmosphere);
Atmosphere->Run(false);
Winds->SetWindNED(FGIC->GetWindNEDFpsIC());
Auxiliary->Run(false);
}
Here is the call graph for this function:
Here is the caller graph for this function:| bool IntegrationSuspended | ( | void | ) | const [inline] |
Definition at line 549 of file FGFDMExec.h.
Referenced by FGRocket::Calculate(), and FGFDMExec::Run().
{return dT == 0.0;}
Here is the caller graph for this function:| bool LoadModel | ( | const string & | AircraftPath, |
| const string & | EnginePath, | ||
| const string & | SystemsPath, | ||
| const string & | model, | ||
| bool | addModelToPath = true |
||
| ) |
| AircraftPath | path to the aircraft/ directory. For instance: "aircraft". Under aircraft, then, would be directories for various modeled aircraft such as C172/, x15/, etc. |
| EnginePath | path to the directory under which engine config files are kept, for instance "engine" |
| SystemsPath | path to the directory under which systems config files are kept, for instance "systems" |
| model | the name of the aircraft model itself. This file will be looked for in the directory specified in the AircraftPath variable, and in turn under the directory with the same name as the model. For instance: "aircraft/x15/x15.xml" |
| addModelToPath | set to true to add the model name to the AircraftPath, defaults to true |
Definition at line 684 of file FGFDMExec.cpp.
Referenced by FGScript::LoadScript().
{
FGFDMExec::AircraftPath = RootDir + AircraftPath;
FGFDMExec::EnginePath = RootDir + EnginePath;
FGFDMExec::SystemsPath = RootDir + SystemsPath;
return LoadModel(model, addModelToPath);
}
Here is the caller graph for this function:| bool LoadModel | ( | const string & | model, |
| bool | addModelToPath = true |
||
| ) |
The paths to the aircraft and engine config file directories must be set prior to calling this. See below.
| model | the name of the aircraft model itself. This file will be looked for in the directory specified in the AircraftPath variable, and in turn under the directory with the same name as the model. For instance: "aircraft/x15/x15.xml" |
| addModelToPath | set to true to add the model name to the AircraftPath, defaults to true |
Definition at line 696 of file FGFDMExec.cpp.
References FGFDMExec::PropertyCatalogStructure::base_string, FGFDMExec::BuildPropertyCatalog(), FGJSBBase::fgblue, FGJSBBase::fgdef, FGJSBBase::fgred, Element::FindElement(), Element::FindNextElement(), Element::GetAttributeValue(), FGJSBBase::highint, FGFDMExec::PropertyCatalogStructure::node, and FGJSBBase::reset.
{
string token;
string aircraftCfgFileName;
Element* element = 0L;
bool result = false; // initialize result to false, indicating input file not yet read
modelName = model; // Set the class modelName attribute
if( AircraftPath.empty() || EnginePath.empty() || SystemsPath.empty()) {
cerr << "Error: attempted to load aircraft with undefined ";
cerr << "aircraft, engine, and system paths" << endl;
return false;
}
FullAircraftPath = AircraftPath;
if (addModelToPath) FullAircraftPath += "/" + model;
aircraftCfgFileName = FullAircraftPath + "/" + model + ".xml";
if (modelLoaded) {
DeAllocate();
Allocate();
}
int saved_debug_lvl = debug_lvl;
document = LoadXMLDocument(aircraftCfgFileName); // "document" is a class member
if (document) {
if (IsChild) debug_lvl = 0;
ReadPrologue(document);
if (IsChild) debug_lvl = saved_debug_lvl;
// Process the fileheader element in the aircraft config file. This element is OPTIONAL.
element = document->FindElement("fileheader");
if (element) {
result = ReadFileHeader(element);
if (!result) {
cerr << endl << "Aircraft fileheader element has problems in file " << aircraftCfgFileName << endl;
return result;
}
}
if (IsChild) debug_lvl = 0;
// Process the metrics element. This element is REQUIRED.
element = document->FindElement("metrics");
if (element) {
result = ((FGAircraft*)Models[eAircraft])->Load(element);
if (!result) {
cerr << endl << "Aircraft metrics element has problems in file " << aircraftCfgFileName << endl;
return result;
}
} else {
cerr << endl << "No metrics element was found in the aircraft config file." << endl;
return false;
}
// Process the mass_balance element. This element is REQUIRED.
element = document->FindElement("mass_balance");
if (element) {
result = ((FGMassBalance*)Models[eMassBalance])->Load(element);
if (!result) {
cerr << endl << "Aircraft mass_balance element has problems in file " << aircraftCfgFileName << endl;
return result;
}
} else {
cerr << endl << "No mass_balance element was found in the aircraft config file." << endl;
return false;
}
// Process the ground_reactions element. This element is REQUIRED.
element = document->FindElement("ground_reactions");
if (element) {
result = ((FGGroundReactions*)Models[eGroundReactions])->Load(element);
if (!result) {
cerr << endl << "Aircraft ground_reactions element has problems in file " << aircraftCfgFileName << endl;
return result;
}
((FGFCS*)Models[eSystems])->AddGear(((FGGroundReactions*)Models[eGroundReactions])->GetNumGearUnits());
} else {
cerr << endl << "No ground_reactions element was found in the aircraft config file." << endl;
return false;
}
// Process the external_reactions element. This element is OPTIONAL.
element = document->FindElement("external_reactions");
if (element) {
result = ((FGExternalReactions*)Models[eExternalReactions])->Load(element);
if (!result) {
cerr << endl << "Aircraft external_reactions element has problems in file " << aircraftCfgFileName << endl;
return result;
}
}
// Process the buoyant_forces element. This element is OPTIONAL.
element = document->FindElement("buoyant_forces");
if (element) {
result = ((FGBuoyantForces*)Models[eBuoyantForces])->Load(element);
if (!result) {
cerr << endl << "Aircraft buoyant_forces element has problems in file " << aircraftCfgFileName << endl;
return result;
}
}
// Process the propulsion element. This element is OPTIONAL.
element = document->FindElement("propulsion");
if (element) {
result = ((FGPropulsion*)Models[ePropulsion])->Load(element);
if (!result) {
cerr << endl << "Aircraft propulsion element has problems in file " << aircraftCfgFileName << endl;
return result;
}
for (unsigned int i=0; i<((FGPropulsion*)Models[ePropulsion])->GetNumEngines(); i++)
((FGFCS*)Models[eSystems])->AddThrottle();
}
// Process the system element[s]. This element is OPTIONAL, and there may be more than one.
element = document->FindElement("system");
while (element) {
result = ((FGFCS*)Models[eSystems])->Load(element, FGFCS::stSystem);
if (!result) {
cerr << endl << "Aircraft system element has problems in file " << aircraftCfgFileName << endl;
return result;
}
element = document->FindNextElement("system");
}
// Process the autopilot element. This element is OPTIONAL.
element = document->FindElement("autopilot");
if (element) {
result = ((FGFCS*)Models[eSystems])->Load(element, FGFCS::stAutoPilot);
if (!result) {
cerr << endl << "Aircraft autopilot element has problems in file " << aircraftCfgFileName << endl;
return result;
}
}
// Process the flight_control element. This element is OPTIONAL.
element = document->FindElement("flight_control");
if (element) {
result = ((FGFCS*)Models[eSystems])->Load(element, FGFCS::stFCS);
if (!result) {
cerr << endl << "Aircraft flight_control element has problems in file " << aircraftCfgFileName << endl;
return result;
}
}
// Process the aerodynamics element. This element is OPTIONAL, but almost always expected.
element = document->FindElement("aerodynamics");
if (element) {
result = ((FGAerodynamics*)Models[eAerodynamics])->Load(element);
if (!result) {
cerr << endl << "Aircraft aerodynamics element has problems in file " << aircraftCfgFileName << endl;
return result;
}
} else {
cerr << endl << "No expected aerodynamics element was found in the aircraft config file." << endl;
}
// Process the input element. This element is OPTIONAL.
element = document->FindElement("input");
if (element) {
result = ((FGInput*)Models[eInput])->Load(element);
if (!result) {
cerr << endl << "Aircraft input element has problems in file " << aircraftCfgFileName << endl;
return result;
}
}
// Process the output element[s]. This element is OPTIONAL, and there may be more than one.
element = document->FindElement("output");
while (element) {
string output_file_name = aircraftCfgFileName;
if (!element->GetAttributeValue("file").empty()) {
output_file_name = RootDir + element->GetAttributeValue("file");
result = ((FGOutput*)Models[eOutput])->SetDirectivesFile(output_file_name);
}
else
result = ((FGOutput*)Models[eOutput])->Load(element);
if (!result) {
cerr << endl << "Aircraft output element has problems in file " << output_file_name << endl;
return result;
}
element = document->FindNextElement("output");
}
// Lastly, process the child element. This element is OPTIONAL - and NOT YET SUPPORTED.
element = document->FindElement("child");
if (element) {
result = ReadChild(element);
if (!result) {
cerr << endl << "Aircraft child element has problems in file " << aircraftCfgFileName << endl;
return result;
}
}
// Since all vehicle characteristics have been loaded, place the values in the Inputs
// structure for the FGModel-derived classes.
LoadModelConstants();
modelLoaded = true;
if (debug_lvl > 0) {
LoadInputs(eMassBalance); // Update all input mass properties for the report.
Models[eMassBalance]->Run(false); // Update all mass properties for the report.
LoadInputs(ePropulsion); // Update propulsion properties for the report.
Models[ePropulsion]->Run(false); // Update propulsion properties for the report.
LoadInputs(eMassBalance); // Update all (one more time) input mass properties for the report.
Models[eMassBalance]->Run(false); // Update all (one more time) mass properties for the report.
((FGMassBalance*)Models[eMassBalance])->GetMassPropertiesReport();
cout << endl << fgblue << highint
<< "End of vehicle configuration loading." << endl
<< "-------------------------------------------------------------------------------"
<< reset << endl;
}
if (IsChild) debug_lvl = saved_debug_lvl;
} else {
cerr << fgred
<< " JSBSim failed to open the configuration file: " << aircraftCfgFileName
<< fgdef << endl;
}
for (unsigned int i=0; i< Models.size(); i++) LoadInputs(i);
if (result) {
struct PropertyCatalogStructure masterPCS;
masterPCS.base_string = "";
masterPCS.node = Root->GetNode();
BuildPropertyCatalog(&masterPCS);
}
return result;
}
Here is the call graph for this function:| bool LoadScript | ( | const string & | Script, |
| double | deltaT = 0.0, |
||
| const string | initfile = "" |
||
| ) |
| Script | The full path name and file name for the script to be loaded. |
| deltaT | The simulation integration step size, if given. If no value is supplied then 0.0 is used and the value is expected to be supplied in the script file itself. |
| initfile | The initialization file that will override the initialization file specified in the script file. If no file name is given on the command line, the file specified in the script will be used. If an initialization file is not given in either place, an error will result. |
Definition at line 672 of file FGFDMExec.cpp.
References FGScript::LoadScript().
{
bool result;
Script = new FGScript(this);
result = Script->LoadScript(RootDir + script, deltaT, initfile);
return result;
}
Here is the call graph for this function:| string QueryPropertyCatalog | ( | const string & | check | ) |
A string is returned that contains a carriage return delimited list of all strings in the property catalog that matches the supplied check string.
| check | The string to search for in the property catalog. |
Definition at line 972 of file FGFDMExec.cpp.
Referenced by FGInput::Run().
{
string results="";
for (unsigned i=0; i<PropertyCatalog.size(); i++) {
if (PropertyCatalog[i].find(in) != string::npos) results += PropertyCatalog[i] + "\n";
}
if (results.empty()) return "No matches found\n";
return results;
}
Here is the caller graph for this function:| bool Run | ( | void | ) |
Definition at line 349 of file FGFDMExec.cpp.
References FGFDMExec::IncrTime(), FGFDMExec::IntegrationSuspended(), and FGScript::RunScript().
Referenced by FGTrimAnalysisControl::initTheta(), and FGFDMExec::RunIC().
{
bool success=true;
Debug(2);
for (unsigned int i=1; i<ChildFDMList.size(); i++) {
ChildFDMList[i]->AssignState( (FGPropagate*)Models[ePropagate] ); // Transfer state to the child FDM
ChildFDMList[i]->Run();
}
IncrTime();
// returns true if success, false if complete
if (Script != 0 && !IntegrationSuspended()) success = Script->RunScript();
for (unsigned int i = 0; i < Models.size(); i++) {
LoadInputs(i);
Models[i]->Run(holding);
}
if (Terminate) success = false;
return (success);
}
Here is the call graph for this function:
Here is the caller graph for this function:| bool RunIC | ( | void | ) |
dt=0.
Definition at line 589 of file FGFDMExec.cpp.
References FGInitialCondition::GetEngineRunning(), FGInitialCondition::GetNumEnginesRunning(), FGFDMExec::Initialize(), FGPropulsion::InitRunning(), FGFDMExec::ResumeIntegration(), FGFDMExec::Run(), and FGFDMExec::SuspendIntegration().
Referenced by FGFDMExec::ResetToInitialConditions().
{
FGPropulsion* propulsion = (FGPropulsion*)Models[ePropulsion];
Models[eOutput]->InitModel();
SuspendIntegration(); // saves the integration rate, dt, then sets it to 0.0.
Initialize(IC);
Run();
ResumeIntegration(); // Restores the integration rate to what it was.
for (unsigned int i=0; i<IC->GetNumEnginesRunning(); i++)
propulsion->InitRunning(IC->GetEngineRunning(i));
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| void Schedule | ( | FGModel * | model, |
| int | rate = 1 |
||
| ) |
The "rate" is not really a clock rate. It represents how many calls to the FGFDMExec::Run() method must be made before the model is executed. A value of 1 means that the model will be executed for each call to the exec's Run() method. A value of 5 means that the model will only be executed every 5th call to the exec's Run() method. Use of a rate other than one is at this time not recommended.
| model | A pointer to the model being scheduled. |
| rate | The rate at which to execute the model as described above. Default is every frame (rate=1). |
Definition at line 341 of file FGFDMExec.cpp.
{
model->SetRate(rate);
Models.push_back(model);
}
| bool SetAircraftPath | ( | const string & | path | ) | [inline] |
| path | path to the aircraft directory. For instance: "aircraft". Under aircraft, then, would be directories for various modeled aircraft such as C172/, x15/, etc. |
Definition at line 330 of file FGFDMExec.h.
{ AircraftPath = RootDir + path; return true; }
| void Setdt | ( | double | delta_t | ) | [inline] |
| delta_t | the time step in seconds. |
Definition at line 561 of file FGFDMExec.h.
Referenced by FGScript::LoadScript().
{ dT = delta_t; }
Here is the caller graph for this function:| bool SetEnginePath | ( | const string & | path | ) | [inline] |
| path | path to the directory under which engine config files are kept, for instance "engine" |
Definition at line 324 of file FGFDMExec.h.
{ EnginePath = RootDir + path; return true; }
| void SetGroundCallback | ( | FGGroundCallback * | gc | ) | [inline] |
For optimal memory management, a shared pointer is used internally that maintains a reference counter. The calling application must therefore use FGGroundCallback_ptr 'smart pointers' to manage their copy of the ground callback.
| gc | A pointer to a ground callback object |
Definition at line 277 of file FGFDMExec.h.
Referenced by FGFDMExec::FGFDMExec().
{ FGLocation::SetGroundCallback(gc); }
Here is the caller graph for this function:| void SetLoggingRate | ( | double | rate | ) | [inline] |
Definition at line 447 of file FGFDMExec.h.
References FGOutput::SetRate().
{ Output->SetRate(rate); }
Here is the call graph for this function:| bool SetOutputDirectives | ( | const string & | fname | ) | [inline] |
Calling this function passes the name of an output directives file to the FGOutput object associated with this run. The call to this function should be made prior to loading an aircraft model. This call results in an FGOutput object being built as the first Output object in the FDMExec-managed list of Output objects that may be created for an aircraft model. If this call is made after an aircraft model is loaded, there is no effect. Any Output objects added by the aircraft model itself (in an <output> element) will be added after this one. Care should be taken not to refer to the same file name. An output directives file contains an <output> </output> element, within which should be specified the parameters or parameter groups that should be logged.
| fname | the filename of an output directives file. |
Definition at line 440 of file FGFDMExec.h.
References FGOutput::SetDirectivesFile().
Referenced by FGScript::LoadScript().
{return Output->SetDirectivesFile(RootDir + fname);}
Here is the call graph for this function:
Here is the caller graph for this function:| bool SetOutputFileName | ( | const string & | fname | ) | [inline] |
| fname | the name of the file to output data to |
Definition at line 452 of file FGFDMExec.h.
References FGOutput::SetOutputName().
{ return Output->SetOutputName(0, fname); }
Here is the call graph for this function:| void SetPropertyValue | ( | const string & | property, |
| double | value | ||
| ) | [inline] |
| property | the property to be set |
| value | the value to set the property to |
Definition at line 401 of file FGFDMExec.h.
References FGPropertyNode::SetDouble().
{
instance->GetNode()->SetDouble(property, value);
}
Here is the call graph for this function:| void SetRootDir | ( | const string & | rootDir | ) | [inline] |
| rootDir | the string containing the root directory. |
Definition at line 565 of file FGFDMExec.h.
{RootDir = rootDir;}
| double Setsim_time | ( | double | cur_time | ) | [inline] |
| cur_time | the current time |
Definition at line 554 of file FGFDMExec.h.
Referenced by FGFDMExec::DoLinearization(), FGFDMExec::Initialize(), and FGScript::LoadScript().
{
sim_time = cur_time;
return sim_time;
}
Here is the caller graph for this function:| bool SetSystemsPath | ( | const string & | path | ) | [inline] |
| path | path to the directory under which systems config files are kept, for instance "systems" |
Definition at line 335 of file FGFDMExec.h.
{ SystemsPath = RootDir + path; return true; }
| void Unbind | ( | void | ) | [inline] |
Definition at line 246 of file FGFDMExec.h.
References FGPropertyManager::Unbind().
Referenced by FGFDMExec::~FGFDMExec().
{instance->Unbind();}
Here is the call graph for this function:
Here is the caller graph for this function: