]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Airplane.hpp
When we are asked to produce no force on a Surface (e.g. a weight that
[flightgear.git] / src / FDM / YASim / Airplane.hpp
index bc35a9b30b939a5dcf3d1b1935bfe2030a7cdcd9..8c46c46f5688507b984d3dd12cf15ea32e91b145 100644 (file)
@@ -10,6 +10,8 @@
 namespace yasim {
 
 class Gear;
+class Hook;
+class Launchbar;
 class Thruster;
 
 class Airplane {
@@ -18,7 +20,7 @@ public:
     ~Airplane();
 
     void iterate(float dt);
-    void consumeFuel(float dt);
+    void calcFuelWeights();
 
     ControlMap* getControlMap();
     Model* getModel();
@@ -42,6 +44,8 @@ public:
                      float taper=1, float mid=0.5);
     int addTank(float* pos, float cap, float fuelDensity);
     void addGear(Gear* g);
+    void addHook(Hook* h);
+    void addLaunchbar(Launchbar* l);
     void addThruster(Thruster* t, float mass, float* cg);
     void addBallast(float* pos, float mass);
 
@@ -55,12 +59,21 @@ public:
     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);
+    Hook* getHook();
+    Launchbar* getLaunchbar();
 
+    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);
 
@@ -86,6 +99,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();
@@ -104,6 +118,7 @@ private:
     void compileContactPoints();
     float normFactor(float f);
     void updateGearState();
+    void setupWeights(bool isApproach);
 
     Model _model;
     ControlMap _controls;
@@ -127,6 +142,8 @@ private:
 
     Vector _rotors;
 
+    Vector _solveWeights;
+
     Vector _cruiseControls;
     State _cruiseState;
     float _cruiseP;