]> git.mxchange.org Git - flightgear.git/commitdiff
Fixed the initialization process for JSBSim models: the error message "FGTrim::calcRo...
authorBertrand Coconnier <bcoconni@users.sourceforge.net>
Sat, 16 Jan 2016 18:32:50 +0000 (19:32 +0100)
committerBertrand Coconnier <bcoconni@users.sourceforge.net>
Sat, 16 Jan 2016 18:32:50 +0000 (19:32 +0100)
src/FDM/JSBSim/initialization/FGTrim.cpp
src/FDM/JSBSim/initialization/FGTrimAxis.cpp

index 526b81f22de4694a3ff882083191c7fc3b857055..9472400c92f3648749c1852fecfbdedf8563c910 100644 (file)
@@ -57,7 +57,7 @@ using namespace std;
 
 namespace JSBSim {
 
-IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.29 2015/12/13 08:19:57 bcoconni Exp $");
+IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.30 2015/12/29 13:44:39 ehofman Exp $");
 IDENT(IdHdr,ID_TRIM);
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -74,6 +74,7 @@ FGTrim::FGTrim(FGFDMExec *FDMExec,TrimMode tt)
 
   Debug=0;DebugLevel=0;
   fdmex=FDMExec;
+  fgic = *fdmex->GetIC();
   total_its=0;
   gamma_fallback=false;
   mode=tt;
@@ -196,7 +197,6 @@ bool FGTrim::DoTrim(void) {
   double aileron0 = FCS->GetDaCmd();
   double rudder0 = FCS->GetDrCmd();
   double PitchTrim0 = FCS->GetPitchTrimCmd();
-  fgic = *fdmex->GetIC();
 
   for(int i=0;i < fdmex->GetGroundReactions()->GetNumGearUnits();i++){
     fdmex->GetGroundReactions()->GetGearUnit(i)->SetReport(false);
@@ -210,6 +210,8 @@ bool FGTrim::DoTrim(void) {
   fgic.SetRRadpsIC(0.0);
 
   if (mode == tGround) {
+    fdmex->Initialize(&fgic);
+    fdmex->Run();
     trimOnGround();
     double theta = fgic.GetThetaRadIC();
     double phi = fgic.GetPhiRadIC();
@@ -790,7 +792,6 @@ void FGTrim::setDebug(FGTrimAxis& axis) {
 
 void FGTrim::SetMode(TrimMode tt) {
     ClearStates();
-    fdmex->GetPropagate()->SetInitialState(&fgic);
     mode=tt;
     switch(tt) {
       case tFull:
index 69a03ab4abd53bb91c162e4bd5603621af813116..d78e53d99c33eb58058d5b099e25e4b12697c58a 100644 (file)
@@ -126,17 +126,17 @@ FGTrimAxis::FGTrimAxis(FGFDMExec* fdex, FGInitialCondition* ic, State st,
   case tAltAGL:
     control_min=0;
     control_max=30;
-    control_value=fdmex->GetPropagate()->GetDistanceAGL();
+    control_value=ic->GetAltitudeAGLFtIC();
     solver_eps=tolerance/100;
     break;
   case tTheta:
-    control_min=fdmex->GetPropagate()->GetEuler(eTht) - 5*degtorad;
-    control_max=fdmex->GetPropagate()->GetEuler(eTht) + 5*degtorad;
+    control_min=ic->GetThetaRadIC() - 5*degtorad;
+    control_max=ic->GetThetaRadIC() + 5*degtorad;
     state_convert=radtodeg;
     break;
   case tPhi:
-    control_min=fdmex->GetPropagate()->GetEuler(ePhi) - 30*degtorad;
-    control_max=fdmex->GetPropagate()->GetEuler(ePhi) + 30*degtorad;
+    control_min=ic->GetPhiRadIC() - 30*degtorad;
+    control_max=ic->GetPhiRadIC() + 30*degtorad;
     state_convert=radtodeg;
     control_convert=radtodeg;
     break;
@@ -147,8 +147,8 @@ FGTrimAxis::FGTrimAxis(FGFDMExec* fdex, FGInitialCondition* ic, State st,
     control_convert=radtodeg;
     break;
   case tHeading:
-    control_min=fdmex->GetPropagate()->GetEuler(ePsi) - 30*degtorad;
-    control_max=fdmex->GetPropagate()->GetEuler(ePsi) + 30*degtorad;
+    control_min=ic->GetPsiRadIC() - 30*degtorad;
+    control_max=ic->GetPsiRadIC() + 30*degtorad;
     state_convert=radtodeg;
     break;
   }