]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Model.hpp
Constant-speed props were seeking to engine speed, not prop speed.
[flightgear.git] / src / FDM / YASim / Model.hpp
index a54799d01534552ee4feedb5de7b8ebfff49366f..a27af5c057b677de2c5bb95a8bd065bfd7441456 100644 (file)
@@ -4,7 +4,8 @@
 #include "Integrator.hpp"
 #include "RigidBody.hpp"
 #include "BodyEnvironment.hpp"
-#include "util/Vector.hpp"
+#include "Vector.hpp"
+#include "Turbulence.hpp"
 
 namespace yasim {
 
@@ -12,6 +13,9 @@ namespace yasim {
 class Integrator;
 class Thruster;
 class Surface;
+class Rotorpart;
+class Rotorblade;
+class Rotor;
 class Gear;
 
 class Model : public BodyEnvironment {
@@ -22,19 +26,32 @@ public:
     RigidBody* getBody();
     Integrator* getIntegrator();
 
+    void setTurbulence(Turbulence* turb) { _turb = turb; }
+
     State* getState();
     void setState(State* s);
 
+    bool isCrashed();
+    void setCrashed(bool crashed);
+    float getAGL();
+
     void iterate();
 
     // Externally-managed subcomponents
     int addThruster(Thruster* t);
     int addSurface(Surface* surf);
+    int addRotorpart(Rotorpart* rpart);
+    int addRotorblade(Rotorblade* rblade);
+    int addRotor(Rotor* rotor);
     int addGear(Gear* gear);
     Surface* getSurface(int handle);
+    Rotorpart* getRotorpart(int handle);
+    Rotorblade* getRotorblade(int handle);
+    Rotor* getRotor(int handle);
     Gear* getGear(int handle);
 
     // Semi-private methods for use by the Airplane solver.
+    int numThrusters();
     Thruster* getThruster(int handle);
     void setThruster(int handle, Thruster* t);
     void initIteration();
@@ -44,28 +61,40 @@ public:
     // Per-iteration settables
     //
     void setGroundPlane(double* planeNormal, double fromOrigin);
+    void setGroundEffect(float* pos, float span, float mul);
     void setWind(float* wind);
-    void setAirDensity(float rho);
-    void setAir(float pressure, float temp);
+    void setAir(float pressure, float temp, float density);
 
     // BodyEnvironment callbacks
     virtual void calcForces(State* s);
     virtual void newState(State* s);
 
 private:
+    void initRotorIteration();
     void calcGearForce(Gear* g, float* v, float* rot, float* ground);
     float gearFriction(float wgt, float v, Gear* g);
     float localGround(State* s, float* out);
-    void localWind(float* pos, State* s, float* out);
+    void localWind(float* pos, State* s, float* out, float alt);
 
     Integrator _integrator;
     RigidBody _body;
 
+    Turbulence* _turb;
+
     Vector _thrusters;
     Vector _surfaces;
+    Vector _rotorparts;
+    Vector _rotorblades;
+    Vector _rotors;
     Vector _gears;
 
+    float _groundEffectSpan;
+    float _groundEffect;
+    float _wingCenter[3];
+
     double _ground[4];
+    float _pressure;
+    float _temp;
     float _rho;
     float _wind[3];
 
@@ -74,6 +103,8 @@ private:
     float _torque[3];
 
     State* _s;
+    bool _crashed;
+    float _agl;
 };
 
 }; // namespace yasim