From fa43f1a5cd0879c160b746cac61226661dfbe604 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 21 Jun 1999 03:01:57 +0000 Subject: [PATCH] Updates to JSBsim. --- Simulator/FDM/JSBsim.cxx | 2 +- Simulator/FDM/JSBsim/FGAircraft.cpp | 157 +++++++--------------- Simulator/FDM/JSBsim/FGAircraft.h | 2 +- Simulator/FDM/JSBsim/FGAtmosphere.cpp | 11 +- Simulator/FDM/JSBsim/FGAtmosphere.h | 16 +-- Simulator/FDM/JSBsim/FGCoefficient.cpp | 174 ++++++++++--------------- Simulator/FDM/JSBsim/FGCoefficient.h | 140 ++------------------ Simulator/FDM/JSBsim/FGControls.cpp | 11 +- Simulator/FDM/JSBsim/FGControls.h | 11 +- Simulator/FDM/JSBsim/FGFDMExec.cpp | 2 +- Simulator/FDM/JSBsim/FGMain.cpp | 12 +- Simulator/FDM/JSBsim/FGState.cpp | 2 +- 12 files changed, 153 insertions(+), 387 deletions(-) diff --git a/Simulator/FDM/JSBsim.cxx b/Simulator/FDM/JSBsim.cxx index f28cf0d4a..934645318 100644 --- a/Simulator/FDM/JSBsim.cxx +++ b/Simulator/FDM/JSBsim.cxx @@ -65,7 +65,7 @@ int fgJSBsimInit(double dt) { FGPath engine_path( current_options.get_fg_root() ); engine_path.append( "Engine" ); - FDMExec.GetAircraft()->LoadAircraftEx(aircraft_path.str(), + FDMExec.GetAircraft()->LoadAircraft(aircraft_path.str(), engine_path.str(), "X15"); FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft" ); diff --git a/Simulator/FDM/JSBsim/FGAircraft.cpp b/Simulator/FDM/JSBsim/FGAircraft.cpp index 2f58ea87b..aa5bef805 100644 --- a/Simulator/FDM/JSBsim/FGAircraft.cpp +++ b/Simulator/FDM/JSBsim/FGAircraft.cpp @@ -94,43 +94,6 @@ Control 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. - ******************************************************************************** INCLUDES *******************************************************************************/ @@ -180,7 +143,7 @@ FGAircraft::~FGAircraft(void) { } -bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string fname) +bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string fname) { string path; string fullpath; @@ -190,7 +153,11 @@ bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string string holding_string; char scratch[128]; ifstream coeffInFile; + streampos gpos; + int axis; + string axis_descript; + axis = -1; aircraftDef = aircraft_path + "/" + fname + "/" + fname + ".cfg"; ifstream aircraftfile(aircraftDef.c_str()); cout << "Reading Aircraft Configuration File: " << aircraftDef << endl; @@ -201,9 +168,11 @@ bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string while (!aircraftfile.fail()) { holding_string.erase(); aircraftfile >> holding_string; - // if (holding_string.compare("//",0,2) != 0) { - if ( !(holding_string.substr(0, 2) == "//") ) { - +#ifdef __BORLANDC__ + if (holding_string.compare(0, 2, "//") != 0) { +#else + if (holding_string.compare("//",0,2) != 0) { +#endif if (holding_string == "AIRCRAFT") { cout << "Reading in Aircraft parameters ..." << endl; } else if (holding_string == "AERODYNAMICS") { @@ -269,97 +238,63 @@ bool FGAircraft::LoadAircraftEx(string aircraft_path, string engine_path, string } else if (holding_string == "LIFT") { - cout << " Lift Coefficients ..." << endl; - aircraftfile >> tag; - streampos gpos = aircraftfile.tellg(); - aircraftfile >> tag; - if ( !(tag == "}") ) { - aircraftfile.seekg(gpos); - Coeff[LiftCoeff][coeff_ctr[LiftCoeff]] = new FGCoefficient(FDMExec, aircraftfile); - coeff_ctr[LiftCoeff]++; - } else { - cout << " None found ..." << endl; - } - + axis_descript = " Lift Coefficients ..."; + axis = LiftCoeff; + } else if (holding_string == "DRAG") { - cout << " Drag Coefficients ..." << endl; - aircraftfile >> tag; - streampos gpos = aircraftfile.tellg(); - aircraftfile >> tag; - if ( !(tag == "}") ) { - aircraftfile.seekg(gpos); - Coeff[DragCoeff][coeff_ctr[DragCoeff]] = new FGCoefficient(FDMExec, aircraftfile); - coeff_ctr[DragCoeff]++; - } else { - cout << " None found ..." << endl; - } + axis_descript = " Drag Coefficients ..."; + axis = DragCoeff; } else if (holding_string == "SIDE") { - cout << " Side Coefficients ..." << endl; - aircraftfile >> tag; - streampos gpos = aircraftfile.tellg(); - aircraftfile >> tag; - if ( !(tag == "}") ) { - aircraftfile.seekg(gpos); - Coeff[SideCoeff][coeff_ctr[SideCoeff]] = new FGCoefficient(FDMExec, aircraftfile); - coeff_ctr[SideCoeff]++; - } else { - cout << " None found ..." << endl; - } + axis_descript = " Side Coefficients ..."; + axis = SideCoeff; } else if (holding_string == "ROLL") { - cout << " Roll Coefficients ..." << endl; - aircraftfile >> tag; - streampos gpos = aircraftfile.tellg(); - aircraftfile >> tag; - if ( !(tag == "}") ) { - aircraftfile.seekg(gpos); - Coeff[RollCoeff][coeff_ctr[RollCoeff]] = new FGCoefficient(FDMExec, aircraftfile); - coeff_ctr[RollCoeff]++; - } else { - cout << " None found ..." << endl; - } + axis_descript = " Roll Coefficients ..."; + axis = RollCoeff; } else if (holding_string == "PITCH") { - cout << " Pitch Coefficients ..." << endl; - aircraftfile >> tag; - streampos gpos = aircraftfile.tellg(); - aircraftfile >> tag; - if ( !(tag == "}") ) { - aircraftfile.seekg(gpos); - Coeff[PitchCoeff][coeff_ctr[PitchCoeff]] = new FGCoefficient(FDMExec, aircraftfile); - coeff_ctr[PitchCoeff]++; - } else { - cout << " None found ..." << endl; - } + axis_descript = " Pitch Coefficients ..."; + axis = PitchCoeff; } else if (holding_string == "YAW") { - cout << " Yaw Coefficients ..." << endl; - aircraftfile >> tag; - streampos gpos = aircraftfile.tellg(); - aircraftfile >> tag; - if ( !(tag == "}") ) { - aircraftfile.seekg(gpos); - Coeff[YawCoeff][coeff_ctr[YawCoeff]] = new FGCoefficient(FDMExec, aircraftfile); - coeff_ctr[YawCoeff]++; - } else { - cout << " None found ..." << endl; - } - - } else { + axis_descript = " Yaw Coefficients ..."; + axis = YawCoeff; + } + if (axis >= 0) { + cout << axis_descript << endl; + aircraftfile >> tag; + gpos = aircraftfile.tellg(); + aircraftfile >> tag; + if (tag != "}" ) { + while (tag != "}") { + aircraftfile.seekg(gpos); + Coeff[axis][coeff_ctr[axis]] = new FGCoefficient(FDMExec, aircraftfile); + coeff_ctr[axis]++; + aircraftfile >> tag; + gpos = aircraftfile.tellg(); + aircraftfile >> tag; + } + } else { + cout << " None found ..." << endl; + } + } + axis = -1; + } else { aircraftfile.getline(scratch, 127); } } cout << "End of Configuration File Parsing." << endl; - return true; + + return true; } diff --git a/Simulator/FDM/JSBsim/FGAircraft.h b/Simulator/FDM/JSBsim/FGAircraft.h index 0335a8033..9e3fe974c 100644 --- a/Simulator/FDM/JSBsim/FGAircraft.h +++ b/Simulator/FDM/JSBsim/FGAircraft.h @@ -129,7 +129,7 @@ public: ~FGAircraft(void); bool Run(void); - bool LoadAircraftEx(string, string, string); + bool LoadAircraft(string, string, string); inline string GetAircraftName(void) {return AircraftName;} inline void SetGearUp(bool tt) {GearUp = tt;} inline bool GetGearUp(void) {return GearUp;} diff --git a/Simulator/FDM/JSBsim/FGAtmosphere.cpp b/Simulator/FDM/JSBsim/FGAtmosphere.cpp index a066b3046..151a797f1 100644 --- a/Simulator/FDM/JSBsim/FGAtmosphere.cpp +++ b/Simulator/FDM/JSBsim/FGAtmosphere.cpp @@ -71,8 +71,17 @@ bool FGAtmosphere::Run(void) + 7.0E-13*State->Geth()*State->Geth() - 2.0E-18*State->Geth()*State->Geth()*State->Geth(); - State->SetMach(State->GetVt()/State->Geta()); + State->SetMach(State->GetVt()/State->Geta()); } else { // skip Run() execution this time } return false; } + +float FGAtmosphere::CalcRho(float altitude) +{ + return (0.002377 - 7.0E-08*altitude + + 7.0E-13*altitude*altitude + - 2.0E-18*altitude*altitude*altitude); + +} + diff --git a/Simulator/FDM/JSBsim/FGAtmosphere.h b/Simulator/FDM/JSBsim/FGAtmosphere.h index 25afde57b..a698742c8 100644 --- a/Simulator/FDM/JSBsim/FGAtmosphere.h +++ b/Simulator/FDM/JSBsim/FGAtmosphere.h @@ -58,26 +58,12 @@ using namespace std; class FGAtmosphere : public FGModel { public: - // *************************************************************************** - /** @memo Constructor - @param FGFDMExec* - a pointer to the "owning" FDM Executive - */ FGAtmosphere(FGFDMExec*); - - // *************************************************************************** - /** @memo Destructor - */ ~FGAtmosphere(void); - - // *************************************************************************** - /** This must be called for each dt to execute the model algorithm */ bool Run(void); - // *************************************************************************** - /** @memo Returns the air density - @return float air density in slugs/cubic foot - */ inline float Getrho(void) {return rho;} + float CalcRho(float altitude); protected: diff --git a/Simulator/FDM/JSBsim/FGCoefficient.cpp b/Simulator/FDM/JSBsim/FGCoefficient.cpp index 565b08949..65d61edaa 100644 --- a/Simulator/FDM/JSBsim/FGCoefficient.cpp +++ b/Simulator/FDM/JSBsim/FGCoefficient.cpp @@ -30,69 +30,6 @@ FUNCTIONAL DESCRIPTION This class models the stability derivative coefficient lookup tables or equations. Note that the coefficients need not be calculated each delta-t. -The coefficient files are located in the axis subdirectory for each aircraft. -For instance, for the X-15, you would find subdirectories under the -aircraft/X-15/ directory named CLIFT, CDRAG, CSIDE, CROLL, CPITCH, CYAW. Under -each of these directories would be files named a, a0, q, and so on. The file -named "a" under the CLIFT directory would contain data for the stability -derivative modeling lift due to a change in alpha. See the FGAircraft.cpp file -for additional information. The coefficient files have the following format: - - - - - - - - - - - - - -<... repeat above for each column of data in table ...> - -As an example for the X-15, for the lift due to mach: - -CLa0 -Lift_at_zero_alpha -Table 8 3 -16384 -32768 -16387 - -0.00 -0.0 0.0 -0.5 0.4 -0.9 0.9 -1.0 1.6 -1.1 1.3 -1.4 1.0 -2.0 0.5 -3.0 0.5 - -30000.00 -0.0 0.0 -0.5 0.5 -0.9 1.0 -1.0 1.7 -1.1 1.4 -1.4 1.1 -2.0 0.6 -3.0 0.6 - -70000.00 -0.0 0.0 -0.5 0.6 -0.9 1.1 -1.0 1.7 -1.1 1.5 -1.4 1.2 -2.0 0.7 -3.0 0.7 - Note that the values in a row which index into the table must be the same value for each column of data, so the first column of numbers for each altitude are seen to be equal, and there are the same number of values for each altitude. @@ -125,10 +62,29 @@ INCLUDES FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile) { - int r, c; + int r, c, start, end, n; float ftrashcan; string strashcan; + coeffdef["FG_QBAR"] = 1; + coeffdef["FG_WINGAREA"] = 2; + coeffdef["FG_WINGSPAN"] = 4; + coeffdef["FG_CBAR"] = 8; + coeffdef["FG_ALPHA"] = 16; + coeffdef["FG_ALPHADOT"] = 32; + coeffdef["FG_BETA"] = 64; + coeffdef["FG_BETADOT"] = 128; + coeffdef["FG_PITCHRATE"] = 256; + coeffdef["FG_ROLLRATE"] = 512; + coeffdef["FG_YAWRATE"] = 1024; + coeffdef["FG_ELEVATOR"] = 2048; + coeffdef["FG_AILERON"] = 4096; + coeffdef["FG_RUDDER"] = 8192; + coeffdef["FG_MACH"] = 16384; + coeffdef["FG_ALTITUDE"] = 32768L; + coeffdef["FG_I2VEL"] = 65536L; + coeffdef["FG_HALF"] = 131072L; + FDMExec = fdex; State = FDMExec->GetState(); Atmosphere = FDMExec->GetAtmosphere(); @@ -163,19 +119,51 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile) coeffDefFile >> columns; cout << "Cols: " << columns; } - coeffDefFile >> LookupR; + cout << endl; - cout << " Row indexing parameter: " << LookupR << endl; + + coeffDefFile >> strashcan; + if (strashcan.substr(0,1) == "F") { + LookupR = coeffdef[strashcan.c_str()]; + cout << " Row indexing parameter: " << strashcan << endl; + } else { + LookupR = atoi(strashcan.c_str()); + cout << " Row indexing parameter: " << LookupR << endl; + } + } if (type == TABLE) { - coeffDefFile >> LookupC; - cout << " Column indexing parameter: " << LookupC << endl; + coeffDefFile >> strashcan; + if (strashcan.substr(0,1) == "F") { + LookupC = coeffdef[strashcan.c_str()]; + cout << " Column indexing parameter: " << strashcan << endl; + } else { + LookupC = atoi(strashcan.c_str()); + cout << " Column indexing parameter: " << LookupC << endl; + } + } + + coeffDefFile >> strashcan; + + end = strashcan.length(); + n = strashcan.find("|"); + start = 0; + multipliers = 0; + if (strashcan.substr(0,1) == "F") { + while(n < end && n >= 0) { + n -= start; + multipliers += coeffdef[strashcan.substr(start,n).c_str()]; + start += n+1; + n = strashcan.find("|",start); + } + multipliers += coeffdef[strashcan.substr(start,end).c_str()]; + } else { + multipliers = atoi(strashcan.c_str()); } - coeffDefFile >> multipliers; cout << " Non-Dimensionalized by: "; - + mult_count = 0; if (multipliers & FG_QBAR) { mult_idx[mult_count] = FG_QBAR; @@ -256,12 +244,18 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile) mult_idx[mult_count] = FG_ALTITUDE; mult_count++; cout << "h "; + } + if (multipliers & FG_I2VEL) { + mult_idx[mult_count] = FG_I2VEL; + mult_count++; + cout << "1 /(2*Vt) "; } cout << endl; - + switch(type) { case VALUE: coeffDefFile >> StaticValue; + cout << " Value = " << StaticValue << endl; break; case VECTOR: Allocate(rows,2); @@ -283,6 +277,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile) case TABLE: Allocate(rows, columns); + Table3D[0][0] = 0.0; for (c=1;c<=columns;c++) { coeffDefFile >> Table3D[0][c]; for (r=1;r<=rows;r++) { @@ -299,7 +294,7 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile) } cout << endl; } - + break; } } else { @@ -353,15 +348,11 @@ float FGCoefficient::Value(float rVal, float cVal) col2temp = rFactor*(Table3D[r][c] - Table3D[r-1][c]) + Table3D[r-1][c]; Value = col1temp + cFactor*(col2temp - col1temp); - -//cout << "Value for " << description << " is " << Value; - + for (midx=0;midx= Val) break; r = r < 2 ? 2 : (r > rows ? rows : r); @@ -385,14 +376,10 @@ float FGCoefficient::Value(float Val) Value = Factor*(Table3D[r][1] - Table3D[r-1][1]) + Table3D[r-1][1]; -// cout << "Value for " << description << " is " << Value; - for (midx=0;midxGetqbar() << endl; return State->Getqbar(); case FG_WINGAREA: -//cout << "S: " << Aircraft->GetWingArea() << endl; return Aircraft->GetWingArea(); case FG_WINGSPAN: -//cout << "b: " << Aircraft->GetWingSpan() << endl; return Aircraft->GetWingSpan(); case FG_CBAR: -//cout << "Cbar: " << Aircraft->Getcbar() << endl; return Aircraft->Getcbar(); case FG_ALPHA: -//cout << "Alpha: " << Translation->Getalpha() << endl; return Translation->Getalpha(); case FG_ALPHADOT: -//cout << "Adot: " << State->Getadot() << endl; return State->Getadot(); case FG_BETA: -//cout << "Beta: " << Translation->Getbeta() << endl; return Translation->Getbeta(); case FG_BETADOT: -//cout << "Bdot: " << State->Getbdot() << endl; return State->Getbdot(); case FG_PITCHRATE: -//cout << "Q: " << Rotation->GetQ() << endl; return Rotation->GetQ(); case FG_ROLLRATE: -//cout << "P: " << Rotation->GetP() << endl; return Rotation->GetP(); case FG_YAWRATE: -//cout << "R: " << Rotation->GetR() << endl; return Rotation->GetR(); case FG_ELEVATOR: -//cout << "De: " << FCS->GetDe() << endl; return FCS->GetDe(); case FG_AILERON: -//cout << "Da: " << FCS->GetDa() << endl; return FCS->GetDa(); case FG_RUDDER: -//cout << "Dr: " << FCS->GetDr() << endl; return FCS->GetDr(); case FG_MACH: -//cout << "Mach: " << State->GetMach() << endl; return State->GetMach(); case FG_ALTITUDE: -//cout << "h: " << State->Geth() << endl; return State->Geth(); + case FG_I2VEL: + return 1.0/(0.5 * State->GetVt()); } return 0; } + diff --git a/Simulator/FDM/JSBsim/FGCoefficient.h b/Simulator/FDM/JSBsim/FGCoefficient.h index 4bfc91acf..c28af0dfe 100644 --- a/Simulator/FDM/JSBsim/FGCoefficient.h +++ b/Simulator/FDM/JSBsim/FGCoefficient.h @@ -51,6 +51,8 @@ INCLUDES # include #endif +#include + /******************************************************************************* DEFINES *******************************************************************************/ @@ -73,6 +75,7 @@ using namespace std; #define FG_RUDDER 8192 #define FG_MACH 16384 #define FG_ALTITUDE 32768L +#define FG_I2VEL 65536L /******************************************************************************* FORWARD DECLARATIONS @@ -90,81 +93,11 @@ class FGOutput; /******************************************************************************* COMMENTS, REFERENCES, and NOTES -*******************************************************************************/ -/** +******************************************************************************** + This class models the stability derivative coefficient lookup tables or equations. Note that the coefficients need not be calculated each delta-t. -The coefficient files are located in the axis subdirectory for each aircraft. -For instance, for the X-15, you would find subdirectories under the -aircraft/X-15/ directory named CLIFT, CDRAG, CSIDE, CROLL, CPITCH, CYAW. Under -each of these directories would be files named a, a0, q, and so on. The file -named "a" under the CLIFT directory would contain data for the stability -derivative modeling lift due to a change in alpha. See the FGAircraft.cpp file -for additional information. The coefficient files have the following format: - - - - - - - - - - - - - -<... repeat above for each column of data in table ...> - -As an example for the X-15, for the lift due to mach: -
-
-CLa0
-Lift_at_zero_alpha
-Table 8 3
-16384
-32768
-16387
-
-0.00
-0.0 0.0
-0.5 0.4
-0.9 0.9
-1.0 1.6
-1.1 1.3
-1.4 1.0
-2.0 0.5
-3.0 0.5
-
-30000.00
-0.0 0.0
-0.5 0.5
-0.9 1.0
-1.0 1.7
-1.1 1.4
-1.4 1.1
-2.0 0.6
-3.0 0.6
-
-70000.00
-0.0 0.0
-0.5 0.6
-0.9 1.1
-1.0 1.7
-1.1 1.5
-1.4 1.2
-2.0 0.7
-3.0 0.7
-
- -Note that the values in a row which index into the table must be the same value -for each column of data, so the first column of numbers for each altitude are -seen to be equal, and there are the same number of values for each altitude. - -
 FG_QBAR         1
 FG_WINGAREA     2
 FG_WINGSPAN     4
@@ -181,83 +114,30 @@ FG_AILERON   4096
 FG_RUDDER    8192
 FG_MACH     16384
 FG_ALTITUDE 32768L
-
-@author Jon S. Berndt -@memo This class models the stability derivative coefficient lookup tables or equations. -*/ -/******************************************************************************* +FG_I2VEL 65536L + +******************************************************************************** CLASS DECLARATION *******************************************************************************/ class FGCoefficient { public: - // *************************************************************************** - /** @memo - @param - @return - */ FGCoefficient(FGFDMExec*, ifstream&); - - // *************************************************************************** - /** @memo - @param - @return - */ ~FGCoefficient(void); - - // *************************************************************************** - /** @memo - @param - @return - */ bool Allocate(int); - - // *************************************************************************** - /** @memo - @param - @return - */ bool Allocate(int, int); - - // *************************************************************************** - /** @memo - @param - @return - */ float Value(float, float); - - // *************************************************************************** - /** @memo - @param - @return - */ float Value(float); - - // *************************************************************************** - /** @memo - @param - @return - */ float Value(void); - - // *************************************************************************** - /** @memo - @param - @return - */ float TotalValue(void); - - // *************************************************************************** - /** @memo - @param - @return - */ enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION}; protected: private: + typedef map CoeffMap; + CoeffMap coeffdef; string filename; string description; string name; diff --git a/Simulator/FDM/JSBsim/FGControls.cpp b/Simulator/FDM/JSBsim/FGControls.cpp index ce509a11a..01d8327a7 100644 --- a/Simulator/FDM/JSBsim/FGControls.cpp +++ b/Simulator/FDM/JSBsim/FGControls.cpp @@ -51,15 +51,8 @@ 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. +// Revision 1.5 1999/06/21 03:02:05 curt +// Updates to JSBsim. // // Revision 1.1 1999/02/13 01:12:03 curt // Initial Revision. diff --git a/Simulator/FDM/JSBsim/FGControls.h b/Simulator/FDM/JSBsim/FGControls.h index 165ad2659..62af3ecab 100644 --- a/Simulator/FDM/JSBsim/FGControls.h +++ b/Simulator/FDM/JSBsim/FGControls.h @@ -177,15 +177,8 @@ 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. +// Revision 1.5 1999/06/21 03:02:06 curt +// Updates to JSBsim. // // Revision 1.1 1999/02/13 01:12:03 curt // Initial Revision. diff --git a/Simulator/FDM/JSBsim/FGFDMExec.cpp b/Simulator/FDM/JSBsim/FGFDMExec.cpp index 9f4adfa80..e89ee8844 100644 --- a/Simulator/FDM/JSBsim/FGFDMExec.cpp +++ b/Simulator/FDM/JSBsim/FGFDMExec.cpp @@ -115,7 +115,7 @@ FGFDMExec::FGFDMExec(void) Schedule(Translation, 1); Schedule(Position, 1); Schedule(Auxiliary, 1); - Schedule(Output, 5); + Schedule(Output, 1); terminate = false; frozen = false; diff --git a/Simulator/FDM/JSBsim/FGMain.cpp b/Simulator/FDM/JSBsim/FGMain.cpp index 1783fce90..93843bdce 100644 --- a/Simulator/FDM/JSBsim/FGMain.cpp +++ b/Simulator/FDM/JSBsim/FGMain.cpp @@ -16,8 +16,8 @@ void main(int argc, char** argv) { FGFDMExec* FDMExec; - struct timespec short_wait = {0,100000000}; - struct timespec no_wait = {0,100000000}; +// struct timespec short_wait = {0,100000000}; +// struct timespec no_wait = {0,100000000}; if (argc != 3) { cout << endl @@ -28,7 +28,7 @@ void main(int argc, char** argv) FDMExec = new FGFDMExec(); - FDMExec->GetAircraft()->LoadAircraftEx("aircraft", "engine", string(argv[1])); + FDMExec->GetAircraft()->LoadAircraft("aircraft", "engine", string(argv[1])); FDMExec->GetState()->Reset("aircraft", string(argv[2])); while (FDMExec->GetState()->Getsim_time() <= 25.0) @@ -39,12 +39,12 @@ void main(int argc, char** argv) if (FDMExec->GetState()->Getsim_time() > 5.0) { FDMExec->GetFCS()->SetDa(0.05); - FDMExec->GetFCS()->SetDr(0.05); - FDMExec->GetFCS()->SetDe(0.05); +// FDMExec->GetFCS()->SetDr(0.05); +// FDMExec->GetFCS()->SetDe(0.05); } FDMExec->Run(); - nanosleep(&short_wait,&no_wait); +// nanosleep(&short_wait,&no_wait); } delete FDMExec; diff --git a/Simulator/FDM/JSBsim/FGState.cpp b/Simulator/FDM/JSBsim/FGState.cpp index 92ffa9de4..a55abf3b5 100644 --- a/Simulator/FDM/JSBsim/FGState.cpp +++ b/Simulator/FDM/JSBsim/FGState.cpp @@ -130,7 +130,7 @@ bool FGState::Reset(string path, string fname) FDMExec->GetTranslation()->SetABG(alpha, beta, gamma); Vt = sqrt(U*U + V*V + W*W); - qbar = sqrt(U*U + V*V + W*W); + qbar = 0.5*(U*U + V*V + W*W)*FDMExec->GetAtmosphere()->CalcRho(h); Q0 = sin(psi*0.5)*sin(tht*0.5)*sin(phi*0.5) + cos(psi*0.5)*cos(tht*0.5)*cos(phi*0.5); Q1 = -sin(psi*0.5)*sin(tht*0.5)*cos(phi*0.5) + cos(psi*0.5)*cos(tht*0.5)*sin(phi*0.5); -- 2.39.5