]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Airplane.hpp
Add support for a turbo prop condition lever.
[flightgear.git] / src / FDM / YASim / Airplane.hpp
index 16f0ca714fc97da975ad308886be53112da7ed81..9131fa683cd5a784a5669b1abc3d9fbdedb5b1af 100644 (file)
@@ -18,7 +18,7 @@ public:
     ~Airplane();
 
     void iterate(float dt);
-    void consumeFuel(float dt);
+    void calcFuelWeights();
 
     ControlMap* getControlMap();
     Model* getModel();
@@ -48,20 +48,26 @@ public:
     int addWeight(float* pos, float size);
     void setWeight(int handle, float mass);
 
-    void setApproach(float speed, float altitude);
-    void setApproach(float speed, float altitude, float aoa); 
-    void setCruise(float speed, float altitude);
+    void setApproach(float speed, float altitude, float aoa, float fuel);
+    void setCruise(float speed, float altitude, float fuel);
 
     void setElevatorControl(int control);
     void addApproachControl(int control, float val);
     void addCruiseControl(int control, float val);
 
+    void addSolutionWeight(bool approach, int idx, float wgt);
+
     int numGear();
     Gear* getGear(int g);
 
+    int numThrusters() { return _thrusters.size(); }
+    Thruster* getThruster(int n) {
+        return ((ThrustRec*)_thrusters.get(n))->thruster; }
+    
     int numTanks();
     void setFuelFraction(float frac); // 0-1, total amount of fuel
     float getFuel(int tank); // in kg!
+    float setFuel(int tank, float fuel); // in kg!
     float getFuelDensity(int tank); // kg/m^3
     float getTankCapacity(int tank);
 
@@ -87,6 +93,7 @@ private:
                       int handle; float cg[3]; float mass; };
     struct Control { int control; float val; };
     struct WeightRec { int handle; Surface* surf; };
+    struct SolveWeight { bool approach; int idx; float wgt; };
 
     void runCruise();
     void runApproach();
@@ -105,6 +112,7 @@ private:
     void compileContactPoints();
     float normFactor(float f);
     void updateGearState();
+    void setupWeights(bool isApproach);
 
     Model _model;
     ControlMap _controls;
@@ -128,12 +136,15 @@ private:
 
     Vector _rotors;
 
+    Vector _solveWeights;
+
     Vector _cruiseControls;
     State _cruiseState;
     float _cruiseP;
     float _cruiseT;
     float _cruiseSpeed;
     float _cruiseWeight;
+    float _cruiseFuel;
 
     Vector _approachControls;
     State _approachState;
@@ -142,6 +153,7 @@ private:
     float _approachSpeed;
     float _approachAoA;
     float _approachWeight;
+    float _approachFuel;
 
     int _solutionIterations;
     float _dragFactor;