1
0
Fork 0

Latest jsbsim updates.

This commit is contained in:
curt 2001-04-02 03:12:38 +00:00
parent 2aca8ca2cf
commit 94034c3081
15 changed files with 471 additions and 405 deletions

View file

@ -225,8 +225,8 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
ReadPrologue(&AC_cfg); ReadPrologue(&AC_cfg);
while ((AC_cfg.GetNextConfigLine() != "EOF") && while ((AC_cfg.GetNextConfigLine() != string("EOF")) &&
(token = AC_cfg.GetValue()) != "/FDM_CONFIG") { (token = AC_cfg.GetValue()) != string("/FDM_CONFIG")) {
if (token == "METRICS") { if (token == "METRICS") {
cout << fgcyan << "\n Reading Metrics" << fgdef << endl; cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
ReadMetrics(&AC_cfg); ReadMetrics(&AC_cfg);
@ -455,9 +455,9 @@ void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg) {
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/METRICS") { while ((token = AC_cfg->GetValue()) != string("/METRICS")) {
*AC_cfg >> parameter; *AC_cfg >> parameter;
if (parameter == "AC_WINGAREA") { if (parameter == string("AC_WINGAREA")) {
*AC_cfg >> WingArea; *AC_cfg >> WingArea;
cout << " WingArea: " << WingArea << endl; cout << " WingArea: " << WingArea << endl;
} else if (parameter == "AC_WINGSPAN") { } else if (parameter == "AC_WINGSPAN") {
@ -522,12 +522,12 @@ void FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg) {
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") { while ((token = AC_cfg->GetValue()) != string("/AERODYNAMICS")) {
if (token == "AXIS") { if (token == "AXIS") {
CoeffArray ca; CoeffArray ca;
axis = AC_cfg->GetValue("NAME"); axis = AC_cfg->GetValue("NAME");
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/AXIS") { while ((token = AC_cfg->GetValue()) != string("/AXIS")) {
ca.push_back(new FGCoefficient(FDMExec, AC_cfg)); ca.push_back(new FGCoefficient(FDMExec, AC_cfg));
DisplayCoeffFactors(ca.back()->Getmultipliers()); DisplayCoeffFactors(ca.back()->Getmultipliers());
} }
@ -544,7 +544,7 @@ void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg) {
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") { while ((token = AC_cfg->GetValue()) != string("/UNDERCARRIAGE")) {
lGear.push_back(FGLGear(AC_cfg, FDMExec)); lGear.push_back(FGLGear(AC_cfg, FDMExec));
} }
} }
@ -562,7 +562,7 @@ void FGAircraft::ReadOutput(FGConfigFile* AC_cfg) {
Output->SetType(token); Output->SetType(token);
AC_cfg->GetNextConfigLine(); AC_cfg->GetNextConfigLine();
while ((token = AC_cfg->GetValue()) != "/OUTPUT") { while ((token = AC_cfg->GetValue()) != string("/OUTPUT")) {
*AC_cfg >> parameter; *AC_cfg >> parameter;
if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate; if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate;
if (parameter == "SIMULATION") { if (parameter == "SIMULATION") {
@ -634,7 +634,7 @@ void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg) {
CFGVersion = AC_cfg->GetValue("VERSION"); CFGVersion = AC_cfg->GetValue("VERSION");
cout << " Version: " << highint << CFGVersion cout << " Version: " << highint << CFGVersion
<< normint << endl; << normint << endl;
if (CFGVersion != NEEDED_CFG_VERSION) { if (CFGVersion != string(NEEDED_CFG_VERSION)) {
cout << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT." cout << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
" RESULTS WILL BE UNPREDICTABLE !!" << endl; " RESULTS WILL BE UNPREDICTABLE !!" << endl;
cout << "Current version needed is: " << NEEDED_CFG_VERSION << endl; cout << "Current version needed is: " << NEEDED_CFG_VERSION << endl;

View file

@ -48,7 +48,11 @@ INCLUDES
#include "FGState.h" #include "FGState.h"
#include "FGFDMExec.h" #include "FGFDMExec.h"
#include <iomanip.h> #ifndef FGFS
# include <iomanip.h>
#else
# include STL_IOMANIP
#endif
static const char *IdSrc = "$Id$"; static const char *IdSrc = "$Id$";
static const char *IdHdr = "ID_COEFFICIENT"; static const char *IdHdr = "ID_COEFFICIENT";

View file

@ -53,8 +53,8 @@ FGControls::~FGControls() {
// $Log$ // $Log$
// Revision 1.22 2001/03/29 23:04:51 curt // Revision 1.23 2001/04/02 01:12:38 curt
// Latest round of JSBSim updates. // Latest jsbsim updates.
// //
// Revision 1.7 2001/03/22 14:10:24 jberndt // Revision 1.7 2001/03/22 14:10:24 jberndt
// Fixed ID comment // Fixed ID comment

View file

@ -178,8 +178,8 @@ extern FGControls controls;
// $Log$ // $Log$
// Revision 1.21 2001/03/29 23:04:51 curt // Revision 1.22 2001/04/02 01:12:38 curt
// Latest round of JSBSim updates. // Latest jsbsim updates.
// //
// Revision 1.10 2001/03/22 14:10:24 jberndt // Revision 1.10 2001/03/22 14:10:24 jberndt
// Fixed ID comment // Fixed ID comment

View file

@ -117,6 +117,7 @@ CLASS IMPLEMENTATION
FGFDMExec::FGFDMExec(void) FGFDMExec::FGFDMExec(void)
{ {
Frame = 0;
FirstModel = 0; FirstModel = 0;
Error = 0; Error = 0;
State = 0; State = 0;
@ -304,13 +305,16 @@ bool FGFDMExec::Run(void)
if (State->Getsim_time() >= EndTime) return false; if (State->Getsim_time() >= EndTime) return false;
} }
if (debug_lvl & 4) cout << "=========================" << endl; if (debug_lvl & 4)
cout << "================== Frame: " << Frame << " Time: "
<< State->Getsim_time() << endl;
while (!model_iterator->Run()) { while (!model_iterator->Run()) {
model_iterator = model_iterator->NextModel; model_iterator = model_iterator->NextModel;
if (model_iterator == 0L) break; if (model_iterator == 0L) break;
} }
Frame++;
State->IncrTime(); State->IncrTime();
return true; return true;

View file

@ -299,6 +299,7 @@ private:
bool frozen; bool frozen;
bool terminate; bool terminate;
int Error; int Error;
int Frame;
bool modelLoaded; bool modelLoaded;
bool Scripted; bool Scripted;

View file

@ -259,7 +259,7 @@ FGColumnVector FGLGear::Force(void)
switch (eSteerType) { switch (eSteerType) {
case stSteer: case stSteer:
SteerAngle = SteerGain*RudderPedal; SteerAngle = SteerGain*FCS->GetDrCmd();
break; break;
case stFixed: case stFixed:
SteerAngle = 0.0; SteerAngle = 0.0;
@ -322,7 +322,10 @@ FGColumnVector FGLGear::Force(void)
// Compute the forces in the wheel ground plane. // Compute the forces in the wheel ground plane.
RollingForce = vLocalForce(eZ) * BrakeFCoeff * fabs(RollingWhlVel)/RollingWhlVel; RollingForce = 0;
if(fabs(RollingWhlVel) > 1E-3) {
RollingForce = vLocalForce(eZ) * BrakeFCoeff * fabs(RollingWhlVel)/RollingWhlVel;
}
SideForce = vLocalForce(eZ) * FCoeff; SideForce = vLocalForce(eZ) * FCoeff;
// Transform these forces back to the local reference frame. // Transform these forces back to the local reference frame.

View file

@ -23,6 +23,12 @@ INCLUDES
#include <stdlib.h> #include <stdlib.h>
#ifdef FGFS #ifdef FGFS
# include <simgear/compiler.h> # include <simgear/compiler.h>
# include STL_STRING
SG_USING_STD(string);
SG_USING_STD(ostream);
SG_USING_STD(istream);
SG_USING_STD(cerr);
SG_USING_STD(endl);
# ifdef FG_HAVE_STD_INCLUDES # ifdef FG_HAVE_STD_INCLUDES
# include <fstream> # include <fstream>
# include <cmath> # include <cmath>
@ -36,9 +42,14 @@ INCLUDES
# include <fstream> # include <fstream>
# include <cmath> # include <cmath>
# include <iostream> # include <iostream>
# include <string>
using std::string;
using std::ostream;
using std::istream;
using std::cerr;
using std::endl;
#endif #endif
#include <string>
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS DEFINITIONS
@ -46,12 +57,6 @@ DEFINITIONS
#define ID_MATRIX "$Id$" #define ID_MATRIX "$Id$"
using std::string;
using std::ostream;
using std::istream;
using std::cerr;
using std::endl;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@ -155,38 +160,5 @@ private:
void Debug(void); void Debug(void);
}; };
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: FGMatrix3x3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGMatrix3x3 : public FGMatrix
{
public:
FGMatrix3x3(void) {FGMatrix(3,3);}
// ~FGMatrix3x3(void) {~FGMatrix();}
};
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: FGColumnVector4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGColumnVector4 : public FGColumnVector
{
public:
FGColumnVector4(void) {FGColumnVector(4);}
// ~FGColumnVector4(void) {~FGColumnVector();}
};
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: FGColumnVector3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGColumnVector3 : public FGColumnVector
{
public:
FGColumnVector3(void) {FGColumnVector(3);}
// ~FGColumnVector3(void) {~FGColumnVector();}
};
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif #endif

View file

@ -73,6 +73,8 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, FGConfigFile* Nzl_cfg) : FGThruster(FDMEx
} }
} }
Thrust = 0;
if (debug_lvl & 2) cout << "Instantiated: FGNozzle" << endl; if (debug_lvl & 2) cout << "Instantiated: FGNozzle" << endl;
} }
@ -87,7 +89,6 @@ FGNozzle::~FGNozzle()
float FGNozzle::Calculate(float CfPc) float FGNozzle::Calculate(float CfPc)
{ {
float Thrust;
float pAtm = fdmex->GetAtmosphere()->GetPressure(); float pAtm = fdmex->GetAtmosphere()->GetPressure();
Thrust = (CfPc + (PE - pAtm)*ExpR) * (Diameter / ExpR) * nzlEff; Thrust = (CfPc + (PE - pAtm)*ExpR) * (Diameter / ExpR) * nzlEff;

View file

@ -52,8 +52,8 @@ FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(e
string token; string token;
int rows, cols; int rows, cols;
PropName = Prop_cfg->GetValue("NAME"); Name = Prop_cfg->GetValue("NAME");
cout << "\n Propeller Name: " << PropName << endl; cout << "\n Propeller Name: " << Name << endl;
Prop_cfg->GetNextConfigLine(); Prop_cfg->GetNextConfigLine();
while (Prop_cfg->GetValue() != "/FG_PROPELLER") { while (Prop_cfg->GetValue() != "/FG_PROPELLER") {
*Prop_cfg >> token; *Prop_cfg >> token;

View file

@ -124,9 +124,6 @@ public:
/// Retrieves the propeller moment of inertia /// Retrieves the propeller moment of inertia
float GetIxx(void) { return Ixx; } float GetIxx(void) { return Ixx; }
/// Retrieves the Thrust in pounds
float GetThrust(void) { return Thrust; }
/// Retrieves the Torque in foot-pounds (Don't you love the English system?) /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
float GetTorque(void) { return Torque; } float GetTorque(void) { return Torque; }
@ -147,7 +144,6 @@ public:
float Calculate(float PowerAvailable); float Calculate(float PowerAvailable);
private: private:
string PropName;
int numBlades; int numBlades;
float RPM; float RPM;
float Ixx; float Ixx;
@ -155,7 +151,6 @@ private:
float MaxPitch; float MaxPitch;
float MinPitch; float MinPitch;
float Pitch; float Pitch;
float Thrust;
float Torque; float Torque;
FGTable *Efficiency; FGTable *Efficiency;
FGTable *cThrust; FGTable *cThrust;

View file

@ -285,6 +285,87 @@ bool FGPropulsion::LoadPropulsion(FGConfigFile* AC_cfg)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGPropulsion::GetPropulsionStrings(void)
{
string PropulsionStrings = "";
bool firstime = true;
for (unsigned int i=0;i<Engines.size();i++) {
if (!firstime) {
PropulsionStrings += ", ";
firstime = false;
}
/*
switch(Engines[i].GetType()) {
case etPiston:
PropulsionStrings += (Engines[i].GetName() + "_PwrAvail, ");
break;
case etRocket:
break;
case etTurboJet:
case etTurboProp:
case etTurboShaft:
break;
}
switch(Thrusters[i].GetType()) {
case ttNozzle:
PropulsionStrings += (Thrusters[i].GetName() + "_Thrust, ");
break;
case ttRotor:
break;
case ttPropeller:
break;
}
*/
}
return PropulsionStrings;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGPropulsion::GetPropulsionValues(void)
{
char buff[20];
string PropulsionValues = "";
bool firstime = true;
for (unsigned int i=0;i<Engines.size();i++) {
if (!firstime) {
PropulsionValues += ", ";
firstime = false;
}
/*
switch(Engines[i].GetType()) {
case etPiston:
PropulsionValues += (string(gcvt(Thrusters[i].GetPowerAvailable(), 10, buff)) + ", ");
break;
case etRocket:
break;
case etTurboJet:
case etTurboProp:
case etTurboShaft:
break;
}
switch(Thrusters[i].GetType()) {
case ttNozzle:
PropulsionValues += (string(gcvt(Thrusters[i].GetThrust(), 10, buff)) + ", ");
break;
case ttRotor:
break;
case ttPropeller:
break;
}
*/
}
return PropulsionValues;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropulsion::Debug(void) void FGPropulsion::Debug(void)
{ {
//TODO: Add your source code here //TODO: Add your source code here

View file

@ -157,6 +157,8 @@ public:
bool GetSteadyState(void); bool GetSteadyState(void);
string GetPropulsionStrings(void);
string GetPropulsionValues(void);
inline FGColumnVector& GetForces(void) {return *Forces; } inline FGColumnVector& GetForces(void) {return *Forces; }
inline FGColumnVector& GetMoments(void) {return *Moments;} inline FGColumnVector& GetMoments(void) {return *Moments;}

View file

@ -63,6 +63,7 @@ public:
void SetName(string name) {Name = name;} void SetName(string name) {Name = name;}
virtual float GetPowerRequired(void) {return 0.0;} virtual float GetPowerRequired(void) {return 0.0;}
virtual void SetdeltaT(float dt) {deltaT = dt;} virtual void SetdeltaT(float dt) {deltaT = dt;}
float GetThrust(void) {return Thrust;}
protected: protected:
string Name; string Name;

View file

@ -46,6 +46,9 @@ INCLUDES
#ifdef FGFS #ifdef FGFS
# include <simgear/compiler.h> # include <simgear/compiler.h>
# include STL_STRING
SG_USING_STD(cout);
SG_USING_STD(endl);
# ifdef FG_HAVE_STD_INCLUDES # ifdef FG_HAVE_STD_INCLUDES
# include <iostream> # include <iostream>
# include <fstream> # include <fstream>
@ -56,9 +59,11 @@ INCLUDES
#else #else
# include <iostream> # include <iostream>
# include <fstream> # include <fstream>
# include <string>
using std::cout;
using std::endl;
#endif #endif
#include <string>
#include <sys/types.h> #include <sys/types.h>
#if defined(__BORLANDC__) || defined(_MSC_VER) #if defined(__BORLANDC__) || defined(_MSC_VER)
@ -76,9 +81,6 @@ DEFINITIONS
#define ID_FDMSOCKET "$Id$" #define ID_FDMSOCKET "$Id$"
using std::cout;
using std::endl;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/