From: curt Date: Fri, 30 Nov 2001 17:49:37 +0000 (+0000) Subject: Sync with latest JSBSim changes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=71a562b695f510b84b674cba9352d58249d73387;p=flightgear.git Sync with latest JSBSim changes. --- diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index ee28d6a63..7f4c37610 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -198,7 +198,7 @@ void FGJSBsim::init() { break; } - stall_warning->setBoolValue(false); + stall_warning->setDoubleValue(0); SG_LOG( SG_FLIGHT, SG_INFO, " Bank Angle: " << Rotation->Getphi()*RADTODEG << " deg" ); @@ -382,7 +382,7 @@ bool FGJSBsim::copy_from_JSBsim() { // Auxiliary->GetNpilot(2)/32.1739, // Auxiliary->GetNpilot(3)/32.1739 ); - _set_Nlf( Aerodynamics->GetNlf() ); + _set_Nlf( Aircraft->GetNlf() ); // Velocities diff --git a/src/FDM/JSBSim/AUTHORS b/src/FDM/JSBSim/AUTHORS new file mode 100644 index 000000000..41b5f2b3f --- /dev/null +++ b/src/FDM/JSBSim/AUTHORS @@ -0,0 +1,56 @@ +AUTHORS +------- + +Jon S. Berndt +primary architect and coordinator +jsb@hal-pc.org +CVS access as developer (r/w) + + +Tony Peden +additional architecture support +trimming and aerodynamics +interface with flightgear +apeden@earthlink.net +CVS access as developer (r/w) + + +Additional support (programming, bug fixes, aircraft models) +by the FlightGear team and others as listed: + +Curt Olson +wrote initial interface with flightgear +works flightgear/jsbsim issues +curt@flightgear.org + +Norman Vine +matrix math class optimization support +general C++ suggestions, debugging, and support +nhv@cape.com + +Christian Mayer +JSBSim compatibility with MSVC +mail@ChristianMayer.de + +Erik Hofman +JSBSim compatibility with IRIX +erik@ehofman.com + +David Megginson +ported Dave Luff's piston engine model initially to JSBSim +creation of multi-engine C-310 model and testing/debugging +general C++ suggestions, debugging, and support +david@megginson.com + +Ross Golder +improvements to the build process and auto* files +ross@golder.org + +Dave Luff +wrote the piston engine model used by LaRCSim and is ported to JSBSim +eazdluf@nottingham.ac.uk + +Norman Princen +provided an improved gear model +nprincen@hotmail.com + diff --git a/src/FDM/JSBSim/FGAerodynamics.cpp b/src/FDM/JSBSim/FGAerodynamics.cpp index 8c20cc60f..2b62a7d37 100644 --- a/src/FDM/JSBSim/FGAerodynamics.cpp +++ b/src/FDM/JSBSim/FGAerodynamics.cpp @@ -100,7 +100,10 @@ bool FGAerodynamics::Run(void) vFs(axis_ctr+1) += Coeff[axis_ctr][ctr]->TotalValue(); } } - + //correct signs of drag and lift to wind axes convention + //positive forward, right, down + vFs(1)*=-1; vFs(3)*=-1; + //cout << "Aircraft::vFs: " << vFs << endl; vForces = State->GetTs2b()*vFs; vDXYZcg(eX) = -(Aircraft->GetXYZrp(eX) @@ -198,17 +201,6 @@ string FGAerodynamics::GetCoefficientValues(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -double FGAerodynamics::GetNlf(void) -{ - if (fabs(Position->GetGamma()) < 1.57) { - return (vFs(eZ)/(MassBalance->GetWeight()*cos(Position->GetGamma()))); - } else { - return 0.0; - } -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - double FGAerodynamics::GetLoD(void) { double LoD; diff --git a/src/FDM/JSBSim/FGAerodynamics.h b/src/FDM/JSBSim/FGAerodynamics.h index ffacb3148..21b4230eb 100644 --- a/src/FDM/JSBSim/FGAerodynamics.h +++ b/src/FDM/JSBSim/FGAerodynamics.h @@ -134,8 +134,6 @@ public: coefficients */ string GetCoefficientValues(void); - /// Gets the Normal Load Factor - double GetNlf(void); private: typedef map AxisIndex; diff --git a/src/FDM/JSBSim/FGAircraft.cpp b/src/FDM/JSBSim/FGAircraft.cpp index f57e6b33a..1ea85b39f 100644 --- a/src/FDM/JSBSim/FGAircraft.cpp +++ b/src/FDM/JSBSim/FGAircraft.cpp @@ -105,7 +105,8 @@ FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex), vXYZep(3), vDXYZcg(3), vBodyAccel(3), - vNcg(3) + vNcg(3), + vNwcg(3) { Name = "FGAircraft"; alphaclmin = alphaclmax = 0; @@ -179,6 +180,9 @@ bool FGAircraft::Run(void) vBodyAccel = vForces/MassBalance->GetMass(); vNcg = vBodyAccel/Inertial->gravity(); + + vNwcg = State->GetTb2s() * vNcg; + vNwcg(3) = -1*vNwcg(3) + 1; if (alphaclmax != 0) { if (Translation->Getalpha() > 0.85*alphaclmax) { @@ -196,6 +200,13 @@ bool FGAircraft::Run(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +float FGAircraft::GetNlf(void) +{ + return vNwcg(3); +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg) { string token = AC_cfg->GetValue(); diff --git a/src/FDM/JSBSim/FGAircraft.h b/src/FDM/JSBSim/FGAircraft.h index 2fee85267..e4110fc9b 100644 --- a/src/FDM/JSBSim/FGAircraft.h +++ b/src/FDM/JSBSim/FGAircraft.h @@ -200,7 +200,11 @@ public: inline void SetAlphaCLMax(double tt) { alphaclmax=tt; } inline void SetAlphaCLMin(double tt) { alphaclmin=tt; } - inline bool GetStallWarn(void) { return impending_stall; } + inline double GetStallWarn(void) { return impending_stall; } + + float GetNlf(void); + + inline FGColumnVector3& GetNwcg(void) { return vNwcg; } private: FGColumnVector3 vMoments; @@ -211,6 +215,7 @@ private: FGColumnVector3 vDXYZcg; FGColumnVector3 vBodyAccel; FGColumnVector3 vNcg; + FGColumnVector3 vNwcg; double WingArea, WingSpan, cbar, WingIncidence; double HTailArea, VTailArea, HTailArm, VTailArm; diff --git a/src/FDM/JSBSim/FGAtmosphere.h b/src/FDM/JSBSim/FGAtmosphere.h index faa74ea44..5b1e8648c 100644 --- a/src/FDM/JSBSim/FGAtmosphere.h +++ b/src/FDM/JSBSim/FGAtmosphere.h @@ -145,6 +145,7 @@ public: inline void SetTurbGain(double tt) {TurbGain = tt;} inline double GetTurbPQR(int idx) {return vTurbPQR(idx);} + inline FGColumnVector3& GetTurbPQR(void) {return vTurbPQR;} private: double rho; diff --git a/src/FDM/JSBSim/FGConfigFile.cpp b/src/FDM/JSBSim/FGConfigFile.cpp index b9d5066f8..33efd37ec 100644 --- a/src/FDM/JSBSim/FGConfigFile.cpp +++ b/src/FDM/JSBSim/FGConfigFile.cpp @@ -1,322 +1,322 @@ -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - Header: FGConfigFile.h - Author: Jon Berndt - Date started: 03/29/00 - Purpose: Config file read-in class - Called by: FGAircraft - -FUNCTIONAL DESCRIPTION --------------------------------------------------------------------------------- - -HISTORY --------------------------------------------------------------------------------- -03/16/2000 JSB Created - -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -INCLUDES -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - -#include "FGConfigFile.h" -#include -#include - -static const char *IdSrc = "$Id$"; -static const char *IdHdr = ID_CONFIGFILE; - -/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -CLASS IMPLEMENTATION -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ - -FGConfigFile::FGConfigFile(string cfgFileName) -{ -#if defined ( sgi ) && !defined( __GNUC__ ) - cfgfile.open(cfgFileName.c_str(), ios::in ); -#else - cfgfile.open(cfgFileName.c_str(), ios::in | ios::binary ); -#endif - CommentsOn = false; - CurrentIndex = 0; - Opened = true; -#if defined ( sgi ) && !defined( __GNUC__ ) - if (!cfgfile.fail() && !cfgfile.eof()) GetNextConfigLine(); -#else - if (cfgfile.is_open()) GetNextConfigLine(); -#endif - else Opened = false; - - if (debug_lvl & 2) cout << "Instantiated: FGConfigFile" << endl; -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -FGConfigFile::~FGConfigFile() -{ - cfgfile.close(); - if (debug_lvl & 2) cout << "Destroyed: FGConfigFile" << endl; -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -string FGConfigFile::GetNextConfigLine(void) -{ - int deblank, not_found = string::npos; - int comment_starts_at; - int comment_ends_at; - int comment_length; - int line_length; - bool start_comment, end_comment; - string CommentStringTemp; - - do { - CurrentLine = GetLine(); - line_length = CurrentLine.length(); - comment_starts_at = CurrentLine.find(""); - - if (comment_ends_at >= 0) end_comment = true; - else end_comment = false; - - if (!start_comment && !end_comment) { // command comment - if (CommentsOn) CommentStringTemp = CurrentLine; - CommentString += CommentStringTemp + "\r\n"; - } else if (start_comment && comment_ends_at > comment_starts_at) { // - CommentsOn = false; - comment_length = comment_ends_at + 2 - comment_starts_at + 1; - LineComment = CurrentLine.substr(comment_starts_at+4, comment_length-4-3); - CurrentLine.erase(comment_starts_at, comment_length); - } else if ( start_comment && !end_comment) { // - CommentsOn = false; - comment_length = comment_ends_at + 2 + 1; - CommentStringTemp = CurrentLine.substr(0, comment_length-4); - CommentString += CommentStringTemp + "\r\n"; - CurrentLine.erase(0, comment_length); - } else if (start_comment && comment_ends_at < comment_starts_at) { // --> command "); + + if (comment_ends_at >= 0) end_comment = true; + else end_comment = false; + + if (!start_comment && !end_comment) { // command comment + if (CommentsOn) CommentStringTemp = CurrentLine; + CommentString += CommentStringTemp + "\r\n"; + } else if (start_comment && comment_ends_at > comment_starts_at) { // + CommentsOn = false; + comment_length = comment_ends_at + 2 - comment_starts_at + 1; + LineComment = CurrentLine.substr(comment_starts_at+4, comment_length-4-3); + CurrentLine.erase(comment_starts_at, comment_length); + } else if ( start_comment && !end_comment) { // + CommentsOn = false; + comment_length = comment_ends_at + 2 + 1; + CommentStringTemp = CurrentLine.substr(0, comment_length-4); + CommentString += CommentStringTemp + "\r\n"; + CurrentLine.erase(0, comment_length); + } else if (start_comment && comment_ends_at < comment_starts_at) { // --> command