]> git.mxchange.org Git - flightgear.git/commitdiff
Updates to get engine working.
authorcurt <curt>
Tue, 7 Sep 1999 23:15:45 +0000 (23:15 +0000)
committercurt <curt>
Tue, 7 Sep 1999 23:15:45 +0000 (23:15 +0000)
src/FDM/JSBSim/FGAircraft.h
src/FDM/JSBSim/FGControls.cpp
src/FDM/JSBSim/FGControls.h
src/FDM/JSBSim/FGEngine.cpp
src/FDM/JSBSim/FGFCS.cpp
src/FDM/JSBSim/FGFCS.h
src/FDM/JSBSim/FGOutput.cpp
src/FDM/JSBSim/FGOutput.h
src/FDM/JSBSim/FGPosition.cpp
src/FDM/JSBSim/JSBSim.cpp
src/FDM/JSBSim/Makefile.solo

index 9e3fe974cce73b77f0bec929f00ee2cb358ea0ac..aa7229079ed27c1d386829dc84f555793cd61ce6 100644 (file)
@@ -150,6 +150,7 @@ public:
   inline float GetIyy(void) {return Iyy;}
   inline float GetIzz(void) {return Izz;}
   inline float GetIxz(void) {return Ixz;}
+  inline int   GetNumEngines(void) {return numEngines;}
 
 private:
   void GetState(void);
index de2f140f55d2aaa4306e3465bdb92355c8ce729f..8dde344658455cc319b72910f8022cf3ff449818 100644 (file)
@@ -51,8 +51,8 @@ FGControls::~FGControls() {
 
 
 // $Log$
-// Revision 1.5  1999/08/17 19:18:11  curt
-// Updates from Jon.
+// Revision 1.6  1999/09/07 21:15:45  curt
+// Updates to get engine working.
 //
 // Revision 1.1  1999/02/13 01:12:03  curt
 // Initial Revision.
index e596f4909544d751f64dca9ae1af3322361f7b00..aaaa7dc2e034f901e21ec60cc0da637b7339432d 100644 (file)
@@ -177,8 +177,8 @@ extern FGControls controls;
 
 
 // $Log$
-// Revision 1.5  1999/08/17 19:18:11  curt
-// Updates from Jon.
+// Revision 1.6  1999/09/07 21:15:45  curt
+// Updates to get engine working.
 //
 // Revision 1.1  1999/02/13 01:12:03  curt
 // Initial Revision.
index 275d793e511bb59643157ea07ef759d6d283aa68..42cd972ed42d842f61c83f5364c0df265acc7685 100644 (file)
@@ -31,6 +31,8 @@ See header file.
 HISTORY
 --------------------------------------------------------------------------------
 01/21/99   JSB   Created
+09/03/99   JSB   Changed Rocket thrust equation to correct -= Thrust instead of
+                 += Thrust (thanks to Tony Peden)
 
 ********************************************************************************
 INCLUDES
@@ -137,7 +139,7 @@ float FGEngine::CalcRocketThrust(void)
     Flameout = false;
   }
 
-  Thrust += 0.8*(Thrust - lastThrust); // actual thrust
+  Thrust -= 0.8*(Thrust - lastThrust); // actual thrust
 
   return Thrust;
 }
index 04bfb388035b327636af0248083333f8c83a30a9..eede2ea5986c6601048a21931cb9456daf7e06e9 100644 (file)
@@ -72,3 +72,14 @@ bool FGFCS::Run(void)
   }
   return false;
 }
+
+
+void FGFCS::SetThrottle(int engineNum, float setting)
+{
+  if (engineNum < 0) {
+    for (int ctr=0;ctr<Aircraft->GetNumEngines();ctr++) Throttle[ctr] = setting;
+  } else {
+    Throttle[engineNum] = setting;
+  }
+}
+
index 026dcc50bc32b5bdbb6a1eeb5e3d4baa801668d4..7617bd04552fbdd0d6bee6d6252ce328013d15e1 100644 (file)
@@ -66,7 +66,7 @@ public:
        inline void SetDr(float tt) {Dr = tt;}
        inline void SetDf(float tt) {Df = tt;}
        inline void SetDs(float tt) {Ds = tt;}
