]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/YASim/Rotorpart.cpp
Show YASim config error messages.
[flightgear.git] / src / FDM / YASim / Rotorpart.cpp
index f762f4b8cbaf1d8f9b165d2ec373baa3c635eb12..bd54f41227590436931b53b0df3e13c256481ed8 100644 (file)
@@ -1,3 +1,5 @@
+#include <ostream>
+
 #include <simgear/debug/logstream.hxx>
 
 #include "Math.hpp"
@@ -6,6 +8,8 @@
 #include <stdio.h>
 #include <string.h>
 namespace yasim {
+using std::endl;
+
 const float pi=3.14159;
 float _help = 0;
 Rotorpart::Rotorpart()
@@ -95,7 +99,7 @@ void Rotorpart::inititeration(float dt,float *rot)
     float b;
     b=_rotor->getBalance();
     float s =Math::sin(_phi+_direction);
-    float c =Math::cos(_phi+_direction);
+    //float c =Math::cos(_phi+_direction);
     if (s>0)
         _balance=(b>0)?(1.-s*(1.-b)):(1.-s)*(1.+b);
     else
@@ -107,7 +111,7 @@ void Rotorpart::setRotor(Rotor *rotor)
     _rotor=rotor;
 }
 
-void Rotorpart::setParameter(char *parametername, float value)
+void Rotorpart::setParameter(const char *parametername, float value)
 {
 #define p(a) if (strcmp(parametername,#a)==0) _##a = value; else
 
@@ -449,22 +453,13 @@ float Rotorpart::calculateAlpha(float* v_rel_air, float rho,
         //angle between blade movement caused by rotor-rotation and the
         //total movement of the blade
 
-        /* the next shold look like this, but this is the inner loop of
-           the rotor simulation. For small angles (and we hav only small
-           angles) the first order approximation works well
         lift_moment += r*(lift * Math::cos(angle) 
             - drag * Math::sin(angle));
         *torque     += r*(drag * Math::cos(angle) 
             + lift * Math::sin(angle));
-            */
-        lift_moment += r*(lift * (1-angle*angle) 
-            - drag * angle);
-        *torque     += r*(drag * (1-angle*angle) 
-            + lift * angle);
-        
         if (returnlift!=NULL) *returnlift+=lift;
     }
-    //as above, use 1st order approximation
+    //use 1st order approximation for alpha
     //float alpha=Math::atan2(lift_moment,_centripetalforce * _len); 
     float alpha;
     if (_shared_flap_hinge)
@@ -553,7 +548,7 @@ void Rotorpart::calcForce(float* v, float rho,  float* out, float* torque,
 
     float dirblade[3];
     Math::cross3(_normal,_directionofcentripetalforce,dirblade);
-    float vblade=Math::abs(Math::dot3(dirblade,v));
+    //float vblade=Math::abs(Math::dot3(dirblade,v));
 
     alpha=_alphaalt+(alpha-_alphaalt)*factor;
     _alpha=alpha;