]> git.mxchange.org Git - flightgear.git/commitdiff
Renamed new FGEngine to FGNewEngine to avoid conflict with stuff in JSBSim.
authorcurt <curt>
Mon, 16 Oct 2000 20:01:23 +0000 (20:01 +0000)
committercurt <curt>
Mon, 16 Oct 2000 20:01:23 +0000 (20:01 +0000)
src/FDM/IO360.cxx
src/FDM/IO360.hxx
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
src/FDM/LaRCsim.hxx
src/FDM/engine.cxx

index 64840d0478b56e0aaf4ea31bb11c259d68b8e990..323578aeeb988e6a700d698997bf90bfd67e9f73 100644 (file)
@@ -67,8 +67,8 @@
 // but it is by no means currently at a completed stage - DCL 15/9/00
 //
 // DCL 28/9/00 - Added estimate of engine and prop inertia and changed engine speed calculation to be calculated from Angular acceleration = Torque / Inertia.  
-//              Requires a timestep to be passed to FGEngine::init and currently assumes this timestep does not change.
-//              Could easily be altered to pass a variable timestep to FGEngine::update every step instead if required.
+//              Requires a timestep to be passed to FGNewEngine::init and currently assumes this timestep does not change.
+//              Could easily be altered to pass a variable timestep to FGNewEngine::update every step instead if required.
 //
 //////////////////////////////////////////////////////////////////////
 
@@ -88,7 +88,7 @@ FG_USING_STD(cout);
 
 
 // Calculate Engine RPM based on Propellor Lever Position
-float FGEngine::Calc_Engine_RPM (float LeverPosition)
+float FGNewEngine::Calc_Engine_RPM (float LeverPosition)
 {
     // Calculate RPM as set by Prop Lever Position. Assumes engine
     // will run at 1000 RPM at full course
@@ -104,7 +104,7 @@ float FGEngine::Calc_Engine_RPM (float LeverPosition)
     return RPM;
 }
 
-float FGEngine::Lookup_Combustion_Efficiency(float thi_actual)
+float FGNewEngine::Lookup_Combustion_Efficiency(float thi_actual)
 {
     float thi[11];  //array of equivalence ratio values
     float neta_comb[11];  //corresponding array of combustion efficiency values
@@ -165,12 +165,12 @@ float FGEngine::Lookup_Combustion_Efficiency(float thi_actual)
     }
 
     //if we get here something has gone badly wrong
-    cout << "ERROR: error in FGEngine::Lookup_Combustion_Efficiency\n";
+    cout << "ERROR: error in FGNewEngine::Lookup_Combustion_Efficiency\n";
     //exit(-1);
     return neta_comb_actual;  //keeps the compiler happy
 }
 /*
-float FGEngine::Calculate_Delta_T_Exhaust(void)
+float FGNewEngine::Calculate_Delta_T_Exhaust(void)
 {
        float dT_exhaust;
        heat_capacity_exhaust = (Cp_air * m_dot_air) + (Cp_fuel * m_dot_fuel);
@@ -201,7 +201,7 @@ static float Calc_Manifold_Pressure ( float LeverPosn, float MaxMan, float MinMa
 
 
 // set initial default values
-void FGEngine::init(double dt) {
+void FGNewEngine::init(double dt) {
 
     CONVERT_CUBIC_INCHES_TO_METERS_CUBED = 1.638706e-5;
     // Control and environment inputs
@@ -346,7 +346,7 @@ static float IAS_to_FPS (float x)
 
 
 // update the engine model based on current control positions
-void FGEngine::update() {
+void FGNewEngine::update() {
     // Declare local variables
     int num = 0;
     // const int num2 = 500;   // default is 100, number if iterations to run
index 01fa64c8a7097cf9cc1b10ad5d8f3235c32fba09..12f199daedba5a862663a776f5133cb0832089d3 100644 (file)
@@ -64,7 +64,7 @@
 
 FG_USING_STD(ofstream);
 
-class FGEngine {
+class FGNewEngine {
 
 private:
 
@@ -194,12 +194,12 @@ public:
     ofstream outfile;
 
     //constructor
-    FGEngine() {
+    FGNewEngine() {
 //     outfile.open("FGEngine.dat", ios::out|ios::trunc);
     }
 
     //destructor
-    ~FGEngine() {
+    ~FGNewEngine() {
 //     outfile.close();
     }
 
index db8ee0c3fca8f4b0a204068cb25ace3cb8d9059a..7037273e0b8a4bfad53b7596279bdd8e615d06b2 100644 (file)
@@ -147,23 +147,25 @@ bool FGJSBsim::init( double dt ) {
           <<  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..." );
-    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);
-    trimmed=true;
-    trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
-    trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
-    //the trimming routine only knows how to get 1 value for throttle
-    
-    delete fgtrim;
+    if(fgic->GetVcalibratedKtsIC() > 50) {
+      FDMExec.RunIC(fgic);
+      FG_LOG( FG_FLIGHT, FG_INFO, "  Starting trim..." );
+      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);
+      trimmed=true;
+      trim_elev=FDMExec.GetFCS()->GetPitchTrimCmd();
+      trim_throttle=FDMExec.GetFCS()->GetThrottleCmd(0)/100;
+      //the trimming routine only knows how to get 1 value for throttle
+
+      delete fgtrim;
+    }  
     FG_LOG( FG_FLIGHT, FG_INFO, "  Trim complete." );
   } else {
     FG_LOG( FG_FLIGHT, FG_INFO, "  Initializing without trim" );
@@ -247,7 +249,7 @@ bool FGJSBsim::copy_to_JSBsim() {
   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()->SetDrCmd( -1*controls.get_rudder());
   FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() );
   FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes
   FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers
index 3933678c956a2a5c9bf29b31c7737399a1c49cfc..0091e46232a1c1efe714bfb2023df45f9b9c24fb 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <Aircraft/aircraft.hxx>
 
+#define ID_JSBSIMXX "$Header"
 
 class FGJSBsim: public FGInterface {
 
index 97773f3c9da1a3107083a91d2b46db44b3838a58..0be365291caf9d0d880ef91bbc108cdde7a2b24e 100644 (file)
@@ -33,7 +33,7 @@
 
 class FGLaRCsim: public FGInterface {
 
-    FGEngine eng;
+    FGNewEngine eng;
 
 public:
 
index a87b3aace4996f0c62b25b1ed5566dd2dcf34065..34619ef191d9193f7e16238073d7b92073dd8902 100644 (file)
@@ -3,7 +3,7 @@
 #include "IO360.hxx"
 
 int main() {
-    FGEngine e;
+    FGNewEngine e;
 
     e.init( 1.0 / 120.0 );