X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FYASim%2FThruster.hpp;h=7d6e0c9cdd65d05e31913021ff4ce06b7ed1aece;hb=c62048d5e26a2931f2a0f5fa7e94b3f7203e4762;hp=25ceac8cfbfc3f788d5546c34595ec429f794306;hpb=5b84ae51a54afb63effb8841ed08643bb5701aa7;p=flightgear.git diff --git a/src/FDM/YASim/Thruster.hpp b/src/FDM/YASim/Thruster.hpp index 25ceac8cf..7d6e0c9cd 100644 --- a/src/FDM/YASim/Thruster.hpp +++ b/src/FDM/YASim/Thruster.hpp @@ -3,45 +3,62 @@ namespace yasim { +class Jet; +class PropEngine; +class Propeller; +class PistonEngine; + class Thruster { public: Thruster(); virtual ~Thruster(); + // Typing info, these are the possible sub-type (or sub-parts) + // that a thruster might have. Any might return null. A little + // clumsy, but much simpler than an RTTI-based implementation. + virtual Jet* getJet() { return 0; } + virtual PropEngine* getPropEngine() { return 0; } + virtual Propeller* getPropeller() { return 0; } + virtual PistonEngine* getPistonEngine() { return 0; } + // Static data void getPosition(float* out); void setPosition(float* pos); void getDirection(float* out); void setDirection(float* dir); - virtual Thruster* clone()=0; - // Controls void setThrottle(float throttle); void setMixture(float mixture); - void setPropAdvance(float advance); + void setStarter(bool starter); + void setFuelState(bool hasFuel) { _fuel = hasFuel; } // Dynamic output + virtual bool isRunning()=0; + virtual bool isCranking()=0; virtual void getThrust(float* out)=0; virtual void getTorque(float* out)=0; virtual void getGyro(float* out)=0; - virtual float getFuelFlow()=0; + virtual float getFuelFlow()=0; // in kg/s // Runtime instructions void setWind(float* wind); - void setDensity(float rho); + void setAir(float pressure, float temp, float density); + virtual void init() {} virtual void integrate(float dt)=0; + virtual void stabilize()=0; protected: - void cloneInto(Thruster* out); - float _pos[3]; float _dir[3]; float _throttle; float _mixture; - float _propAdvance; + bool _starter; // true=engaged, false=disengaged + bool _fuel; // true=available, false=out float _wind[3]; + float _pressure; + float _temp; float _rho; };