#include <vector>
#include <string>
-#include "models/FGOutput.h"
-#include "models/FGInput.h"
#include "initialization/FGTrim.h"
#include "FGJSBBase.h"
#include "input_output/FGPropertyManager.h"
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.64 2011/05/20 03:18:36 jberndt Exp $"
+#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.72 2011/10/14 22:46:49 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
class FGAerodynamics;
class FGAircraft;
class FGAtmosphere;
+class FGAccelerations;
+class FGWinds;
class FGAuxiliary;
class FGBuoyantForces;
class FGExternalReactions;
property actually maps toa function call of DoTrim().
@author Jon S. Berndt
- @version $Revision: 1.64 $
+ @version $Revision: 1.72 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/// Default destructor
~FGFDMExec();
+ // This list of enums is very important! The order in which models are listed here
+ // determines the order of execution of the models.
+ enum eModels { ePropagate=0,
+ eInput,
+ eInertial,
+ eAtmosphere,
+ eWinds,
+ eAuxiliary,
+ eSystems,
+ ePropulsion,
+ eAerodynamics,
+ eGroundReactions,
+ eExternalReactions,
+ eBuoyantForces,
+ eMassBalance,
+ eAircraft,
+ eAccelerations,
+ eNumStandardModels };
+
/** Unbind all tied JSBSim properties. */
void Unbind(void) {instance->Unbind();}
one is at this time not recommended.
@param model A pointer to the model being scheduled.
@param rate The rate at which to execute the model as described above.
+ Default is every frame (rate=1).
@return Currently returns 0 always. */
- void Schedule(FGModel* model, int rate);
+ void Schedule(FGModel* model, int rate=1);
/** This function executes each scheduled model in succession.
@return true if successful, false if sim should be ended */
bool RunIC(void);
/** Sets the ground callback pointer.
- @param gc A pointer to a ground callback object. */
+ @param gc A pointer to a ground callback object.
+ */
void SetGroundCallback(FGGroundCallback* gc);
/** Loads an aircraft model.
/// @name Top-level executive State and Model retrieval mechanism
//@{
/// Returns the FGAtmosphere pointer.
- FGAtmosphere* GetAtmosphere(void) {return Atmosphere;}
+ FGAtmosphere* GetAtmosphere(void) {return (FGAtmosphere*)Models[eAtmosphere];}
+ /// Returns the FGAccelerations pointer.
+ FGAccelerations* GetAccelerations(void) {return (FGAccelerations*)Models[eAccelerations];}
+ /// Returns the FGWinds pointer.
+ FGWinds* GetWinds(void) {return (FGWinds*)Models[eWinds];}
/// Returns the FGFCS pointer.
- FGFCS* GetFCS(void) {return FCS;}
+ FGFCS* GetFCS(void) {return (FGFCS*)Models[eSystems];}
/// Returns the FGPropulsion pointer.
- FGPropulsion* GetPropulsion(void) {return Propulsion;}
+ FGPropulsion* GetPropulsion(void) {return (FGPropulsion*)Models[ePropulsion];}
/// Returns the FGAircraft pointer.
- FGMassBalance* GetMassBalance(void) {return MassBalance;}
+ FGMassBalance* GetMassBalance(void) {return (FGMassBalance*)Models[eMassBalance];}
/// Returns the FGAerodynamics pointer
- FGAerodynamics* GetAerodynamics(void){return Aerodynamics;}
+ FGAerodynamics* GetAerodynamics(void){return (FGAerodynamics*)Models[eAerodynamics];}
/// Returns the FGInertial pointer.
- FGInertial* GetInertial(void) {return Inertial;}
+ FGInertial* GetInertial(void) {return (FGInertial*)Models[eInertial];}
/// Returns the FGGroundReactions pointer.
- FGGroundReactions* GetGroundReactions(void) {return GroundReactions;}
+ FGGroundReactions* GetGroundReactions(void) {return (FGGroundReactions*)Models[eGroundReactions];}
/// Returns the FGExternalReactions pointer.
- FGExternalReactions* GetExternalReactions(void) {return ExternalReactions;}
+ FGExternalReactions* GetExternalReactions(void) {return (FGExternalReactions*)Models[eExternalReactions];}
/// Returns the FGBuoyantForces pointer.
- FGBuoyantForces* GetBuoyantForces(void) {return BuoyantForces;}
+ FGBuoyantForces* GetBuoyantForces(void) {return (FGBuoyantForces*)Models[eBuoyantForces];}
/// Returns the FGAircraft pointer.
- FGAircraft* GetAircraft(void) {return Aircraft;}
+ FGAircraft* GetAircraft(void) {return (FGAircraft*)Models[eAircraft];}
/// Returns the FGPropagate pointer.
- FGPropagate* GetPropagate(void) {return Propagate;}
+ FGPropagate* GetPropagate(void) {return (FGPropagate*)Models[ePropagate];}
/// Returns the FGAuxiliary pointer.
- FGAuxiliary* GetAuxiliary(void) {return Auxiliary;}
+ FGAuxiliary* GetAuxiliary(void) {return (FGAuxiliary*)Models[eAuxiliary];}
/// Returns the FGInput pointer.
- FGInput* GetInput(void) {return Input;}
+ FGInput* GetInput(void) {return (FGInput*)Models[eInput];}
/// Returns the FGGroundCallback pointer.
FGGroundCallback* GetGroundCallback(void) {return GroundCallback;}
/// Retrieves the script object
/** Sets (or overrides) the output filename
@param fname the name of the file to output data to
@return true if successful, false if there is no output specified for the flight model */
- bool SetOutputFileName(const string& fname) {
- if (Outputs.size() > 0) Outputs[0]->SetOutputFileName(fname);
- else return false;
- return true;
- }
+ bool SetOutputFileName(const string& fname);
/** Retrieves the current output filename.
@return the name of the output file for the first output specified by the flight model.
If none is specified, the empty string is returned. */
- string GetOutputFileName(void) {
- if (Outputs.size() > 0) return Outputs[0]->GetOutputFileName();
- else return string("");
- }
+ string GetOutputFileName(void);
/** Executes trimming in the selected mode.
* @param mode Specifies how to trim:
vector<string>& GetPropertyCatalog(void) {return PropertyCatalog;}
- /// Use the MSIS atmosphere model.
- void UseAtmosphereMSIS(void);
-
- /// Use the Mars atmosphere model. (Not operative yet.)
- void UseAtmosphereMars(void);
-
void SetTrimStatus(bool status){ trim_status = status; }
bool GetTrimStatus(void) const { return trim_status; }
void SetTrimMode(int mode){ ta_mode = mode; }
int GetTrimMode(void) const { return ta_mode; }
+ string GetPropulsionTankReport();
+
/// Returns the cumulative simulation time in seconds.
double GetSimTime(void) const { return sim_time; }
bool Constructing;
bool modelLoaded;
bool IsChild;
+ bool firstPass;
string modelName;
string AircraftPath;
string FullAircraftPath;
string Release;
string RootDir;
+ // Standard Model pointers - shortcuts for internal executive use only.
+ FGPropagate* Propagate;
+ FGInertial* Inertial;
+ FGAtmosphere* Atmosphere;
+ FGWinds* Winds;
+ FGAuxiliary* Auxiliary;
+ FGFCS* FCS;
+ FGPropulsion* Propulsion;
+ FGAerodynamics* Aerodynamics;
+ FGGroundReactions* GroundReactions;
+ FGExternalReactions* ExternalReactions;
+ FGBuoyantForces* BuoyantForces;
+ FGMassBalance* MassBalance;
+ FGAircraft* Aircraft;
+ FGAccelerations* Accelerations;
+
bool trim_status;
int ta_mode;
FGGroundCallback* GroundCallback;
- FGAtmosphere* Atmosphere;
- FGFCS* FCS;
- FGPropulsion* Propulsion;
- FGMassBalance* MassBalance;
- FGAerodynamics* Aerodynamics;
- FGInertial* Inertial;
- FGGroundReactions* GroundReactions;
- FGExternalReactions* ExternalReactions;
- FGBuoyantForces* BuoyantForces;
- FGAircraft* Aircraft;
- FGPropagate* Propagate;
- FGAuxiliary* Auxiliary;
- FGInput* Input;
FGScript* Script;
FGInitialCondition* IC;
FGTrim* Trim;
bool ReadChild(Element*);
bool ReadPrologue(Element*);
void ResetToInitialConditions(int mode);
+ void LoadInputs(unsigned int idx);
+ void LoadPlanetConstants(void);
+ void LoadModelConstants(void);
bool Allocate(void);
bool DeAllocate(void);
void Initialize(FGInitialCondition *FGIC);