20010710 sync with JSBSim.
This commit is contained in:
parent
968b9fcb9c
commit
96eff71a13
20 changed files with 105 additions and 101 deletions
|
@ -131,7 +131,7 @@ bool FGAerodynamics::Run(void)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGAerodynamics::LoadAerodynamics(FGConfigFile* AC_cfg)
|
||||
bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token, axis;
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
/** Loads the Aerodynamics model
|
||||
@return true if successful */
|
||||
bool LoadAerodynamics(FGConfigFile* AC_cfg);
|
||||
bool Load(FGConfigFile* AC_cfg);
|
||||
|
||||
/** Outputs coefficient information.
|
||||
Non-dimensionalizing parameter descriptions are output
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
FUNCTIONAL DESCRIPTION
|
||||
--------------------------------------------------------------------------------
|
||||
Models the aircraft reactions and forces. This class is instantiated by the
|
||||
FGFDMExec class and scheduled as an FDM entry. LoadAircraft() is supplied with a
|
||||
name of a valid, registered aircraft, and the data file is parsed.
|
||||
FGFDMExec class and scheduled as an FDM entry.
|
||||
|
||||
HISTORY
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -190,46 +189,32 @@ FGAircraft::~FGAircraft()
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string fname) {
|
||||
string path;
|
||||
string filename;
|
||||
string aircraftCfgFileName;
|
||||
bool FGAircraft::Load(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token;
|
||||
|
||||
AircraftPath = aircraft_path;
|
||||
EnginePath = engine_path;
|
||||
ReadPrologue(AC_cfg);
|
||||
|
||||
# ifndef macintosh
|
||||
aircraftCfgFileName = AircraftPath + "/" + fname + "/" + fname + ".xml";
|
||||
# else
|
||||
aircraftCfgFileName = AircraftPath + ";" + fname + ";" + fname + ".xml";
|
||||
# endif
|
||||
|
||||
FGConfigFile AC_cfg(aircraftCfgFileName);
|
||||
if (!AC_cfg.IsOpen()) return false;
|
||||
|
||||
ReadPrologue(&AC_cfg);
|
||||
|
||||
while ((AC_cfg.GetNextConfigLine() != "EOF") &&
|
||||
(token = AC_cfg.GetValue()) != "/FDM_CONFIG") {
|
||||
while ((AC_cfg->GetNextConfigLine() != "EOF") &&
|
||||
(token = AC_cfg->GetValue()) != "/FDM_CONFIG") {
|
||||
if (token == "METRICS") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
|
||||
ReadMetrics(&AC_cfg);
|
||||
ReadMetrics(AC_cfg);
|
||||
} else if (token == "AERODYNAMICS") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Aerodynamics" << fgdef << endl;
|
||||
ReadAerodynamics(&AC_cfg);
|
||||
ReadAerodynamics(AC_cfg);
|
||||
} else if (token == "UNDERCARRIAGE") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Landing Gear" << fgdef << endl;
|
||||
ReadUndercarriage(&AC_cfg);
|
||||
ReadUndercarriage(AC_cfg);
|
||||
} else if (token == "PROPULSION") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Propulsion" << fgdef << endl;
|
||||
ReadPropulsion(&AC_cfg);
|
||||
ReadPropulsion(AC_cfg);
|
||||
} else if (token == "FLIGHT_CONTROL") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Flight Control" << fgdef << endl;
|
||||
ReadFlightControls(&AC_cfg);
|
||||
ReadFlightControls(AC_cfg);
|
||||
} else if (token == "OUTPUT") {
|
||||
if (debug_lvl > 0) cout << fgcyan << "\n Reading Output directives" << fgdef << endl;
|
||||
ReadOutput(&AC_cfg);
|
||||
ReadOutput(AC_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,7 +360,7 @@ void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
|
|||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAircraft::ReadPropulsion(FGConfigFile* AC_cfg) {
|
||||
if (!Propulsion->LoadPropulsion(AC_cfg)) {
|
||||
if (!Propulsion->Load(AC_cfg)) {
|
||||
cerr << "Propulsion not successfully loaded" << endl;
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +368,7 @@ void FGAircraft::ReadPropulsion(FGConfigFile* AC_cfg) {
|
|||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
void FGAircraft::ReadFlightControls(FGConfigFile* AC_cfg) {
|
||||
if (!FCS->LoadFCS(AC_cfg)) {
|
||||
if (!FCS->Load(AC_cfg)) {
|
||||
cerr << "Flight Controls not successfully loaded" << endl;
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +377,7 @@ void FGAircraft::ReadFlightControls(FGConfigFile* AC_cfg) {
|
|||
|
||||
void FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg)
|
||||
{
|
||||
if (!Aerodynamics->LoadAerodynamics(AC_cfg)) {
|
||||
if (!Aerodynamics->Load(AC_cfg)) {
|
||||
cerr << "Aerodynamics not successfully loaded" << endl;
|
||||
}
|
||||
|
||||
|
|
|
@ -43,16 +43,13 @@ INCLUDES
|
|||
# ifdef SG_HAVE_STD_INCLUDES
|
||||
# include <vector>
|
||||
# include <iterator>
|
||||
# include <map>
|
||||
# else
|
||||
# include <vector.h>
|
||||
# include <iterator.h>
|
||||
# include <map.h>
|
||||
# endif
|
||||
#else
|
||||
# include <vector>
|
||||
# include <iterator>
|
||||
# include <map>
|
||||
#endif
|
||||
|
||||
#include "FGModel.h"
|
||||
|
@ -130,11 +127,9 @@ public:
|
|||
|
||||
/** Loads the aircraft.
|
||||
The executive calls this method to load the aircraft into JSBSim.
|
||||
@param apath path to the aircraft files (e.g. "aircraft/X15/")
|
||||
@param epath path to engine files (e.g. "engine/")
|
||||
@param acname name of aircraft (e.g. "X15")
|
||||
@return true if succesful */
|
||||
bool LoadAircraft(string apath, string epath, string acname);
|
||||
@param AC_cfg a pointer to the config file instance
|
||||
@return true if successful */
|
||||
bool Load(FGConfigFile* AC_cfg);
|
||||
|
||||
/** Gets the aircraft name
|
||||
@return the name of the aircraft as a string type */
|
||||
|
@ -217,8 +212,6 @@ private:
|
|||
|
||||
vector <FGLGear> lGear;
|
||||
|
||||
string AircraftPath;
|
||||
string EnginePath;
|
||||
void ReadMetrics(FGConfigFile*);
|
||||
void ReadPropulsion(FGConfigFile*);
|
||||
void ReadFlightControls(FGConfigFile*);
|
||||
|
|
|
@ -97,7 +97,18 @@ CLASS DECLARATION
|
|||
|
||||
class FGCoefficient
|
||||
{
|
||||
public:
|
||||
FGCoefficient(FGFDMExec*, FGConfigFile*);
|
||||
~FGCoefficient();
|
||||
|
||||
typedef vector <eParam> MultVec;
|
||||
float TotalValue(void);
|
||||
inline string Getname(void) {return name;}
|
||||
inline float GetSD(void) {return SD;}
|
||||
inline MultVec Getmultipliers(void) {return multipliers;}
|
||||
void DumpSD(void);
|
||||
|
||||
private:
|
||||
enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
|
||||
|
||||
int numInstances;
|
||||
|
@ -105,6 +116,9 @@ class FGCoefficient
|
|||
string description;
|
||||
string name;
|
||||
string method;
|
||||
float Value(float, float);
|
||||
float Value(float);
|
||||
float Value(void);
|
||||
float StaticValue;
|
||||
eParam LookupR, LookupC;
|
||||
MultVec multipliers;
|
||||
|
@ -124,19 +138,6 @@ class FGCoefficient
|
|||
FGAuxiliary* Auxiliary;
|
||||
FGOutput* Output;
|
||||
|
||||
public:
|
||||
FGCoefficient(FGFDMExec*, FGConfigFile*);
|
||||
~FGCoefficient();
|
||||
|
||||
float Value(float, float);
|
||||
float Value(float);
|
||||
float Value(void);
|
||||
float TotalValue(void);
|
||||
inline string Getname(void) {return name;}
|
||||
inline float GetSD(void) {return SD;}
|
||||
inline MultVec Getmultipliers(void) {return multipliers;}
|
||||
void DumpSD(void);
|
||||
private:
|
||||
void Debug(void);
|
||||
};
|
||||
|
||||
|
|
|
@ -134,12 +134,12 @@ void FGFCS::SetThrottlePos(int engineNum, float setting)
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGFCS::LoadFCS(FGConfigFile* AC_cfg)
|
||||
bool FGFCS::Load(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token;
|
||||
|
||||
FCSName = AC_cfg->GetValue("NAME");
|
||||
if (debug_lvl > 0) cout << " Control System Name: " << FCSName << endl;
|
||||
Name = AC_cfg->GetValue("NAME");
|
||||
if (debug_lvl > 0) cout << " Control System Name: " << Name << endl;
|
||||
AC_cfg->GetNextConfigLine();
|
||||
while ((token = AC_cfg->GetValue()) != "/FLIGHT_CONTROL") {
|
||||
if (token == "COMPONENT") {
|
||||
|
|
|
@ -350,11 +350,7 @@ public:
|
|||
the config file instance pointer. LoadFCS() is called from FGAircraft.
|
||||
@param AC_cfg pointer to the config file instance
|
||||
@return true if succesful */
|
||||
bool LoadFCS(FGConfigFile* AC_cfg);
|
||||
|
||||
/** The name of the flight control laws for this aircraft.
|
||||
This is given in the config file, and is not used for anything currently.*/
|
||||
string FCSName;
|
||||
bool Load(FGConfigFile* AC_cfg);
|
||||
|
||||
void AddThrottle(void);
|
||||
|
||||
|
|
|
@ -364,14 +364,26 @@ bool FGFDMExec::LoadModel(string APath, string EPath, string model)
|
|||
{
|
||||
bool result = false;
|
||||
|
||||
string aircraftCfgFileName;
|
||||
|
||||
AircraftPath = APath;
|
||||
EnginePath = EPath;
|
||||
|
||||
# ifndef macintosh
|
||||
aircraftCfgFileName = AircraftPath + "/" + model + "/" + model + ".xml";
|
||||
# else
|
||||
aircraftCfgFileName = AircraftPath + ";" + model + ";" + model + ".xml";
|
||||
# endif
|
||||
|
||||
FGConfigFile AC_cfg(aircraftCfgFileName);
|
||||
if (!AC_cfg.IsOpen()) return false;
|
||||
|
||||
if (modelLoaded) {
|
||||
DeAllocate();
|
||||
Allocate();
|
||||
}
|
||||
|
||||
AircraftPath = APath;
|
||||
EnginePath = EPath;
|
||||
result = Aircraft->LoadAircraft(AircraftPath, EnginePath, model);
|
||||
result = Aircraft->Load(&AC_cfg);
|
||||
|
||||
if (result) {
|
||||
modelLoaded = true;
|
||||
|
|
|
@ -66,9 +66,8 @@ bool FGGroundReactions:: Run(void) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGGroundReactions::LoadGroundReactions(FGConfigFile* AC_cfg)
|
||||
bool FGGroundReactions::Load(FGConfigFile* AC_cfg)
|
||||
{
|
||||
//
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
~FGGroundReactions();
|
||||
|
||||
bool Run(void);
|
||||
bool LoadGroundReactions(FGConfigFile* AC_cfg);
|
||||
bool Load(FGConfigFile* AC_cfg);
|
||||
|
||||
private:
|
||||
void Debug(void);
|
||||
|
|
|
@ -79,6 +79,7 @@ class FGRotation;
|
|||
class FGPosition;
|
||||
class FGAuxiliary;
|
||||
class FGOutput;
|
||||
class FGConfigFile;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||
|
@ -105,10 +106,15 @@ public:
|
|||
/// Destructor
|
||||
virtual ~FGModel();
|
||||
|
||||
/** Loads this model.
|
||||
@param Config a pointer to the config file instance
|
||||
@return true if model is successfully loaded*/
|
||||
virtual bool Load(FGConfigFile* Config) {}
|
||||
|
||||
FGModel* NextModel;
|
||||
string Name;
|
||||
|
||||
/** Runs the model; called by the Executive
|
||||
/** Runs the model; called by the Executive
|
||||
@see JSBSim.cpp documentation
|
||||
@return false if no error */
|
||||
virtual bool Run(void);
|
||||
|
|
|
@ -158,7 +158,8 @@ void FGOutput::DelimitedOutput(void)
|
|||
cout << ", ";
|
||||
cout << "QBar, ";
|
||||
cout << "Vtotal, ";
|
||||
cout << "U, V, W, ";
|
||||
cout << "UBody, VBody, WBody, ";
|
||||
cout << "UAero, VAero, WAero, ";
|
||||
cout << "Vn, Ve, Vd";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssForces) {
|
||||
|
@ -233,6 +234,7 @@ void FGOutput::DelimitedOutput(void)
|
|||
cout << Translation->Getqbar() << ", ";
|
||||
cout << Translation->GetVt() << ", ";
|
||||
cout << Translation->GetUVW() << ", ";
|
||||
cout << Translation->GetvAero() << ", ";
|
||||
cout << Position->GetVel();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssForces) {
|
||||
|
@ -312,7 +314,8 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
datafile << ", ";
|
||||
datafile << "QBar, ";
|
||||
datafile << "Vtotal, ";
|
||||
datafile << "U, V, W, ";
|
||||
datafile << "UBody, VBody, WBody, ";
|
||||
datafile << "UAero, VAero, WAero, ";
|
||||
datafile << "Vn, Ve, Vd";
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssForces) {
|
||||
|
@ -390,6 +393,7 @@ void FGOutput::DelimitedOutput(string fname)
|
|||
datafile << Translation->Getqbar() << ", ";
|
||||
datafile << Translation->GetVt() << ", ";
|
||||
datafile << Translation->GetUVW() << ", ";
|
||||
datafile << Translation->GetvAero() << ", ";
|
||||
datafile << Position->GetVel();
|
||||
}
|
||||
if (SubSystems & FGAircraft::ssForces) {
|
||||
|
@ -463,9 +467,12 @@ void FGOutput::SocketOutput(void)
|
|||
socket->Append("Psi");
|
||||
socket->Append("Rho");
|
||||
socket->Append("Vtotal");
|
||||
socket->Append("U");
|
||||
socket->Append("V");
|
||||
socket->Append("W");
|
||||
socket->Append("UBody");
|
||||
socket->Append("VBody");
|
||||
socket->Append("WBody");
|
||||
socket->Append("UAero");
|
||||
socket->Append("VAero");
|
||||
socket->Append("WAero");
|
||||
socket->Append("Vn");
|
||||
socket->Append("Ve");
|
||||
socket->Append("Vd");
|
||||
|
@ -504,9 +511,12 @@ void FGOutput::SocketOutput(void)
|
|||
socket->Append(Rotation->Getpsi());
|
||||
socket->Append(Atmosphere->GetDensity());
|
||||
socket->Append(Translation->GetVt());
|
||||
socket->Append(Translation->GetU());
|
||||
socket->Append(Translation->GetV());
|
||||
socket->Append(Translation->GetW());
|
||||
socket->Append(Translation->GetUVW(eU));
|
||||
socket->Append(Translation->GetUVW(eV));
|
||||
socket->Append(Translation->GetUVW(eW));
|
||||
socket->Append(Translation->GetvAero(eU));
|
||||
socket->Append(Translation->GetvAero(eV));
|
||||
socket->Append(Translation->GetvAero(eW));
|
||||
socket->Append(Position->GetVn());
|
||||
socket->Append(Position->GetVe());
|
||||
socket->Append(Position->GetVd());
|
||||
|
|
|
@ -93,7 +93,6 @@ extern double globalSceneryAltitude;
|
|||
extern double globalSeaLevelRadius;
|
||||
|
||||
FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex),
|
||||
vUVW(3),
|
||||
vVel(3),
|
||||
vVelDot(3),
|
||||
vRunwayNormal(3)
|
||||
|
@ -184,9 +183,8 @@ bool FGPosition:: Run(void) {
|
|||
void FGPosition::GetState(void) {
|
||||
dt = State->Getdt();
|
||||
|
||||
vUVW = Translation->GetUVW();
|
||||
Vt = Translation->GetVt();
|
||||
vVel = State->GetTb2l()*vUVW + Atmosphere->GetWindNED();
|
||||
vVel = State->GetTb2l() * Translation->GetUVW();
|
||||
vVelDot = State->GetTb2l() * Translation->GetUVWdot();
|
||||
|
||||
b = Aircraft->GetWingSpan();
|
||||
|
|
|
@ -83,7 +83,6 @@ public:
|
|||
|
||||
inline FGColumnVector GetVel(void) { return vVel; }
|
||||
inline FGColumnVector GetVelDot(void) { return vVelDot; }
|
||||
inline FGColumnVector GetUVW(void) { return vUVW; }
|
||||
inline double GetVn(void) { return vVel(eX); }
|
||||
inline double GetVe(void) { return vVel(eY); }
|
||||
inline double GetVd(void) { return vVel(eZ); }
|
||||
|
@ -115,7 +114,6 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
FGColumnVector vUVW;
|
||||
FGColumnVector vVel;
|
||||
FGColumnVector vVelDot;
|
||||
FGColumnVector vRunwayNormal;
|
||||
|
|
|
@ -140,7 +140,7 @@ FGPropeller::~FGPropeller()
|
|||
float FGPropeller::Calculate(float PowerAvailable)
|
||||
{
|
||||
float J, C_Thrust, omega;
|
||||
float Vel = (fdmex->GetTranslation()->GetUVW())(1);
|
||||
float Vel = (fdmex->GetTranslation()->GetvAero())(1);
|
||||
float rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
float RPS = RPM/60.0;
|
||||
|
||||
|
@ -175,7 +175,7 @@ float FGPropeller::GetPowerRequired(void)
|
|||
|
||||
float cPReq, RPS = RPM / 60.0;
|
||||
|
||||
float J = (fdmex->GetTranslation()->GetUVW())(1) / (Diameter * RPS);
|
||||
float J = (fdmex->GetTranslation()->GetvAero())(1) / (Diameter * RPS);
|
||||
float rho = fdmex->GetAtmosphere()->GetDensity();
|
||||
|
||||
if (MaxPitch == MinPitch) { // Fixed pitch prop
|
||||
|
|
|
@ -143,7 +143,7 @@ bool FGPropulsion::GetSteadyState(void) {
|
|||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
bool FGPropulsion::LoadPropulsion(FGConfigFile* AC_cfg)
|
||||
bool FGPropulsion::Load(FGConfigFile* AC_cfg)
|
||||
{
|
||||
string token, fullpath;
|
||||
string engineFileName, engType;
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
@param AC_cfg pointer to the config file instance that describes the
|
||||
aircraft being modeled.
|
||||
@return true if successfully loaded, otherwise false */
|
||||
bool LoadPropulsion(FGConfigFile* AC_cfg);
|
||||
bool Load(FGConfigFile* AC_cfg);
|
||||
|
||||
/// Retrieves the number of engines defined for the aircraft.
|
||||
inline unsigned int GetNumEngines(void) {return Engines.size();}
|
||||
|
|
|
@ -87,7 +87,8 @@ FGTranslation::FGTranslation(FGFDMExec* fdmex) : FGModel(fdmex),
|
|||
vForces(3),
|
||||
vEuler(3),
|
||||
vlastUVWdot(3),
|
||||
mVel(3,3)
|
||||
mVel(3,3),
|
||||
vAero(3)
|
||||
{
|
||||
Name = "FGTranslation";
|
||||
qbar = 0;
|
||||
|
@ -130,28 +131,29 @@ bool FGTranslation::Run(void) {
|
|||
vNcg = vUVWdot*INVGRAVITY;
|
||||
|
||||
vUVW += 0.5*dt*rate*(vlastUVWdot + vUVWdot);
|
||||
vAero = vUVW + State->GetTl2b()*Atmosphere->GetWindNED();
|
||||
|
||||
Vt = vUVW.Magnitude();
|
||||
Vt = vAero.Magnitude();
|
||||
|
||||
if (vUVW(eW) != 0.0)
|
||||
alpha = vUVW(eU)*vUVW(eU) > 0.0 ? atan2(vUVW(eW), vUVW(eU)) : 0.0;
|
||||
if (vUVW(eV) != 0.0)
|
||||
beta = vUVW(eU)*vUVW(eU)+vUVW(eW)*vUVW(eW) > 0.0 ? atan2(vUVW(eV),
|
||||
sqrt(vUVW(eU)*vUVW(eU) + vUVW(eW)*vUVW(eW))) : 0.0;
|
||||
if (vAero(eW) != 0.0)
|
||||
alpha = vAero(eU)*vAero(eU) > 0.0 ? atan2(vAero(eW), vAero(eU)) : 0.0;
|
||||
if (vAero(eV) != 0.0)
|
||||
beta = vAero(eU)*vAero(eU)+vAero(eW)*vAero(eW) > 0.0 ? atan2(vAero(eV),
|
||||
sqrt(vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW))) : 0.0;
|
||||
|
||||
// stolen, quite shamelessly, from LaRCsim
|
||||
float mUW = (vUVW(eU)*vUVW(eU) + vUVW(eW)*vUVW(eW));
|
||||
float mUW = (vAero(eU)*vAero(eU) + vAero(eW)*vAero(eW));
|
||||
float signU=1;
|
||||
if (vUVW(eU) != 0.0)
|
||||
signU = vUVW(eU)/fabs(vUVW(eU));
|
||||
if (vAero(eU) != 0.0)
|
||||
signU = vAero(eU)/fabs(vAero(eU));
|
||||
|
||||
if ( (mUW == 0.0) || (Vt == 0.0) ) {
|
||||
adot = 0.0;
|
||||
bdot = 0.0;
|
||||
} else {
|
||||
adot = (vUVW(eU)*vUVWdot(eW) - vUVW(eW)*vUVWdot(eU))/mUW;
|
||||
bdot = (signU*mUW*vUVWdot(eV) - vUVW(eV)*(vUVW(eU)*vUVWdot(eU)
|
||||
+ vUVW(eW)*vUVWdot(eW)))/(Vt*Vt*sqrt(mUW));
|
||||
adot = (vAero(eU)*vAero(eW) - vAero(eW)*vUVWdot(eU))/mUW;
|
||||
bdot = (signU*mUW*vUVWdot(eV) - vAero(eV)*(vAero(eU)*vUVWdot(eU)
|
||||
+ vAero(eW)*vUVWdot(eW)))/(Vt*Vt*sqrt(mUW));
|
||||
}
|
||||
|
||||
qbar = 0.5*rho*Vt*Vt;
|
||||
|
|
|
@ -87,6 +87,8 @@ public:
|
|||
inline float GetUVWdot(int idx) { return vUVWdot(idx); }
|
||||
inline FGColumnVector GetNcg (void) { return vNcg; }
|
||||
inline float GetNcg (int idx) { return vNcg(idx); }
|
||||
inline FGColumnVector GetvAero (void) { return vAero; }
|
||||
inline float GetvAero (int idx) { return vAero(idx); }
|
||||
|
||||
inline float Getalpha(void) { return alpha; }
|
||||
inline float Getbeta (void) { return beta; }
|
||||
|
@ -121,6 +123,7 @@ private:
|
|||
FGColumnVector vEuler;
|
||||
FGColumnVector vlastUVWdot;
|
||||
FGMatrix mVel;
|
||||
FGColumnVector vAero;
|
||||
|
||||
float Vt, qbar, Mach;
|
||||
float Mass, dt;
|
||||
|
|
|
@ -88,7 +88,7 @@ USEUNIT("FGNozzle.cpp");
|
|||
USEUNIT("FGOutput.cpp");
|
||||
USEUNIT("FGPiston.cpp");
|
||||
USEUNIT("FGPosition.cpp");
|
||||
USEUNIT("FGPropeller.cpp");
|
||||
USEUNIT("FGJSBBase.cpp");
|
||||
USEUNIT("FGPropulsion.cpp");
|
||||
USEUNIT("FGRocket.cpp");
|
||||
USEUNIT("FGRotation.cpp");
|
||||
|
@ -112,6 +112,7 @@ USEUNIT("filtersjb\FGGain.cpp");
|
|||
USEUNIT("filtersjb\FGGradient.cpp");
|
||||
USEUNIT("filtersjb\FGSummer.cpp");
|
||||
USEUNIT("filtersjb\FGDeadBand.cpp");
|
||||
USEUNIT("FGPropeller.cpp");
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue