X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FJSBSim%2Fmodels%2FFGPropulsion.h;h=4be73b1698acb0814b0ce5e533a5445c45bc5c6d;hb=642735ab18421db87a07d6841dd720fd4615bfff;hp=71351477e721b0b6b9d1033d67fb102b73a63ea3;hpb=f7f17a4744aaa1dbcd9e64b1a4bc97de888ed892;p=flightgear.git diff --git a/src/FDM/JSBSim/models/FGPropulsion.h b/src/FDM/JSBSim/models/FGPropulsion.h index 71351477e..4be73b169 100644 --- a/src/FDM/JSBSim/models/FGPropulsion.h +++ b/src/FDM/JSBSim/models/FGPropulsion.h @@ -4,7 +4,7 @@ Author: Jon S. Berndt Date started: 08/20/00 - ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) ------------- + ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -38,31 +38,19 @@ SENTRY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#ifdef FGFS -# include -# ifdef SG_HAVE_STD_INCLUDES -# include -# include -# else -# include -# include -# endif -#else -# include -# include -#endif +#include +#include #include "FGModel.h" -#include -#include -#include -#include +#include "propulsion/FGEngine.h" +#include "math/FGMatrix33.h" +#include "input_output/FGXMLFileRead.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_PROPULSION "$Id$" +#define ID_PROPULSION "$Id: FGPropulsion.h,v 1.31 2011/10/31 14:54:41 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -70,6 +58,9 @@ FORWARD DECLARATIONS namespace JSBSim { +class FGTank; +class FGEngine; + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DOCUMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -101,7 +92,7 @@ CLASS DOCUMENTATION @endcode @author Jon S. Berndt - @version $Id$ + @version $Id: FGPropulsion.h,v 1.31 2011/10/31 14:54:41 bcoconni Exp $ @see FGEngine FGTank @@ -122,9 +113,13 @@ public: /** Executes the propulsion model. The initial plan for the FGPropulsion class calls for Run() to be executed, calculating the power available from the engine. - - [Note: Should we be checking the Starved flag here?] */ - bool Run(void); + Can pass in a value indicating if the executive is directing the simulation to Hold. + @param Holding if true, the executive has been directed to hold the sim from + advancing time. Some models may ignore this flag, such as the Input + model, which may need to be active to listen on a socket for the + "Resume" command to be given. + @return false if no error */ + bool Run(bool Holding); bool InitModel(void); @@ -135,32 +130,32 @@ public: bool Load(Element* el); /// Retrieves the number of engines defined for the aircraft. - inline unsigned int GetNumEngines(void) const {return (unsigned int)Engines.size();} + unsigned int GetNumEngines(void) const {return (unsigned int)Engines.size();} /** Retrieves an engine object pointer from the list of engines. @param index the engine index within the vector container @return the address of the specific engine, or zero if no such engine is available */ - inline FGEngine* GetEngine(unsigned int index) { - if (index <= Engines.size()-1) return Engines[index]; - else return 0L; } + FGEngine* GetEngine(unsigned int index) const { + if (index < Engines.size()) return Engines[index]; + else return 0L; } /// Retrieves the number of tanks defined for the aircraft. - inline unsigned int GetNumTanks(void) const {return (unsigned int)Tanks.size();} + unsigned int GetNumTanks(void) const {return (unsigned int)Tanks.size();} /** Retrieves a tank object pointer from the list of tanks. @param index the tank index within the vector container @return the address of the specific tank, or zero if no such tank is available */ - inline FGTank* GetTank(unsigned int index) { - if (index <= Tanks.size()-1) return Tanks[index]; - else return 0L; } + FGTank* GetTank(unsigned int index) const { + if (index < Tanks.size()) return Tanks[index]; + else return 0L; } /** Returns the number of fuel tanks currently actively supplying fuel */ - inline int GetnumSelectedFuelTanks(void) const {return numSelectedFuelTanks;} + int GetnumSelectedFuelTanks(void) const {return numSelectedFuelTanks;} /** Returns the number of oxidizer tanks currently actively supplying oxidizer */ - inline int GetnumSelectedOxiTanks(void) const {return numSelectedOxiTanks;} + int GetnumSelectedOxiTanks(void) const {return numSelectedOxiTanks;} /** Loops the engines until thrust output steady (used for trimming) */ bool GetSteadyState(void); @@ -168,29 +163,30 @@ public: /** Sets up the engines as running */ void InitRunning(int n); - string GetPropulsionStrings(string delimeter); - string GetPropulsionValues(string delimeter); + std::string GetPropulsionStrings(const std::string& delimiter) const; + std::string GetPropulsionValues(const std::string& delimiter) const; + std::string GetPropulsionTankReport(); - inline FGColumnVector3& GetForces(void) {return vForces; } - inline double GetForces(int n) const { return vForces(n);} - inline FGColumnVector3& GetMoments(void) {return vMoments;} - inline double GetMoments(int n) const {return vMoments(n);} + const FGColumnVector3& GetForces(void) const {return vForces; } + double GetForces(int n) const { return vForces(n);} + const FGColumnVector3& GetMoments(void) const {return vMoments;} + double GetMoments(int n) const {return vMoments(n);} - inline bool GetRefuel(void) const {return refuel;} - inline void SetRefuel(bool setting) {refuel = setting;} - inline bool GetFuelDump(void) const {return dump;} - inline void SetFuelDump(bool setting) {dump = setting;} + bool GetRefuel(void) const {return refuel;} + void SetRefuel(bool setting) {refuel = setting;} + bool GetFuelDump(void) const {return dump;} + void SetFuelDump(bool setting) {dump = setting;} double Transfer(int source, int target, double amount); void DoRefuel(double time_slice); void DumpFuel(double time_slice); - FGColumnVector3& GetTanksMoment(void); - double GetTanksWeight(void); + const FGColumnVector3& GetTanksMoment(void); + double GetTanksWeight(void) const; - ifstream* FindEngineFile(string filename); - string FindEngineFullPathname(string engine_filename); + std::ifstream* FindEngineFile(const std::string& filename); + std::string FindEngineFullPathname(const std::string& engine_filename); inline int GetActiveEngine(void) const {return ActiveEngine;} - inline bool GetFuelFreeze(void) {return fuel_freeze;} + inline bool GetFuelFreeze(void) const {return FuelFreeze;} double GetTotalFuelQuantity(void) const {return TotalFuelQuantity;} void SetMagnetos(int setting); @@ -198,11 +194,13 @@ public: void SetCutoff(int setting=0); void SetActiveEngine(int engine); void SetFuelFreeze(bool f); - FGMatrix33& CalculateTankInertias(void); + const FGMatrix33& CalculateTankInertias(void); + + struct FGEngine::Inputs in; private: - vector Engines; - vector Tanks; + std::vector Engines; + std::vector Tanks; unsigned int numSelectedFuelTanks; unsigned int numSelectedOxiTanks; unsigned int numFuelTanks; @@ -217,7 +215,7 @@ private: FGMatrix33 tankJ; bool refuel; bool dump; - bool fuel_freeze; + bool FuelFreeze; double TotalFuelQuantity; double DumpRate; bool IsBound; @@ -226,6 +224,7 @@ private: bool HaveTurboPropEngine; bool HaveRocketEngine; bool HaveElectricEngine; + void ConsumeFuel(FGEngine* engine); int InitializedEngines; bool HasInitializedEngines;