]> git.mxchange.org Git - flightgear.git/commitdiff
Oct. 9, 2000 - synced with latest JSBsim code.
authorcurt <curt>
Mon, 9 Oct 2000 21:16:21 +0000 (21:16 +0000)
committercurt <curt>
Mon, 9 Oct 2000 21:16:21 +0000 (21:16 +0000)
28 files changed:
src/FDM/JSBSim.cxx
src/FDM/JSBSim/FGAircraft.cpp
src/FDM/JSBSim/FGAircraft.h
src/FDM/JSBSim/FGControls.cpp
src/FDM/JSBSim/FGControls.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGFCS.cpp
src/FDM/JSBSim/FGFCS.h
src/FDM/JSBSim/FGFDMExec.cpp
src/FDM/JSBSim/FGInertial.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/FGLGear.cpp
src/FDM/JSBSim/FGLGear.h
src/FDM/JSBSim/FGMassBalance.cpp
src/FDM/JSBSim/FGMassBalance.h
src/FDM/JSBSim/FGPiston.cpp
src/FDM/JSBSim/FGPiston.h
src/FDM/JSBSim/FGRocket.cpp
src/FDM/JSBSim/FGRocket.h
src/FDM/JSBSim/FGTrim.cpp
src/FDM/JSBSim/FGTurboJet.cpp
src/FDM/JSBSim/FGTurboJet.h
src/FDM/JSBSim/FGTurboShaft.cpp
src/FDM/JSBSim/FGTurboShaft.h
src/FDM/JSBSim/JSBSim.cpp
src/FDM/JSBSim/filtersjb/FGFCSComponent.cpp
src/FDM/JSBSim/filtersjb/FGGain.cpp

index 6c1794c957662f92ad107a119566e38e44ef98b1..192a5a080ea2f2bb28ad07db5e9bbfc6ac456023 100644 (file)
@@ -50,6 +50,7 @@
 #include <FDM/JSBSim/FGAuxiliary.h>
 #include <FDM/JSBSim/FGDefs.h>
 #include <FDM/JSBSim/FGInitialCondition.h>
+#include <FDM/JSBSim/FGTrim.h>
 #include <FDM/JSBSim/FGAtmosphere.h>
 
 #include "JSBSim.hxx"
@@ -92,13 +93,17 @@ int FGJSBsim::init( double dt ) {
   FDMExec.GetAtmosphere()->SetWindNED(get_V_north_airmass(),
                                       get_V_east_airmass(),
                                       get_V_down_airmass());
-  
   FDMExec.GetAtmosphere()->UseInternal();
+  
+  FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET);
+  FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
 
   FG_LOG( FG_FLIGHT, FG_INFO, "  Initializing JSBSim with:" );
-
+  
   FGInitialCondition *fgic = new FGInitialCondition(&FDMExec);
-  fgic->SetAltitudeFtIC(get_Altitude());
+  fgic->SetAltitudeAGLFtIC(get_Altitude());
   if((current_options.get_mach() < 0) && (current_options.get_vc() < 0 )) {
     fgic->SetUBodyFpsIC(current_options.get_uBody());
     fgic->SetVBodyFpsIC(current_options.get_vBody());
@@ -116,36 +121,42 @@ int FGJSBsim::init( double dt ) {
     //current_options.get_vc() will return zero by default
   }
 
-
+  //fgic->SetFlightPathAngleDegIC(current_options.get_Gamma());
   fgic->SetRollAngleRadIC(get_Phi());
   fgic->SetPitchAngleRadIC(get_Theta());
   fgic->SetHeadingRadIC(get_Psi());
-//  fgic->SetLatitudeRadIC(get_Latitude());
   fgic->SetLatitudeRadIC(get_Lat_geocentric());
   fgic->SetLongitudeRadIC(get_Longitude());
 
-  FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET);
-  FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
-  FDMExec.GetPosition()->SetRunwayNormal( scenery.cur_normal[0],
-                                          scenery.cur_normal[1],
-                                          scenery.cur_normal[2] );
-
+  
+  
+  
+  //FG_LOG( FG_FLIGHT, FG_INFO, "  gamma: " <<  current_options.get_Gamma());
   FG_LOG( FG_FLIGHT, FG_INFO, "  phi: " <<  get_Phi());
-  FG_LOG( FG_FLIGHT, FG_INFO, "  theta: " <<  get_Theta() );
+  //FG_LOG( FG_FLIGHT, FG_INFO, "  theta: " <<  get_Theta() );
   FG_LOG( FG_FLIGHT, FG_INFO, "  psi: " <<  get_Psi() );
   FG_LOG( FG_FLIGHT, FG_INFO, "  lat: " <<  get_Latitude() );
   FG_LOG( FG_FLIGHT, FG_INFO, "  lon: " <<  get_Longitude() );
