Fixed the initialization process for JSBSim models: the error message "FGTrim::calcRotation DistPlane^2 larger than sqrRadius" should no longer be issued
This commit is contained in:
parent
4d2f9e7955
commit
f526dcdf3a
2 changed files with 11 additions and 10 deletions
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue