]> git.mxchange.org Git - flightgear.git/commitdiff
Updates contributed by Jon Berndt.
authorcurt <curt>
Mon, 28 Jun 1999 17:39:20 +0000 (17:39 +0000)
committercurt <curt>
Mon, 28 Jun 1999 17:39:20 +0000 (17:39 +0000)
src/FDM/JSBSim/FGAircraft.cpp
src/FDM/JSBSim/FGCoefficient.cpp
src/FDM/JSBSim/FGCoefficient.h
src/FDM/JSBSim/FGControls.cpp
src/FDM/JSBSim/FGControls.h
src/FDM/JSBSim/FGMain.cpp
src/FDM/JSBSim/FGMatrix.cpp
src/FDM/JSBSim/FGOutput.cpp

index aa5bef8053bd156ec05c086d32baf537de2ae935..82d9e4599555572404e1b3d8e81a23f341a29c62 100644 (file)
@@ -385,9 +385,14 @@ void FGAircraft::FAero(void)
     for (int ctr=0; ctr < coeff_ctr[axis_ctr]; ctr++)
       F[axis_ctr] += Coeff[axis_ctr][ctr]->TotalValue();
 
-  Forces[0] +=  F[DragCoeff]*cos(alpha)*cos(beta) - F[SideCoeff]*cos(alpha)*sin(beta) - F[LiftCoeff]*sin(alpha);
-  Forces[1] +=  F[DragCoeff]*sin(beta)            + F[SideCoeff]*cos(beta);
-  Forces[2] +=  F[DragCoeff]*sin(alpha)*cos(beta) - F[SideCoeff]*sin(alpha)*sin(beta) + F[LiftCoeff]*cos(alpha);
+  Forces[0] += - F[DragCoeff]*cos(alpha)*cos(beta)
+               - F[SideCoeff]*cos(alpha)*sin(beta)
+               + F[LiftCoeff]*sin(alpha);
+  Forces[1] +=   F[DragCoeff]*sin(beta)
+               + F[SideCoeff]*cos(beta);
+  Forces[2] += - F[DragCoeff]*sin(alpha)*cos(beta)
+               - F[SideCoeff]*sin(alpha)*sin(beta)
+               - F[LiftCoeff]*cos(alpha);
 }
 
 
index 65d61edaac1303e940afb02e576993c77b34993a..0e69bcb75974c374a923f2ca16ce5ffdfc90ea25 100644 (file)
@@ -82,8 +82,8 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
   coeffdef["FG_RUDDER"]    = 8192;
   coeffdef["FG_MACH"]      = 16384;
   coeffdef["FG_ALTITUDE"]  = 32768L;
-  coeffdef["FG_I2VEL"]     = 65536L;
-  coeffdef["FG_HALF"]      = 131072L;
+  coeffdef["FG_BI2VEL"]    = 65536L;
+  coeffdef["FG_CI2VEL"]    = 131072L;
 
   FDMExec     = fdex;
   State       = FDMExec->GetState();
@@ -245,10 +245,15 @@ FGCoefficient::FGCoefficient(FGFDMExec* fdex, ifstream& coeffDefFile)
         mult_count++;
         cout << "h ";
       }
-      if (multipliers & FG_I2VEL) {
-        mult_idx[mult_count] = FG_I2VEL;
+      if (multipliers & FG_BI2VEL) {
+        mult_idx[mult_count] = FG_BI2VEL;
         mult_count++;
-        cout << "1 /(2*Vt) ";
+        cout << "b /(2*Vt) ";
+      }
+      if (multipliers & FG_CI2VEL) {
+        mult_idx[mult_count] = FG_CI2VEL;
+        mult_count++;
+        cout << "c /(2*Vt) ";
       }
                        cout << endl;
 
@@ -450,8 +455,10 @@ float FGCoefficient::GetCoeffVal(int val_idx)
     return State->GetMach();
   case FG_ALTITUDE:
     return State->Geth();
-  case FG_I2VEL:
-    return 1.0/(0.5 * State->GetVt());
+  case FG_BI2VEL:
+    return Aircraft->GetWingSpan()/(2.0 * State->GetVt());
+  case FG_CI2VEL:
+    return Aircraft->Getcbar()/(2.0 * State->GetVt());
   }
   return 0;
 }
index c28af0dfeeb6341fd14aaa6bcdaaef7d2d35126e..c937c54a657d472f48c914eebb94e970e0632ccf 100644 (file)
@@ -75,7 +75,8 @@ using namespace std;
 #define FG_RUDDER    8192
 #define FG_MACH     16384
 #define FG_ALTITUDE 32768L
-#define FG_I2VEL    65536L
+#define FG_BI2VEL   65536L
+#define FG_CI2VEL  131072L
 
 /*******************************************************************************
 FORWARD DECLARATIONS
@@ -114,7 +115,8 @@ FG_AILERON   4096
 FG_RUDDER    8192
 FG_MACH     16384
 FG_ALTITUDE 32768L
-FG_I2VEL    65536L
+FG_BI2VEL   65536L
+FG_CI2VEL  131072L
 
 ********************************************************************************
 CLASS DECLARATION
index ab2c13c77558d9788aeb019bc9aca5fa0a0ff565..c4de8a2ef1a759aa1e24d28b174dec7ae3501d5a 100644 (file)
@@ -51,8 +51,8 @@ FGControls::~FGControls() {
 
 
 // $Log$
-// Revision 1.2  1999/06/21 03:01:38  curt
-// Updated for both JSBsim and Tony Peden's c172 flight model.
+// Revision 1.3  1999/06/28 15:39:23  curt
+// Updates contributed by Jon Berndt.
 //
 // Revision 1.1  1999/02/13 01:12:03  curt
 // Initial Revision.
index 36cfb3300ae9f3fd5dba576dc7c8d3eabf48ed6c..6ed9c16bde790e142de6d1a0e7a2a29af07a38cf 100644 (file)
@@ -177,8 +177,8 @@ extern FGControls controls;
 
 
 // $Log$
-// Revision 1.2  1999/06/21 03:01:39  curt
-// Updated for both JSBsim and Tony Peden's c172 flight model.
+// Revision 1.3  1999/06/28 15:39:24  curt
+// Updates contributed by Jon Berndt.
 //
 // Revision 1.1  1999/02/13 01:12:03  curt
 // Initial Revision.
index 93843bdceefa9d4db62afe8e0d9ecb3dc7ccda2c..08413befdd9e72891810c97f8ba624387f43335c 100644 (file)
@@ -38,9 +38,9 @@ void main(int argc, char** argv)
 //
 
                if (FDMExec->GetState()->Getsim_time() > 5.0) {
-                       FDMExec->GetFCS()->SetDa(0.05);
+                       FDMExec->GetFCS()->SetDe(0.05);
 //                     FDMExec->GetFCS()->SetDr(0.05);
-//                     FDMExec->GetFCS()->SetDe(0.05);
+//                     FDMExec->GetFCS()->SetDa(0.05);
                }
                
     FDMExec->Run();
index 680ca1a20a54a74ba3ff8611c6f6dcec6891d9cc..1c1fcf9370cedb63d225f715cb5ad69c809538e6 100644 (file)
@@ -120,8 +120,8 @@ FGMatrix& FGMatrix::operator=(const FGMatrix& A)
       data = A.data;
     } else {
       data = alloc(rows,cols);
-      for (int i=0; i<=rows; i++) {
-             for (int j=0; j<=cols; j++) {
+      for (unsigned int i=0; i<=rows; i++) {
+             for (unsigned int j=0; j<=cols; j++) {
                      data[i][j] = A.data[i][j];
              }
       }
@@ -161,8 +161,8 @@ void FGMatrix::SetOParams(char delim,int width,int prec,int origin)
 void FGMatrix::InitMatrix(double value)
 {
   if (data) {
-    for (int i=0;i<=rows;i++) {
-                       for (int j=0;j<=cols;j++) {
+    for (unsigned int i=0;i<=rows;i++) {
+                       for (unsigned int j=0;j<=cols;j++) {
                operator()(i,j) = value;
                        }
                }
@@ -187,8 +187,8 @@ FGMatrix operator-(FGMatrix& A, FGMatrix& B)
 
   FGMatrix Diff(A.Rows(),A.Cols());
   Diff.keep=true;
-  for (int i=1;i<=A.Rows();i++) {
-               for (int j=1;j<=A.Cols();j++) {
+  for (unsigned int i=1;i<=A.Rows();i++) {
+               for (unsigned int j=1;j<=A.Cols();j++) {
                        Diff(i,j)=A(i,j)-B(i,j);
                }
        }
@@ -205,8 +205,8 @@ void operator-=(FGMatrix &A,FGMatrix &B)
                exit(1);
        }
 
-  for (int i=1;i<=A.Rows();i++) {
-               for (int j=1;j<=A.Cols();j++) {
+  for (unsigned int i=1;i<=A.Rows();i++) {
+               for (unsigned int j=1;j<=A.Cols();j++) {
                        A(i,j)-=B(i,j);
                }
        }
@@ -224,8 +224,8 @@ FGMatrix operator+(FGMatrix& A, FGMatrix& B)
 
   FGMatrix Sum(A.Rows(),A.Cols());
   Sum.keep = true;
-       for (int i=1;i<=A.Rows();i++) {
-               for (int j=1;j<=A.Cols();j++) {
+       for (unsigned int i=1;i<=A.Rows();i++) {
+               for (unsigned int j=1;j<=A.Cols();j++) {
                        Sum(i,j)=A(i,j)+B(i,j);
                }
        }
@@ -241,8 +241,8 @@ void operator+=(FGMatrix &A,FGMatrix &B)
     cout << endl;
                exit(1);
        }
-  for (int i=1;i<=A.Rows();i++) {
-               for (int j=1;j<=A.Cols();j++) {
+  for (unsigned int i=1;i<=A.Rows();i++) {
+               for (unsigned int j=1;j<=A.Cols();j++) {
                        A(i,j)+=B(i,j);
                }
        }
@@ -253,8 +253,8 @@ FGMatrix operator*(double scalar,FGMatrix &A)
 {
        FGMatrix Product(A.Rows(),A.Cols());
   Product.keep = true;
-       for (int i=1;i<=A.Rows();i++) {
-               for (int j=1;j<=A.Cols();j++) {
+       for (unsigned int i=1;i<=A.Rows();i++) {
+               for (unsigned int j=1;j<=A.Cols();j++) {
        Product(i,j) = scalar*A(i,j);
     }
        }
@@ -264,8 +264,8 @@ FGMatrix operator*(double scalar,FGMatrix &A)
 
 void operator*=(FGMatrix &A,double scalar)
 {
-       for (int i=1;i<=A.Rows();i++) {
-               for (int j=1;j<=A.Cols();j++) {
+       for (unsigned int i=1;i<=A.Rows();i++) {
+               for (unsigned int j=1;j<=A.Cols();j++) {
        A(i,j)*=scalar;
     }
   }
@@ -284,10 +284,10 @@ FGMatrix operator*(FGMatrix &Left, FGMatrix &Right)
 
        FGMatrix Product(Left.Rows(),Right.Cols());
        Product.keep = true;
-       for (int i=1;i<=Left.Rows();i++) {
-               for (int j=1;j<=Right.Cols();j++)       {
+       for (unsigned int i=1;i<=Left.Rows();i++) {
+               for (unsigned int j=1;j<=Right.Cols();j++)      {
        Product(i,j) = 0;
-      for (int k=1;k<=Left.Cols();k++) {
+      for (unsigned int k=1;k<=Left.Cols();k++) {
                        Product(i,j)+=Left(i,k)*Right(k,j);
       }
                }
@@ -309,10 +309,10 @@ void operator*=(FGMatrix &Left,FGMatrix &Right)
        double **prod;
 
                prod=alloc(Left.Rows(),Right.Cols());
-               for (int i=1;i<=Left.Rows();i++) {
-                       for (int j=1;j<=Right.Cols();j++) {
+               for (unsigned int i=1;i<=Left.Rows();i++) {
+                       for (unsigned int j=1;j<=Right.Cols();j++) {
        prod[i][j] = 0;
-                               for (int k=1;k<=Left.Cols();k++) {
+                               for (unsigned int k=1;k<=Left.Cols();k++) {
                prod[i][j]+=Left(i,k)*Right(k,j);
                                }
                        }
@@ -327,8 +327,8 @@ FGMatrix operator/(FGMatrix& A, double scalar)
 {
        FGMatrix Quot(A.Rows(),A.Cols());
        A.keep = true;
-       for (int i=1;i<=A.Rows();i++) {
-               for (int j=1;j<=A.Cols();j++)   {
+       for (unsigned int i=1;i<=A.Rows();i++) {
+               for (unsigned int j=1;j<=A.Cols();j++)  {
                Quot(i,j)=A(i,j)/scalar;
                }
        }
@@ -338,8 +338,8 @@ FGMatrix operator/(FGMatrix& A, double scalar)
 
 void operator/=(FGMatrix &A,double scalar)
 {
-       for (int i=1;i<=A.Rows();i++)   {
-               for (int j=1;j<=A.Cols();j++) {
+       for (unsigned int i=1;i<=A.Rows();i++)  {
+               for (unsigned int j=1;j<=A.Cols();j++) {
                        A(i,j)/=scalar;
                }
        }
@@ -357,8 +357,8 @@ void FGMatrix::T(void)
 
 void FGMatrix::TransposeSquare(void)
 {
-       for (int i=1;i<=rows;i++) {
-               for (int j=i+1;j<=cols;j++) {
+       for (unsigned int i=1;i<=rows;i++) {
+               for (unsigned int j=i+1;j<=cols;j++) {
                        double tmp=data[i][j];
                        data[i][j]=data[j][i];
                        data[j][i]=tmp;
@@ -372,8 +372,8 @@ void FGMatrix::TransposeNonSquare(void)
        double **tran;
 
        tran=alloc(rows,cols);
-       for (int i=1;i<=rows;i++) {
-               for (int j=1;j<=cols;j++) {
+       for (unsigned int i=1;i<=rows;i++) {
+               for (unsigned int j=1;j<=cols;j++) {
                        tran[j][i]=data[i][j];
                }
        }
index e7aa254c61601bb1d54d0739d4d51dc3b2c56b52..abf5bdcac32f70fa22355702a288d03f96790f15 100644 (file)
@@ -190,9 +190,9 @@ void FGOutput::DelimitedOutput(void)
     cout << "Latitude,";
     cout << "Longitude,";
     cout << "QBar,";
-    cout << "Alpha";
-    cout << "L";
-    cout << "M";
+    cout << "Alpha,";
+    cout << "L,";
+    cout << "M,";
     cout << "N";
     cout << endl;
     FirstPass = false;