-  FG_LOG( FG_FLIGHT, FG_INFO, "  alt: " <<  get_Altitude() );
-
+  
+  FG_LOG( FG_FLIGHT, FG_INFO, "  Pressure Altiude: " <<  get_Altitude() );
+  FG_LOG( FG_FLIGHT, FG_INFO, "  Terrain Altitude: " 
+          <<  scenery.cur_radius*METER_TO_FEET );
+  FG_LOG( FG_FLIGHT, FG_INFO, "      AGL Altitude: " 
+          <<  get_Altitude() + get_Sea_level_radius()
+                - scenery.cur_radius*METER_TO_FEET );
+  
+  FG_LOG( FG_FLIGHT, FG_INFO, "      current_options.get_altitude(): " 
+          <<  current_options.get_altitude() );
   //must check > 0, != 0 will give bad result if --notrim set
   if(current_options.get_trim_mode() > 0) {
     FDMExec.RunIC(fgic);
     FG_LOG( FG_FLIGHT, FG_INFO, "  Starting trim..." );
-//    FGTrimLong *fgtrim=new FGTrimLong(&FDMExec,fgic);
-//    fgtrim->DoTrim();
-//    fgtrim->Report();
-//    fgtrim->TrimStats();
-//    fgtrim->ReportState();
+    FGTrim *fgtrim=new FGTrim(&FDMExec,fgic,tLongitudinal);
+    fgtrim->DoTrim();
+    fgtrim->Report();
+    fgtrim->TrimStats();
+    fgtrim->ReportState();
+
 
     controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
     controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
@@ -180,41 +191,15 @@ int FGJSBsim::update( int multiloop ) {
   double save_alt = 0.0;
   double time_step = (1.0 / current_options.get_model_hz()) * multiloop;
   double start_elev = get_Altitude();
-
+  
   // lets try to avoid really screwing up the JSBsim model
   if ( get_Altitude() < -9000 ) {
     save_alt = get_Altitude();
     set_Altitude( 0.0 );
   }
 
-  // copy control positions into the JSBsim structure
-
-  FDMExec.GetFCS()->SetDaCmd( controls.get_aileron());
-  FDMExec.GetFCS()->SetDeCmd( controls.get_elevator());
-  FDMExec.GetFCS()->SetPitchTrimCmd(controls.get_elevator_trim());
-  FDMExec.GetFCS()->SetDrCmd( controls.get_rudder());
-  FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() );
-  FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes
-  FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers
-  FDMExec.GetFCS()->SetThrottleCmd( FGControls::ALL_ENGINES,
-                                    controls.get_throttle( 0 ) * 100.0 );
-
-  // FCS->SetBrake( controls.get_brake( 0 ) );
-
-  // Inform JSBsim of the local terrain altitude; uncommented 5/3/00
-  //  FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
-  FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET);
-  FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
-  FDMExec.GetPosition()->SetRunwayNormal( scenery.cur_normal[0],
-                                          scenery.cur_normal[1],
-                                          scenery.cur_normal[2] );
-
-  FDMExec.GetAtmosphere()->SetExTemperature(get_Static_temperature());
-  FDMExec.GetAtmosphere()->SetExPressure(get_Static_pressure());
-  FDMExec.GetAtmosphere()->SetExDensity(get_Density());
-  FDMExec.GetAtmosphere()->SetWindNED(get_V_north_airmass(),
-                                      get_V_east_airmass(),
-                                      get_V_down_airmass());
+  copy_to_JSBsim();
 
   for ( int i = 0; i < multiloop; i++ ) {
     FDMExec.Run();
@@ -235,10 +220,6 @@ int FGJSBsim::update( int multiloop ) {
   }
 
   double end_elev = get_Altitude();
-  //if ( time_step > 0.0 ) {
-    // feet per second
-  //  set_Climb_Rate( (end_elev - start_elev) / time_step );
-  //}
 
   return 1;
 }
@@ -248,6 +229,34 @@ int FGJSBsim::update( int multiloop ) {
 // Convert from the FGInterface struct to the JSBsim generic_ struct
 
 int FGJSBsim::copy_to_JSBsim() {
+  // copy control positions into the JSBsim structure
+
+  FDMExec.GetFCS()->SetDaCmd( controls.get_aileron());
+  FDMExec.GetFCS()->SetDeCmd( controls.get_elevator());
+  FDMExec.GetFCS()->SetPitchTrimCmd(controls.get_elevator_trim());
+  FDMExec.GetFCS()->SetDrCmd( controls.get_rudder());
+  FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() );
+  FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes
+  FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers
+  FDMExec.GetFCS()->SetThrottleCmd( FGControls::ALL_ENGINES,
+                                    controls.get_throttle( 0 ) * 100.0 );
+
+  FDMExec.GetFCS()->SetLBrake( controls.get_brake( 0 ) );
+  FDMExec.GetFCS()->SetRBrake( controls.get_brake( 1 ) );
+  FDMExec.GetFCS()->SetCBrake( controls.get_brake( 2 ) );
+
+  // Inform JSBsim of the local terrain altitude; uncommented 5/3/00
+  //  FDMExec.GetPosition()->SetRunwayElevation(get_Runway_altitude()); // seems to work
+  FDMExec.GetPosition()->SetRunwayRadius(scenery.cur_radius*METER_TO_FEET);
+  FDMExec.GetPosition()->SetSeaLevelRadius(get_Sea_level_radius());
+
+  FDMExec.GetAtmosphere()->SetExTemperature(get_Static_temperature());
+  FDMExec.GetAtmosphere()->SetExPressure(get_Static_pressure());
+  FDMExec.GetAtmosphere()->SetExDensity(get_Density());
+  FDMExec.GetAtmosphere()->SetWindNED(get_V_north_airmass(),
+                                      get_V_east_airmass(),
+                                      get_V_down_airmass());
+
   return 1;
 }
 
@@ -315,9 +324,9 @@ int FGJSBsim::copy_from_JSBsim() {
                   FDMExec.GetState()->GetParameter(FG_PITCHRATE),
                   FDMExec.GetState()->GetParameter(FG_YAWRATE) );
 
-  /* HUH!?! */ set_Euler_Rates( FDMExec.GetRotation()->Getphi(),
-                   FDMExec.GetRotation()->Gettht(),
-                   FDMExec.GetRotation()->Getpsi() );
+  set_Euler_Rates( FDMExec.GetRotation()->GetEulerRates()(2),
+                   FDMExec.GetRotation()->GetEulerRates()(1),
+                   FDMExec.GetRotation()->GetEulerRates()(3));
 
   // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
 
index be658687116e8453c2b6dd374d4630a60a0798b7..74859c38d434f7a5572dbb7f0607bfd8ed22c747 100644 (file)
@@ -167,29 +167,34 @@ FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex),
 
 FGAircraft::~FGAircraft(void) { 
   unsigned int i,j;
+
   cout << " ~FGAircraft" << endl;
-  if(Engine != NULL) {
-    for(i=0;i<numEngines; i++) 
+  if (Engine != NULL) {
+    for (i=0; i<numEngines; i++)
       delete Engine[i];
   }    
   cout << "  Engine" << endl;
-  if(Tank != NULL) {
-    for(i=0;i<numTanks; i++) 
+
+  if (Tank != NULL) {
+    for (i=0; i<numTanks; i++)
       delete Tank[i];
   }    
   cout << "  Tank" << endl;
+
   cout << "  NumAxes: " << 6 << endl;
-  for(i=0;i<6;i++) {
+  for (i=0; i<6; i++) {
     cout << "  NumCoeffs: " << Coeff[i].size() << "  " << &Coeff[i] << endl;
-    for(j=0;j<Coeff[i].size();j++) {
+    for (j=0; j<Coeff[i].size(); j++) {
       
       cout << "  Coeff[" << i << "][" << j << "]: " << Coeff[i][j] << endl;
       delete Coeff[i][j];
     }
-  } 
+  }
+
   delete[] Coeff;
   cout << "  Coeffs" << endl;
-  for(i=0;i<lGear.size();i++) {
+
+  for (i=0; i<lGear.size(); i++) {
       delete lGear[i];
   }  
 }
@@ -407,6 +412,14 @@ void FGAircraft::FMGear(void) {
   if (GearUp) {
     // crash routine
   } else {
+
+//  iGear = lGear.begin();
+//  while (iGear != lGear.end()) {
+//    vForces  += iGear->Force();
+//    vMoments += iGear->Moment();
+//    iGear++;
+//  }
+
     for (unsigned int i=0;i<lGear.size();i++) {
       vForces  += lGear[i]->Force();
       vMoments += lGear[i]->Moment();
index df74d0fe96e584a3dbedc880aea861e0523d6151..9c2b287cd9d32700fe562008748ac3baf51991c1 100644 (file)
@@ -100,13 +100,16 @@ INCLUDES
 #  include <simgear/compiler.h>
 #  ifdef FG_HAVE_STD_INCLUDES
 #    include <vector>
+#    include <iterator>
 #    include <map>
 #  else
 #    include <vector.h>
+#    include <iterator.h>
 #    include <map.h>
 #  endif
 #else
 #  include <vector>
+#  include <iterator>
 #  include <map>
 #endif
 
@@ -174,6 +177,8 @@ public:
   string GetGroundReactionStrings(void);
   string GetGroundReactionValues(void);
 
+  vector <FGLGear>::iterator iGear;
+
   enum { ssSimulation      = 1,
          ssAerosurfaces    = 2,
          ssRates           = 4,
@@ -231,6 +236,7 @@ private:
 
   string Axis[6];
   vector <FGLGear*> lGear;
+
   string AircraftPath;
   string EnginePath;
   void ReadMetrics(FGConfigFile*);
index 9fdc03b90ebc34485a3026a1bf73323230caaa0d..4e593558653b084bb9ab9eb9698324c3a46dffbe 100644 (file)
@@ -51,8 +51,8 @@ FGControls::~FGControls() {
 
 
 // $Log$
-// Revision 1.15  2000/10/02 21:07:31  curt
-// Oct 2, 2000 JSBSim sync.
+// Revision 1.16  2000/10/09 19:16:22  curt
+// Oct. 9, 2000 - synced with latest JSBsim code.
 //
 // Revision 1.3  2000/04/26 10:55:57  jsb
 // Made changes as required by Curt to install JSBSim into FGFS
index d1b15ca29211c2ba4c9022f3bf4816afc6793a1d..0b94d242dbf8584c606f5e878183e3beb4b893b0 100644 (file)
@@ -177,8 +177,8 @@ extern FGControls controls;
 
 
 // $Log$
-// Revision 1.14  2000/10/02 21:07:31  curt
-// Oct 2, 2000 JSBSim sync.
+// Revision 1.15  2000/10/09 19:16:22  curt
+// Oct. 9, 2000 - synced with latest JSBsim code.
 //
 // Revision 1.6  2000/06/03 13:59:52  jsb
 // Changes for compatibility with MSVC
index d5db29429b6c300386d7758d7de108ff407c21b5..56ca313bf60c88e30c1b19b67acdb7a246168d36 100644 (file)
@@ -55,13 +55,13 @@ SENTRY
 #define FPSTOKTS        0.592484
 #define INCHTOFT        0.08333333
 #define OMEGA_EARTH .00007272205217  
-#define NEEDED_CFG_VERSION "1.30"
+#define NEEDED_CFG_VERSION "1.35"
 
 #define HPTOFTLBSSEC 550
 #define METERS_TO_FEET 3.2808
 
 enum eParam {
-  FG_NOTHING = 0,
+  FG_UNDEF = 0,
   FG_QBAR,
   FG_WINGAREA,
   FG_WINGSPAN,
index ed149ddeb5325ca70fc734817ec31eb41dec05f9..a29df963bd9be533d9799495ad23efad389ccf6c 100644 (file)
@@ -63,7 +63,7 @@ INCLUDES
 
 FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex) {
   Name = "FGFCS";
-  for (int i=0; i < MAX_ENGINES; i++) {
+  for (int i=0; i < MAX_ENGINES; i++) {  // needs to be changed: no limit
     ThrottleCmd[i] = 0.0;
     ThrottlePos[i] = 0.0;
   }
@@ -115,6 +115,20 @@ void FGFCS::SetThrottlePos(int engineNum, float setting) {
 
 /******************************************************************************/
 
+void FGFCS::SetLBrake(float setting) {
+
+}
+
+/******************************************************************************/
+
+void FGFCS::SetRBrake(float setting) {
+}
+
+/******************************************************************************/
+void FGFCS::SetCBrake(float setting) {
+}
+
+/******************************************************************************/
 bool FGFCS::LoadFCS(FGConfigFile* AC_cfg) {
   string token;
 
index 235276e6def7c24fb15b642a99884b8dd32ee9d7..7cf37bf1659447c260a4586fb8e1e38fc1967046 100644 (file)
@@ -64,8 +64,8 @@ private:
   float DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
   float DaPos, DePos, DrPos, DfPos, DsbPos, DspPos;
   float PTrimCmd;
-  float ThrottleCmd[MAX_ENGINES];
-  float ThrottlePos[MAX_ENGINES];
+  float ThrottleCmd[MAX_ENGINES];       // Needs to be changed: no limit
+  float ThrottlePos[MAX_ENGINES];       // Needs to be changed: no limit
 
   vector <FGFCSComponent*> Components;
 
@@ -113,6 +113,9 @@ public:
   inline void SetDsbPos(float tt) { DsbPos = tt; }
   inline void SetDspPos(float tt) { DspPos = tt; }
 
+  void SetLBrake(float);
+  void SetRBrake(float);
+  void SetCBrake(float);
 
   void SetThrottlePos(int ii, float tt);
 
index a46a9644abe1ece6efbfd9bf3e2d02d5fe67e543..e24b445a4220a1b5efafd80c2827e7f870bafd80 100644 (file)
@@ -128,25 +128,15 @@ FGFDMExec::FGFDMExec(void)
 
 FGFDMExec::~FGFDMExec(void){
   
-  cout << "~FGFDMExec" << endl;
   if ( Atmosphere != NULL )  delete Atmosphere;
-  cout << "Atmosphere" << endl;
   if ( FCS != NULL )         delete FCS;
-  cout << "FCS" << endl;
   if ( Aircraft != NULL )    delete Aircraft;
-  cout << "Aircraft" << endl;
   if ( Translation != NULL ) delete Translation;
-  cout << "Translation" << endl;
   if ( Rotation != NULL )    delete Rotation;
-  cout << "Rotation" << endl;
   if ( Position != NULL )    delete Position;
-  cout << "Position" << endl;
   if ( Auxiliary != NULL )   delete Auxiliary;
-  cout << "Auxiliary" << endl;
   if ( Output != NULL )      delete Output;
-  cout << "Output" << endl;
   if ( State != NULL )       delete State;
-  cout << "State" << endl;
 
 }
 
index f3f6c368075fed09a77a62fc47bc5cbfc92ee4a2..f0706a46c73204d654e7b0b7ec7abc71b0291e30 100644 (file)
@@ -54,6 +54,7 @@ INCLUDES
 #endif
 
 #include "FGModel.h"
+#include "FGConfigFile.h"
 
 /*******************************************************************************
 CLASS DECLARATION
index 521a366d7db5b57e0ab66ea04ac016983bb28f59..53edce96db95aa3b39aea3092d4134a69deacc77 100644 (file)
@@ -62,14 +62,15 @@ FGInitialCondition::FGInitialCondition(FGFDMExec *FDMExec) {
   theta=phi=psi=0;
   altitude=hdot=0;
   latitude=longitude=0;
-  u=v=w=0;
+  u=v=w=0;  
+  vnorth=veast=vdown=0;
   lastSpeedSet=setvt;
   if(FDMExec != NULL ) {
     fdmex=FDMExec;
     fdmex->GetPosition()->Seth(altitude);
     fdmex->GetAtmosphere()->Run();
   } else {
-    cout << "FGInitialCondition: This class requires a pointer to an valid FGFDMExec object" << endl;
+    cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
   }
 
 }
@@ -119,12 +120,14 @@ void FGInitialCondition::SetMachIC(float tt) {
   //cout << "Vt: " << vt*FPSTOKTS << " Vc: " << vc*FPSTOKTS << endl;
 }
 
-
-
 void FGInitialCondition::SetClimbRateFpmIC(float tt) {
+  SetClimbRateFpsIC(tt/60.0);
+}
+
+void FGInitialCondition::SetClimbRateFpsIC(float tt) {
 
   if(vt > 0.1) {
-    hdot=tt/60;
+    hdot=tt;
     gamma=asin(hdot/vt);
   }
 }
@@ -143,7 +146,6 @@ void FGInitialCondition::SetUBodyFpsIC(float tt) {
 }
 
   
-
 void FGInitialCondition::SetVBodyFpsIC(float tt) {
   v=tt;
   vt=sqrt(u*u+v*v+w*w);
@@ -184,7 +186,41 @@ void FGInitialCondition::SetAltitudeAGLFtIC(float tt) {
   fdmex->GetPosition()->SetDistanceAGL(tt);
   altitude=fdmex->GetPosition()->Geth();
   SetAltitudeFtIC(altitude);
-}  
+} 
+
+void FGInitialCondition::calcUVWfromNED(void) {
+  u=vnorth*cos(theta)*cos(psi) + 
+     veast*cos(theta)*sin(psi) - 
+     vdown*sin(theta);
+  v=vnorth*(sin(phi)*sin(theta)*cos(psi) - cos(phi)*sin(psi)) +
+     veast*(sin(phi)*sin(theta)*sin(psi) + cos(phi)*cos(psi)) +
+     vdown*sin(phi)*cos(theta);
+  w=vnorth*(cos(phi)*sin(theta)*cos(psi) + sin(phi)*sin(psi)) +
+     veast*(cos(phi)*sin(theta)*sin(psi) - sin(phi)*cos(psi)) +
+     vdown*cos(phi)*cos(theta);
+}     
+void FGInitialCondition::SetVnorthFpsIC(float tt) {
+  vnorth=tt;
+  calcUVWfromNED();
+  vt=sqrt(u*u + v*v + w*w);
+  lastSpeedSet=setvt;
+}        
+  
+void FGInitialCondition::SetVeastFpsIC(float tt) {
+  veast=tt;
+  calcUVWfromNED();
+  vt=sqrt(u*u + v*v + w*w);
+  lastSpeedSet=setvt;
+} 
+
+void FGInitialCondition::SetVdownFpsIC(float tt) {
+  vdown=tt;
+  calcUVWfromNED();
+  vt=sqrt(u*u + v*v + w*w);
+  SetClimbRateFpsIC(-1*vdown);
+  lastSpeedSet=setvt;
+} 
 
 bool FGInitialCondition::getMachFromVcas(float *Mach,float vcas) {
  
index 86635749f2939bcd7e6d99c34fa49945ccef9e74..bd8d48a10d9e56409809f2d0e3586b711e30a4be 100644 (file)
@@ -89,12 +89,10 @@ typedef enum { setvt, setvc, setve, setmach } speedset;
    
    Alpha,Gamma, and Theta:
      This class assumes that it will be used to set up the sim for a
-        steady, zero pitch rate condition. This entails the assumption
-        that alpha=theta-gamma. Since any two of those angles specifies 
-        the third (again, for zero pitch rate) gamma (flight path angle) 
-        is favored when setting alpha and theta and alpha is favored when 
-        setting gamma. i.e.
-         set alpha : recalculate theta using gamma as currently set
+        steady, zero pitch rate condition. Since any two of those angles 
+   specifies the third gamma (flight path angle) is favored when setting
+   alpha and theta and alpha is favored when setting gamma. i.e.
+       set alpha : recalculate theta using gamma as currently set
                  set theta : recalculate alpha using gamma as currently set
                  set gamma : recalculate theta using alpha as currently set
  
@@ -119,7 +117,11 @@ public:
   void SetUBodyFpsIC(float tt);
   void SetVBodyFpsIC(float tt);
   void SetWBodyFpsIC(float tt);
-
+  
+  void SetVnorthFpsIC(float tt);
+  void SetVeastFpsIC(float tt);
+  void SetVdownFpsIC(float tt);
+  
   void SetAltitudeFtIC(float tt);
   void SetAltitudeAGLFtIC(float tt);
 
@@ -128,6 +130,7 @@ public:
   void SetFlightPathAngleRadIC(float tt);
   //set speed first
   void SetClimbRateFpmIC(float tt);
+  void SetClimbRateFpsIC(float tt);
   //use currently stored gamma, recalcualte theta
   inline void SetAlphaDegIC(float tt)      { alpha=tt*DEGTORAD; getTheta(); }
   inline void SetAlphaRadIC(float tt)      { alpha=tt; getTheta(); }
@@ -203,6 +206,7 @@ private:
   float altitude,hdot;
   float latitude,longitude;
   float u,v,w;
+  float vnorth,veast,vdown;
   
   float xlo, xhi,xmin,xmax;
   
@@ -221,6 +225,7 @@ private:
   float GammaEqOfTheta(float Theta);
   float GammaEqOfAlpha(float Alpha);
   float calcVcas(float Mach);
+  void calcUVWfromNED(void);
   
   bool findInterval(float x,float guess);
   bool solve(float *y, float x);
index 3acf3ad435caea510aaa807fb2833ef3a1faa491..322412fd0ddf19e048a6e4b431809f6a25a6d33e 100644 (file)
@@ -51,22 +51,25 @@ FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : vXYZ(3),
 {
   string tmp;
   *AC_cfg >> tmp >> name >> vXYZ(1) >> vXYZ(2) >> vXYZ(3)  
-            >> kSpring >> bDamp >> statFCoeff >> brakeCoeff;
-  
-  
+            >> kSpring >> bDamp>> dynamicFCoeff >> staticFCoeff
+                 >> SteerType >> BrakeType >> GroupMember >> maxSteerAngle;
+    
   cout << "    Name: " << name << endl;
   cout << "      Location: " << vXYZ << endl;
-  cout << "      Spring Constant: " << kSpring << endl;
+  cout << "      Spring Constant:  " << kSpring << endl;
   cout << "      Damping Constant: " << bDamp << endl;
-  cout << "      Rolling Resistance: " << statFCoeff << endl;
-  cout << "      Braking Coeff: " << brakeCoeff << endl;
+  cout << "      Dynamic Friction: " << dynamicFCoeff << endl;
+  cout << "      Static Friction:  " << staticFCoeff << endl;
+  cout << "      Brake Type:       " << BrakeType << endl;
+  cout << "      Grouping:         " << GroupMember << endl;
+  cout << "      Steering Type:    " << SteerType << endl;
+  cout << "      Max Steer Angle:  " << maxSteerAngle << endl;
   
   State       = Exec->GetState();
   Aircraft    = Exec->GetAircraft();
   Position    = Exec->GetPosition();
   Rotation    = Exec->GetRotation();
   
-  
   WOW = false;
   ReportEnable=true;
   FirstContact = false;
@@ -113,12 +116,20 @@ FGColumnVector FGLGear::Force(void)
       GroundSpeed   =  Position->GetVel().Magnitude();
     }
 
+    // The following code normalizes the wheel velocity vector, reverses it, and zeroes out
+    // the z component of the velocity. The question is, should the Z axis velocity be zeroed
+    // out first before the normalization takes place or not? Subsequent to that, the Wheel
+    // Velocity vector now points as a unit vector backwards and parallel to the wheel
+    // velocity vector. It acts AT the wheel.
+
     vWhlVelVec      = -1.0 * vWhlVelVec.Normalize();
     vWhlVelVec(eZ)  =  0.00;
 
+// the following needs work regarding friction coefficients and braking and steering
+
     vLocalForce(eZ) =  min(-compressLength * kSpring - compressSpeed * bDamp, (float)0.0);
-    vLocalForce(eX) =  fabs(vLocalForce(eZ) * statFCoeff) * vWhlVelVec(eX);
-    vLocalForce(eY) =  fabs(vLocalForce(eZ) * statFCoeff) * vWhlVelVec(eY);
+    vLocalForce(eX) =  fabs(vLocalForce(eZ) * staticFCoeff) * vWhlVelVec(eX);
+    vLocalForce(eY) =  fabs(vLocalForce(eZ) * staticFCoeff) * vWhlVelVec(eY);
 
     MaximumStrutForce = max(MaximumStrutForce, fabs(vLocalForce(eZ)));
     MaximumStrutTravel = max(MaximumStrutTravel, fabs(compressLength));
@@ -128,7 +139,6 @@ FGColumnVector FGLGear::Force(void)
     cout << "      Force: " << vForce << endl;
     cout << "      Moment: " << vMoment << endl;
 
-
   } else {
 
     WOW = false;
index 7c35914f4ffbef25890a3b64a0ccc35495ef3175..9e8c46e16bc42534da934222da8e11fc50e96faf 100644 (file)
@@ -92,6 +92,8 @@ public:
   inline float  GetCompVel(void)   {return compressSpeed; }
   inline float  GetCompForce(void) {return Force()(3);    }
   
+  inline void SetBrake(double bp) {brakePct = bp;}
+  
   inline void SetReport(bool bb) { ReportEnable=bb; }
   inline bool GetReport(void)    { return ReportEnable; }
   
@@ -101,10 +103,12 @@ private:
   FGColumnVector vXYZ;
   FGColumnVector vMoment;
   FGColumnVector vWhlBodyVec;
-  float kSpring, bDamp, compressLength, compressSpeed;
-  float statFCoeff, rollFCoeff, skidFCoeff;
-  float frictionForce, compForce;
-  float brakePct, brakeForce, brakeCoeff;
+  float kSpring;
+  float bDamp;
+  float compressLength;
+  float compressSpeed;
+  float staticFCoeff, dynamicFCoeff;
+  float brakePct;
   float maxCompLen;
   double SinkRate;
   double GroundSpeed;
@@ -116,6 +120,10 @@ private:
   bool Reported;
   bool ReportEnable;
   string name;
+  string BrakeType;
+  string SteerType;
+  string GroupMember;
+  float  maxSteerAngle;
 
   FGFDMExec*     Exec;
   FGState*       State;
index 81a4eb9a897ecfdb839f2bc82f644c46b99b5eae..4e534a54b431d3a644632fd15e51350c8c068473 100644 (file)
@@ -45,7 +45,7 @@ INCLUDES
 *******************************************************************************/
 
 
-FGMassBalance::FGMassBalance() : FGModel()
+FGMassBalance::FGMassBalance(FGFDMExec* fdmex) : FGModel(fdmex)
 {
   //
 }
index b2ed0c1804758cb67fa73c72a2cb73c5cec4b1cd..4d6ac9d794d721785462e54062b02d40a815fc81 100644 (file)
@@ -52,7 +52,7 @@ class FGMassBalance : public FGModel
 {
 
 public:
-  FGMassBalance();
+  FGMassBalance(FGFDMExec*);
   ~FGMassBalance();
 
   bool Run(void);
index 9cce927f646a406055f127ab2ae0bfbff1a4b7f9..0982ca2b75920682c92ee5931b291ec33cbb2937 100644 (file)
@@ -45,7 +45,8 @@ INCLUDES
 *******************************************************************************/
 
 
-FGPiston::FGPiston() : FGEngine()
+FGPiston::FGPiston(FGFDMExec* fdex, string enginePath, string engineName, int num) :
+                                 FGEngine(fdex, enginePath, engineName, num)
 {
   //
 }
index 6437bb4a7434e7635a46804e0da2c443561a425a..5e9c78cc77344e4e75ff0f6d77defb1e1645b6f7 100644 (file)
@@ -52,7 +52,7 @@ class FGPiston : public FGEngine
 {
 
 public:
-  FGPiston();
+  FGPiston(FGFDMExec*, string, string, int);
   ~FGPiston();
 
 };
index f94487d45af6bd59f23feec21afcf14b4fbecb11..6a219f8023fef6d5ee315d9fe4dadcb56ccc6b2a 100644 (file)
@@ -45,7 +45,8 @@ INCLUDES
 *******************************************************************************/
 
 
-FGRocket::FGRocket() : FGEngine()
+FGRocket::FGRocket(FGFDMExec* fdex, string enginePath, string engineName, int num) :
+                                 FGEngine(fdex, enginePath, engineName, num)
 {
   //
 }
index 990bd31f56ab0c8614bd34e54553eee737a6e407..119b200455978a401e8223afa6e55c6b7812c385 100644 (file)
@@ -52,7 +52,7 @@ class FGRocket : public FGEngine
 {
 
 public:
-  FGRocket();
+  FGRocket(FGFDMExec*, string, string, int);
   ~FGRocket();
 
 };
index 4089ba909c83ef93167d8a27bd4ba42018c99594..78d4d821978d6db4793c3134b0461afef331d8c5 100644 (file)
@@ -167,11 +167,15 @@ void FGTrim::ReportState(void) {
     sprintf(gear,"Down");
   sprintf(out, "    Flaps: %3s  Gear: %4s\n",flap,gear);
   cout << out;
-  sprintf(out, "    Speed: %4.0f KCAS  Mach: %5.2f  Altitude: %7.0f ft.\n",
+  sprintf(out, "    Speed: %4.0f KCAS  Mach: %5.2f\n",
                     fdmex->GetAuxiliary()->GetVcalibratedKTS(),
                     fdmex->GetState()->GetParameter(FG_MACH),
                     fdmex->GetPosition()->Geth() );
   cout << out;
+  sprintf(out, "    Altitude: %7.0f ft.  AGL Altitude: %7.0f ft.\n",
+                    fdmex->GetPosition()->Geth(),
+                    fdmex->GetPosition()->GetDistanceAGL() );
+  cout << out;
   sprintf(out, "    Angle of Attack: %6.2f deg  Pitch Angle: %6.2f deg\n",
                     fdmex->GetState()->GetParameter(FG_ALPHA)*RADTODEG,
                     fdmex->GetRotation()->Gettht()*RADTODEG );
index a7ee4ecdcc586564363877e9a9e50d0ddf219608..4cc0accb4f58a60c12ff306644db8dc9245a5445 100644 (file)
@@ -45,7 +45,8 @@ INCLUDES
 *******************************************************************************/
 
 
-FGTurboJet::FGTurboJet() : FGEngine()
+FGTurboJet::FGTurboJet(FGFDMExec* fdex, string enginePath, string engineName, int num) :
+                                 FGEngine(fdex, enginePath, engineName, num)
 {
   //
 }
index 323498abf33816094a09a51f8b34bc98c263efb8..b38637e7c798b2a9f5ff5d962376c36523bb2ee4 100644 (file)
@@ -52,7 +52,7 @@ class FGTurboJet : public FGEngine
 {
 
 public:
-  FGTurboJet();
+  FGTurboJet(FGFDMExec*, string, string, int);
   ~FGTurboJet();
 
 };
index c83825460dbabc7473b736c05a806ebcf4681d2e..572656f38e00dabaa55c91cb0e9a1737204a6e97 100644 (file)
@@ -45,7 +45,8 @@ INCLUDES
 *******************************************************************************/
 
 
-FGTurboShaft::FGTurboShaft() : FGEngine()
+FGTurboShaft::FGTurboShaft(FGFDMExec* fdex, string enginePath, string engineName, int num) :
+                                 FGEngine(fdex, enginePath, engineName, num)
 {
   //
 }
index 832c14411d3ed836e2494a3b7a164a2bb4ad2cb8..e19f43cc732dda0b30404e01d4051fbc8aeb075b 100644 (file)
@@ -52,7 +52,7 @@ class FGTurboShaft : public FGEngine
 {
 
 public:
-  FGTurboShaft();
+  FGTurboShaft(FGFDMExec*, string, string, int);
   ~FGTurboShaft();
 
 };
index 8f898eb4f69e9243f122b10da6d14a6f4ed52e9f..99c9e1f6b4b556570bf1f3c1f22e09aeac3e2e4a 100644 (file)
@@ -71,7 +71,6 @@ USEUNIT("filtersjb\FGGain.cpp");
 USEUNIT("filtersjb\FGGradient.cpp");
 USEUNIT("filtersjb\FGSummer.cpp");
 USEUNIT("filtersjb\FGDeadBand.cpp");
-USEUNIT("FGTrimLong.cpp");
 USEUNIT("filtersjb\FGFlaps.cpp");
 USEFILE("JSBSim.cxx");
 USEUNIT("FGForce.cpp");
index 22a0b37a747cd078a52076ad5a843b241c7ca323..48491ef66b41beec368bed2e8a3966b3526823ee 100644 (file)
@@ -54,10 +54,10 @@ FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs)
   Type       = "";
   ID         = 0;
   Input      = 0.0;
-  InputIdx   = FG_NOTHING;
+  InputIdx   = FG_UNDEF;
   Output     = 0.0;
   sOutputIdx = "";
-  OutputIdx  = FG_NOTHING;
+  OutputIdx  = FG_UNDEF;
   IsOutput   = false;
 }
 
index 0744983f1733c691c48022d52c4a32fa6379277b..40b4fe4aa3a0ae0098a9dbdb6712bfdc44af75d2 100644 (file)
@@ -59,7 +59,7 @@ FGGain::FGGain(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
   Schedule.clear();
   Gain = 1.000;
   Min = Max = 0;
-  ScheduledBy = FG_NOTHING;
+  ScheduledBy = FG_UNDEF;
 
   Type = AC_cfg->GetValue("TYPE");
   Name = AC_cfg->GetValue("NAME");