]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Airplane.hpp
First cut at a turbulence model for YASim. It's a
[flightgear.git] / src / FDM / YASim / Airplane.hpp
index 250d1e15ebb4c073869e24fe9dfeeaffc0edb3e1..16f0ca714fc97da975ad308886be53112da7ed81 100644 (file)
@@ -4,7 +4,8 @@
 #include "ControlMap.hpp"
 #include "Model.hpp"
 #include "Wing.hpp"
-#include "util/Vector.hpp"
+#include "Rotor.hpp"
+#include "Vector.hpp"
 
 namespace yasim {
 
@@ -17,6 +18,7 @@ public:
     ~Airplane();
 
     void iterate(float dt);
+    void consumeFuel(float dt);
 
     ControlMap* getControlMap();
     Model* getModel();
@@ -32,9 +34,14 @@ public:
     void setTail(Wing* tail);
     void addVStab(Wing* vstab);
 
-    void addFuselage(float* front, float* back, float width);
+    void addRotor(Rotor* Rotor);
+    int getNumRotors() {return _rotors.size();}
+    Rotor* getRotor(int i) {return (Rotor*)_rotors.get(i);}
+
+    void addFuselage(float* front, float* back, float width,
+                     float taper=1, float mid=0.5);
     int addTank(float* pos, float cap, float fuelDensity);
-    void addGear(Gear* g, float transitionTime);
+    void addGear(Gear* g);
     void addThruster(Thruster* t, float mass, float* cg);
     void addBallast(float* pos, float mass);
 
@@ -45,19 +52,22 @@ public:
     void setApproach(float speed, float altitude, float aoa); 
     void setCruise(float speed, float altitude);
 
+    void setElevatorControl(int control);
     void addApproachControl(int control, float val);
     void addCruiseControl(int control, float val);
 
     int numGear();
     Gear* getGear(int g);
-    void setGearState(bool down, float dt);
 
     int numTanks();
     void setFuelFraction(float frac); // 0-1, total amount of fuel
     float getFuel(int tank); // in kg!
     float getFuelDensity(int tank); // kg/m^3
+    float getTankCapacity(int tank);
 
     void compile(); // generate point masses & such, then solve
+    void initEngines();
+    void stabilizeThrust();
 
     // Solution output values
     int getSolutionIterations();
@@ -65,13 +75,14 @@ public:
     float getLiftRatio();
     float getCruiseAoA();
     float getTailIncidence();
+    float getApproachElevator() { return _approachElevator.val; }
     char* getFailureMsg();
 
 private:
     struct Tank { float pos[3]; float cap; float fill;
                  float density; int handle; };
-    struct Fuselage { float front[3], back[3], width; };
-    struct GearRec { Gear* gear; Surface* surf; float wgt; float time; };
+    struct Fuselage { float front[3], back[3], width, taper, mid; };
+    struct GearRec { Gear* gear; Surface* surf; float wgt; };
     struct ThrustRec { Thruster* thruster;
                       int handle; float cg[3]; float mass; };
     struct Control { int control; float val; };
@@ -82,14 +93,18 @@ private:
     void setupState(float aoa, float speed, State* s);
     void solveGear();
     void solve();
+    void solveHelicopter();
     float compileWing(Wing* w);
+    float compileRotor(Rotor* w);
     float compileFuselage(Fuselage* f);
     void compileGear(GearRec* gr);
-    void stabilizeThrust();
     void applyDragFactor(float factor);
     void applyLiftRatio(float factor);
     float clamp(float val, float min, float max);
+    void addContactPoint(float* pos);
+    void compileContactPoints();
     float normFactor(float f);
+    void updateGearState();
 
     Model _model;
     ControlMap _controls;
@@ -107,18 +122,23 @@ private:
     float _ballast;
 
     Vector _gears;
+    Vector _contacts; // non-gear ground contact points
     Vector _weights;
     Vector _surfs; // NON-wing Surfaces
 
+    Vector _rotors;
+
     Vector _cruiseControls;
     State _cruiseState;
-    float _cruiseRho;
+    float _cruiseP;
+    float _cruiseT;
     float _cruiseSpeed;
     float _cruiseWeight;
 
     Vector _approachControls;
     State _approachState;
-    float _approachRho;
+    float _approachP;
+    float _approachT;
     float _approachSpeed;
     float _approachAoA;
     float _approachWeight;
@@ -128,6 +148,7 @@ private:
     float _liftRatio;
     float _cruiseAoA;
     float _tailIncidence;
+    Control _approachElevator;
     char* _failureMsg;
 };