]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Thruster.hpp
It can't be turned off, so force the running flag to true to avoid an
[flightgear.git] / src / FDM / YASim / Thruster.hpp
1 #ifndef _THRUSTER_HPP
2 #define _THRUSTER_HPP
3
4 namespace yasim {
5
6 class Jet;
7 class PropEngine;
8 class Propeller;
9 class Engine;
10
11 class Thruster {
12 public:
13     Thruster();
14     virtual ~Thruster();
15
16     // Typing info, these are the possible sub-type (or sub-parts)
17     // that a thruster might have.  Any might return null.  A little
18     // clumsy, but much simpler than an RTTI-based implementation.
19     virtual Jet* getJet() { return 0; }
20     virtual PropEngine* getPropEngine() { return 0; }
21     virtual Propeller* getPropeller() { return 0; }
22     virtual Engine* getEngine() { return 0; }
23     
24     // Static data
25     void getPosition(float* out);
26     void setPosition(float* pos);
27     void getDirection(float* out);
28     void setDirection(float* dir);
29
30     // Controls
31     void setThrottle(float throttle);
32     void setMixture(float mixture);
33     void setStarter(bool starter);
34     void setFuelState(bool hasFuel) { _fuel = hasFuel; }
35
36     // Dynamic output
37     virtual bool isRunning()=0;
38     virtual bool isCranking()=0;
39     virtual void getThrust(float* out)=0;
40     virtual void getTorque(float* out)=0;
41     virtual void getGyro(float* out)=0;
42     virtual float getFuelFlow()=0; // in kg/s
43
44     // Runtime instructions
45     void setWind(float* wind);
46     void setAir(float pressure, float temp, float density);
47     virtual void init() {}
48     virtual void integrate(float dt)=0;
49     virtual void stabilize()=0;
50
51 protected:
52     float _pos[3];
53     float _dir[3];
54     float _throttle;
55     float _mixture;
56     bool _starter; // true=engaged, false=disengaged
57     bool _fuel; // true=available, false=out
58
59     float _wind[3];
60     float _pressure;
61     float _temp;
62     float _rho;
63 };
64
65 }; // namespace yasim
66 #endif // _THRUSTER_HPP
67