-       inline void SetThrottle(int ii, float tt) {Throttle[ii] = tt;}
+       void SetThrottle(int ii, float tt);
 
 protected:
 
index 9094f8997a854eb699a02bb4894bcf552481b276..cf626ac76cf0f3d5c862b02a582bc2f45648524e 100644 (file)
@@ -39,21 +39,6 @@ HISTORY
 INCLUDES
 *******************************************************************************/
 
-#ifdef FGFS
-#  include <Include/compiler.h>
-#  ifdef FG_HAVE_STD_INCLUDES
-#    include <iostream>
-#  else
-#    include <iostream.h>
-#  endif
-#else
-#  include <iostream>
-#endif
-
-#ifdef HAVE_CURSES
-  #include <ncurses.h>
-#endif
-
 #include "FGOutput.h"
 #include "FGState.h"
 #include "FGFDMExec.h"
@@ -73,11 +58,6 @@ FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
 {
   Name = "FGOutput";
   FirstPass = true;
-#ifdef HAVE_CURSES
-  initscr();
-  cbreak();
-  noecho();
-#endif
 }
 
 
@@ -89,82 +69,13 @@ FGOutput::~FGOutput(void)
 bool FGOutput::Run(void)
 {
   if (!FGModel::Run()) {
-    DelimitedOutput();
-//    ConsoleOutput();
+    DelimitedOutput("JSBSimData.csv");
   } else {
   }
   return false;
 }
 
 
