#include "FGTrim.h"
#include "FGAircraft.h"
#include "FGMassBalance.h"
+#include "FGGroundReactions.h"
+#include "FGInertial.h"
#include "FGAerodynamics.h"
#include "FGColumnVector3.h"
+
#if _MSC_VER
#pragma warning (disable : 4786 4788)
#endif
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_TRIM;
iAxes++;
}
TrimAxes.clear();
- cout << "TrimAxes.size(): " << TrimAxes.size() << endl;
+ //cout << "TrimAxes.size(): " << TrimAxes.size() << endl;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
fdmex->GetOutput()->Disable();
+
+ fgic->SetPRadpsIC(0.0);
+ fgic->SetQRadpsIC(0.0);
+ fgic->SetRRadpsIC(0.0);
//clear the sub iterations counts & zero out the controls
for(current_axis=0;current_axis<TrimAxes.size();current_axis++) {
//cout << current_axis << " " << TrimAxes[current_axis]->GetStateName()
//<< " " << TrimAxes[current_axis]->GetControlName()<< endl;
if(TrimAxes[current_axis]->GetStateType() == tQdot) {
- if(mode == tGround)
+ if(mode == tGround) {
TrimAxes[current_axis]->initTheta();
+ }
}
xlo=TrimAxes[current_axis]->GetControlMin();
xhi=TrimAxes[current_axis]->GetControlMax();
} while((axis_count < TrimAxes.size()) && (!trim_failed));
if((!trim_failed) && (axis_count >= TrimAxes.size())) {
total_its=N;
- cout << endl << " Trim successful" << endl;
+ if (debug_lvl > 0)
+ cout << endl << " Trim successful" << endl;
} else {
total_its=N;
- cout << endl << " Trim failed" << endl;
+ if (debug_lvl > 0)
+ cout << endl << " Trim failed" << endl;
}
for(i=0;i < fdmex->GetGroundReactions()->GetNumGearUnits();i++){
fdmex->GetGroundReactions()->GetGearUnit(i)->SetReport(true);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGTrim::setupPullup() {
- float g,q,cgamma;
- FGColumnVector3 vPQR;
+ double g,q,cgamma;
g=fdmex->GetInertial()->gravity();
cgamma=cos(fgic->GetFlightPathAngleRadIC());
cout << "setPitchRateInPullup(): " << g << ", " << cgamma << ", "
<< fgic->GetVtrueFpsIC() << endl;
q=g*(targetNlf-cgamma)/fgic->GetVtrueFpsIC();
cout << targetNlf << ", " << q << endl;
- fdmex->GetRotation()->SetPQR(0,q,0);
+ fgic->SetQRadpsIC(q);
cout << "setPitchRateInPullup() complete" << endl;
}
} else {
p=q=r=0;
}
- fdmex->GetRotation()->SetPQR(p,q,r);
+ fgic->SetPRadpsIC(p);
+ fgic->SetQRadpsIC(q);
+ fgic->SetRRadpsIC(r);
} else if( mode == tPullup && fabs(targetNlf-1) > 0.01) {
- float g,q,cgamma;
- FGColumnVector3 vPQR;
+ double g,q,cgamma;
g=fdmex->GetInertial()->gravity();
cgamma=cos(fgic->GetFlightPathAngleRadIC());
q=g*(targetNlf-cgamma)/fgic->GetVtrueFpsIC();
- fdmex->GetRotation()->SetPQR(0,q,0);
+ fgic->SetQRadpsIC(q);
}
}
void FGTrim::SetMode(TrimMode tt) {
ClearStates();
+ mode=tt;
switch(tt) {
case tFull:
- cout << " Full Trim" << endl;
+ if (debug_lvl > 0)
+ cout << " Full Trim" << endl;
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAlpha ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tUdot,tThrottle ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
break;
case tLongitudinal:
- cout << " Longitudinal Trim" << endl;
+ if (debug_lvl > 0)
+ cout << " Longitudinal Trim" << endl;
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAlpha ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tUdot,tThrottle ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
break;
case tGround:
- cout << " Ground Trim" << endl;
+ if (debug_lvl > 0)
+ cout << " Ground Trim" << endl;
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAltAGL ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tTheta ));
//TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tPhi ));
current_axis=0;
}
//YOU WERE WARNED, BUT YOU DID IT ANYWAY.
-
+}