1
0
Fork 0

Trimming in turn now works

This commit is contained in:
tony 2002-02-26 22:28:41 +00:00
parent 998c2a9325
commit 51587dbe75
3 changed files with 16 additions and 11 deletions

View file

@ -158,7 +158,7 @@ bool FGAircraft::Run(void)
float FGAircraft::GetNlf(void) float FGAircraft::GetNlf(void)
{ {
return vNwcg(3); return -1*Aerodynamics->GetvFs(3)/MassBalance->GetWeight();
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -832,12 +832,14 @@ void FGState::ReportState(void) {
Aircraft->GetNlf(), Aircraft->GetNlf(),
GetParameter(FG_PITCHRATE)*radtodeg ); GetParameter(FG_PITCHRATE)*radtodeg );
cout << out; cout << out;
snprintf(out,80, " Heading: %3.0f deg true Sideslip: %5.2f deg\n", snprintf(out,80, " Heading: %3.0f deg true Sideslip: %5.2f deg Yaw Rate: %5.2f deg/s\n",
Rotation->Getpsi()*radtodeg, Rotation->Getpsi()*radtodeg,
GetParameter(FG_BETA)*radtodeg ); GetParameter(FG_BETA)*radtodeg,
Rotation->GetPQR(3)*radtodeg );
cout << out; cout << out;
snprintf(out,80, " Bank Angle: %5.2f deg\n", snprintf(out,80, " Bank Angle: %5.2f deg Roll Rate: %5.2f deg/s\n",
Rotation->Getphi()*radtodeg ); Rotation->Getphi()*radtodeg,
Rotation->GetPQR(1)*radtodeg );
cout << out; cout << out;
snprintf(out,80, " Elevator: %5.2f deg Left Aileron: %5.2f deg Rudder: %5.2f deg\n", snprintf(out,80, " Elevator: %5.2f deg Left Aileron: %5.2f deg Rudder: %5.2f deg\n",
GetParameter(FG_ELEVATOR_POS)*radtodeg, GetParameter(FG_ELEVATOR_POS)*radtodeg,

View file

@ -118,9 +118,9 @@ FGTrim::FGTrim(FGFDMExec *FDMExec,FGInitialCondition *FGIC, TrimMode tt ) {
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tWdot,tAlpha )); 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,tUdot,tThrottle ));
TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim )); TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tQdot,tPitchTrim ));
//TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tVdot,tBeta )); TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tVdot,tBeta ));
//TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tAileron )); TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tPdot,tAileron ));
//TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder )); TrimAxes.push_back(new FGTrimAxis(fdmex,fgic,tRdot,tRudder ));
break; break;
case tCustom: case tCustom:
case tNone: case tNone:
@ -605,19 +605,22 @@ void FGTrim::setupPullup() {
void FGTrim::setupTurn(void){ void FGTrim::setupTurn(void){
double g,phi; double g,phi;
phi = fgic->GetRollAngleRadIC(); phi = fgic->GetRollAngleRadIC();
if( fabs(phi) > 0.01 && fabs(phi) < 1.56 ) { if( fabs(phi) > 0.001 && fabs(phi) < 1.56 ) {
targetNlf = 1 / cos(phi); targetNlf = 1 / cos(phi);
g = fdmex->GetInertial()->gravity(); g = fdmex->GetInertial()->gravity();
psidot = g*tan(phi) / fgic->GetVtrueFpsIC(); psidot = g*tan(phi) / fgic->GetUBodyFpsIC();
cout << targetNlf << ", " << psidot << endl; cout << targetNlf << ", " << psidot << endl;
} }
} }
void FGTrim::updateRates(void){ void FGTrim::updateRates(void){
if(mode == tTurn) { double phi = fgic->GetRollAngleRadIC();
double g = fdmex->GetInertial()->gravity();
if(fabs(phi) > 0.001 && fabs(phi) < 1.56 ) {
double p,q,r,theta,phi; double p,q,r,theta,phi;
theta=fgic->GetPitchAngleRadIC(); theta=fgic->GetPitchAngleRadIC();
phi=fgic->GetRollAngleRadIC(); phi=fgic->GetRollAngleRadIC();
psidot = g*tan(phi) / fgic->GetUBodyFpsIC();
p=-psidot*sin(theta); p=-psidot*sin(theta);
q=psidot*cos(theta)*sin(phi); q=psidot*cos(theta)*sin(phi);
r=psidot*cos(theta)*cos(phi); r=psidot*cos(theta)*cos(phi);