From 5bbd649b5ab28567cbe0b814c7d6822fdf1242cb Mon Sep 17 00:00:00 2001 From: mfranz Date: Tue, 15 May 2007 21:30:33 +0000 Subject: [PATCH] Maik JUSTUS: "further (final?) modifications for the jet ranger rotor" --- src/FDM/YASim/Rotor.cpp | 4 ++++ src/FDM/YASim/Rotor.hpp | 3 ++- src/FDM/YASim/Rotorpart.cpp | 7 ++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/FDM/YASim/Rotor.cpp b/src/FDM/YASim/Rotor.cpp index 0b132772e..371139189 100644 --- a/src/FDM/YASim/Rotor.cpp +++ b/src/FDM/YASim/Rotor.cpp @@ -3,6 +3,7 @@ #include "Math.hpp" #include "Surface.hpp" #include "Rotorpart.hpp" +#include "Glue.hpp" #include "Ground.hpp" #include "Rotor.hpp" @@ -695,6 +696,9 @@ void Rotor::calcLiftFactor(float* v, float rho, State *s) *(_translift_maxfactor-1)+1)/_translift_maxfactor; _lift_factor = _f_ge*_f_tl*_f_vs; + + //store the gravity direction + Glue::geodUp(s->pos, _grav_direction); } void Rotor::findGroundEffectAltitude(Ground * ground_cb,State *s) diff --git a/src/FDM/YASim/Rotor.hpp b/src/FDM/YASim/Rotor.hpp index 379a36a7b..1b326415e 100644 --- a/src/FDM/YASim/Rotor.hpp +++ b/src/FDM/YASim/Rotor.hpp @@ -113,9 +113,9 @@ public: float getOverallStall() {if (_stall_v2sum !=0 ) return _stall_sum/_stall_v2sum; else return 0;} float getAirfoilIncidenceNoLift() {return _airfoil_incidence_no_lift;} - Vector _rotorparts; void findGroundEffectAltitude(Ground * ground_cb,State *s); + float *getGravDirection() {return _grav_direction;} void writeInfo(); void setSharedFlapHinge(bool s); @@ -201,6 +201,7 @@ private: float _rotor_correction_factor; float _phi; bool _shared_flap_hinge; + float _grav_direction[3]; }; std::ostream & operator<<(std::ostream & out, /*const*/ Rotor& r); diff --git a/src/FDM/YASim/Rotorpart.cpp b/src/FDM/YASim/Rotorpart.cpp index 450f93f14..417904c9c 100644 --- a/src/FDM/YASim/Rotorpart.cpp +++ b/src/FDM/YASim/Rotorpart.cpp @@ -361,7 +361,8 @@ float Rotorpart::calculateAlpha(float* v_rel_air, float rho, int i,n; for (i=0;i<3;i++) moment[i]=0; - lift_moment=-_mass*_len*9.81; //*cos yaw * cos roll + float relgrav = Math::dot3(_normal,_rotor->getGravDirection()); + lift_moment=-_mass*_len*9.81*relgrav; *torque=0;// if((_nextrp==NULL)||(_lastrp==NULL)||(_rotor==NULL)) return 0.0;//not initialized. Can happen during startupt of flightgear @@ -453,12 +454,12 @@ float Rotorpart::calculateAlpha(float* v_rel_air, float rho, { float div=0; if (Math::abs(_alphaalt) >1e-6) - div=(_centripetalforce * _len - _mass * _len * 9.81 /_alpha0*(_alphaalt+_oppositerp->getAlphaAlt())/(2.0*_alphaalt)); + div=(_centripetalforce * _len - _mass * _len * 9.81 * relgrav /_alpha0*(_alphaalt+_oppositerp->getAlphaAlt())/(2.0*_alphaalt)); if (Math::abs(div)>1e-6) alpha=lift_moment/div; else if(Math::abs(_alphaalt+_oppositerp->getAlphaAlt())>1e-6) { - float div=(_centripetalforce * _len - _mass * _len * 9.81 *0.5)*(_alphaalt+_oppositerp->getAlphaAlt()); + float div=(_centripetalforce * _len - _mass * _len * 9.81 *0.5 * relgrav)*(_alphaalt+_oppositerp->getAlphaAlt()); if (Math::abs(div)>1e-6) alpha=_oppositerp->getAlphaAlt()+lift_moment/div*_alphaalt; }