Syncing with most recent JSBSim.
This commit is contained in:
parent
53fdf0c25c
commit
6b2e17493e
28 changed files with 499 additions and 452 deletions
|
@ -263,7 +263,7 @@ bool FGJSBsim::update( int multiloop ) {
|
||||||
fdmex->Run();
|
fdmex->Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FGJSBBase::Message* msg;
|
FGJSBBase::Message* msg;
|
||||||
while (fdmex->ReadMessage()) {
|
while (fdmex->ReadMessage()) {
|
||||||
msg = fdmex->ProcessMessage();
|
msg = fdmex->ProcessMessage();
|
||||||
switch (msg->type) {
|
switch (msg->type) {
|
||||||
|
|
|
@ -48,12 +48,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGAerodynamics::FGAerodynamics(FGFDMExec* FDMExec) : FGModel(FDMExec),
|
FGAerodynamics::FGAerodynamics(FGFDMExec* FDMExec) : FGModel(FDMExec)
|
||||||
vFs(3),
|
|
||||||
vForces(3),
|
|
||||||
vMoments(3),
|
|
||||||
vLastFs(3),
|
|
||||||
vDXYZcg(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGAerodynamics";
|
Name = "FGAerodynamics";
|
||||||
|
|
||||||
|
|
|
@ -98,15 +98,7 @@ static const char *IdHdr = ID_AIRCRAFT;
|
||||||
CLASS IMPLEMENTATION
|
CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex),
|
FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
vMoments(3),
|
|
||||||
vForces(3),
|
|
||||||
vXYZrp(3),
|
|
||||||
vXYZep(3),
|
|
||||||
vDXYZcg(3),
|
|
||||||
vBodyAccel(3),
|
|
||||||
vNcg(3),
|
|
||||||
vNwcg(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGAircraft";
|
Name = "FGAircraft";
|
||||||
alphaclmin = alphaclmax = 0;
|
alphaclmin = alphaclmax = 0;
|
||||||
|
@ -237,8 +229,9 @@ bool FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
|
||||||
{
|
{
|
||||||
string token = "";
|
string token = "";
|
||||||
string parameter;
|
string parameter;
|
||||||
double EW, bixx, biyy, bizz, bixz, biyz;
|
double EW, bixx, biyy, bizz, bixy, bixz;
|
||||||
FGColumnVector3 vbaseXYZcg(3);
|
double pmWt, pmX, pmY, pmZ;
|
||||||
|
FGColumnVector3 vbaseXYZcg;
|
||||||
|
|
||||||
AC_cfg->GetNextConfigLine();
|
AC_cfg->GetNextConfigLine();
|
||||||
|
|
||||||
|
@ -280,14 +273,14 @@ bool FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
|
||||||
*AC_cfg >> bizz;
|
*AC_cfg >> bizz;
|
||||||
if (debug_lvl > 0) cout << " baseIzz: " << bizz << endl;
|
if (debug_lvl > 0) cout << " baseIzz: " << bizz << endl;
|
||||||
MassBalance->SetBaseIzz(bizz);
|
MassBalance->SetBaseIzz(bizz);
|
||||||
|
} else if (parameter == "AC_IXY") {
|
||||||
|
*AC_cfg >> bixy;
|
||||||
|
if (debug_lvl > 0) cout << " baseIxy: " << bixy << endl;
|
||||||
|
MassBalance->SetBaseIxy(bixy);
|
||||||
} else if (parameter == "AC_IXZ") {
|
} else if (parameter == "AC_IXZ") {
|
||||||
*AC_cfg >> bixz;
|
*AC_cfg >> bixz;
|
||||||
if (debug_lvl > 0) cout << " baseIxz: " << bixz << endl;
|
if (debug_lvl > 0) cout << " baseIxz: " << bixz << endl;
|
||||||
MassBalance->SetBaseIxz(bixz);
|
MassBalance->SetBaseIxz(bixz);
|
||||||
} else if (parameter == "AC_IYZ") {
|
|
||||||
*AC_cfg >> biyz;
|
|
||||||
if (debug_lvl > 0) cout << " baseIyz: " << biyz << endl;
|
|
||||||
MassBalance->SetBaseIyz(biyz);
|
|
||||||
} else if (parameter == "AC_EMPTYWT") {
|
} else if (parameter == "AC_EMPTYWT") {
|
||||||
*AC_cfg >> EW;
|
*AC_cfg >> EW;
|
||||||
MassBalance->SetEmptyWeight(EW);
|
MassBalance->SetEmptyWeight(EW);
|
||||||
|
@ -307,6 +300,11 @@ bool FGAircraft::ReadMetrics(FGConfigFile* AC_cfg)
|
||||||
if (debug_lvl > 0) cout << " Maximum Alpha: " << alphaclmax
|
if (debug_lvl > 0) cout << " Maximum Alpha: " << alphaclmax
|
||||||
<< " Minimum Alpha: " << alphaclmin
|
<< " Minimum Alpha: " << alphaclmin
|
||||||
<< endl;
|
<< endl;
|
||||||
|
} else if (parameter == "AC_POINTMASS") {
|
||||||
|
*AC_cfg >> pmWt >> pmX >> pmY >> pmZ;
|
||||||
|
if (debug_lvl > 0) cout << " Point Mass Object: " << pmWt << " lbs. at "
|
||||||
|
<< "X, Y, Z (in.): " << pmX << " " << pmY << " " << pmZ
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,15 +68,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex),
|
FGAtmosphere::FGAtmosphere(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
vDirectiondAccelDt(3),
|
|
||||||
vDirectionAccel(3),
|
|
||||||
vDirection(3),
|
|
||||||
vTurbulence(3),
|
|
||||||
vTurbulenceGrad(3),
|
|
||||||
vBodyTurbGrad(3),
|
|
||||||
vTurbPQR(3),
|
|
||||||
vWindNED(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGAtmosphere";
|
Name = "FGAtmosphere";
|
||||||
lastIndex=0;
|
lastIndex=0;
|
||||||
|
|
|
@ -63,9 +63,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex),
|
FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
vPilotAccel(3),
|
|
||||||
vToEyePt(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGAuxiliary";
|
Name = "FGAuxiliary";
|
||||||
vcas = veas = mach = qbar = pt = 0;
|
vcas = veas = mach = qbar = pt = 0;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
Module: FGMatrix33.cpp
|
Module: FGColumnVector3.cpp
|
||||||
Author: Originally by Tony Peden [formatted here (and broken??) by JSB]
|
Author: Originally by Tony Peden [formatted here (and broken??) by JSB]
|
||||||
Date started: 1998
|
Date started: 1998
|
||||||
Purpose: FGMatrix33 class
|
Purpose: FGColumnVector3 class
|
||||||
Called by: Various
|
Called by: Various
|
||||||
|
|
||||||
FUNCTIONAL DESCRIPTION
|
FUNCTIONAL DESCRIPTION
|
||||||
|
@ -19,8 +19,6 @@ INCLUDES
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#include "FGColumnVector3.h"
|
#include "FGColumnVector3.h"
|
||||||
#include "FGMatrix33.h"
|
|
||||||
|
|
||||||
|
|
||||||
static const char *IdSrc = "$Id$";
|
static const char *IdSrc = "$Id$";
|
||||||
static const char *IdHdr = ID_COLUMNVECTOR3;
|
static const char *IdHdr = ID_COLUMNVECTOR3;
|
||||||
|
@ -39,10 +37,10 @@ FGColumnVector3::FGColumnVector3(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGColumnVector3::FGColumnVector3(int m)
|
FGColumnVector3::FGColumnVector3(double X, double Y, double Z)
|
||||||
{
|
{
|
||||||
rowCtr = 1;
|
rowCtr = 1;
|
||||||
data[0]=0; data[1]=0; data[2]=0; data[3]=0;
|
data[0] = 0; data[eX] = X; data[eY] = Y; data[eZ] = Z;
|
||||||
|
|
||||||
if (debug_lvl & 2) cout << "Instantiated: FGColumnVector3" << endl;
|
if (debug_lvl & 2) cout << "Instantiated: FGColumnVector3" << endl;
|
||||||
}
|
}
|
||||||
|
@ -81,29 +79,6 @@ FGColumnVector3 FGColumnVector3::operator=(const FGColumnVector3& b)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
double& FGColumnVector3::operator()(int m) const
|
|
||||||
{
|
|
||||||
return data[m];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
/* FGColumnVector3 operator*(const FGMatrix33& Mat, FGColumnVector3& Col)
|
|
||||||
{
|
|
||||||
FGColumnVector3 Product;
|
|
||||||
|
|
||||||
Product(1) = Col(1)*Mat(1,1) + Col(2)*Mat(1,2) + Col(3)*Mat(1,3);
|
|
||||||
Product(2) = Col(1)*Mat(2,1) + Col(2)*Mat(2,2) + Col(3)*Mat(2,3);
|
|
||||||
Product(3) = Col(1)*Mat(3,1) + Col(2)*Mat(3,2) + Col(3)*Mat(3,3);
|
|
||||||
|
|
||||||
return Product;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGColumnVector3 FGColumnVector3::operator+(const FGColumnVector3& C)
|
FGColumnVector3 FGColumnVector3::operator+(const FGColumnVector3& C)
|
||||||
|
@ -292,13 +267,6 @@ FGColumnVector3 FGColumnVector3::multElementWise(const FGColumnVector3& V)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGColumnVector3::Debug(void)
|
|
||||||
{
|
|
||||||
//TODO: Add your source code here
|
|
||||||
}
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
ostream& operator<<(ostream& os, const FGColumnVector3& col)
|
ostream& operator<<(ostream& os, const FGColumnVector3& col)
|
||||||
{
|
{
|
||||||
os << col(1) << " , " << col(2) << " , " << col(3);
|
os << col(1) << " , " << col(2) << " , " << col(3);
|
||||||
|
@ -314,3 +282,11 @@ FGColumnVector3& FGColumnVector3::operator<<(const double ff)
|
||||||
rowCtr = 1;
|
rowCtr = 1;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void FGColumnVector3::Debug(void)
|
||||||
|
{
|
||||||
|
//TODO: Add your source code here
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
Header: FGMatrix33.h
|
Header: FGColumnVector3.h
|
||||||
Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
|
Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
|
||||||
Date started: Unknown
|
Date started: Unknown
|
||||||
|
|
||||||
HISTORY
|
HISTORY
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
??/??/?? TP Created
|
|
||||||
03/16/2000 JSB Added exception throwing
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
SENTRY
|
SENTRY
|
||||||
|
@ -54,7 +52,6 @@ INCLUDES
|
||||||
using std::string;
|
using std::string;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "FGMatrix33.h"
|
|
||||||
#include "FGJSBBase.h"
|
#include "FGJSBBase.h"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -67,8 +64,6 @@ DEFINITIONS
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
class FGMatrix33;
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DECLARATION: FGColumnVector3
|
DECLARATION: FGColumnVector3
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
@ -77,7 +72,7 @@ class FGColumnVector3 : public FGJSBBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGColumnVector3(void);
|
FGColumnVector3(void);
|
||||||
FGColumnVector3(int m);
|
FGColumnVector3(double X, double Y, double Z);
|
||||||
FGColumnVector3(const FGColumnVector3& b);
|
FGColumnVector3(const FGColumnVector3& b);
|
||||||
~FGColumnVector3(void);
|
~FGColumnVector3(void);
|
||||||
|
|
||||||
|
@ -104,7 +99,6 @@ public:
|
||||||
FGColumnVector3 Normalize(void);
|
FGColumnVector3 Normalize(void);
|
||||||
|
|
||||||
friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);
|
friend FGColumnVector3 operator*(const double scalar, const FGColumnVector3& A);
|
||||||
//friend FGColumnVector3 operator*(const FGMatrix33& M, FGColumnVector3& V);
|
|
||||||
|
|
||||||
friend ostream& operator<<(ostream& os, const FGColumnVector3& col);
|
friend ostream& operator<<(ostream& os, const FGColumnVector3& col);
|
||||||
|
|
||||||
|
|
|
@ -30,17 +30,18 @@ CLASS IMPLEMENTATION
|
||||||
FGColumnVector4::FGColumnVector4(void)
|
FGColumnVector4::FGColumnVector4(void)
|
||||||
{
|
{
|
||||||
rowCtr = 1;
|
rowCtr = 1;
|
||||||
//cout << "Allocated: " << data << endl;
|
data[1]=0;data[2]=0;data[3]=0;data[4]=0;
|
||||||
|
|
||||||
if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
|
if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGColumnVector4::FGColumnVector4(int m)
|
FGColumnVector4::FGColumnVector4(double A, double B, double C, double D)
|
||||||
{
|
{
|
||||||
rowCtr = 1;
|
rowCtr = 1;
|
||||||
data[1]=0;data[2]=0;data[3]=0;data[4]=0;
|
data[1]=0;data[2]=0;data[3]=0;data[4]=0;
|
||||||
//cout << "Allocated: " << data << endl;
|
|
||||||
if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
|
if (debug_lvl & 2) cout << "Instantiated: FGColumnVector4" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +49,6 @@ FGColumnVector4::FGColumnVector4(int m)
|
||||||
|
|
||||||
FGColumnVector4::~FGColumnVector4(void)
|
FGColumnVector4::~FGColumnVector4(void)
|
||||||
{
|
{
|
||||||
//cout << "Freed: " << data << endl;
|
|
||||||
if (debug_lvl & 2) cout << "Destroyed: FGColumnVector4" << endl;
|
if (debug_lvl & 2) cout << "Destroyed: FGColumnVector4" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,34 +240,6 @@ FGColumnVector4 FGColumnVector4::Normalize(void)
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
FGColumnVector4 FGColumnVector4::operator*(const FGColumnVector4& V)
|
|
||||||
{
|
|
||||||
FGColumnVector4 Product;
|
|
||||||
|
|
||||||
Product(1) = data[2] * V(3) - data[3] * V(2);
|
|
||||||
Product(2) = data[3] * V(1) - data[1] * V(3);
|
|
||||||
Product(3) = data[1] * V(2) - data[2] * V(1);
|
|
||||||
|
|
||||||
return Product;
|
|
||||||
} */
|
|
||||||
|
|
||||||
|
|
||||||
/* //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
void FGColumnVector4::operator*=(const FGColumnVector4& V)
|
|
||||||
{
|
|
||||||
double a,b,c;
|
|
||||||
a = data[1]; b=data[2]; c=data[3];
|
|
||||||
|
|
||||||
data[1] = b * V(3) - c * V(2);
|
|
||||||
data[2] = c * V(1) - a * V(3);
|
|
||||||
data[3] = a * V(2) - b * V(1);
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGColumnVector4 FGColumnVector4::multElementWise(const FGColumnVector4& V)
|
FGColumnVector4 FGColumnVector4::multElementWise(const FGColumnVector4& V)
|
||||||
|
@ -284,13 +256,6 @@ FGColumnVector4 FGColumnVector4::multElementWise(const FGColumnVector4& V)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGColumnVector4::Debug(void)
|
|
||||||
{
|
|
||||||
//TODO: Add your source code here
|
|
||||||
}
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
|
|
||||||
ostream& operator<<(ostream& os, FGColumnVector4& col)
|
ostream& operator<<(ostream& os, FGColumnVector4& col)
|
||||||
{
|
{
|
||||||
os << col(1) << " , " << col(2) << " , " << col(3) << " , " << col(4);
|
os << col(1) << " , " << col(2) << " , " << col(3) << " , " << col(4);
|
||||||
|
@ -302,8 +267,14 @@ ostream& operator<<(ostream& os, FGColumnVector4& col)
|
||||||
FGColumnVector4& FGColumnVector4::operator<<(const double ff)
|
FGColumnVector4& FGColumnVector4::operator<<(const double ff)
|
||||||
{
|
{
|
||||||
data[rowCtr] = ff;
|
data[rowCtr] = ff;
|
||||||
if (++rowCtr > 4 )
|
if (++rowCtr > 4) rowCtr = 1;
|
||||||
rowCtr = 1;
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void FGColumnVector4::Debug(void)
|
||||||
|
{
|
||||||
|
//TODO: Add your source code here
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
Header: FGMatrix33.h
|
Header: FGColumnVector4.h
|
||||||
Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
|
Author: Originally by Tony Peden [formatted and adapted here by Jon Berndt]
|
||||||
Date started: Unknown
|
Date started: Unknown
|
||||||
|
|
||||||
HISTORY
|
HISTORY
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
??/??/?? TP Created
|
|
||||||
03/16/2000 JSB Added exception throwing
|
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
SENTRY
|
SENTRY
|
||||||
|
@ -74,21 +72,19 @@ class FGColumnVector4 : public FGJSBBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FGColumnVector4(void);
|
FGColumnVector4(void);
|
||||||
FGColumnVector4(int m);
|
FGColumnVector4(double A, double B, double C, double D);
|
||||||
FGColumnVector4(const FGColumnVector4& b);
|
FGColumnVector4(const FGColumnVector4& b);
|
||||||
~FGColumnVector4(void);
|
~FGColumnVector4(void);
|
||||||
|
|
||||||
FGColumnVector4 operator=(const FGColumnVector4& b);
|
FGColumnVector4 operator=(const FGColumnVector4& b);
|
||||||
|
|
||||||
FGColumnVector4 operator*(const double scalar);
|
FGColumnVector4 operator*(const double scalar);
|
||||||
//FGColumnVector4 operator*(const FGColumnVector4& V); // Cross product operator
|
|
||||||
FGColumnVector4 operator/(const double scalar);
|
FGColumnVector4 operator/(const double scalar);
|
||||||
FGColumnVector4 operator+(const FGColumnVector4& B); // must not return reference
|
FGColumnVector4 operator+(const FGColumnVector4& B); // must not return reference
|
||||||
FGColumnVector4 operator-(const FGColumnVector4& B);
|
FGColumnVector4 operator-(const FGColumnVector4& B);
|
||||||
|
|
||||||
void operator-=(const FGColumnVector4 &B);
|
void operator-=(const FGColumnVector4 &B);
|
||||||
void operator+=(const FGColumnVector4 &B);
|
void operator+=(const FGColumnVector4 &B);
|
||||||
//void operator*=(const FGColumnVector4 &B);
|
|
||||||
void operator*=(const double scalar);
|
void operator*=(const double scalar);
|
||||||
void operator/=(const double scalar);
|
void operator/=(const double scalar);
|
||||||
|
|
||||||
|
@ -97,8 +93,8 @@ public:
|
||||||
|
|
||||||
FGColumnVector4& operator<<(const double ff);
|
FGColumnVector4& operator<<(const double ff);
|
||||||
|
|
||||||
inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; }
|
inline void InitMatrix(void) { data[1]=0; data[2]=0; data[3]=0; data[4]=0; }
|
||||||
inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; }
|
inline void InitMatrix(double ff) { data[1]=ff; data[2]=ff; data[3]=ff; data[4]=ff;}
|
||||||
|
|
||||||
double Magnitude(void);
|
double Magnitude(void);
|
||||||
FGColumnVector4 Normalize(void);
|
FGColumnVector4 Normalize(void);
|
||||||
|
@ -118,3 +114,4 @@ private:
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -583,8 +583,6 @@ bool FGFDMExec::LoadScript(string script)
|
||||||
cerr << "Aircraft file " << aircraft << " was not found" << endl;
|
cerr << "Aircraft file " << aircraft << " was not found" << endl;
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
if ( ! State->Reset("aircraft", aircraft, initialize))
|
|
||||||
State->Initialize(2000,0,0,0,0,0,0.5,0.5,40000,0,0,0);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -640,6 +638,7 @@ void FGFDMExec::RunScript(void)
|
||||||
iC->newValue[i] = iC->OriginalValue[i] + iC->SetValue[i];
|
iC->newValue[i] = iC->OriginalValue[i] + iC->SetValue[i];
|
||||||
break;
|
break;
|
||||||
case FG_BOOL:
|
case FG_BOOL:
|
||||||
|
iC->newValue[i] = iC->SetValue[i];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cerr << "Invalid Type specified" << endl;
|
cerr << "Invalid Type specified" << endl;
|
||||||
|
@ -651,7 +650,7 @@ void FGFDMExec::RunScript(void)
|
||||||
|
|
||||||
switch (iC->Action[i]) {
|
switch (iC->Action[i]) {
|
||||||
case FG_RAMP:
|
case FG_RAMP:
|
||||||
newSetValue = (currentTime - iC->StartTime[i])/(iC->TC[i])
|
newSetValue = (currentTime - iC->StartTime[i])/(iC->TC[i])
|
||||||
* (iC->newValue[i] - iC->OriginalValue[i]) + iC->OriginalValue[i];
|
* (iC->newValue[i] - iC->OriginalValue[i]) + iC->OriginalValue[i];
|
||||||
if (newSetValue > iC->newValue[i]) newSetValue = iC->newValue[i];
|
if (newSetValue > iC->newValue[i]) newSetValue = iC->newValue[i];
|
||||||
break;
|
break;
|
||||||
|
@ -667,9 +666,6 @@ void FGFDMExec::RunScript(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
State->SetParameter(iC->SetParam[i], newSetValue);
|
State->SetParameter(iC->SetParam[i], newSetValue);
|
||||||
if ((unsigned long int)Propulsion->GetTank(0) == 0) {
|
|
||||||
cout << "Param # getting set: " << iC->SetParam[i] << " Value: " << newSetValue << endl;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iC++;
|
iC++;
|
||||||
|
|
|
@ -294,18 +294,18 @@ private:
|
||||||
struct condition {
|
struct condition {
|
||||||
vector <eParam> TestParam;
|
vector <eParam> TestParam;
|
||||||
vector <eParam> SetParam;
|
vector <eParam> SetParam;
|
||||||
vector <double> TestValue;
|
vector <double> TestValue;
|
||||||
vector <double> SetValue;
|
vector <double> SetValue;
|
||||||
vector <string> Comparison;
|
vector <string> Comparison;
|
||||||
vector <double> TC;
|
vector <double> TC;
|
||||||
vector <bool> Persistent;
|
vector <bool> Persistent;
|
||||||
vector <eAction> Action;
|
vector <eAction> Action;
|
||||||
vector <eType> Type;
|
vector <eType> Type;
|
||||||
vector <bool> Triggered;
|
vector <bool> Triggered;
|
||||||
vector <double> newValue;
|
vector <double> newValue;
|
||||||
vector <double> OriginalValue;
|
vector <double> OriginalValue;
|
||||||
vector <double> StartTime;
|
vector <double> StartTime;
|
||||||
vector <double> EndTime;
|
vector <double> EndTime;
|
||||||
|
|
||||||
condition() {
|
condition() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,18 +54,8 @@ static const char *IdHdr = ID_FORCE;
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGForce::FGForce(FGFDMExec *FDMExec) :
|
FGForce::FGForce(FGFDMExec *FDMExec) :
|
||||||
ttype(tNone),
|
ttype(tNone),
|
||||||
fdmex(FDMExec),
|
fdmex(FDMExec)
|
||||||
vFn(3),
|
|
||||||
vMn(3),
|
|
||||||
vH(3),
|
|
||||||
vFb(3),
|
|
||||||
vM(3),
|
|
||||||
vXYZn(3),
|
|
||||||
vDXYZ(3),
|
|
||||||
vSense(3),
|
|
||||||
mT(3,3)
|
|
||||||
|
|
||||||
{
|
{
|
||||||
mT(1,1) = 1; //identity matrix
|
mT(1,1) = 1; //identity matrix
|
||||||
mT(2,2) = 1;
|
mT(2,2) = 1;
|
||||||
|
@ -83,15 +73,17 @@ FGForce::~FGForce()
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGColumnVector3& FGForce::GetBodyForces(void) {
|
FGColumnVector3& FGForce::GetBodyForces(void)
|
||||||
|
{
|
||||||
vFb = Transform()*(vFn.multElementWise(vSense));
|
vFb = Transform()*(vFn.multElementWise(vSense));
|
||||||
|
|
||||||
//find the distance from this vector's location to the cg
|
// Find the distance from this vector's acting location to the cg; this
|
||||||
//needs to be done like this to convert from structural to body coords
|
// needs to be done like this to convert from structural to body coords.
|
||||||
vDXYZ(1) = -(vXYZn(1) - fdmex->GetMassBalance()->GetXYZcg(1))*inchtoft;
|
// CG and RP values are in inches
|
||||||
vDXYZ(2) = (vXYZn(2) - fdmex->GetMassBalance()->GetXYZcg(2))*inchtoft; //cg and rp values are in inches
|
|
||||||
vDXYZ(3) = -(vXYZn(3) - fdmex->GetMassBalance()->GetXYZcg(3))*inchtoft;
|
vDXYZ(eX) = -(vActingXYZn(eX) - fdmex->GetMassBalance()->GetXYZcg(eX))*inchtoft;
|
||||||
|
vDXYZ(eY) = (vActingXYZn(eY) - fdmex->GetMassBalance()->GetXYZcg(eY))*inchtoft;
|
||||||
|
vDXYZ(eZ) = -(vActingXYZn(eZ) - fdmex->GetMassBalance()->GetXYZcg(eZ))*inchtoft;
|
||||||
|
|
||||||
vM = vMn + vDXYZ*vFb;
|
vM = vMn + vDXYZ*vFb;
|
||||||
|
|
||||||
|
@ -100,7 +92,8 @@ FGColumnVector3& FGForce::GetBodyForces(void) {
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGMatrix33 FGForce::Transform(void) {
|
FGMatrix33 FGForce::Transform(void)
|
||||||
|
{
|
||||||
switch(ttype) {
|
switch(ttype) {
|
||||||
case tWindBody:
|
case tWindBody:
|
||||||
return fdmex->GetState()->GetTs2b();
|
return fdmex->GetState()->GetTs2b();
|
||||||
|
@ -118,9 +111,9 @@ FGMatrix33 FGForce::Transform(void) {
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGForce::SetAnglesToBody(double broll, double bpitch, double byaw) {
|
void FGForce::SetAnglesToBody(double broll, double bpitch, double byaw)
|
||||||
|
{
|
||||||
if(ttype == tCustom) {
|
if (ttype == tCustom) {
|
||||||
double cp,sp,cr,sr,cy,sy;
|
double cp,sp,cr,sr,cy,sy;
|
||||||
|
|
||||||
cp=cos(bpitch); sp=sin(bpitch);
|
cp=cos(bpitch); sp=sin(bpitch);
|
||||||
|
@ -139,7 +132,6 @@ void FGForce::SetAnglesToBody(double broll, double bpitch, double byaw) {
|
||||||
mT(3,2)=cr*sp*sy-sr*cy;
|
mT(3,2)=cr*sp*sy-sr*cy;
|
||||||
mT(3,3)=cr*cp;
|
mT(3,3)=cr*cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -244,27 +244,49 @@ public:
|
||||||
inline FGColumnVector3& GetNativeForces(void) { return vFn; }
|
inline FGColumnVector3& GetNativeForces(void) { return vFn; }
|
||||||
inline FGColumnVector3& GetNativeMoments(void) { return vMn; }
|
inline FGColumnVector3& GetNativeMoments(void) { return vMn; }
|
||||||
|
|
||||||
|
|
||||||
FGColumnVector3& GetBodyForces(void);
|
FGColumnVector3& GetBodyForces(void);
|
||||||
|
|
||||||
inline FGColumnVector3& GetMoments(void) { return vM; }
|
inline FGColumnVector3& GetMoments(void) { return vM; }
|
||||||
|
|
||||||
//point of application, JSBsim structural coords
|
// Normal point of application, JSBsim structural coords
|
||||||
//(inches, x +back, y +right, z +up)
|
// (inches, x +back, y +right, z +up)
|
||||||
inline void SetLocation(double x, double y, double z) {
|
inline void SetLocation(double x, double y, double z) {
|
||||||
vXYZn(1) = x;
|
vXYZn(eX) = x;
|
||||||
vXYZn(2) = y;
|
vXYZn(eY) = y;
|
||||||
vXYZn(3) = z;
|
vXYZn(eZ) = z;
|
||||||
|
SetActingLocation(x, y, z);
|
||||||
}
|
}
|
||||||
inline void SetLocationX(double x) {vXYZn(1) = x;}
|
|
||||||
inline void SetLocationY(double y) {vXYZn(2) = y;}
|
|
||||||
inline void SetLocationZ(double z) {vXYZn(3) = z;}
|
|
||||||
inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; }
|
|
||||||
|
|
||||||
inline double GetLocationX( void ) { return vXYZn(1);}
|
/** Acting point of application.
|
||||||
inline double GetLocationY( void ) { return vXYZn(2);}
|
JSBsim structural coords used (inches, x +back, y +right, z +up).
|
||||||
inline double GetLocationZ( void ) { return vXYZn(3);}
|
This function sets the point at which the force acts - this may
|
||||||
|
not be the same as where the object resides. One area where this
|
||||||
|
is true is P-Factor modeling.
|
||||||
|
@param x acting location of force
|
||||||
|
@param y acting location of force
|
||||||
|
@param z acting location of force */
|
||||||
|
inline void SetActingLocation(double x, double y, double z) {
|
||||||
|
vActingXYZn(eX) = x;
|
||||||
|
vActingXYZn(eY) = y;
|
||||||
|
vActingXYZn(eZ) = z;
|
||||||
|
}
|
||||||
|
inline void SetLocationX(double x) {vXYZn(eX) = x; vActingXYZn(eX) = x;}
|
||||||
|
inline void SetLocationY(double y) {vXYZn(eY) = y; vActingXYZn(eY) = y;}
|
||||||
|
inline void SetLocationZ(double z) {vXYZn(eZ) = z; vActingXYZn(eZ) = z;}
|
||||||
|
inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;}
|
||||||
|
inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;}
|
||||||
|
inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;}
|
||||||
|
inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; SetActingLocation(vv);}
|
||||||
|
inline void SetActingLocation(FGColumnVector3 vv) { vActingXYZn = vv; }
|
||||||
|
|
||||||
|
inline double GetLocationX( void ) { return vXYZn(eX);}
|
||||||
|
inline double GetLocationY( void ) { return vXYZn(eY);}
|
||||||
|
inline double GetLocationZ( void ) { return vXYZn(eZ);}
|
||||||
|
inline double GetActingLocationX( void ) { return vActingXYZn(eX);}
|
||||||
|
inline double GetActingLocationY( void ) { return vActingXYZn(eY);}
|
||||||
|
inline double GetActingLocationZ( void ) { return vActingXYZn(eZ);}
|
||||||
FGColumnVector3& GetLocation(void) { return vXYZn; }
|
FGColumnVector3& GetLocation(void) { return vXYZn; }
|
||||||
|
FGColumnVector3& GetActingLocation(void) { return vActingXYZn; }
|
||||||
|
|
||||||
//these angles are relative to body axes, not earth!!!!!
|
//these angles are relative to body axes, not earth!!!!!
|
||||||
//I'm using these because pitch, roll, and yaw are easy to visualize,
|
//I'm using these because pitch, roll, and yaw are easy to visualize,
|
||||||
|
@ -274,9 +296,11 @@ public:
|
||||||
//They are in radians.
|
//They are in radians.
|
||||||
|
|
||||||
void SetAnglesToBody(double broll, double bpitch, double byaw);
|
void SetAnglesToBody(double broll, double bpitch, double byaw);
|
||||||
inline void SetAnglesToBody(FGColumnVector3 vv) { SetAnglesToBody(vv(1), vv(2), vv(3));}
|
inline void SetAnglesToBody(FGColumnVector3 vv) {
|
||||||
|
SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw));
|
||||||
|
}
|
||||||
|
|
||||||
inline void SetSense(double x, double y, double z) { vSense(1)=x, vSense(2)=y, vSense(3)=z; }
|
inline void SetSense(double x, double y, double z) { vSense(eX)=x, vSense(eY)=y, vSense(eZ)=z; }
|
||||||
inline void SetSense(FGColumnVector3 vv) { vSense=vv; }
|
inline void SetSense(FGColumnVector3 vv) { vSense=vv; }
|
||||||
|
|
||||||
inline FGColumnVector3& GetSense(void) { return vSense; }
|
inline FGColumnVector3& GetSense(void) { return vSense; }
|
||||||
|
@ -298,6 +322,7 @@ private:
|
||||||
FGColumnVector3 vFb;
|
FGColumnVector3 vFb;
|
||||||
FGColumnVector3 vM;
|
FGColumnVector3 vM;
|
||||||
FGColumnVector3 vXYZn;
|
FGColumnVector3 vXYZn;
|
||||||
|
FGColumnVector3 vActingXYZn;
|
||||||
FGColumnVector3 vDXYZ;
|
FGColumnVector3 vDXYZ;
|
||||||
FGColumnVector3 vSense;
|
FGColumnVector3 vSense;
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGGroundReactions::FGGroundReactions(FGFDMExec* fgex) : FGModel(fgex),
|
FGGroundReactions::FGGroundReactions(FGFDMExec* fgex) : FGModel(fgex)
|
||||||
vForces(3),
|
|
||||||
vMoments(3),
|
|
||||||
vMaxStaticGrip(3),
|
|
||||||
vMaxMomentResist(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGGroundReactions";
|
Name = "FGGroundReactions";
|
||||||
|
|
||||||
|
|
|
@ -47,11 +47,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGInertial::FGInertial(FGFDMExec* fgex) : FGModel(fgex),
|
FGInertial::FGInertial(FGFDMExec* fgex) : FGModel(fgex)
|
||||||
vOmegaLocal(3),
|
|
||||||
vForces(3),
|
|
||||||
vRadius(3),
|
|
||||||
vGravity(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGInertial";
|
Name = "FGInertial";
|
||||||
|
|
||||||
|
|
|
@ -57,13 +57,7 @@ static const char *IdHdr = ID_LGEAR;
|
||||||
CLASS IMPLEMENTATION
|
CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : vXYZ(3),
|
FGLGear::FGLGear(FGConfigFile* AC_cfg, FGFDMExec* fdmex) : Exec(fdmex)
|
||||||
vMoment(3),
|
|
||||||
vWhlBodyVec(3),
|
|
||||||
vForce(3),
|
|
||||||
vLocalForce(3),
|
|
||||||
vWhlVelVec(3),
|
|
||||||
Exec(fdmex)
|
|
||||||
{
|
{
|
||||||
string tmp;
|
string tmp;
|
||||||
string Retractable;
|
string Retractable;
|
||||||
|
@ -202,19 +196,24 @@ FGColumnVector3& FGLGear::Force(void)
|
||||||
{
|
{
|
||||||
vForce.InitMatrix();
|
vForce.InitMatrix();
|
||||||
vMoment.InitMatrix();
|
vMoment.InitMatrix();
|
||||||
if(isRetractable ) {
|
|
||||||
if( FCS->GetGearPos() < 0.01 ) {
|
if (isRetractable) {
|
||||||
GearUp=true;GearDown=false;
|
if (FCS->GetGearPos() < 0.01) {
|
||||||
} else if(FCS->GetGearPos() > 0.99) {
|
GearUp = true;
|
||||||
GearDown=true;GearUp=false;
|
GearDown = false;
|
||||||
|
} else if (FCS->GetGearPos() > 0.99) {
|
||||||
|
GearDown = true;
|
||||||
|
GearUp = false;
|
||||||
} else {
|
} else {
|
||||||
GearUp=false; GearDown=false;
|
GearUp = false;
|
||||||
|
GearDown = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GearUp=false; GearDown=true;
|
GearUp = false;
|
||||||
|
GearDown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GearDown ) {
|
if (GearDown) {
|
||||||
double SteerGain = 0;
|
double SteerGain = 0;
|
||||||
double SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
|
double SinWheel, CosWheel, SideWhlVel, RollingWhlVel;
|
||||||
double RollingForce, SideForce, FCoeff;
|
double RollingForce, SideForce, FCoeff;
|
||||||
|
|
|
@ -68,20 +68,22 @@ bool FGMassBalance::Run(void)
|
||||||
{
|
{
|
||||||
if (!FGModel::Run()) {
|
if (!FGModel::Run()) {
|
||||||
|
|
||||||
Weight = EmptyWeight + Propulsion->GetTanksWeight();
|
Weight = EmptyWeight + Propulsion->GetTanksWeight() + GetPointMassWeight();
|
||||||
|
|
||||||
Mass = Weight / Inertial->gravity();
|
Mass = Weight / Inertial->gravity();
|
||||||
|
|
||||||
// Calculate new CG here.
|
// Calculate new CG here.
|
||||||
|
|
||||||
vXYZcg = (Propulsion->GetTanksCG() + EmptyWeight*vbaseXYZcg) / Weight;
|
vXYZcg = (Propulsion->GetTanksCG() + EmptyWeight*vbaseXYZcg
|
||||||
|
+ GetPointMassCG() ) / Weight;
|
||||||
|
|
||||||
// Calculate new moments of inertia here
|
// Calculate new moments of inertia here
|
||||||
|
|
||||||
Ixx = baseIxx + Propulsion->GetTanksIxx(vXYZcg);
|
Ixx = baseIxx + Propulsion->GetTanksIxx(vXYZcg) + GetPMIxx();
|
||||||
Iyy = baseIyy + Propulsion->GetTanksIyy(vXYZcg);
|
Iyy = baseIyy + Propulsion->GetTanksIyy(vXYZcg) + GetPMIyy();
|
||||||
Izz = baseIzz + Propulsion->GetTanksIzz(vXYZcg);
|
Izz = baseIzz + Propulsion->GetTanksIzz(vXYZcg) + GetPMIzz();
|
||||||
Ixz = baseIxz + Propulsion->GetTanksIxz(vXYZcg);
|
Ixy = baseIxy + Propulsion->GetTanksIxy(vXYZcg) + GetPMIxy();
|
||||||
|
Ixz = baseIxz + Propulsion->GetTanksIxz(vXYZcg) + GetPMIxz();
|
||||||
|
|
||||||
if (debug_lvl > 1) Debug();
|
if (debug_lvl > 1) Debug();
|
||||||
|
|
||||||
|
@ -93,6 +95,98 @@ bool FGMassBalance::Run(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void FGMassBalance::AddPointMass(double weight, double X, double Y, double Z)
|
||||||
|
{
|
||||||
|
PointMassLoc.push_back(*(new FGColumnVector3(X, Y, Z)));
|
||||||
|
PointMassWeight.push_back(weight);
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
double FGMassBalance::GetPointMassWeight(void)
|
||||||
|
{
|
||||||
|
double PM_total_weight = 0.0;
|
||||||
|
|
||||||
|
for (unsigned int i=0; i<PointMassWeight.size(); i++) {
|
||||||
|
PM_total_weight += PointMassWeight[i];
|
||||||
|
}
|
||||||
|
return PM_total_weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
FGColumnVector3& FGMassBalance::GetPointMassCG(void)
|
||||||
|
{
|
||||||
|
PointMassCG.InitMatrix();
|
||||||
|
|
||||||
|
for (unsigned int i=0; i<PointMassLoc.size(); i++) {
|
||||||
|
PointMassCG += PointMassWeight[i]*PointMassLoc[i];
|
||||||
|
}
|
||||||
|
return PointMassCG;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
double FGMassBalance::GetPMIxx(void)
|
||||||
|
{
|
||||||
|
double I = 0.0;
|
||||||
|
for (unsigned int i=0; i<PointMassLoc.size(); i++) {
|
||||||
|
I += PointMassLoc[i](eX)*PointMassLoc[i](eX)*PointMassWeight[i];
|
||||||
|
}
|
||||||
|
I /= (144.0*Inertial->gravity());
|
||||||
|
return I;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
double FGMassBalance::GetPMIyy(void)
|
||||||
|
{
|
||||||
|
double I = 0.0;
|
||||||
|
for (unsigned int i=0; i<PointMassLoc.size(); i++) {
|
||||||
|
I += PointMassLoc[i](eY)*PointMassLoc[i](eY)*PointMassWeight[i];
|
||||||
|
}
|
||||||
|
I /= (144.0*Inertial->gravity());
|
||||||
|
return I;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
double FGMassBalance::GetPMIzz(void)
|
||||||
|
{
|
||||||
|
double I = 0.0;
|
||||||
|
for (unsigned int i=0; i<PointMassLoc.size(); i++) {
|
||||||
|
I += PointMassLoc[i](eZ)*PointMassLoc[i](eZ)*PointMassWeight[i];
|
||||||
|
}
|
||||||
|
I /= (144.0*Inertial->gravity());
|
||||||
|
return I;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
double FGMassBalance::GetPMIxy(void)
|
||||||
|
{
|
||||||
|
double I = 0.0;
|
||||||
|
for (unsigned int i=0; i<PointMassLoc.size(); i++) {
|
||||||
|
I += PointMassLoc[i](eX)*PointMassLoc[i](eY)*PointMassWeight[i];
|
||||||
|
}
|
||||||
|
I /= (144.0*Inertial->gravity());
|
||||||
|
return I;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
double FGMassBalance::GetPMIxz(void)
|
||||||
|
{
|
||||||
|
double I = 0.0;
|
||||||
|
for (unsigned int i=0; i<PointMassLoc.size(); i++) {
|
||||||
|
I += PointMassLoc[i](eX)*PointMassLoc[i](eZ)*PointMassWeight[i];
|
||||||
|
}
|
||||||
|
I /= (144.0*Inertial->gravity());
|
||||||
|
return I;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGMassBalance::Debug(void)
|
void FGMassBalance::Debug(void)
|
||||||
{
|
{
|
||||||
if (debug_lvl & 16) { // Sanity check variables
|
if (debug_lvl & 16) { // Sanity check variables
|
||||||
|
|
|
@ -44,6 +44,7 @@ INCLUDES
|
||||||
|
|
||||||
#include "FGModel.h"
|
#include "FGModel.h"
|
||||||
#include "FGPropulsion.h"
|
#include "FGPropulsion.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define ID_MASSBALANCE "$Id$"
|
#define ID_MASSBALANCE "$Id$"
|
||||||
|
|
||||||
|
@ -65,8 +66,8 @@ public:
|
||||||
inline double GetIxx(void) {return Ixx;}
|
inline double GetIxx(void) {return Ixx;}
|
||||||
inline double GetIyy(void) {return Iyy;}
|
inline double GetIyy(void) {return Iyy;}
|
||||||
inline double GetIzz(void) {return Izz;}
|
inline double GetIzz(void) {return Izz;}
|
||||||
|
inline double GetIxy(void) {return Ixy;}
|
||||||
inline double GetIxz(void) {return Ixz;}
|
inline double GetIxz(void) {return Ixz;}
|
||||||
inline double GetIyz(void) {return Iyz;}
|
|
||||||
inline FGColumnVector3& GetXYZcg(void) {return vXYZcg;}
|
inline FGColumnVector3& GetXYZcg(void) {return vXYZcg;}
|
||||||
inline double GetXYZcg(int axis) {return vXYZcg(axis);}
|
inline double GetXYZcg(int axis) {return vXYZcg(axis);}
|
||||||
|
|
||||||
|
@ -74,9 +75,18 @@ public:
|
||||||
inline void SetBaseIxx(double bixx) { baseIxx = bixx;}
|
inline void SetBaseIxx(double bixx) { baseIxx = bixx;}
|
||||||
inline void SetBaseIyy(double biyy) { baseIyy = biyy;}
|
inline void SetBaseIyy(double biyy) { baseIyy = biyy;}
|
||||||
inline void SetBaseIzz(double bizz) { baseIzz = bizz;}
|
inline void SetBaseIzz(double bizz) { baseIzz = bizz;}
|
||||||
|
inline void SetBaseIxy(double bixy) { baseIxy = bixy;}
|
||||||
inline void SetBaseIxz(double bixz) { baseIxz = bixz;}
|
inline void SetBaseIxz(double bixz) { baseIxz = bixz;}
|
||||||
inline void SetBaseIyz(double biyz) { baseIyz = biyz;}
|
|
||||||
inline void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = CG;}
|
inline void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = CG;}
|
||||||
|
|
||||||
|
void AddPointMass(double weight, double X, double Y, double Z);
|
||||||
|
double GetPointMassWeight(void);
|
||||||
|
FGColumnVector3& GetPointMassCG(void);
|
||||||
|
double GetPMIxx(void);
|
||||||
|
double GetPMIyy(void);
|
||||||
|
double GetPMIzz(void);
|
||||||
|
double GetPMIxy(void);
|
||||||
|
double GetPMIxz(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double Weight;
|
double Weight;
|
||||||
|
@ -85,16 +95,19 @@ private:
|
||||||
double Ixx;
|
double Ixx;
|
||||||
double Iyy;
|
double Iyy;
|
||||||
double Izz;
|
double Izz;
|
||||||
|
double Ixy;
|
||||||
double Ixz;
|
double Ixz;
|
||||||
double Iyz;
|
|
||||||
double baseIxx;
|
double baseIxx;
|
||||||
double baseIyy;
|
double baseIyy;
|
||||||
double baseIzz;
|
double baseIzz;
|
||||||
|
double baseIxy;
|
||||||
double baseIxz;
|
double baseIxz;
|
||||||
double baseIyz;
|
|
||||||
FGColumnVector3 vXYZcg;
|
FGColumnVector3 vXYZcg;
|
||||||
FGColumnVector3 vXYZtank;
|
FGColumnVector3 vXYZtank;
|
||||||
FGColumnVector3 vbaseXYZcg;
|
FGColumnVector3 vbaseXYZcg;
|
||||||
|
vector <FGColumnVector3> PointMassLoc;
|
||||||
|
vector <double> PointMassWeight;
|
||||||
|
FGColumnVector3 PointMassCG;
|
||||||
void Debug(void);
|
void Debug(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -195,6 +195,7 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
outstream << "Altitude, ";
|
outstream << "Altitude, ";
|
||||||
outstream << "Phi, Tht, Psi, ";
|
outstream << "Phi, Tht, Psi, ";
|
||||||
outstream << "Alpha, ";
|
outstream << "Alpha, ";
|
||||||
|
outstream << "Beta, ";
|
||||||
outstream << "Latitude, ";
|
outstream << "Latitude, ";
|
||||||
outstream << "Longitude, ";
|
outstream << "Longitude, ";
|
||||||
outstream << "Distance AGL, ";
|
outstream << "Distance AGL, ";
|
||||||
|
@ -269,6 +270,7 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
outstream << Position->Geth() << ", ";
|
outstream << Position->Geth() << ", ";
|
||||||
outstream << Rotation->GetEuler() << ", ";
|
outstream << Rotation->GetEuler() << ", ";
|
||||||
outstream << Translation->Getalpha() << ", ";
|
outstream << Translation->Getalpha() << ", ";
|
||||||
|
outstream << Translation->Getbeta() << ", ";
|
||||||
outstream << Position->GetLatitude() << ", ";
|
outstream << Position->GetLatitude() << ", ";
|
||||||
outstream << Position->GetLongitude() << ", ";
|
outstream << Position->GetLongitude() << ", ";
|
||||||
outstream << Position->GetDistanceAGL() << ", ";
|
outstream << Position->GetDistanceAGL() << ", ";
|
||||||
|
|
|
@ -68,9 +68,7 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg)
|
||||||
Cycles=2;
|
Cycles=2;
|
||||||
IdleRPM=600;
|
IdleRPM=600;
|
||||||
// Set constants
|
// Set constants
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Name = Eng_cfg->GetValue("NAME");
|
Name = Eng_cfg->GetValue("NAME");
|
||||||
Eng_cfg->GetNextConfigLine();
|
Eng_cfg->GetNextConfigLine();
|
||||||
while (Eng_cfg->GetValue() != string("/FG_PISTON")) {
|
while (Eng_cfg->GetValue() != string("/FG_PISTON")) {
|
||||||
|
|
|
@ -95,10 +95,7 @@ extern double globalTriNormal[3];
|
||||||
extern double globalSceneryAltitude;
|
extern double globalSceneryAltitude;
|
||||||
extern double globalSeaLevelRadius;
|
extern double globalSeaLevelRadius;
|
||||||
|
|
||||||
FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex),
|
FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
vVel(3),
|
|
||||||
vVelDot(3),
|
|
||||||
vRunwayNormal(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGPosition";
|
Name = "FGPosition";
|
||||||
LongitudeDot = LatitudeDot = RadiusDot = 0.0;
|
LongitudeDot = LatitudeDot = RadiusDot = 0.0;
|
||||||
|
|
|
@ -105,6 +105,7 @@ FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(e
|
||||||
|
|
||||||
Type = ttPropeller;
|
Type = ttPropeller;
|
||||||
RPM = 0;
|
RPM = 0;
|
||||||
|
vTorque.InitMatrix();
|
||||||
|
|
||||||
if (debug_lvl & 2) cout << "Instantiated: FGPropeller" << endl;
|
if (debug_lvl & 2) cout << "Instantiated: FGPropeller" << endl;
|
||||||
}
|
}
|
||||||
|
@ -155,8 +156,8 @@ double FGPropeller::Calculate(double PowerAvailable)
|
||||||
if (P_Factor > 0.0001) {
|
if (P_Factor > 0.0001) {
|
||||||
alpha = fdmex->GetTranslation()->Getalpha();
|
alpha = fdmex->GetTranslation()->Getalpha();
|
||||||
beta = fdmex->GetTranslation()->Getbeta();
|
beta = fdmex->GetTranslation()->Getbeta();
|
||||||
SetLocationY( GetLocationY() + P_Factor*alpha*fabs(Sense)/Sense);
|
SetActingLocationY( GetLocationY() + P_Factor*alpha*fabs(Sense)/Sense);
|
||||||
SetLocationZ( GetLocationZ() + P_Factor*beta*fabs(Sense)/Sense);
|
SetActingLocationZ( GetLocationZ() + P_Factor*beta*fabs(Sense)/Sense);
|
||||||
} else if (P_Factor < 0.000) {
|
} else if (P_Factor < 0.000) {
|
||||||
cerr << "P-Factor value in config file must be greater than zero" << endl;
|
cerr << "P-Factor value in config file must be greater than zero" << endl;
|
||||||
}
|
}
|
||||||
|
@ -175,10 +176,10 @@ double FGPropeller::Calculate(double PowerAvailable)
|
||||||
|
|
||||||
if (omega <= 5) omega = 1.0;
|
if (omega <= 5) omega = 1.0;
|
||||||
|
|
||||||
Torque = PowerAvailable / omega;
|
ExcessTorque = PowerAvailable / omega;
|
||||||
RPM = (RPS + ((Torque / Ixx) / (2.0 * M_PI)) * deltaT) * 60.0;
|
RPM = (RPS + ((ExcessTorque / Ixx) / (2.0 * M_PI)) * deltaT) * 60.0;
|
||||||
|
|
||||||
vMn = fdmex->GetRotation()->GetPQR()*vH + Torque*Sense;
|
vMn = fdmex->GetRotation()->GetPQR()*vH + vTorque*Sense;
|
||||||
|
|
||||||
return Thrust; // return thrust in pounds
|
return Thrust; // return thrust in pounds
|
||||||
}
|
}
|
||||||
|
@ -216,6 +217,8 @@ double FGPropeller::GetPowerRequired(void)
|
||||||
|
|
||||||
PowerRequired = cPReq*RPS*RPS*RPS*Diameter*Diameter*Diameter*Diameter
|
PowerRequired = cPReq*RPS*RPS*RPS*Diameter*Diameter*Diameter*Diameter
|
||||||
*Diameter*rho;
|
*Diameter*rho;
|
||||||
|
vTorque(eX) = PowerRequired / ((RPM/60)*2.0*M_PI);
|
||||||
|
|
||||||
return PowerRequired;
|
return PowerRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,170 +1,171 @@
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
Header: FGPropeller.h
|
Header: FGPropeller.h
|
||||||
Author: Jon S. Berndt
|
Author: Jon S. Berndt
|
||||||
Date started: 08/24/00
|
Date started: 08/24/00
|
||||||
|
|
||||||
------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) -------------
|
------------- Copyright (C) 2000 Jon S. Berndt (jsb@hal-pc.org) -------------
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
Foundation; either version 2 of the License, or (at your option) any later
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
version.
|
version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
details.
|
details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
You should have received a copy of the GNU General Public License along with
|
||||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
Place - Suite 330, Boston, MA 02111-1307, USA.
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Further information about the GNU General Public License can also be found on
|
Further information about the GNU General Public License can also be found on
|
||||||
the world wide web at http://www.gnu.org.
|
the world wide web at http://www.gnu.org.
|
||||||
|
|
||||||
HISTORY
|
HISTORY
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
08/24/00 JSB Created
|
08/24/00 JSB Created
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
SENTRY
|
SENTRY
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#ifndef FGPROPELLER_H
|
#ifndef FGPROPELLER_H
|
||||||
#define FGPROPELLER_H
|
#define FGPROPELLER_H
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
INCLUDES
|
INCLUDES
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#include "FGThruster.h"
|
#include "FGThruster.h"
|
||||||
#include "FGTable.h"
|
#include "FGTable.h"
|
||||||
#include "FGTranslation.h"
|
#include "FGTranslation.h"
|
||||||
#include "FGRotation.h"
|
#include "FGRotation.h"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_PROPELLER "$Id$"
|
#define ID_PROPELLER "$Id$"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS DOCUMENTATION
|
CLASS DOCUMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
/** Propeller modeling class.
|
/** Propeller modeling class.
|
||||||
FGPropeller models a propeller given the tabular data for Ct and Cp
|
FGPropeller models a propeller given the tabular data for Ct and Cp
|
||||||
indexed by advance ratio "J". The data for the propeller is
|
indexed by advance ratio "J". The data for the propeller is
|
||||||
stored in a config file named "prop_name.xml". The propeller config file
|
stored in a config file named "prop_name.xml". The propeller config file
|
||||||
is referenced from the main aircraft config file in the "Propulsion" section.
|
is referenced from the main aircraft config file in the "Propulsion" section.
|
||||||
See the constructor for FGPropeller to see what is read in and what should
|
See the constructor for FGPropeller to see what is read in and what should
|
||||||
be stored in the config file.<br>
|
be stored in the config file.<br>
|
||||||
Several references were helpful, here:<ul>
|
Several references were helpful, here:<ul>
|
||||||
<li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
|
<li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
|
||||||
Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
|
Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
|
||||||
<li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of
|
<li>Edwin Hartman, David Biermann, "The Aerodynamic Characteristics of
|
||||||
Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6
|
Full Scale Propellers Having 2, 3, and 4 Blades of Clark Y and R.A.F. 6
|
||||||
Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
|
Airfoil Sections", NACA Report TN-640, 1938 (?)</li>
|
||||||
<li>Various NACA Technical Notes and Reports</li>
|
<li>Various NACA Technical Notes and Reports</li>
|
||||||
<ul>
|
<ul>
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
@see FGEngine
|
@see FGEngine
|
||||||
@see FGThruster
|
@see FGThruster
|
||||||
@see FGTable
|
@see FGTable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS DECLARATION
|
CLASS DECLARATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
class FGPropeller : public FGThruster {
|
class FGPropeller : public FGThruster {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/** Constructor for FGPropeller.
|
/** Constructor for FGPropeller.
|
||||||
@param exec a pointer to the main executive object
|
@param exec a pointer to the main executive object
|
||||||
@param AC_cfg a pointer to the main aircraft config file object */
|
@param AC_cfg a pointer to the main aircraft config file object */
|
||||||
FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);
|
FGPropeller(FGFDMExec* exec, FGConfigFile* AC_cfg);
|
||||||
|
|
||||||
/// Destructor for FGPropeller - deletes the FGTable objects
|
/// Destructor for FGPropeller - deletes the FGTable objects
|
||||||
~FGPropeller();
|
~FGPropeller();
|
||||||
|
|
||||||
/** Sets the Revolutions Per Minute for the propeller. Normally the propeller
|
/** Sets the Revolutions Per Minute for the propeller. Normally the propeller
|
||||||
instance will calculate its own rotational velocity, given the Torque
|
instance will calculate its own rotational velocity, given the Torque
|
||||||
produced by the engine and integrating over time using the standard
|
produced by the engine and integrating over time using the standard
|
||||||
equation for rotational acceleration "a": a = Q/I , where Q is Torque and
|
equation for rotational acceleration "a": a = Q/I , where Q is Torque and
|
||||||
I is moment of inertia for the propeller.
|
I is moment of inertia for the propeller.
|
||||||
@param rpm the rotational velocity of the propeller */
|
@param rpm the rotational velocity of the propeller */
|
||||||
void SetRPM(double rpm) {RPM = rpm;}
|
void SetRPM(double rpm) {RPM = rpm;}
|
||||||
|
|
||||||
/** This commands the pitch of the blade to change to the value supplied.
|
/** This commands the pitch of the blade to change to the value supplied.
|
||||||
This call is meant to be issued either from the cockpit or by the flight
|
This call is meant to be issued either from the cockpit or by the flight
|
||||||
control system (perhaps to maintain constant RPM for a constant-speed
|
control system (perhaps to maintain constant RPM for a constant-speed
|
||||||
propeller). This value will be limited to be within whatever is specified
|
propeller). This value will be limited to be within whatever is specified
|
||||||
in the config file for Max and Min pitch. It is also one of the lookup
|
in the config file for Max and Min pitch. It is also one of the lookup
|
||||||
indices to the power and thrust tables for variable-pitch propellers.
|
indices to the power and thrust tables for variable-pitch propellers.
|
||||||
@param pitch the pitch of the blade in degrees. */
|
@param pitch the pitch of the blade in degrees. */
|
||||||
void SetPitch(double pitch) {Pitch = pitch;}
|
void SetPitch(double pitch) {Pitch = pitch;}
|
||||||
|
|
||||||
void SetPFactor(double pf) {P_Factor = pf;}
|
void SetPFactor(double pf) {P_Factor = pf;}
|
||||||
|
|
||||||
void SetSense(double s) { Sense = s;}
|
void SetSense(double s) { Sense = s;}
|
||||||
|
|
||||||
/// Retrieves the pitch of the propeller in degrees.
|
/// Retrieves the pitch of the propeller in degrees.
|
||||||
double GetPitch(void) { return Pitch; }
|
double GetPitch(void) { return Pitch; }
|
||||||
|
|
||||||
/// Retrieves the RPMs of the propeller
|
/// Retrieves the RPMs of the propeller
|
||||||
double GetRPM(void) { return RPM; }
|
double GetRPM(void) { return RPM; }
|
||||||
|
|
||||||
/// Retrieves the propeller moment of inertia
|
/// Retrieves the propeller moment of inertia
|
||||||
double GetIxx(void) { return Ixx; }
|
double GetIxx(void) { return Ixx; }
|
||||||
|
|
||||||
/// 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?)
|
||||||
double GetTorque(void) { return Torque; }
|
double GetTorque(void) { return vTorque(eX); }
|
||||||
|
|
||||||
/** Retrieves the power required (or "absorbed") by the propeller -
|
/** Retrieves the power required (or "absorbed") by the propeller -
|
||||||
i.e. the power required to keep spinning the propeller at the current
|
i.e. the power required to keep spinning the propeller at the current
|
||||||
velocity, air density, and rotational rate. */
|
velocity, air density, and rotational rate. */
|
||||||
double GetPowerRequired(void);
|
double GetPowerRequired(void);
|
||||||
|
|
||||||
/** Calculates and returns the thrust produced by this propeller.
|
/** Calculates and returns the thrust produced by this propeller.
|
||||||
Given the excess power available from the engine (in foot-pounds), the thrust is
|
Given the excess power available from the engine (in foot-pounds), the thrust is
|
||||||
calculated, as well as the current RPM. The RPM is calculated by integrating
|
calculated, as well as the current RPM. The RPM is calculated by integrating
|
||||||
the torque provided by the engine over what the propeller "absorbs"
|
the torque provided by the engine over what the propeller "absorbs"
|
||||||
(essentially the "drag" of the propeller).
|
(essentially the "drag" of the propeller).
|
||||||
@param PowerAvailable this is the excess power provided by the engine to
|
@param PowerAvailable this is the excess power provided by the engine to
|
||||||
accelerate the prop. It could be negative, dictating that the propeller
|
accelerate the prop. It could be negative, dictating that the propeller
|
||||||
would be slowed.
|
would be slowed.
|
||||||
@return the thrust in pounds */
|
@return the thrust in pounds */
|
||||||
double Calculate(double PowerAvailable);
|
double Calculate(double PowerAvailable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int numBlades;
|
int numBlades;
|
||||||
double RPM;
|
double RPM;
|
||||||
double Ixx;
|
double Ixx;
|
||||||
double Diameter;
|
double Diameter;
|
||||||
double MaxPitch;
|
double MaxPitch;
|
||||||
double MinPitch;
|
double MinPitch;
|
||||||
double MinRPM;
|
double MinRPM;
|
||||||
double MaxRPM;
|
double MaxRPM;
|
||||||
double P_Factor;
|
double P_Factor;
|
||||||
double Sense;
|
double Sense;
|
||||||
double Pitch;
|
double Pitch;
|
||||||
double Torque;
|
double ExcessTorque;
|
||||||
FGTable *cThrust;
|
FGColumnVector3 vTorque;
|
||||||
FGTable *cPower;
|
FGTable *cThrust;
|
||||||
void Debug(void);
|
FGTable *cPower;
|
||||||
};
|
void Debug(void);
|
||||||
|
};
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
#endif
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec),
|
FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
|
||||||
Forces(3),
|
|
||||||
Moments(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGPropulsion";
|
Name = "FGPropulsion";
|
||||||
numSelectedFuelTanks = numSelectedOxiTanks = 0;
|
numSelectedFuelTanks = numSelectedOxiTanks = 0;
|
||||||
|
@ -90,16 +88,16 @@ bool FGPropulsion::Run(void)
|
||||||
double PowerAvailable;
|
double PowerAvailable;
|
||||||
dt = State->Getdt();
|
dt = State->Getdt();
|
||||||
|
|
||||||
Forces.InitMatrix();
|
vForces.InitMatrix();
|
||||||
Moments.InitMatrix();
|
vMoments.InitMatrix();
|
||||||
|
|
||||||
if (!FGModel::Run()) {
|
if (!FGModel::Run()) {
|
||||||
for (unsigned int i=0; i<numEngines; i++) {
|
for (unsigned int i=0; i<numEngines; i++) {
|
||||||
Thrusters[i]->SetdeltaT(dt*rate);
|
Thrusters[i]->SetdeltaT(dt*rate);
|
||||||
PowerAvailable = Engines[i]->Calculate(Thrusters[i]->GetPowerRequired());
|
PowerAvailable = Engines[i]->Calculate(Thrusters[i]->GetPowerRequired());
|
||||||
Thrusters[i]->Calculate(PowerAvailable);
|
Thrusters[i]->Calculate(PowerAvailable);
|
||||||
Forces += Thrusters[i]->GetBodyForces(); // sum body frame forces
|
vForces += Thrusters[i]->GetBodyForces(); // sum body frame forces
|
||||||
Moments += Thrusters[i]->GetMoments(); // sum body frame moments
|
vMoments += Thrusters[i]->GetMoments(); // sum body frame moments
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,8 +115,8 @@ bool FGPropulsion::GetSteadyState(void)
|
||||||
int steady_count,j=0;
|
int steady_count,j=0;
|
||||||
bool steady=false;
|
bool steady=false;
|
||||||
|
|
||||||
Forces.InitMatrix();
|
vForces.InitMatrix();
|
||||||
Moments.InitMatrix();
|
vMoments.InitMatrix();
|
||||||
|
|
||||||
if (!FGModel::Run()) {
|
if (!FGModel::Run()) {
|
||||||
for (unsigned int i=0; i<numEngines; i++) {
|
for (unsigned int i=0; i<numEngines; i++) {
|
||||||
|
@ -138,8 +136,8 @@ bool FGPropulsion::GetSteadyState(void)
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
Forces += Thrusters[i]->GetBodyForces(); // sum body frame forces
|
vForces += Thrusters[i]->GetBodyForces(); // sum body frame forces
|
||||||
Moments += Thrusters[i]->GetMoments(); // sum body frame moments
|
vMoments += Thrusters[i]->GetMoments(); // sum body frame moments
|
||||||
Engines[i]->SetTrimMode(false);
|
Engines[i]->SetTrimMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,8 +156,8 @@ bool FGPropulsion::ICEngineStart(void)
|
||||||
int j;
|
int j;
|
||||||
dt = State->Getdt();
|
dt = State->Getdt();
|
||||||
|
|
||||||
Forces.InitMatrix();
|
vForces.InitMatrix();
|
||||||
Moments.InitMatrix();
|
vMoments.InitMatrix();
|
||||||
|
|
||||||
for (unsigned int i=0; i<numEngines; i++) {
|
for (unsigned int i=0; i<numEngines; i++) {
|
||||||
Engines[i]->SetTrimMode(true);
|
Engines[i]->SetTrimMode(true);
|
||||||
|
@ -170,8 +168,8 @@ bool FGPropulsion::ICEngineStart(void)
|
||||||
Thrusters[i]->Calculate(PowerAvailable);
|
Thrusters[i]->Calculate(PowerAvailable);
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
Forces += Thrusters[i]->GetBodyForces(); // sum body frame forces
|
vForces += Thrusters[i]->GetBodyForces(); // sum body frame forces
|
||||||
Moments += Thrusters[i]->GetMoments(); // sum body frame moments
|
vMoments += Thrusters[i]->GetMoments(); // sum body frame moments
|
||||||
Engines[i]->SetTrimMode(false);
|
Engines[i]->SetTrimMode(false);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -168,10 +168,10 @@ public:
|
||||||
string GetPropulsionStrings(void);
|
string GetPropulsionStrings(void);
|
||||||
string GetPropulsionValues(void);
|
string GetPropulsionValues(void);
|
||||||
|
|
||||||
inline FGColumnVector3& GetForces(void) {return Forces; }
|
inline FGColumnVector3& GetForces(void) {return vForces; }
|
||||||
inline double GetForces(int n) { return Forces(n);}
|
inline double GetForces(int n) { return vForces(n);}
|
||||||
inline FGColumnVector3& GetMoments(void) {return Moments;}
|
inline FGColumnVector3& GetMoments(void) {return vMoments;}
|
||||||
inline double GetMoments(int n) {return Moments(n);}
|
inline double GetMoments(int n) {return vMoments(n);}
|
||||||
|
|
||||||
FGColumnVector3& GetTanksCG(void);
|
FGColumnVector3& GetTanksCG(void);
|
||||||
double GetTanksWeight(void);
|
double GetTanksWeight(void);
|
||||||
|
@ -195,8 +195,8 @@ private:
|
||||||
unsigned int numTanks;
|
unsigned int numTanks;
|
||||||
unsigned int numThrusters;
|
unsigned int numThrusters;
|
||||||
double dt;
|
double dt;
|
||||||
FGColumnVector3 Forces;
|
FGColumnVector3 vForces;
|
||||||
FGColumnVector3 Moments;
|
FGColumnVector3 vMoments;
|
||||||
FGColumnVector3 vXYZtank;
|
FGColumnVector3 vXYZtank;
|
||||||
void Debug(void);
|
void Debug(void);
|
||||||
};
|
};
|
||||||
|
|
|
@ -75,14 +75,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGRotation::FGRotation(FGFDMExec* fdmex) : FGModel(fdmex),
|
FGRotation::FGRotation(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
vPQR(3),
|
|
||||||
vAeroPQR(3),
|
|
||||||
vPQRdot(3),
|
|
||||||
vMoments(3),
|
|
||||||
vEuler(3),
|
|
||||||
vEulerRates(3),
|
|
||||||
vlastPQRdot(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGRotation";
|
Name = "FGRotation";
|
||||||
cTht=cPhi=cPsi=1.0;
|
cTht=cPhi=cPsi=1.0;
|
||||||
|
|
|
@ -73,19 +73,7 @@ CLASS IMPLEMENTATION
|
||||||
// entry in the enum eParam definition in FGJSBBase.h. The ID is what must be used
|
// entry in the enum eParam definition in FGJSBBase.h. The ID is what must be used
|
||||||
// in any config file entry which references that item.
|
// in any config file entry which references that item.
|
||||||
|
|
||||||
FGState::FGState(FGFDMExec* fdex) :
|
FGState::FGState(FGFDMExec* fdex)
|
||||||
mTb2l(3,3),
|
|
||||||
mTl2b(3,3),
|
|
||||||
mTs2b(3,3),
|
|
||||||
mTb2s(3,3),
|
|
||||||
vQtrn(4),
|
|
||||||
vlastQdot(4),
|
|
||||||
vQdot(4),
|
|
||||||
vUVW(3),
|
|
||||||
vLocalVelNED(3),
|
|
||||||
vLocalEuler(3),
|
|
||||||
vTmp(4),
|
|
||||||
vEuler(3)
|
|
||||||
{
|
{
|
||||||
FDMExec = fdex;
|
FDMExec = fdex;
|
||||||
|
|
||||||
|
@ -323,13 +311,17 @@ double FGState::GetParameter(string val_string) {
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
eParam FGState::GetParameterIndex(string val_string) {
|
eParam FGState::GetParameterIndex(string val_string)
|
||||||
|
{
|
||||||
return coeffdef[val_string];
|
return coeffdef[val_string];
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGState::SetParameter(eParam val_idx, double val) {
|
void FGState::SetParameter(eParam val_idx, double val)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
switch(val_idx) {
|
switch(val_idx) {
|
||||||
case FG_ELEVATOR_POS:
|
case FG_ELEVATOR_POS:
|
||||||
FCS->SetDePos(val);
|
FCS->SetDePos(val);
|
||||||
|
@ -350,10 +342,22 @@ void FGState::SetParameter(eParam val_idx, double val) {
|
||||||
FCS->SetDfPos(val);
|
FCS->SetDfPos(val);
|
||||||
break;
|
break;
|
||||||
case FG_THROTTLE_POS:
|
case FG_THROTTLE_POS:
|
||||||
FCS->SetThrottlePos(ActiveEngine,val);
|
if (ActiveEngine == -1) {
|
||||||
|
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
||||||
|
FCS->SetThrottlePos(i,val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FCS->SetThrottlePos(ActiveEngine,val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FG_MIXTURE_POS:
|
case FG_MIXTURE_POS:
|
||||||
FCS->SetMixturePos(ActiveEngine,val);
|
if (ActiveEngine == -1) {
|
||||||
|
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
||||||
|
FCS->SetMixturePos(i,val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FCS->SetMixturePos(ActiveEngine,val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FG_ELEVATOR_CMD:
|
case FG_ELEVATOR_CMD:
|
||||||
|
@ -375,19 +379,43 @@ void FGState::SetParameter(eParam val_idx, double val) {
|
||||||
FCS->SetDfCmd(val);
|
FCS->SetDfCmd(val);
|
||||||
break;
|
break;
|
||||||
case FG_THROTTLE_CMD:
|
case FG_THROTTLE_CMD:
|
||||||
FCS->SetThrottleCmd(ActiveEngine,val);
|
if (ActiveEngine == -1) {
|
||||||
|
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
||||||
|
FCS->SetThrottleCmd(i,val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FCS->SetThrottleCmd(ActiveEngine,val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FG_MIXTURE_CMD:
|
case FG_MIXTURE_CMD:
|
||||||
FCS->SetMixtureCmd(ActiveEngine,val);
|
if (ActiveEngine == -1) {
|
||||||
|
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
||||||
|
FCS->SetMixtureCmd(i,val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FCS->SetMixtureCmd(ActiveEngine,val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FG_MAGNETO_CMD:
|
case FG_MAGNETO_CMD:
|
||||||
Propulsion->GetEngine(ActiveEngine)->SetMagnetos((int)val); // need to account for -1
|
if (ActiveEngine == -1) {
|
||||||
|
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
||||||
|
Propulsion->GetEngine(i)->SetMagnetos((int)val);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Propulsion->GetEngine(ActiveEngine)->SetMagnetos((int)val);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FG_STARTER_CMD:
|
case FG_STARTER_CMD:
|
||||||
if (val < 0.001)
|
if (ActiveEngine == -1) {
|
||||||
Propulsion->GetEngine(ActiveEngine)->SetStarter(false); // need to account for -1
|
for (i=0; i<Propulsion->GetNumEngines(); i++) {
|
||||||
else if (val >= 0.001)
|
if (val < 0.001)
|
||||||
Propulsion->GetEngine(ActiveEngine)->SetStarter(true); // need to account for -1
|
Propulsion->GetEngine(i)->SetStarter(false);
|
||||||
|
else if (val >= 0.001)
|
||||||
|
Propulsion->GetEngine(i)->SetStarter(true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Propulsion->GetEngine(ActiveEngine)->SetStarter(true);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case FG_ACTIVE_ENGINE:
|
case FG_ACTIVE_ENGINE:
|
||||||
ActiveEngine = (int)val;
|
ActiveEngine = (int)val;
|
||||||
|
|
|
@ -77,12 +77,7 @@ CLASS IMPLEMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
|
|
||||||
FGTranslation::FGTranslation(FGFDMExec* fdmex) : FGModel(fdmex),
|
FGTranslation::FGTranslation(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
vUVW(3),
|
|
||||||
vUVWdot(3),
|
|
||||||
vlastUVWdot(3),
|
|
||||||
mVel(3,3),
|
|
||||||
vAeroUVW(3)
|
|
||||||
{
|
{
|
||||||
Name = "FGTranslation";
|
Name = "FGTranslation";
|
||||||
qbar = 0;
|
qbar = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue