]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/FGInitialCondition.cpp
Initial revision.
[flightgear.git] / src / FDM / JSBSim / FGInitialCondition.cpp
index b407f0375fb9e5f96435d11b0d2603c545914a97..213a495f156804509cabac9cd5324a3318c1226a 100644 (file)
@@ -366,6 +366,8 @@ void FGInitialCondition::calcWindUVW(void) {
         wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2);
         weast=whead*sin(psi) + wcross*sin(psi+M_PI/2);
       break;
+      case setwned:
+      break;
     }    
     uw=wnorth*ctheta*cpsi +
        weast*ctheta*spsi -
@@ -536,7 +538,7 @@ bool FGInitialCondition::getTheta(void) {
 //******************************************************************************
 
 double FGInitialCondition::GammaEqOfTheta(double Theta) {
-  double a,b,c,d;
+  double a,b,c;
   double sTheta,cTheta;
 
   //theta=Theta; stheta=sin(theta); ctheta=cos(theta);
@@ -551,7 +553,7 @@ double FGInitialCondition::GammaEqOfTheta(double Theta) {
 //******************************************************************************
 
 double FGInitialCondition::GammaEqOfAlpha(double Alpha) {
-  double a,b,c,d;
+  double a,b,c;
   double sAlpha,cAlpha;
 
   sAlpha=sin(Alpha); cAlpha=cos(Alpha);
@@ -654,7 +656,7 @@ bool FGInitialCondition::solve(double *y,double x)
 
   //initializations
   d=1;
-
+  x2 = 0;
   x1=xlo;x3=xhi;
   f1=(this->*sfunc)(x1)-x;
   f3=(this->*sfunc)(x3)-x;
@@ -664,9 +666,8 @@ bool FGInitialCondition::solve(double *y,double x)
   i=0;
   while ((fabs(d) > eps) && (i < 100)) {
     d=(x3-x1)/d0;
-    if (f3-f1 != 0.0) x2 = x1-d*d0*f1/(f3-f1);
-    else              x2 = x1-d*d0*f1/0.01; // TONY: What is correct? This is a WAG.
-
+    x2 = x1-d*d0*f1/(f3-f1);
+    
     f2=(this->*sfunc)(x2)-x;
     //cout << "solve x1,x2,x3: " << x1 << "," << x2 << "," << x3 << endl;
     //cout << "                " << f1 << "," << f2 << "," << f3 << endl;
@@ -721,7 +722,10 @@ bool FGInitialCondition::Load(string acpath, string acname, string rstfile)
 # endif
 
   FGConfigFile resetfile(resetDef);
-  if (!resetfile.IsOpen()) return false;
+  if (!resetfile.IsOpen()) {
+    cerr << "Failed to open reset file: " << resetDef << endl;
+    return false;
+  }  
 
   resetfile.GetNextConfigLine();
   token = resetfile.GetValue();