Latest JSBSim changes, including SGI patch.
This commit is contained in:
parent
83711bfd82
commit
d3db1e622b
7 changed files with 379 additions and 192 deletions
|
@ -116,9 +116,14 @@ string FGGroundReactions::GetGroundReactionStrings(void)
|
|||
for (unsigned int i=0;i<lGear.size();i++) {
|
||||
if (!firstime) GroundReactionStrings += ", ";
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_WOW, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_compressLength, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_compressSpeed, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_Force");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_stroke, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_strokeVel, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_CompressForce, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_WhlSideForce, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_WhlRollForce, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_BodyXForce, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_BodyYForce, ");
|
||||
GroundReactionStrings += (lGear[i].GetName() + "_WhlSlipDegrees");
|
||||
|
||||
firstime = false;
|
||||
}
|
||||
|
@ -140,7 +145,12 @@ string FGGroundReactions::GetGroundReactionValues(void)
|
|||
GroundReactionValues += string( lGear[i].GetWOW()?"1":"0" ) + ", ";
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetCompLen(), 5, buff)) + ", ");
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetCompVel(), 6, buff)) + ", ");
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetCompForce(), 10, buff)));
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetCompForce(), 10, buff)) + ", ");
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetWheelSideForce(), 6, buff)) + ", ");
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetWheelRollForce(), 6, buff)) + ", ");
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetBodyXForce(), 6, buff)) + ", ");
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetBodyYForce(), 6, buff)) + ", ");
|
||||
GroundReactionValues += (string(gcvt(lGear[i].GetWheelSlipAngle(), 6, buff)));
|
||||
|
||||
firstime = false;
|
||||
}
|
||||
|
|
|
@ -256,6 +256,7 @@ public:
|
|||
@return pointer to a Message structure (or NULL if no mesage) */
|
||||
Message* ProcessMessage(void);
|
||||
//@}
|
||||
string GetVersion(void) {return JSBSim_version;}
|
||||
|
||||
protected:
|
||||
static Message localMsg;
|
||||
|
|
|
@ -181,6 +181,9 @@ FGLGear::~FGLGear()
|
|||
|
||||
FGColumnVector3& FGLGear::Force(void)
|
||||
{
|
||||
double SteerGain = 0;
|
||||
double SinWheel, CosWheel;
|
||||
|
||||
vForce.InitMatrix();
|
||||
vMoment.InitMatrix();
|
||||
|
||||
|
@ -201,10 +204,6 @@ FGColumnVector3& FGLGear::Force(void)
|
|||
}
|
||||
|
||||
if (GearDown) {
|
||||
double SteerGain = 0;
|
||||
double SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
|
||||
double RollingForce, SideForce, FCoeff;
|
||||
double WheelSlip;
|
||||
|
||||
vWhlBodyVec = (vXYZ - MassBalance->GetXYZcg()) / 12.0;
|
||||
vWhlBodyVec(eX) = -vWhlBodyVec(eX);
|
||||
|
|
|
@ -235,6 +235,11 @@ public:
|
|||
inline bool GetRetractable(void) { return isRetractable; }
|
||||
inline bool GetGearUnitUp(void) { return GearUp; }
|
||||
inline bool GetGearUnitDown(void) { return GearDown; }
|
||||
inline double GetWheelSideForce(void) { return SideForce; }
|
||||
inline double GetWheelRollForce(void) { return RollingForce; }
|
||||
inline double GetBodyXForce(void) { return vLocalForce(eX); }
|
||||
inline double GetBodyYForce(void) { return vLocalForce(eY); }
|
||||
inline double GetWheelSlipAngle(void) { return WheelSlip; }
|
||||
|
||||
private:
|
||||
FGColumnVector3 vXYZ;
|
||||
|
@ -258,6 +263,9 @@ private:
|
|||
double DistanceTraveled;
|
||||
double MaximumStrutForce;
|
||||
double MaximumStrutTravel;
|
||||
double SideWhlVel, RollingWhlVel;
|
||||
double RollingForce, SideForce, FCoeff;
|
||||
double WheelSlip;
|
||||
bool WOW;
|
||||
bool lastWOW;
|
||||
bool FirstContact;
|
||||
|
|
|
@ -211,7 +211,12 @@ void FGTable::Print(void)
|
|||
if (Type == tt1D) startRow = 1;
|
||||
else startRow = 0;
|
||||
|
||||
#if defined (sgi) && !defined(__GNUC__)
|
||||
unsigned long flags = cout.setf(ios::fixed);
|
||||
#else
|
||||
ios::fmtflags flags = cout.setf(ios::fixed); // set up output stream
|
||||
#endif
|
||||
|
||||
cout.precision(4);
|
||||
|
||||
for (int r=startRow; r<=nRows; r++) {
|
||||
|
|
|
@ -116,7 +116,8 @@ bool FGTranslation::Run(void)
|
|||
|
||||
vUVWdot = mVel*Rotation->GetPQR() + Aircraft->GetBodyAccel();
|
||||
|
||||
vUVW += Tc * (vlastUVWdot + vUVWdot);
|
||||
vUVW += Tc*(vUVWdot + vlastUVWdot);
|
||||
|
||||
vAeroUVW = vUVW + State->GetTl2b()*Atmosphere->GetWindNED();
|
||||
|
||||
Vt = vAeroUVW.Magnitude();
|
||||
|
|
|
@ -51,6 +51,7 @@ INCLUDES
|
|||
#include "FGOutput.h"
|
||||
#include "FGConfigFile.h"
|
||||
#include "FGScript.h"
|
||||
#include "FGJSBBase.h"
|
||||
|
||||
#ifdef FGFS
|
||||
#include <simgear/compiler.h>
|
||||
|
@ -63,6 +64,66 @@ INCLUDES
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if __BCPLUSPLUS__ == 0x540
|
||||
#pragma hdrstop
|
||||
#include <condefs.h>
|
||||
//---------------------------------------------------------------------------
|
||||
USERES("JSBSim.res");
|
||||
USEUNIT("FGUtility.cpp");
|
||||
USEUNIT("FGAircraft.cpp");
|
||||
USEUNIT("FGAtmosphere.cpp");
|
||||
USEUNIT("FGAuxiliary.cpp");
|
||||
USEUNIT("FGCoefficient.cpp");
|
||||
USEUNIT("FGColumnVector3.cpp");
|
||||
USEUNIT("FGColumnVector4.cpp");
|
||||
USEUNIT("FGConfigFile.cpp");
|
||||
USEUNIT("FGEngine.cpp");
|
||||
USEUNIT("FGFactorGroup.cpp");
|
||||
USEUNIT("FGFCS.cpp");
|
||||
USEUNIT("FGFDMExec.cpp");
|
||||
USEUNIT("FGfdmSocket.cpp");
|
||||
USEUNIT("FGForce.cpp");
|
||||
USEUNIT("FGGroundReactions.cpp");
|
||||
USEUNIT("FGInertial.cpp");
|
||||
USEUNIT("FGInitialCondition.cpp");
|
||||
USEUNIT("FGJSBBase.cpp");
|
||||
USEUNIT("FGLGear.cpp");
|
||||
USEUNIT("FGMassBalance.cpp");
|
||||
USEUNIT("FGMatrix33.cpp");
|
||||
USEUNIT("FGModel.cpp");
|
||||
USEUNIT("FGNozzle.cpp");
|
||||
USEUNIT("FGOutput.cpp");
|
||||
USEUNIT("FGPiston.cpp");
|
||||
USEUNIT("FGPosition.cpp");
|
||||
USEUNIT("FGPropeller.cpp");
|
||||
USEUNIT("FGPropulsion.cpp");
|
||||
USEUNIT("FGRocket.cpp");
|
||||
USEUNIT("FGRotation.cpp");
|
||||
USEUNIT("FGRotor.cpp");
|
||||
USEUNIT("FGScript.cpp");
|
||||
USEUNIT("FGState.cpp");
|
||||
USEUNIT("FGTable.cpp");
|
||||
USEUNIT("FGTank.cpp");
|
||||
USEUNIT("FGThruster.cpp");
|
||||
USEUNIT("FGTranslation.cpp");
|
||||
USEUNIT("FGTrim.cpp");
|
||||
USEUNIT("FGTrimAxis.cpp");
|
||||
USEUNIT("FGTurboJet.cpp");
|
||||
USEUNIT("FGTurboProp.cpp");
|
||||
USEUNIT("FGTurboShaft.cpp");
|
||||
USEUNIT("FGAerodynamics.cpp");
|
||||
USEUNIT("filtersjb\FGSwitch.cpp");
|
||||
USEUNIT("filtersjb\FGFCSComponent.cpp");
|
||||
USEUNIT("filtersjb\FGFilter.cpp");
|
||||
USEUNIT("filtersjb\FGGain.cpp");
|
||||
USEUNIT("filtersjb\FGGradient.cpp");
|
||||
USEUNIT("filtersjb\FGKinemat.cpp");
|
||||
USEUNIT("filtersjb\FGSummer.cpp");
|
||||
USEUNIT("filtersjb\FGDeadBand.cpp");
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma argsused
|
||||
#endif
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
DEFINITIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
@ -73,10 +134,23 @@ GLOBAL DATA
|
|||
|
||||
static const char *IdSrc = "$Id$";
|
||||
|
||||
string ScriptName;
|
||||
string AircraftName;
|
||||
string ResetName;
|
||||
string LogOutputName;
|
||||
string LogDirectiveName;
|
||||
FGFDMExec* FDMExec;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
FORWARD DECLARATIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
void options(int, char**);
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
DOCUMENTATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
@ -95,48 +169,48 @@ DOCUMENTATION
|
|||
IMPLEMENTATION
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
FGFDMExec* FDMExec;
|
||||
ScriptName = "";
|
||||
AircraftName = "";
|
||||
ResetName = "";
|
||||
LogOutputName = "";
|
||||
LogDirectiveName = "";
|
||||
bool result = false;
|
||||
bool Scripted = false;
|
||||
FGScript* Script;
|
||||
|
||||
if (argc != 3 && argc != 2) {
|
||||
cerr << endl
|
||||
<< " You must enter the name of a registered aircraft and reset point:"
|
||||
<< endl << endl << " FDM <aircraft name> <reset file>" << endl;
|
||||
cerr << endl << " Alternatively, you may specify only the name of a script file:"
|
||||
<< endl << endl << " FDM <script file>" << endl << endl;
|
||||
exit(0);
|
||||
}
|
||||
options(argc, argv);
|
||||
|
||||
FDMExec = new FGFDMExec();
|
||||
|
||||
if (argc == 2) { // SCRIPTED CASE
|
||||
if (!ScriptName.empty()) { // SCRIPTED CASE
|
||||
|
||||
Script = new FGScript(FDMExec);
|
||||
result = Script->LoadScript(argv[1]);
|
||||
result = Script->LoadScript(ScriptName);
|
||||
|
||||
if (!result) {
|
||||
cerr << "Script file " << argv[1] << " was not successfully loaded" << endl;
|
||||
cerr << "Script file " << ScriptName << " was not successfully loaded" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
Scripted = true;
|
||||
|
||||
} else { // form jsbsim <acname> <resetfile>
|
||||
} else if (!AircraftName.empty() || !ResetName.empty()) { // form jsbsim <acname> <resetfile>
|
||||
|
||||
if ( ! FDMExec->LoadModel("aircraft", "engine", string(argv[1]))) {
|
||||
if ( ! FDMExec->LoadModel("aircraft", "engine", AircraftName)) {
|
||||
cerr << " JSBSim could not be started" << endl << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
FGInitialCondition IC(FDMExec);
|
||||
if ( ! IC.Load("aircraft",string(argv[1]),string(argv[2]))) {
|
||||
if ( ! IC.Load("aircraft",AircraftName,ResetName)) {
|
||||
cerr << "Initialization unsuccessful" << endl;
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
cout << " No Aircraft, Script, or Reset information given" << endl << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -178,3 +252,92 @@ int main(int argc, char** argv)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void options(int count, char **arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (count == 1) {
|
||||
cout << endl << " JSBSim version " << FDMExec->GetVersion() << endl << endl;
|
||||
cout << " Usage: jsbsim <options>" << endl << endl;
|
||||
cout << " options:" << endl;
|
||||
cout << " --help returns this message" << endl;
|
||||
cout << " --version returns the version number" << endl;
|
||||
cout << " --outputlogfile=<filename> sets the name of the data output file" << endl;
|
||||
cout << " --logdirectivefile=<filename> specifies the name of the data logging directives file" << endl;
|
||||
cout << " --aircraft=<filename> specifies the name of the aircraft to be modeled" << endl;
|
||||
cout << " --script=<filename> specifies a script to run" << endl;
|
||||
cout << " --initfile=<filename> specifies an initilization file" << endl << endl;
|
||||
cout << " NOTE: There can be no spaces around the = sign when" << endl;
|
||||
cout << " an option is followed by a filename" << endl << endl;
|
||||
}
|
||||
|
||||
for (i=1; i<count; i++) {
|
||||
string argument = string(arg[i]);
|
||||
int n=0;
|
||||
if (argument.find("--help") != string::npos) {
|
||||
cout << endl << " JSBSim version " << FDMExec->GetVersion() << endl << endl;
|
||||
cout << " Usage: jsbsim <options>" << endl << endl;
|
||||
cout << " options:" << endl;
|
||||
cout << " --help returns this message" << endl;
|
||||
cout << " --version returns the version number" << endl;
|
||||
cout << " --outputlogfile=<filename> sets the name of the data output file" << endl;
|
||||
cout << " --logdirectivefile=<filename> specifies the name of the data logging directives file" << endl;
|
||||
cout << " --aircraft=<filename> specifies the name of the aircraft to be modeled" << endl;
|
||||
cout << " --script=<filename> specifies a script to run" << endl;
|
||||
cout << " --initfile=<filename> specifies an initilization file" << endl << endl;
|
||||
cout << " NOTE: There can be no spaces around the = sign when" << endl;
|
||||
cout << " an option is followed by a filename" << endl << endl;
|
||||
exit(0);
|
||||
} else if (argument.find("--version") != string::npos) {
|
||||
cout << endl << " JSBSim Version: " << FDMExec->GetVersion() << endl << endl;
|
||||
exit (0);
|
||||
} else if (argument.find("--outputlogfile") != string::npos) {
|
||||
n = argument.find("=")+1;
|
||||
if (n > 0) {
|
||||
LogOutputName = argument.substr(argument.find("=")+1);
|
||||
} else {
|
||||
LogOutputName = "JSBout.csv";
|
||||
cerr << " Output log file name not valid or not understood. Using JSBout.csv as default";
|
||||
}
|
||||
} else if (argument.find("--logdirectivefile") != string::npos) {
|
||||
n = argument.find("=")+1;
|
||||
if (n > 0) {
|
||||
LogDirectiveName = argument.substr(argument.find("=")+1);
|
||||
} else {
|
||||
cerr << " Log directives file not valid or not understood." << endl << endl;
|
||||
exit(1);
|
||||
}
|
||||
} else if (argument.find("--aircraft") != string::npos) {
|
||||
n = argument.find("=")+1;
|
||||
if (n > 0) {
|
||||
AircraftName = argument.substr(argument.find("=")+1);
|
||||
} else {
|
||||
cerr << " Aircraft name not valid or not understood." << endl << endl;
|
||||
exit(1);
|
||||
}
|
||||
} else if (argument.find("--script") != string::npos) {
|
||||
n = argument.find("=")+1;
|
||||
if (n > 0) {
|
||||
ScriptName = argument.substr(argument.find("=")+1);
|
||||
} else {
|
||||
cerr << " Script name not valid or not understood." << endl << endl;
|
||||
exit(1);
|
||||
}
|
||||
} else if (argument.find("--initfile") != string::npos) {
|
||||
n = argument.find("=")+1;
|
||||
if (n > 0) {
|
||||
ResetName = argument.substr(argument.find("=")+1);
|
||||
} else {
|
||||
cerr << " Reset name not valid or not understood." << endl << endl;
|
||||
exit(1);
|
||||
}
|
||||
} else {
|
||||
cerr << endl << " Parameter: " << argument << " not understood" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue