1
0
Fork 0

20000803 updates.

This commit is contained in:
curt 2000-08-04 03:20:09 +00:00
parent 8ec5fd715b
commit 120b26cc88
8 changed files with 33 additions and 22 deletions

View file

@ -160,7 +160,8 @@ int FGJSBsim::init( double dt ) {
FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing JSBSim" ); FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing JSBSim" );
copy_from_JSBsim(); copy_from_JSBsim();
return 1; return 1;
} }
@ -344,6 +345,12 @@ int FGJSBsim::copy_from_JSBsim() {
set_Euler_Angles( FDMExec.GetRotation()->Getphi(), set_Euler_Angles( FDMExec.GetRotation()->Getphi(),
FDMExec.GetRotation()->Gettht(), FDMExec.GetRotation()->Gettht(),
FDMExec.GetRotation()->Getpsi() ); FDMExec.GetRotation()->Getpsi() );
for(int i=0; i<3; i++ ) {
for (int j=0; j<3; j++ ) {
set_T_Local_to_Body(i,j,FDMExec.GetState()->GetTl2b()(i,j));
}
}
set_Alpha( FDMExec.GetTranslation()->Getalpha() ); set_Alpha( FDMExec.GetTranslation()->Getalpha() );
set_Beta( FDMExec.GetTranslation()->Getbeta() ); set_Beta( FDMExec.GetTranslation()->Getbeta() );
@ -365,7 +372,7 @@ int FGJSBsim::copy_from_JSBsim() {
set_Static_pressure( FDMExec.GetAtmosphere()->GetPressure() ); set_Static_pressure( FDMExec.GetAtmosphere()->GetPressure() );
set_Static_temperature ( FDMExec.GetAtmosphere()->GetTemperature() ); set_Static_temperature ( FDMExec.GetAtmosphere()->GetTemperature() );
set_Earth_position_angle( FDMExec.GetAuxiliary()->GetEarthPositionAngle() );
/* **FIXME*** */ set_Sea_level_radius( sl_radius2 * METER_TO_FEET ); /* **FIXME*** */ set_Sea_level_radius( sl_radius2 * METER_TO_FEET );
/* **FIXME*** */ set_Earth_position_angle( 0.0 ); /* **FIXME*** */ set_Earth_position_angle( 0.0 );

View file

@ -60,6 +60,7 @@ FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex) {
Name = "FGAuxiliary"; Name = "FGAuxiliary";
vcas = veas = mach = qbar = pt = 0; vcas = veas = mach = qbar = pt = 0;
psl = rhosl = 1; psl = rhosl = 1;
earthPosAngle = 0.0;
} }
@ -93,8 +94,10 @@ bool FGAuxiliary::Run() {
veas = sqrt(2*qbar/rhosl); veas = sqrt(2*qbar/rhosl);
vPilotAccel = Translation->GetUVWdot() + Aircraft->GetXYZep() * Rotation->GetPQRdot(); vPilotAccel = Translation->GetUVWdot() + Aircraft->GetXYZep() * Rotation->GetPQRdot();
earthPosAngle += State->Getdt()*OMEGA_EARTH;
} else { } else {
} }

View file

@ -65,6 +65,8 @@ public:
inline FGColumnVector GetPilotAccel(void) { return vPilotAccel; } inline FGColumnVector GetPilotAccel(void) { return vPilotAccel; }
inline FGColumnVector GetNpilot(void) { return vPilotAccel*INVGRAVITY; } inline FGColumnVector GetNpilot(void) { return vPilotAccel*INVGRAVITY; }
inline float GetEarthPositionAngle(void) { return earthPosAngle; }
protected: protected:
@ -83,6 +85,8 @@ private:
FGColumnVector vPilotAccel; FGColumnVector vPilotAccel;
float earthPosAngle;
void GetState(void); void GetState(void);
}; };

View file

@ -54,6 +54,7 @@ SENTRY
#define KTSTOFPS 1.68781 #define KTSTOFPS 1.68781
#define FPSTOKTS 0.592484 #define FPSTOKTS 0.592484
#define INCHTOFT 0.08333333 #define INCHTOFT 0.08333333
#define OMEGA_EARTH .00007272205217
#define NEEDED_CFG_VERSION "1.30" #define NEEDED_CFG_VERSION "1.30"
#define HPTOFTLBSSEC 550 #define HPTOFTLBSSEC 550

View file

@ -344,24 +344,22 @@ FGMatrix FGMatrix::operator/(const double scalar)
} }
} }
} else }
cerr << "Attempt to divide by zero in method FGMatrix::operator/(const double scalar), object at " << this << endl; return Quot;
return Quot;
} }
/******************************************************************************/ /******************************************************************************/
void FGMatrix::operator/=(const double scalar) void FGMatrix::operator/=(const double scalar)
{ {
if(scalar != 0) { if(scalar != 0) {
for (unsigned int i=1; i<=Rows(); i++) { for (unsigned int i=1; i<=Rows(); i++) {
for (unsigned int j=1; j<=Cols(); j++) { for (unsigned int j=1; j<=Cols(); j++) {
data[i][j]/=scalar; data[i][j]/=scalar;
} }
} }
} else }
cerr << "Attempt to divide by zero in method FGMatrix::operator/=(const double scalar), object " << this << endl;
} }
/******************************************************************************/ /******************************************************************************/
@ -521,15 +519,9 @@ FGColumnVector FGColumnVector::operator/(const double scalar)
{ {
FGColumnVector Quotient(Rows()); FGColumnVector Quotient(Rows());
if(scalar != 0) { if(scalar != 0) {
for (unsigned int i=1; i<=Rows(); i++) Quotient(i) = data[i][1] / scalar; for (unsigned int i=1; i<=Rows(); i++) Quotient(i) = data[i][1] / scalar;
}
} else
cerr << "Attempt to divide by zero in method FGColumnVector::operator/(const double scalar), object " << this << endl;
return Quotient; return Quotient;
} }
/******************************************************************************/ /******************************************************************************/

View file

@ -58,11 +58,12 @@ FGTank::FGTank(FGConfigFile* AC_cfg)
*AC_cfg >> Capacity; // pounds (amount it can hold) *AC_cfg >> Capacity; // pounds (amount it can hold)
*AC_cfg >> Contents; // pounds (amount it is holding) *AC_cfg >> Contents; // pounds (amount it is holding)
Selected = true; Selected = true;
if(Capacity != 0)
if (Capacity != 0) {
PctFull = 100.0*Contents/Capacity; // percent full; 0 to 100.0 PctFull = 100.0*Contents/Capacity; // percent full; 0 to 100.0
else { } else {
Contents=0; Contents = 0;
PctFull=0; PctFull = 0;
} }
} }

View file

@ -120,7 +120,7 @@ int main(int argc, char** argv)
float cmd = 0.0; float cmd = 0.0;
while (FDMExec->GetState()->Getsim_time() <= 145.0) while (FDMExec->GetState()->Getsim_time() <= 10.0)
{ {
// Fake an elevator ramp here after 1 second, hold for one second, ramp down // Fake an elevator ramp here after 1 second, hold for one second, ramp down
/* /*

View file

@ -637,6 +637,9 @@ public:
inline double get_T_local_to_body_33() const { inline double get_T_local_to_body_33() const {
return t_local_to_body_m[2][2]; return t_local_to_body_m[2][2];
} }
inline void set_T_Local_to_Body( int i, int j, double value) {
t_local_to_body_m[i-1][j-1] = value;
}
inline void set_T_Local_to_Body( double m[3][3] ) { inline void set_T_Local_to_Body( double m[3][3] ) {
int i, j; int i, j;
for ( i = 0; i < 3; i++ ) { for ( i = 0; i < 3; i++ ) {