-void FGOutput::ConsoleOutput(void)
-{
-#ifdef HAVE_CURSES
-  string buffer;
-
-  clear();
-  move(1,1);  insstr("Quaternions");
-  move(2,5);  insstr("Q0");
-  move(2,16); insstr("Q1");
-  move(2,27); insstr("Q2");
-  move(2,38); insstr("Q3");
-
-  move(3,1);  buffer = Rotation->GetQ0(); insstr(buffer.c_str());
-  move(3,12); buffer = Rotation->GetQ1(); insstr(buffer.c_str());
-  move(3,23); buffer = Rotation->GetQ2(); insstr(buffer.c_str());
-  move(3,34); buffer = Rotation->GetQ3(); insstr(buffer.c_str());
-
-  move(0,0); insstr("Time: ");
-  move(0,6); insstr(gcvt(State->Getsim_time(),6,buffer));
-
-  move(2,46); insstr("Phi");
-  move(2,55); insstr("Tht");
-  move(2,64); insstr("Psi");
-
-  move(3,45); buffer = Rotation->Getphi(); insstr(buffer.c_str());
-  move(3,54); buffer = Rotation->Gettht(); insstr(buffer.c_str());
-  move(3,63); buffer = Rotation->Getpsi(); insstr(buffer.c_str());
-
-  move(5,47); insstr("U");
-  move(5,56); insstr("V");
-  move(5,65); insstr("W");
-
-  move(6,45); buffer = Translation->GetU(); insstr(buffer.c_str());
-  move(6,54); buffer = Translation->GetV(); insstr(buffer.c_str());
-  move(6,63); buffer = Translation->GetW(); insstr(buffer.c_str());
-
-  move(8,47); insstr("Fx");
-  move(8,56); insstr("Fy");
-  move(8,65); insstr("Fz");
-
-  move(9,45); buffer = Aircraft->GetFx(); insstr(buffer.c_str());
-  move(9,54); buffer = Aircraft->GetFy(); insstr(buffer.c_str());
-  move(9,63); buffer = Aircraft->GetFz(); insstr(buffer.c_str());
-
-  move(11,47); insstr("Fn");
-  move(11,56); insstr("Fe");
-  move(11,65); insstr("Fd");
-
-  move(12,45); buffer = Position->GetFn(); insstr(buffer.c_str());
-  move(12,54); buffer = Position->GetFe(); insstr(buffer.c_str());
-  move(12,63); buffer = Position->GetFd(); insstr(buffer.c_str());
-
-  move(14,47); insstr("Latitude");
-  move(14,57); insstr("Longitude");
-  move(14,67); insstr("Altitude");
-
-  move(15,47); buffer = State->Getlatitude(); insstr(buffer.c_str());
-  move(15,57); buffer = State->Getlongitude(); insstr(buffer.c_str());
-  move(15,67); buffer = State->Geth(); insstr(buffer.c_str());
-
-  refresh();
-
-  move(LINES-1,1);
-  refresh();
-#endif
-}
-
-
 void FGOutput::DelimitedOutput(void)
 {
   if (FirstPass) {
@@ -227,3 +138,69 @@ void FGOutput::DelimitedOutput(void)
   cout << endl;
 
 }
+
+
+void FGOutput::DelimitedOutput(string fname)
+{
+  if (FirstPass) {
+    datafile.open(fname.c_str());
+    datafile << "Time,";
+    datafile << "Altitude,";
+    datafile << "Phi,";
+    datafile << "Tht,";
+    datafile << "Psi,";
+    datafile << "Rho,";
+    datafile << "Vtotal,";
+    datafile << "U,";
+    datafile << "V,";
+    datafile << "W,";
+    datafile << "Vn,";
+    datafile << "Ve,";
+    datafile << "Vd,";
+    datafile << "Udot,";
+    datafile << "Vdot,";
+    datafile << "Wdot,";
+    datafile << "Fx,";
+    datafile << "Fy,";
+    datafile << "Fz,";
+    datafile << "Latitude,";
+    datafile << "Longitude,";
+    datafile << "QBar,";
+    datafile << "Alpha,";
+    datafile << "L,";
+    datafile << "M,";
+    datafile << "N";
+    datafile << endl;
+    FirstPass = false;
+  }
+
+  datafile << State->Getsim_time() << ",";
+  datafile << State->Geth() << ",";
+  datafile << Rotation->Getphi() << ",";
+  datafile << Rotation->Gettht() << ",";
+  datafile << Rotation->Getpsi() << ",";
+  datafile << Atmosphere->Getrho() << ",";
+  datafile << State->GetVt() << ",";
+  datafile << Translation->GetU() << ",";
+  datafile << Translation->GetV() << ",";
+  datafile << Translation->GetW() << ",";
+  datafile << Position->GetVn() << ",";
+  datafile << Position->GetVe() << ",";
+  datafile << Position->GetVd() << ",";
+  datafile << Translation->GetUdot() << ",";
+  datafile << Translation->GetVdot() << ",";
+  datafile << Translation->GetWdot() << ",";
+  datafile << Aircraft->GetFx() << ",";
+  datafile << Aircraft->GetFy() << ",";
+  datafile << Aircraft->GetFz() << ",";
+  datafile << State->Getlatitude() << ",";
+  datafile << State->Getlongitude() << ",";
+  datafile << State->Getqbar() << ",";
+  datafile << Translation->Getalpha() << ",";
+  datafile << Aircraft->GetL() << ",";
+  datafile << Aircraft->GetM() << ",";
+  datafile << Aircraft->GetN() << "";
+  datafile << endl;
+  datafile.flush();
+}
+
index 9741683bddc774dc7ad10129da9fc82bac2d9da7..fc94daa1833c1f3cbc834151dc033e0565647f6b 100644 (file)
@@ -40,7 +40,21 @@ INCLUDES
 
 #include "FGModel.h"
 
-using namespace std;
+#ifdef FGFS
+#  include <Include/compiler.h>
+#  ifdef FG_HAVE_STD_INCLUDES
+#    include <iostream>
+#    include <fstream>
+#  else
+#    include <iostream.h>
+#    include <fstream.h>
+#  endif
+#else
+#  include <iostream>
+#  include <fstream>
+#endif
+
+//using namespace std;
 
 /*******************************************************************************
 CLASS DECLARATION
@@ -54,13 +68,14 @@ public:
 
   bool Run(void);
 
-  void ConsoleOutput(void);
   void DelimitedOutput(void);
+  void DelimitedOutput(string);
 
 protected:
 
 private:
   bool FirstPass;
+  ofstream datafile;
 };
 
 /******************************************************************************/
index 2f7eb655c03fa6b5679383a277ea2449b55b0c63..3489bc0f1a19f962b8d3e7a697ad61935039cc53 100644 (file)
@@ -124,7 +124,7 @@ bool FGPosition:: Run(void)
     Ve = T[1][2]*U + T[2][2]*V + T[3][2]*W;
     Vd = T[1][3]*U + T[2][3]*V + T[3][3]*W;
 
-    AccelN = invMass * Fn + invRadius * (Vn*Vd - Ve*Ve*tanLat); // Eqn. 3.6
+/*    AccelN = invMass * Fn + invRadius * (Vn*Vd - Ve*Ve*tanLat); // Eqn. 3.6
     AccelE = invMass * Fe + invRadius * (Ve*Vd + Vn*Ve*tanLat); // From
     AccelD = invMass * Fd - invRadius * (Vn*Vn + Ve*Ve);        // Reference [3]
 
@@ -133,7 +133,7 @@ bool FGPosition:: Run(void)
     Vd += 0.5*dt*rate*(3.0*AccelD - lastAccelD);                // Reference [3]
 
     Vee = Ve - OMEGAEARTH * (Radius) * cosLat;                  // From Eq. 3.8
-                                                                // Reference [3]
+*/                                                                // Reference [3]
     lastLatitudeDot = LatitudeDot;
     lastLongitudeDot = LongitudeDot;
     lastRadiusDot = RadiusDot;
index e1dab85ad82ac2e1393cd05a9a4c5875ca995975..3e38cab84ff64b017b9277c9240cb329f678bedb 100644 (file)
@@ -40,14 +40,13 @@ INCLUDES
 *******************************************************************************/
 
 #if __BCPLUSPLUS__     >= 0x0540   // If compiling under Borland C++Builder
+  //---------------------------------------------------------------------------
   #pragma hdrstop
   #include <condefs.h>
-  //---------------------------------------------------------------------------
   USEUNIT("FGAircraft.cpp");
   USEUNIT("FGAtmosphere.cpp");
   USEUNIT("FGAuxiliary.cpp");
   USEUNIT("FGCoefficient.cpp");
-  USEUNIT("FGControls.cpp");
   USEUNIT("FGEngine.cpp");
   USEUNIT("FGFCS.cpp");
   USEUNIT("FGFDMExec.cpp");
@@ -114,3 +113,7 @@ int main(int argc, char** argv)
   
   return 0;
 }
+
+WinMain()
+{
+}
index 66b5a0d729505c9ddec3ce351489967ae6edc562..661c1dfb009ea043e057d7cd46dc7dd852f7adf1 100644 (file)
@@ -1,7 +1,6 @@
-JSBSim : FGAircraft.o FGAtmosphere.o FGCoefficient.o FGFCS.o FGFDMExec.o \
-       FGModel.o FGOutput.o FGPosition.o FGRotation.o FGState.o \
-       FGTranslation.o FGUtility.o FGEngine.o FGTank.o FGAuxiliary.o \
-       JSBSim.o FGInitialCondition.o
+JSBSim : FGAircraft.o FGAtmosphere.o FGCoefficient.o FGFCS.o FGFDMExec.o\
+      FGModel.o FGOutput.o FGPosition.o FGRotation.o FGState.o FGTranslation.o\
+      FGUtility.o FGEngine.o FGTank.o FGAuxiliary.o JSBSim.o
        g++ $(CCOPTS) -lm *.o -oJSBSim
 FGAircraft.o : FGAircraft.cpp
        g++ $(CCOPTS) -c FGAircraft.cpp