From ff41907c0ecbf6c7b37a4d8cadd846c9f3355442 Mon Sep 17 00:00:00 2001 From: curt Date: Sun, 20 Jun 1999 02:12:04 +0000 Subject: [PATCH] Updated JSBsim from Jon Berndt Fixed a typo in hud.cxx. --- Simulator/Cockpit/hud.cxx | 2 +- Simulator/FDM/JSBsim/FGAircraft.h | 337 ++-------------------------- Simulator/FDM/JSBsim/FGControls.cpp | 7 + Simulator/FDM/JSBsim/FGControls.h | 7 + Simulator/FDM/JSBsim/FGFCS.h | 2 +- Simulator/FDM/JSBsim/FGFDMExec.h | 4 +- Simulator/FDM/JSBsim/FGUtility.cpp | 10 +- Simulator/FDM/JSBsim/FGUtility.h | 2 +- 8 files changed, 41 insertions(+), 330 deletions(-) diff --git a/Simulator/Cockpit/hud.cxx b/Simulator/Cockpit/hud.cxx index e98f855cf..6e2341f8e 100644 --- a/Simulator/Cockpit/hud.cxx +++ b/Simulator/Cockpit/hud.cxx @@ -1103,7 +1103,7 @@ void fgUpdateHUD( void ) { } char *gmt_str = get_formated_gmt_time(); - HUD_TextList.add( fgText( gmt_str, 40, 10) ); + HUD_TextList.add( fgText( 40, 10, gmt_str ) ); HUD_TextList.draw(); diff --git a/Simulator/FDM/JSBsim/FGAircraft.h b/Simulator/FDM/JSBsim/FGAircraft.h index 5df1329c5..0335a8033 100644 --- a/Simulator/FDM/JSBsim/FGAircraft.h +++ b/Simulator/FDM/JSBsim/FGAircraft.h @@ -37,10 +37,10 @@ SENTRY /******************************************************************************* COMMENTS, REFERENCES, and NOTES *******************************************************************************/ -/** +/* The aerodynamic coefficients used in this model typically are: -
-Longitudinal
+
+Longitudinal
   CL0 - Reference lift at zero alpha
   CD0 - Reference drag at zero alpha
   CDM - Drag due to Mach
@@ -56,7 +56,7 @@ The aerodynamic coefficients used in this model typically are:
   Cmq - Pitch damping (pitch moment due to pitch rate)
   CmM - Pitch Moment due to Mach
 
-Lateral
+Lateral
   Cyb - Side force due to sideslip
   Cyr - Side force due to yaw rate
 
@@ -67,7 +67,7 @@ The aerodynamic coefficients used in this model typically are:
   Cnp - Rudder adverse yaw (yaw moment due to roll rate)
   Cnr - Yaw damping (yaw moment due to yaw rate)
 
-Control
+Control
   CLDe - Lift due to elevator
   CDDe - Drag due to elevator
   CyDr - Side force due to rudder
@@ -78,60 +78,18 @@ The aerodynamic coefficients used in this model typically are:
   ClDr - Roll moment due to rudder
   CnDr - Yaw moment due to rudder
   CnDa - Yaw moment due to aileron
-
-This class expects to be run in a directory which contains the subdirectory -structure shown below (where example aircraft X-15 is shown): - -
-aircraft/
-  X-15/
-    X-15.dat reset00 reset01 reset02 ...
-      CDRAG/
-        a0 a M De
-      CSIDE/
-        b r Dr Da
-      CLIFT/
-        a0 a M adt De
-      CROLL/
-        b p r Da Dr
-      CPITCH/
-        a0 a adt q M De
-      CYAW/
-        b p r Dr Da
-  F-16/
-    F-16.dat reset00 reset01 ...
-      CDRAG/
-        a0 a M De
-      ...
-
- -The General Idea - -The file structure is arranged so that various modeled aircraft are stored in -their own subdirectory. Each aircraft subdirectory is named after the aircraft. -There should be a file present in the specific aircraft subdirectory (e.g. -aircraft/X-15) with the same name as the directory with a .dat appended. This -file contains mass properties information, name of aircraft, etc. for the -aircraft. In that same directory are reset files numbered starting from 0 (two -digit numbers), e.g. reset03. Within each reset file are values for important -state variables for specific flight conditions (altitude, airspeed, etc.). Also -within this directory are the directories containing lookup tables for the -stability derivatives for the aircraft. -@author Jon S. Berndt -@memo Encompasses all aircraft functionality and objects -@see -
  • [1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling + +[1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate - School, January 1994
  • -
  • [2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices", - JSC 12960, July 1977
  • -
  • [3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at - NASA-Ames", NASA CR-2497, January 1975
  • -
  • [4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics", - Wiley & Sons, 1979 ISBN 0-471-03032-5
  • -
  • [5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons, - 1982 ISBN 0-471-08936-2
  • -
    + School, January 1994 +[2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices", + JSC 12960, July 1977 +[3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at + NASA-Ames", NASA CR-2497, January 1975 +[4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics", + Wiley & Sons, 1979 ISBN 0-471-03032-5 +[5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons, + 1982 ISBN 0-471-08936-2 */ /******************************************************************************* @@ -145,8 +103,6 @@ INCLUDES # else # include # endif -# include STL_STRING - FG_USING_STD(string); #else # include #endif @@ -160,9 +116,7 @@ INCLUDES DEFINITIONS *******************************************************************************/ -#ifndef FGFS using namespace std; -#endif /******************************************************************************* CLASS DECLARATION @@ -171,325 +125,69 @@ CLASS DECLARATION class FGAircraft : public FGModel { public: - // *************************************************************************** - /** @memo Constructor - @param FGFDMExec* - a pointer to the "owning" FDM Executive - */ - FGAircraft(FGFDMExec*); - - // *************************************************************************** - /** Destructor */ + FGAircraft(FGFDMExec*); ~FGAircraft(void); - // *************************************************************************** - /** This must be called for each dt to execute the model algorithm */ bool Run(void); - - // *************************************************************************** - /** This function must be called with the name of an aircraft which - has an associated .dat file in the appropriate subdirectory. The paths - to the appropriate subdirectories are given as the first two parameters. - @memo Loads the given aircraft. - @param string Path to the aircraft files - @param string Path to the engine files - @param string The name of the aircraft to be loaded, e.g. "X15". - @return True - if successful - */ - bool LoadAircraft(string, string, string); - - // *************************************************************************** - /** This function must be called with the name of an aircraft which - has an associated .dat file in the appropriate subdirectory. The paths - to the appropriate subdirectories are given as the first two parameters. - @memo Loads the given aircraft. - @param string Path to the aircraft files - @param string Path to the engine files - @param string The name of the aircraft to be loaded, e.g. "X15". - @return True - if successful - */ bool LoadAircraftEx(string, string, string); - - // *************************************************************************** - /** @memo Gets the aircraft name as defined in the aircraft config file. - @param - @return string Aircraft name. - */ inline string GetAircraftName(void) {return AircraftName;} - - // *************************************************************************** - /** @memo Sets the GearUp flag - @param boolean true or false - @return - */ inline void SetGearUp(bool tt) {GearUp = tt;} - - // *************************************************************************** - /** @memo Returns the state of the GearUp flag - @param - @return boolean true or false - */ inline bool GetGearUp(void) {return GearUp;} - - // *************************************************************************** - /** @memo Returns the area of the wing - @param - @return float wing area S, in square feet - */ inline float GetWingArea(void) {return WingArea;} - - // *************************************************************************** - /** @memo Returns the wing span - @param - @return float wing span in feet - */ inline float GetWingSpan(void) {return WingSpan;} - - // *************************************************************************** - /** @memo Returns the average wing chord - @param - @return float wing chord in feet - */ inline float Getcbar(void) {return cbar;} - - // *************************************************************************** - /** @memo Returns an engine object - @param int The engine number - @return FGEengine* The pointer to the requested engine object. - */ inline FGEngine* GetEngine(int tt) {return Engine[tt];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline FGTank* GetTank(int tt) {return Tank[tt];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetWeight(void) {return Weight;} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetMass(void) {return Mass;} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetL(void) {return Moments[0];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetM(void) {return Moments[1];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetN(void) {return Moments[2];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetFx(void) {return Forces[0];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetFy(void) {return Forces[1];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetFz(void) {return Forces[2];} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetIxx(void) {return Ixx;} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetIyy(void) {return Iyy;} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetIzz(void) {return Izz;} - - // *************************************************************************** - /** @memo - @param - @return - */ inline float GetIxz(void) {return Ixz;} private: - // *************************************************************************** - /** @memo - @param - @return - */ void GetState(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void PutState(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void FAero(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void FGear(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void FMass(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void FProp(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void MAero(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void MGear(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void MMass(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void MProp(void); - - // *************************************************************************** - /** @memo - @param - @return - */ void MassChange(void); - - // *************************************************************************** - /** @memo - @param - @return - */ float Moments[3]; - - // *************************************************************************** - /** @memo - @param - @return - */ float Forces[3]; - - // *************************************************************************** - /** @memo - @param - @return - */ string AircraftName; - - // *************************************************************************** - /// float Ixx, Iyy, Izz, Ixz, EmptyMass, Mass; - /// float Xcg, Ycg, Zcg; - /// float Xep, Yep, Zep; - /// float rho, qbar, Vt; - /// float alpha, beta; - /// float WingArea, WingSpan, cbar; - /// float phi, tht, psi; - /// float Weight, EmptyWeight; - /// float dt; - /// int numTanks; - /// int numEngines; - /// int numSelectedOxiTanks; - /// int numSelectedFuelTanks; - /// FGTank* Tank[MAX_TANKS]; - /// FGEngine *Engine[MAX_ENGINES]; - /// FGCoefficient *Coeff[6][10]; - /// int coeff_ctr[6]; - /// bool GearUp; - /// enum Param {LiftCoeff, DragCoeff, SideCoeff, @@ -498,7 +196,6 @@ private: YawCoeff, numCoeffs}; - /// string Axis[6]; protected: diff --git a/Simulator/FDM/JSBsim/FGControls.cpp b/Simulator/FDM/JSBsim/FGControls.cpp index 375a9057f..ce509a11a 100644 --- a/Simulator/FDM/JSBsim/FGControls.cpp +++ b/Simulator/FDM/JSBsim/FGControls.cpp @@ -51,6 +51,13 @@ FGControls::~FGControls() { // $Log$ +// Revision 1.4 1999/06/20 02:12:07 curt +// Updated JSBsim from Jon Berndt +// Fixed a typo in hud.cxx. +// +// Revision 1.1.1.1 1999/06/17 18:07:34 curt +// Start of 0.7.x branch +// // Revision 1.3 1999/05/08 03:19:15 curt // Incorporated latest JSBsim updates. // diff --git a/Simulator/FDM/JSBsim/FGControls.h b/Simulator/FDM/JSBsim/FGControls.h index 75675008e..165ad2659 100644 --- a/Simulator/FDM/JSBsim/FGControls.h +++ b/Simulator/FDM/JSBsim/FGControls.h @@ -177,6 +177,13 @@ extern FGControls controls; // $Log$ +// Revision 1.4 1999/06/20 02:12:08 curt +// Updated JSBsim from Jon Berndt +// Fixed a typo in hud.cxx. +// +// Revision 1.1.1.1 1999/06/17 18:07:34 curt +// Start of 0.7.x branch +// // Revision 1.3 1999/05/08 03:19:16 curt // Incorporated latest JSBsim updates. // diff --git a/Simulator/FDM/JSBsim/FGFCS.h b/Simulator/FDM/JSBsim/FGFCS.h index 285b4d28b..026dcc50b 100644 --- a/Simulator/FDM/JSBsim/FGFCS.h +++ b/Simulator/FDM/JSBsim/FGFCS.h @@ -76,4 +76,4 @@ private: }; /******************************************************************************/ -#endif +#endif \ No newline at end of file diff --git a/Simulator/FDM/JSBsim/FGFDMExec.h b/Simulator/FDM/JSBsim/FGFDMExec.h index 8e6bdbfc0..98acb5c43 100644 --- a/Simulator/FDM/JSBsim/FGFDMExec.h +++ b/Simulator/FDM/JSBsim/FGFDMExec.h @@ -59,8 +59,8 @@ class FGOutput; class FGFDMExec { public: - FGFDMExec(void); - ~FGFDMExec(void); + FGFDMExec::FGFDMExec(void); + FGFDMExec::~FGFDMExec(void); FGModel* FirstModel; diff --git a/Simulator/FDM/JSBsim/FGUtility.cpp b/Simulator/FDM/JSBsim/FGUtility.cpp index f7e7d1de3..4d18883db 100644 --- a/Simulator/FDM/JSBsim/FGUtility.cpp +++ b/Simulator/FDM/JSBsim/FGUtility.cpp @@ -76,7 +76,7 @@ FGUtility::~FGUtility() float FGUtility::ToGeodetic() { - float GeodeticLat, Latitude, Radius, Altitude; + float Latitude, Radius, Altitude; float tanLat, xAlpha, muAlpha, sinmuAlpha, denom, rhoAlpha, dMu; float lPoint, lambdaSL, sinlambdaSL, dLambda, rAlpha; @@ -85,8 +85,6 @@ float FGUtility::ToGeodetic() if (( M_PI_2 - Latitude < ONESECOND) || ( M_PI_2 + Latitude < ONESECOND)) { // Near a pole - GeodeticLat = Latitude; - Altitude = Radius - SeaLevelR; } else { tanLat = tan(Latitude); xAlpha = ECCENT*EARTHRAD / @@ -104,7 +102,7 @@ float FGUtility::ToGeodetic() rhoAlpha = EARTHRAD*(1.0 - EPS) / (denom*denom*denom); dMu = atan2(lPoint*sin(dLambda),rhoAlpha + Altitude); State->SetGeodeticLat(muAlpha - dMu); - lambdaSL = atan(ECCENTSQRD*tan(GeodeticLat)); + lambdaSL = atan(ECCENTSQRD*tan(muAlpha - dMu)); sinlambdaSL = sin(lambdaSL); SeaLevelR = sqrt(EARTHRADSQRD / (1 + INVECCENTSQRDM1* sinlambdaSL*sinlambdaSL)); } @@ -115,8 +113,9 @@ float FGUtility::ToGeodetic() float FGUtility:: FromGeodetic() { float lambdaSL, sinlambdaSL, coslambdaSL, sinMu, cosMu, py, px; - float Altitude, SeaLevelR; + float Altitude, SeaLevelR, Radius; + Radius = State->Geth() + EARTHRAD; lambdaSL = atan(ECCENTSQRD*tan(State->GetGeodeticLat())); sinlambdaSL = sin(lambdaSL); coslambdaSL = cos(lambdaSL); @@ -124,6 +123,7 @@ float FGUtility:: FromGeodetic() cosMu = cos(State->GetGeodeticLat()); SeaLevelR = sqrt(EARTHRADSQRD / (1 + INVECCENTSQRDM1*sinlambdaSL*sinlambdaSL)); + Altitude = Radius - SeaLevelR; px = SeaLevelR*coslambdaSL + Altitude*cosMu; py = SeaLevelR*sinlambdaSL + Altitude*sinMu; State->Setlatitude(atan2(py,px)); diff --git a/Simulator/FDM/JSBsim/FGUtility.h b/Simulator/FDM/JSBsim/FGUtility.h index 18cb3eaf1..142e33d3f 100644 --- a/Simulator/FDM/JSBsim/FGUtility.h +++ b/Simulator/FDM/JSBsim/FGUtility.h @@ -42,7 +42,7 @@ INCLUDES DEFINES *******************************************************************************/ -// FG_USING_STD(std); +using namespace std; /******************************************************************************* CLASS DECLARATION -- 2.39.5