 |
JSBSim Flight Dynamics Model
1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
|
37 #ifndef FGFDMEXEC_HEADER_H
38 #define FGFDMEXEC_HEADER_H
47 #include "models/FGPropagate.h"
48 #include "models/FGOutput.h"
49 #include "math/FGTemplateFunc.h"
62 class FGAccelerations;
65 class FGBuoyantForces;
66 class FGExternalReactions;
67 class FGGroundReactions;
203 void Run(
void) {exec->
Run();}
205 exec->
GetPropagate()->SetVState(source_prop->GetVState());
230 enum eModels { ePropagate=0,
246 eNumStandardModels };
275 bool LoadModel(
const SGPath& AircraftPath,
const SGPath& EnginePath,
276 const SGPath& SystemsPath,
const std::string& model,
277 bool addModelToPath =
true);
289 bool LoadModel(
const std::string& model,
bool addModelToPath =
true);
302 bool LoadScript(
const SGPath& Script,
double deltaT=0.0,
303 const SGPath& initfile=SGPath());
312 EnginePath = GetFullPath(path);
324 AircraftPath = GetFullPath(path);
335 SystemsPath = GetFullPath(path);
346 OutputPath = GetFullPath(path);
407 {
return instance->GetNode()->
GetDouble(property); }
413 instance->GetNode()->
SetDouble(property, value);
482 void Hold(
void) {holding =
true;}
493 static const int DONT_EXECUTE_RUN_IC = 0x2;
527 void PrintPropertyCatalog(
void);
530 void PrintSimulationConfiguration(
void)
const;
532 std::vector<std::string>& GetPropertyCatalog(
void) {
return PropertyCatalog;}
534 void SetTrimStatus(
bool status){ trim_status = status; }
535 bool GetTrimStatus(
void)
const {
return trim_status; }
536 void SetTrimMode(
int mode){ ta_mode = mode; }
537 int GetTrimMode(
void)
const {
return ta_mode; }
539 std::string GetPropulsionTankReport();
564 void Setdt(
double delta_t) { dT = delta_t; }
612 return TemplateFunctions.count(name) ? TemplateFunctions[name] :
nullptr;
615 void AddTemplateFunc(
const std::string& name, Element* el) {
616 TemplateFunctions[name] =
new FGTemplateFunc(
this, el);
619 const std::shared_ptr<std::default_random_engine>& GetRandomEngine(
void)
const
620 {
return RandomEngine; }
626 unsigned short Terminate;
631 bool IncrementThenHolding;
632 int TimeStepsUntilHold;
636 std::string modelName;
638 SGPath FullAircraftPath;
642 std::string CFGVersion;
647 FGPropagate* Propagate;
648 FGInertial* Inertial;
649 FGAtmosphere* Atmosphere;
651 FGAuxiliary* Auxiliary;
653 FGPropulsion* Propulsion;
654 FGAerodynamics* Aerodynamics;
655 FGGroundReactions* GroundReactions;
656 FGExternalReactions* ExternalReactions;
657 FGBuoyantForces* BuoyantForces;
658 FGMassBalance* MassBalance;
659 FGAircraft* Aircraft;
660 FGAccelerations* Accelerations;
665 unsigned int ResetMode;
669 FGInitialCondition* IC;
672 FGPropertyManager* Root;
674 FGPropertyManager* instance;
679 std::shared_ptr<std::default_random_engine> RandomEngine;
683 unsigned int* FDMctr;
685 std::vector <std::string> PropertyCatalog;
686 std::vector <childData*> ChildFDMList;
687 std::vector <FGModel*> Models;
688 std::map<std::string, FGTemplateFunc_ptr> TemplateFunctions;
690 bool ReadFileHeader(Element*);
691 bool ReadChild(Element*);
692 bool ReadPrologue(Element*);
694 int SRand(
void)
const {
return RandomSeed;}
695 void LoadInputs(
unsigned int idx);
696 void LoadPlanetConstants(
void);
697 void LoadModelConstants(
void);
699 bool DeAllocate(
void);
700 void InitializeModels(
void);
701 int GetDisperse(
void)
const {
return disperse;}
702 SGPath GetFullPath(
const SGPath& name) {
703 if (name.isRelative())
704 return RootDir/name.utf8Str();
709 void Debug(
int from);
void SetHoldDown(bool hd)
Sets the property forces/hold-down.
bool LoadScript(const SGPath &Script, double deltaT=0.0, const SGPath &initfile=SGPath())
Load a script.
Encapsulates the JSBSim simulation executive.
const SGPath & GetSystemsPath(void)
Retrieves the systems path.
std::string QueryPropertyCatalog(const std::string &check)
Retrieves property or properties matching the supplied string.
static const int START_NEW_OUTPUT
Mode flags for ResetToInitialConditions.
FGOutput * GetOutput(void)
Returns the FGOutput pointer.
double IncrTime(void)
Increments the simulation time if not in Holding mode.
void SuspendIntegration(void)
Suspends the simulation and sets the delta T to zero.
This class implements a 3 element column vector.
Encapsulates the aerodynamic calculations.
Manages the external and/or arbitrary forces and moments.
FGInitialCondition * GetIC(void)
Returns a pointer to the FGInitialCondition object.
void SetRootDir(const SGPath &rootDir)
Set the root directory that is used to obtain absolute paths from relative paths.
FGInertial * GetInertial(void)
Returns the FGInertial pointer.
const SGPath & GetAircraftPath(void)
Retrieves the aircraft path.
void SetLoggingRate(double rate)
Sets the logging rate in Hz for all output objects (if any).
Models weight, balance and moment of inertia information.
const std::string & GetModelName(void) const
Returns the model name.
void BuildPropertyCatalog(struct PropertyCatalogStructure *pcs)
Builds a catalog of properties.
~FGFDMExec()
Default destructor.
double GetSimTime(void) const
Returns the cumulative simulation time in seconds.
void ForceOutput(int idx)
Force an output instance to generate its output.
FGAircraft * GetAircraft(void)
Returns the FGAircraft pointer.
bool IntegrationSuspended(void) const
Returns the simulation suspension state.
FGGroundReactions * GetGroundReactions(void)
Returns the FGGroundReactions pointer.
FGPropertyManager * GetPropertyManager(void)
Returns a pointer to the property manager object.
bool SetOutputFileName(const int n, const std::string &fname)
Sets (or overrides) the output filename.
void SetPropertyValue(const std::string &property, double value)
Sets a property value.
const SGPath & GetRootDir(void) const
Retrieve the Root Directory.
FGAuxiliary * GetAuxiliary(void)
Returns the FGAuxiliary pointer.
FGInput * GetInput(void)
Returns the FGInput pointer.
void SetDebugLevel(int level)
Sets the debug level.
bool SetDirectivesFile(const SGPath &fname)
Adds a new output instance to the Output Manager.
double Setsim_time(double cur_time)
Sets the current sim time.
void DoTrim(int mode)
Executes trimming in the selected mode.
bool SetOutputDirectives(const SGPath &fname)
Sets the output (logging) mechanism for this run.
void ResumeIntegration(void)
Resumes the simulation by resetting delta T to the correct value.
std::string base_string
Name of the property.
FGScript * GetScript(void)
Retrieves the script object.
childData * GetChildFDM(int i) const
Gets a particular child FDM.
std::string GetOutputName(unsigned int idx) const
Get the name identifier to which the output will be directed.
bool Holding(void)
Returns true if the simulation is Holding (i.e. simulation time is not moving).
FGWinds * GetWinds(void)
Returns the FGWinds pointer.
double GetDouble(const std::string &name, double defaultValue=0.0) const
Get a double value for a property.
Encapsulates the JSBSim scripting capability.
void Unbind(void)
Unbind all tied JSBSim properties.
Models an empty, abstract base atmosphere class.
FGPropagate * GetPropagate(void)
Returns the FGPropagate pointer.
void ResetToInitialConditions(int mode)
Resets the initial conditions object and prepares the simulation to run again.
int GetFDMCount(void) const
Gets the number of child FDMs.
bool GetHoldDown(void) const
Gets the value of the property forces/hold-down.
void EnableIncrementThenHold(int Timesteps)
Turn on hold after increment.
FGMassBalance * GetMassBalance(void)
Returns the FGAircraft pointer.
std::string GetOutputFileName(int n) const
Retrieves the current output filename.
Models the EOM and integration/propagation of state.
The trimming routine for JSBSim.
FGAerodynamics * GetAerodynamics(void)
Returns the FGAerodynamics pointer.
Initializes the simulation run.
void CheckIncrementalHold(void)
Checks if required to hold afer increment.
double GetDeltaT(void) const
Returns the simulation delta T.
FGPropulsion * GetPropulsion(void)
Returns the FGPropulsion pointer.
void Unbind(void)
Unbind all properties bound by this manager to an external data source.
unsigned int GetFrame(void) const
Retrieves the current frame count.
Manages ground reactions modeling.
FGFCS * GetFCS(void)
Returns the FGFCS pointer.
void Hold(void)
Pauses execution by preventing time from incrementing.
FGTrim * GetTrim(void)
Returns a pointer to the FGTrim object.
void EnableOutput(void)
Enables data logging to all outputs.
std::vector< std::string > EnumerateFDMs(void)
Returns a vector of strings representing the names of all loaded models (future)
void Disable(void)
Disables the output generation for all output instances.
Handles the calculation of accelerations.
Encapsulates an Aircraft and its systems.
Handles simulation output.
bool SetEnginePath(const SGPath &path)
Set the path to the engine config file directories.
const SGPath & GetEnginePath(void)
Retrieves the engine path.
Encapsulates the Flight Control System (FCS) functionality.
bool SetOutputName(unsigned int idx, const std::string &name)
Overwrites the name identifier under which the output will be logged.
bool SetAircraftPath(const SGPath &path)
Set the path to the aircraft config file directories.
bool RunIC(void)
Initializes the sim from the initial condition object and executes each scheduled model without integ...
Propulsion management class.
FGFDMExec(FGPropertyManager *root=0, unsigned int *fdmctr=0)
Default constructor.
FGExternalReactions * GetExternalReactions(void)
Returns the FGExternalReactions pointer.
const SGPath & GetOutputPath(void)
Retrieves the path to the output files.
int GetDebugLevel(void) const
Retrieves the current debug level setting.
Models inertial forces (e.g.
void Setdt(double delta_t)
Sets the integration time step for the simulation executive.
bool SetSystemsPath(const SGPath &path)
Set the path to the systems config file directories.
void SetChild(bool ch)
Marks this instance of the Exec object as a "child" object.
void Enable(void)
Enables the output generation for all output instances.
FGPropertyNode_ptr node
The node for the property.
void Resume(void)
Resumes execution from a "Hold".
bool SetDouble(const std::string &name, double val)
Set a double value for a property.
bool LoadModel(const SGPath &AircraftPath, const SGPath &EnginePath, const SGPath &SystemsPath, const std::string &model, bool addModelToPath=true)
Loads an aircraft model.
Encapsulates various uncategorized scheduled functions.
void ForceOutput(int idx=0)
Forces the specified output object to print its items once.
const SGPath & GetFullAircraftPath(void)
Retrieves the full aircraft path name.
void Initialize(FGInitialCondition *FGIC)
Initializes the simulation with initial conditions.
FGAccelerations * GetAccelerations(void)
Returns the FGAccelerations pointer.
Models atmospheric disturbances: winds, gusts, turbulence, downbursts, etc.
FGBuoyantForces * GetBuoyantForces(void)
Returns the FGBuoyantForces pointer.
bool Run(void)
This function executes each scheduled model in succession.
void SetRateHz(double rate)
Modifies the output rate for all output instances.
double GetPropertyValue(const std::string &property)
Retrieves the value of a property.
Encapsulates the Buoyant forces calculations.
void DisableOutput(void)
Disables data logging to all outputs.
bool SetOutputPath(const SGPath &path)
Set the directory where the output files will be written.