Sync. w. JSBSim CVS
This commit is contained in:
parent
33a52bdca2
commit
c09d1c92ca
41 changed files with 510 additions and 554 deletions
|
@ -220,7 +220,7 @@ bool FGAerodynamics::Load(FGConfigFile* AC_cfg)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGAerodynamics::GetCoefficientStrings(void)
|
string FGAerodynamics::GetCoefficientStrings(string delimeter)
|
||||||
{
|
{
|
||||||
string CoeffStrings = "";
|
string CoeffStrings = "";
|
||||||
bool firstime = true;
|
bool firstime = true;
|
||||||
|
@ -231,7 +231,7 @@ string FGAerodynamics::GetCoefficientStrings(void)
|
||||||
if (firstime) {
|
if (firstime) {
|
||||||
firstime = false;
|
firstime = false;
|
||||||
} else {
|
} else {
|
||||||
CoeffStrings += ", ";
|
CoeffStrings += delimeter;
|
||||||
}
|
}
|
||||||
CoeffStrings += Coeff[axis][sd]->GetCoefficientName();
|
CoeffStrings += Coeff[axis][sd]->GetCoefficientName();
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ string FGAerodynamics::GetCoefficientStrings(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGAerodynamics::GetCoefficientValues(void)
|
string FGAerodynamics::GetCoefficientValues(string delimeter)
|
||||||
{
|
{
|
||||||
string SDValues = "";
|
string SDValues = "";
|
||||||
bool firstime = true;
|
bool firstime = true;
|
||||||
|
@ -251,7 +251,7 @@ string FGAerodynamics::GetCoefficientValues(void)
|
||||||
if (firstime) {
|
if (firstime) {
|
||||||
firstime = false;
|
firstime = false;
|
||||||
} else {
|
} else {
|
||||||
SDValues += ", ";
|
SDValues += delimeter;
|
||||||
}
|
}
|
||||||
SDValues += Coeff[axis][sd]->GetSDstring();
|
SDValues += Coeff[axis][sd]->GetSDstring();
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,13 +156,15 @@ public:
|
||||||
inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
|
inline void SetAlphaCLMin(double tt) { alphaclmin=tt; }
|
||||||
|
|
||||||
/** Gets the strings for the current set of coefficients.
|
/** Gets the strings for the current set of coefficients.
|
||||||
|
@param delimeter either a tab or comma string depending on output type
|
||||||
@return a string containing the descriptive names for all coefficients */
|
@return a string containing the descriptive names for all coefficients */
|
||||||
string GetCoefficientStrings(void);
|
string GetCoefficientStrings(string delimeter);
|
||||||
|
|
||||||
/** Gets the coefficient values.
|
/** Gets the coefficient values.
|
||||||
|
@param delimeter either a tab or comma string depending on output type
|
||||||
@return a string containing the numeric values for the current set of
|
@return a string containing the numeric values for the current set of
|
||||||
coefficients */
|
coefficients */
|
||||||
string GetCoefficientValues(void);
|
string GetCoefficientValues(string delimeter);
|
||||||
|
|
||||||
void bind(void);
|
void bind(void);
|
||||||
void bindModel(void);
|
void bindModel(void);
|
||||||
|
|
|
@ -168,9 +168,10 @@ bool FGCoefficient::Load(FGConfigFile *AC_cfg)
|
||||||
end = multparms.length();
|
end = multparms.length();
|
||||||
|
|
||||||
n = multparms.find("|");
|
n = multparms.find("|");
|
||||||
|
if (n == string::npos) n = end;
|
||||||
start = 0;
|
start = 0;
|
||||||
if (multparms != string("none")) {
|
if (multparms != string("none")) {
|
||||||
while (n < end && n >= 0) {
|
while (n < end && n != string::npos) {
|
||||||
n -= start;
|
n -= start;
|
||||||
mult = multparms.substr(start,n);
|
mult = multparms.substr(start,n);
|
||||||
multipliers.push_back( resolveSymbol( mult ) );
|
multipliers.push_back( resolveSymbol( mult ) );
|
||||||
|
|
|
@ -19,6 +19,7 @@ INCLUDES
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#include "FGColumnVector3.h"
|
#include "FGColumnVector3.h"
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
|
@ -37,6 +38,15 @@ FGColumnVector3::FGColumnVector3(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
string FGColumnVector3::Dump(string delimeter) const
|
||||||
|
{
|
||||||
|
char buffer[256];
|
||||||
|
sprintf(buffer, "%f%s%f%s%f", Entry(1), delimeter.c_str(), Entry(2), delimeter.c_str(), Entry(3));
|
||||||
|
return string(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
FGColumnVector3 FGColumnVector3::operator/(const double scalar) const
|
FGColumnVector3 FGColumnVector3::operator/(const double scalar) const
|
||||||
{
|
{
|
||||||
if (scalar != 0.0)
|
if (scalar != 0.0)
|
||||||
|
|
|
@ -89,19 +89,14 @@ class FGColumnVector3 : public FGJSBBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Default initializer.
|
/** Default initializer.
|
||||||
|
Create a zero vector. */
|
||||||
Create a zero vector.
|
|
||||||
*/
|
|
||||||
FGColumnVector3(void);
|
FGColumnVector3(void);
|
||||||
|
|
||||||
/** Initialization by given values.
|
/** Initialization by given values.
|
||||||
|
|
||||||
@param X value of the x-conponent.
|
@param X value of the x-conponent.
|
||||||
@param Y value of the y-conponent.
|
@param Y value of the y-conponent.
|
||||||
@param Z value of the z-conponent.
|
@param Z value of the z-conponent.
|
||||||
|
Create a vector from the doubles given in the arguments. */
|
||||||
Create a vector from the doubles given in the arguments.
|
|
||||||
*/
|
|
||||||
FGColumnVector3(double X, double Y, double Z) {
|
FGColumnVector3(double X, double Y, double Z) {
|
||||||
data[0] = X;
|
data[0] = X;
|
||||||
data[1] = Y;
|
data[1] = Y;
|
||||||
|
@ -110,11 +105,8 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Copy constructor.
|
/** Copy constructor.
|
||||||
|
|
||||||
@param v Vector which is used for initialization.
|
@param v Vector which is used for initialization.
|
||||||
|
Create copy of the vector given in the argument. */
|
||||||
Create copy of the vector given in the argument.
|
|
||||||
*/
|
|
||||||
FGColumnVector3(const FGColumnVector3& v) {
|
FGColumnVector3(const FGColumnVector3& v) {
|
||||||
data[0] = v.data[0];
|
data[0] = v.data[0];
|
||||||
data[1] = v.data[1];
|
data[1] = v.data[1];
|
||||||
|
@ -122,69 +114,51 @@ public:
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor.
|
/// Destructor.
|
||||||
*/
|
|
||||||
~FGColumnVector3(void) { Debug(1); }
|
~FGColumnVector3(void) { Debug(1); }
|
||||||
|
|
||||||
|
|
||||||
/** Read access the entries of the vector.
|
/** Read access the entries of the vector.
|
||||||
|
|
||||||
@param idx the component index.
|
@param idx the component index.
|
||||||
|
|
||||||
Return the value of the matrix entry at the given index.
|
Return the value of the matrix entry at the given index.
|
||||||
Indices are counted starting with 1.
|
Indices are counted starting with 1.
|
||||||
|
Note that the index given in the argument is unchecked. */
|
||||||
Note that the index given in the argument is unchecked.
|
|
||||||
*/
|
|
||||||
double operator()(unsigned int idx) const { return Entry(idx); }
|
double operator()(unsigned int idx) const { return Entry(idx); }
|
||||||
|
|
||||||
/** Write access the entries of the vector.
|
/** Write access the entries of the vector.
|
||||||
|
|
||||||
@param idx the component index.
|
@param idx the component index.
|
||||||
|
|
||||||
Return a reference to the vector entry at the given index.
|
Return a reference to the vector entry at the given index.
|
||||||
Indices are counted starting with 1.
|
Indices are counted starting with 1.
|
||||||
|
Note that the index given in the argument is unchecked. */
|
||||||
Note that the index given in the argument is unchecked.
|
|
||||||
*/
|
|
||||||
double& operator()(unsigned int idx) { return Entry(idx); }
|
double& operator()(unsigned int idx) { return Entry(idx); }
|
||||||
|
|
||||||
/** Read access the entries of the vector.
|
/** Read access the entries of the vector.
|
||||||
|
|
||||||
@param idx the component index.
|
@param idx the component index.
|
||||||
|
|
||||||
Return the value of the matrix entry at the given index.
|
Return the value of the matrix entry at the given index.
|
||||||
Indices are counted starting with 1.
|
Indices are counted starting with 1.
|
||||||
|
|
||||||
This function is just a shortcut for the @ref double
|
This function is just a shortcut for the @ref double
|
||||||
operator()(unsigned int idx) const function. It is
|
operator()(unsigned int idx) const function. It is
|
||||||
used internally to access the elements in a more convenient way.
|
used internally to access the elements in a more convenient way.
|
||||||
|
Note that the index given in the argument is unchecked. */
|
||||||
Note that the index given in the argument is unchecked.
|
|
||||||
*/
|
|
||||||
double Entry(unsigned int idx) const { return data[idx-1]; }
|
double Entry(unsigned int idx) const { return data[idx-1]; }
|
||||||
|
|
||||||
/** Write access the entries of the vector.
|
/** Write access the entries of the vector.
|
||||||
|
|
||||||
@param idx the component index.
|
@param idx the component index.
|
||||||
|
|
||||||
Return a reference to the vector entry at the given index.
|
Return a reference to the vector entry at the given index.
|
||||||
Indices are counted starting with 1.
|
Indices are counted starting with 1.
|
||||||
|
|
||||||
This function is just a shortcut for the @ref double&
|
This function is just a shortcut for the @ref double&
|
||||||
operator()(unsigned int idx) function. It is
|
operator()(unsigned int idx) function. It is
|
||||||
used internally to access the elements in a more convenient way.
|
used internally to access the elements in a more convenient way.
|
||||||
|
Note that the index given in the argument is unchecked. */
|
||||||
Note that the index given in the argument is unchecked.
|
|
||||||
*/
|
|
||||||
double& Entry(unsigned int idx) { return data[idx-1]; }
|
double& Entry(unsigned int idx) { return data[idx-1]; }
|
||||||
|
|
||||||
|
/** Prints the contents of the vector
|
||||||
|
@param delimeter the item separator (tab or comma)
|
||||||
|
@return a string with the delimeter-separated contents of the vector */
|
||||||
|
string Dump(string delimeter) const;
|
||||||
|
|
||||||
/** Assignment operator.
|
/** Assignment operator.
|
||||||
|
|
||||||
@param b source vector.
|
@param b source vector.
|
||||||
|
Copy the content of the vector given in the argument into *this. */
|
||||||
Copy the content of the vector given in the argument into *this.
|
|
||||||
*/
|
|
||||||
FGColumnVector3& operator=(const FGColumnVector3& b) {
|
FGColumnVector3& operator=(const FGColumnVector3& b) {
|
||||||
data[0] = b.data[0];
|
data[0] = b.data[0];
|
||||||
data[1] = b.data[1];
|
data[1] = b.data[1];
|
||||||
|
@ -193,71 +167,53 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Comparison operator.
|
/** Comparison operator.
|
||||||
|
|
||||||
@param b other vector.
|
@param b other vector.
|
||||||
|
Returns true if both vectors are exactly the same. */
|
||||||
Returns true if both vectors are exactly the same.
|
|
||||||
*/
|
|
||||||
bool operator==(const FGColumnVector3& b) const {
|
bool operator==(const FGColumnVector3& b) const {
|
||||||
return data[0] == b.data[0] && data[1] == b.data[1] && data[2] == b.data[2];
|
return data[0] == b.data[0] && data[1] == b.data[1] && data[2] == b.data[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Comparison operator.
|
/** Comparison operator.
|
||||||
|
|
||||||
@param b other vector.
|
@param b other vector.
|
||||||
|
Returns false if both vectors are exactly the same. */
|
||||||
Returns false if both vectors are exactly the same.
|
|
||||||
*/
|
|
||||||
bool operator!=(const FGColumnVector3& b) const { return ! operator==(b); }
|
bool operator!=(const FGColumnVector3& b) const { return ! operator==(b); }
|
||||||
|
|
||||||
/** Multiplication by a scalar.
|
/** Multiplication by a scalar.
|
||||||
|
|
||||||
@param scalar scalar value to multiply the vector with.
|
@param scalar scalar value to multiply the vector with.
|
||||||
@return The resulting vector from the multiplication with that scalar.
|
@return The resulting vector from the multiplication with that scalar.
|
||||||
|
Multiply the vector with the scalar given in the argument. */
|
||||||
Multiply the vector with the scalar given in the argument.
|
|
||||||
*/
|
|
||||||
FGColumnVector3 operator*(const double scalar) const {
|
FGColumnVector3 operator*(const double scalar) const {
|
||||||
return FGColumnVector3(scalar*Entry(1), scalar*Entry(2), scalar*Entry(3));
|
return FGColumnVector3(scalar*Entry(1), scalar*Entry(2), scalar*Entry(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Multiply by 1/scalar.
|
/** Multiply by 1/scalar.
|
||||||
|
|
||||||
@param scalar scalar value to devide the vector through.
|
@param scalar scalar value to devide the vector through.
|
||||||
@return The resulting vector from the division through that scalar.
|
@return The resulting vector from the division through that scalar.
|
||||||
|
Multiply the vector with the 1/scalar given in the argument. */
|
||||||
Multiply the vector with the 1/scalar given in the argument.
|
|
||||||
*/
|
|
||||||
FGColumnVector3 operator/(const double scalar) const;
|
FGColumnVector3 operator/(const double scalar) const;
|
||||||
|
|
||||||
/** Cross product multiplication.
|
/** Cross product multiplication.
|
||||||
|
|
||||||
@param v vector to multiply with.
|
@param v vector to multiply with.
|
||||||
@return The resulting vector from the cross product multiplication.
|
@return The resulting vector from the cross product multiplication.
|
||||||
|
|
||||||
Compute and return the cross product of the current vector with
|
Compute and return the cross product of the current vector with
|
||||||
the given argument.
|
the given argument. */
|
||||||
*/
|
|
||||||
FGColumnVector3 operator*(const FGColumnVector3& V) const {
|
FGColumnVector3 operator*(const FGColumnVector3& V) const {
|
||||||
return FGColumnVector3( Entry(2) * V(3) - Entry(3) * V(2),
|
return FGColumnVector3( Entry(2) * V(3) - Entry(3) * V(2),
|
||||||
Entry(3) * V(1) - Entry(1) * V(3),
|
Entry(3) * V(1) - Entry(1) * V(3),
|
||||||
Entry(1) * V(2) - Entry(2) * V(1) );
|
Entry(1) * V(2) - Entry(2) * V(1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Addition operator.
|
/// Addition operator.
|
||||||
*/
|
|
||||||
FGColumnVector3 operator+(const FGColumnVector3& B) const {
|
FGColumnVector3 operator+(const FGColumnVector3& B) const {
|
||||||
return FGColumnVector3( Entry(1) + B(1), Entry(2) + B(2), Entry(3) + B(3) );
|
return FGColumnVector3( Entry(1) + B(1), Entry(2) + B(2), Entry(3) + B(3) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Subtraction operator.
|
/// Subtraction operator.
|
||||||
*/
|
|
||||||
FGColumnVector3 operator-(const FGColumnVector3& B) const {
|
FGColumnVector3 operator-(const FGColumnVector3& B) const {
|
||||||
return FGColumnVector3( Entry(1) - B(1), Entry(2) - B(2), Entry(3) - B(3) );
|
return FGColumnVector3( Entry(1) - B(1), Entry(2) - B(2), Entry(3) - B(3) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Subtract an other vector.
|
/// Subtract an other vector.
|
||||||
*/
|
|
||||||
FGColumnVector3& operator-=(const FGColumnVector3 &B) {
|
FGColumnVector3& operator-=(const FGColumnVector3 &B) {
|
||||||
Entry(1) -= B(1);
|
Entry(1) -= B(1);
|
||||||
Entry(2) -= B(2);
|
Entry(2) -= B(2);
|
||||||
|
@ -265,8 +221,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add an other vector.
|
/// Add an other vector.
|
||||||
*/
|
|
||||||
FGColumnVector3& operator+=(const FGColumnVector3 &B) {
|
FGColumnVector3& operator+=(const FGColumnVector3 &B) {
|
||||||
Entry(1) += B(1);
|
Entry(1) += B(1);
|
||||||
Entry(2) += B(2);
|
Entry(2) += B(2);
|
||||||
|
@ -274,8 +229,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Scale by a scalar.
|
/// Scale by a scalar.
|
||||||
*/
|
|
||||||
FGColumnVector3& operator*=(const double scalar) {
|
FGColumnVector3& operator*=(const double scalar) {
|
||||||
Entry(1) *= scalar;
|
Entry(1) *= scalar;
|
||||||
Entry(2) *= scalar;
|
Entry(2) *= scalar;
|
||||||
|
@ -283,8 +237,7 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Scale by a 1/scalar.
|
/// Scale by a 1/scalar.
|
||||||
*/
|
|
||||||
FGColumnVector3& operator/=(const double scalar);
|
FGColumnVector3& operator/=(const double scalar);
|
||||||
|
|
||||||
void InitMatrix(void) { data[0] = data[1] = data[2] = 0.0; }
|
void InitMatrix(void) { data[0] = data[1] = data[2] = 0.0; }
|
||||||
|
@ -294,25 +247,19 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Length of the vector.
|
/** Length of the vector.
|
||||||
|
Compute and return the euclidean norm of this vector. */
|
||||||
Compute and return the euclidean norm of this vector.
|
|
||||||
*/
|
|
||||||
double Magnitude(void) const;
|
double Magnitude(void) const;
|
||||||
|
|
||||||
/** Length of the vector in a coordinate axis plane.
|
/** Length of the vector in a coordinate axis plane.
|
||||||
|
|
||||||
Compute and return the euclidean norm of this vector projected into
|
Compute and return the euclidean norm of this vector projected into
|
||||||
the coordinate axis plane idx1-idx2.
|
the coordinate axis plane idx1-idx2. */
|
||||||
*/
|
|
||||||
double Magnitude(int idx1, int idx2) const {
|
double Magnitude(int idx1, int idx2) const {
|
||||||
return sqrt( Entry(idx1)*Entry(idx1) + Entry(idx2)*Entry(idx2) );
|
return sqrt( Entry(idx1)*Entry(idx1) + Entry(idx2)*Entry(idx2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Normalize.
|
/** Normalize.
|
||||||
|
|
||||||
Normalize the vector to have the Magnitude() == 1.0. If the vector
|
Normalize the vector to have the Magnitude() == 1.0. If the vector
|
||||||
is equal to zero it is left untouched.
|
is equal to zero it is left untouched. */
|
||||||
*/
|
|
||||||
FGColumnVector3& Normalize(void);
|
FGColumnVector3& Normalize(void);
|
||||||
|
|
||||||
// ??? Is this something sensible ??
|
// ??? Is this something sensible ??
|
||||||
|
@ -340,24 +287,18 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Scalar multiplication.
|
/** Scalar multiplication.
|
||||||
|
|
||||||
@param scalar scalar value to multiply with.
|
@param scalar scalar value to multiply with.
|
||||||
@param A Vector to multiply.
|
@param A Vector to multiply.
|
||||||
|
Multiply the Vector with a scalar value.*/
|
||||||
Multiply the Vector with a scalar value.
|
|
||||||
*/
|
|
||||||
inline FGColumnVector3 operator*(double scalar, const FGColumnVector3& A) {
|
inline FGColumnVector3 operator*(double scalar, const FGColumnVector3& A) {
|
||||||
// use already defined operation.
|
// use already defined operation.
|
||||||
return A*scalar;
|
return A*scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write vector to a stream.
|
/** Write vector to a stream.
|
||||||
|
|
||||||
@param os Stream to write to.
|
@param os Stream to write to.
|
||||||
@param M Matrix to write.
|
@param M Matrix to write.
|
||||||
|
Write the matrix to a stream.*/
|
||||||
Write the matrix to a stream.
|
|
||||||
*/
|
|
||||||
ostream& operator<<(ostream& os, const FGColumnVector3& col);
|
ostream& operator<<(ostream& os, const FGColumnVector3& col);
|
||||||
|
|
||||||
} // namespace JSBSim
|
} // namespace JSBSim
|
||||||
|
|
|
@ -214,7 +214,7 @@ string FGConfigFile::GetLine(void)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((test = cfgfile.get()) != EOF) { // get *next* character
|
if ((test = cfgfile.get()) != EOF) { // get *next* character
|
||||||
#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
|
#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740) || defined (_MSC_VER)
|
||||||
if (test >= 0x20 || test == 0x09) cfgfile.putback(test);
|
if (test >= 0x20 || test == 0x09) cfgfile.putback(test);
|
||||||
#else
|
#else
|
||||||
if (test >= 0x20 || test == 0x09) cfgfile.unget();
|
if (test >= 0x20 || test == 0x09) cfgfile.unget();
|
||||||
|
|
|
@ -91,19 +91,19 @@ double FGElectric::Calculate(void)
|
||||||
|
|
||||||
PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
|
PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
|
||||||
|
|
||||||
return Thruster->Calculate(PowerAvailable);
|
return Thrust = Thruster->Calculate(PowerAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGElectric::GetEngineLabels(void)
|
string FGElectric::GetEngineLabels(string delimeter)
|
||||||
{
|
{
|
||||||
return ""; // currently no labels are returned for this engine
|
return ""; // currently no labels are returned for this engine
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGElectric::GetEngineValues(void)
|
string FGElectric::GetEngineValues(string delimeter)
|
||||||
{
|
{
|
||||||
return ""; // currently no values are returned for this engine
|
return ""; // currently no values are returned for this engine
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ public:
|
||||||
double GetPowerAvailable(void) {return PowerAvailable;}
|
double GetPowerAvailable(void) {return PowerAvailable;}
|
||||||
double CalcFuelNeed(void);
|
double CalcFuelNeed(void);
|
||||||
double getRPM(void) {return RPM;}
|
double getRPM(void) {return RPM;}
|
||||||
string GetEngineLabels(void);
|
string GetEngineLabels(string delimeter);
|
||||||
string GetEngineValues(void);
|
string GetEngineValues(string delimeter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -87,6 +87,7 @@ FGEngine::FGEngine(FGFDMExec* exec, int engine_number) : EngineNumber(engine_num
|
||||||
TrimMode = false;
|
TrimMode = false;
|
||||||
FuelFlow_gph = 0.0;
|
FuelFlow_gph = 0.0;
|
||||||
FuelFlow_pph = 0.0;
|
FuelFlow_pph = 0.0;
|
||||||
|
FuelFreeze = false;
|
||||||
|
|
||||||
FDMExec = exec;
|
FDMExec = exec;
|
||||||
State = FDMExec->GetState();
|
State = FDMExec->GetState();
|
||||||
|
@ -100,6 +101,10 @@ FGEngine::FGEngine(FGFDMExec* exec, int engine_number) : EngineNumber(engine_num
|
||||||
|
|
||||||
PropertyManager = FDMExec->GetPropertyManager();
|
PropertyManager = FDMExec->GetPropertyManager();
|
||||||
|
|
||||||
|
char property_name[80];
|
||||||
|
snprintf(property_name, 80, "propulsion/engine[%u]/thrust", EngineNumber);
|
||||||
|
PropertyManager->Tie( property_name, &Thrust);
|
||||||
|
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +112,11 @@ FGEngine::FGEngine(FGFDMExec* exec, int engine_number) : EngineNumber(engine_num
|
||||||
|
|
||||||
FGEngine::~FGEngine()
|
FGEngine::~FGEngine()
|
||||||
{
|
{
|
||||||
if (Thruster)
|
if (Thruster) delete Thruster;
|
||||||
delete Thruster;
|
|
||||||
|
char property_name[80];
|
||||||
|
snprintf(property_name, 80, "propulsion/engine[%u]/thrust", EngineNumber);
|
||||||
|
PropertyManager->Untie( property_name);
|
||||||
|
|
||||||
Debug(1);
|
Debug(1);
|
||||||
}
|
}
|
||||||
|
@ -121,6 +129,8 @@ FGEngine::~FGEngine()
|
||||||
|
|
||||||
void FGEngine::ConsumeFuel(void)
|
void FGEngine::ConsumeFuel(void)
|
||||||
{
|
{
|
||||||
|
if (FuelFreeze) return;
|
||||||
|
unsigned int i;
|
||||||
double Fshortage, Oshortage, TanksWithFuel;
|
double Fshortage, Oshortage, TanksWithFuel;
|
||||||
FGTank* Tank;
|
FGTank* Tank;
|
||||||
|
|
||||||
|
@ -128,7 +138,7 @@ void FGEngine::ConsumeFuel(void)
|
||||||
Fshortage = Oshortage = TanksWithFuel = 0.0;
|
Fshortage = Oshortage = TanksWithFuel = 0.0;
|
||||||
|
|
||||||
// count how many assigned tanks have fuel
|
// count how many assigned tanks have fuel
|
||||||
for (unsigned int i=0; i<SourceTanks.size(); i++) {
|
for (i=0; i<SourceTanks.size(); i++) {
|
||||||
Tank = Propulsion->GetTank(SourceTanks[i]);
|
Tank = Propulsion->GetTank(SourceTanks[i]);
|
||||||
if (Tank->GetContents() > 0.0) {
|
if (Tank->GetContents() > 0.0) {
|
||||||
++TanksWithFuel;
|
++TanksWithFuel;
|
||||||
|
@ -136,7 +146,7 @@ void FGEngine::ConsumeFuel(void)
|
||||||
}
|
}
|
||||||
if (!TanksWithFuel) return;
|
if (!TanksWithFuel) return;
|
||||||
|
|
||||||
for (unsigned int i=0; i<SourceTanks.size(); i++) {
|
for (i=0; i<SourceTanks.size(); i++) {
|
||||||
Tank = Propulsion->GetTank(SourceTanks[i]);
|
Tank = Propulsion->GetTank(SourceTanks[i]);
|
||||||
if (Tank->GetType() == FGTank::ttFUEL) {
|
if (Tank->GetType() == FGTank::ttFUEL) {
|
||||||
Fshortage += Tank->Drain(CalcFuelNeed()/TanksWithFuel);
|
Fshortage += Tank->Drain(CalcFuelNeed()/TanksWithFuel);
|
||||||
|
|
|
@ -135,6 +135,7 @@ public:
|
||||||
virtual void SetRunning(bool bb) { Running=bb; }
|
virtual void SetRunning(bool bb) { Running=bb; }
|
||||||
virtual void SetName(string name) { Name = name; }
|
virtual void SetName(string name) { Name = name; }
|
||||||
virtual void AddFeedTank(int tkID);
|
virtual void AddFeedTank(int tkID);
|
||||||
|
virtual void SetFuelFreeze(bool f) { FuelFreeze = f; }
|
||||||
|
|
||||||
virtual void SetStarter(bool s) { Starter = s; }
|
virtual void SetStarter(bool s) { Starter = s; }
|
||||||
|
|
||||||
|
@ -175,8 +176,8 @@ public:
|
||||||
bool LoadThruster(FGConfigFile* AC_cfg);
|
bool LoadThruster(FGConfigFile* AC_cfg);
|
||||||
FGThruster* GetThruster(void) {return Thruster;}
|
FGThruster* GetThruster(void) {return Thruster;}
|
||||||
|
|
||||||
virtual string GetEngineLabels(void) = 0;
|
virtual string GetEngineLabels(string delimeter) = 0;
|
||||||
virtual string GetEngineValues(void) = 0;
|
virtual string GetEngineValues(string delimeter) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FGPropertyManager* PropertyManager;
|
FGPropertyManager* PropertyManager;
|
||||||
|
@ -202,6 +203,7 @@ protected:
|
||||||
bool Running;
|
bool Running;
|
||||||
bool Cranking;
|
bool Cranking;
|
||||||
bool TrimMode;
|
bool TrimMode;
|
||||||
|
bool FuelFreeze;
|
||||||
|
|
||||||
double FuelFlow_gph;
|
double FuelFlow_gph;
|
||||||
double FuelFlow_pph;
|
double FuelFlow_pph;
|
||||||
|
|
|
@ -420,7 +420,7 @@ double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGFCS::GetComponentStrings(void)
|
string FGFCS::GetComponentStrings(string delimeter)
|
||||||
{
|
{
|
||||||
unsigned int comp;
|
unsigned int comp;
|
||||||
string CompStrings = "";
|
string CompStrings = "";
|
||||||
|
@ -428,14 +428,14 @@ string FGFCS::GetComponentStrings(void)
|
||||||
|
|
||||||
for (comp = 0; comp < FCSComponents.size(); comp++) {
|
for (comp = 0; comp < FCSComponents.size(); comp++) {
|
||||||
if (firstime) firstime = false;
|
if (firstime) firstime = false;
|
||||||
else CompStrings += ", ";
|
else CompStrings += delimeter;
|
||||||
|
|
||||||
CompStrings += FCSComponents[comp]->GetName();
|
CompStrings += FCSComponents[comp]->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (comp = 0; comp < APComponents.size(); comp++)
|
for (comp = 0; comp < APComponents.size(); comp++)
|
||||||
{
|
{
|
||||||
CompStrings += ", ";
|
CompStrings += delimeter;
|
||||||
CompStrings += APComponents[comp]->GetName();
|
CompStrings += APComponents[comp]->GetName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ string FGFCS::GetComponentStrings(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGFCS::GetComponentValues(void)
|
string FGFCS::GetComponentValues(string delimeter)
|
||||||
{
|
{
|
||||||
unsigned int comp;
|
unsigned int comp;
|
||||||
string CompValues = "";
|
string CompValues = "";
|
||||||
|
@ -453,14 +453,14 @@ string FGFCS::GetComponentValues(void)
|
||||||
|
|
||||||
for (comp = 0; comp < FCSComponents.size(); comp++) {
|
for (comp = 0; comp < FCSComponents.size(); comp++) {
|
||||||
if (firstime) firstime = false;
|
if (firstime) firstime = false;
|
||||||
else CompValues += ", ";
|
else CompValues += delimeter;
|
||||||
|
|
||||||
sprintf(buffer, "%9.6f", FCSComponents[comp]->GetOutput());
|
sprintf(buffer, "%9.6f", FCSComponents[comp]->GetOutput());
|
||||||
CompValues += string(buffer);
|
CompValues += string(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (comp = 0; comp < APComponents.size(); comp++) {
|
for (comp = 0; comp < APComponents.size(); comp++) {
|
||||||
sprintf(buffer, ", %9.6f", APComponents[comp]->GetOutput());
|
sprintf(buffer, "%s%9.6f", delimeter.c_str(), APComponents[comp]->GetOutput());
|
||||||
CompValues += string(buffer);
|
CompValues += string(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -425,11 +425,16 @@ public:
|
||||||
@return pointer to the State object */
|
@return pointer to the State object */
|
||||||
inline FGState* GetState(void) { return State; }
|
inline FGState* GetState(void) { return State; }
|
||||||
|
|
||||||
/** Retrieves all component names for inclusion in output stream */
|
/** Retrieves all component names for inclusion in output stream
|
||||||
string GetComponentStrings(void);
|
@param delimeter either a tab or comma string depending on output type
|
||||||
|
@return a string containing the descriptive names for all components */
|
||||||
|
string GetComponentStrings(string delimeter);
|
||||||
|
|
||||||
/** Retrieves all component outputs for inclusion in output stream */
|
/** Retrieves all component outputs for inclusion in output stream
|
||||||
string GetComponentValues(void);
|
@param delimeter either a tab or comma string depending on output type
|
||||||
|
@return a string containing the numeric values for the current set of
|
||||||
|
component outputs */
|
||||||
|
string GetComponentValues(string delimeter);
|
||||||
|
|
||||||
/// @name Pilot input command setting
|
/// @name Pilot input command setting
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -120,30 +120,30 @@ bool FGGroundReactions::Load(FGConfigFile* AC_cfg)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGGroundReactions::GetGroundReactionStrings(void)
|
string FGGroundReactions::GetGroundReactionStrings(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
for (unsigned int i=0;i<lGear.size();i++) {
|
for (unsigned int i=0;i<lGear.size();i++) {
|
||||||
string name = lGear[i].GetName();
|
string name = lGear[i].GetName();
|
||||||
buf << name << "_WOW, "
|
buf << name << "_WOW" << delimeter
|
||||||
<< name << "_stroke, "
|
<< name << "_stroke" << delimeter
|
||||||
<< name << "_strokeVel, "
|
<< name << "_strokeVel" << delimeter
|
||||||
<< name << "_CompressForce, "
|
<< name << "_CompressForce" << delimeter
|
||||||
<< name << "_WhlSideForce, "
|
<< name << "_WhlSideForce" << delimeter
|
||||||
<< name << "_WhlVelVecX, "
|
<< name << "_WhlVelVecX" << delimeter
|
||||||
<< name << "_WhlVelVecY, "
|
<< name << "_WhlVelVecY" << delimeter
|
||||||
<< name << "_WhlRollForce, "
|
<< name << "_WhlRollForce" << delimeter
|
||||||
<< name << "_BodyXForce, "
|
<< name << "_BodyXForce" << delimeter
|
||||||
<< name << "_BodyYForce, "
|
<< name << "_BodyYForce" << delimeter
|
||||||
<< name << "_WhlSlipDegrees, ";
|
<< name << "_WhlSlipDegrees" << delimeter;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf << "TotalGearForce_X, "
|
buf << "TotalGearForce_X" << delimeter
|
||||||
<< "TotalGearForce_Y, "
|
<< "TotalGearForce_Y" << delimeter
|
||||||
<< "TotalGearForce_Z, "
|
<< "TotalGearForce_Z" << delimeter
|
||||||
<< "TotalGearMoment_L, "
|
<< "TotalGearMoment_L" << delimeter
|
||||||
<< "TotalGearMoment_M, "
|
<< "TotalGearMoment_M" << delimeter
|
||||||
<< "TotalGearMoment_N";
|
<< "TotalGearMoment_N";
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
|
@ -151,30 +151,30 @@ string FGGroundReactions::GetGroundReactionStrings(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGGroundReactions::GetGroundReactionValues(void)
|
string FGGroundReactions::GetGroundReactionValues(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
for (unsigned int i=0;i<lGear.size();i++) {
|
for (unsigned int i=0;i<lGear.size();i++) {
|
||||||
FGLGear& gear = lGear[i];
|
FGLGear& gear = lGear[i];
|
||||||
buf << (gear.GetWOW() ? "1, " : "0, ")
|
buf << (gear.GetWOW() ? "1, " : "0, ")
|
||||||
<< setprecision(5) << gear.GetCompLen() << ", "
|
<< setprecision(5) << gear.GetCompLen() << delimeter
|
||||||
<< setprecision(6) << gear.GetCompVel() << ", "
|
<< setprecision(6) << gear.GetCompVel() << delimeter
|
||||||
<< setprecision(10) << gear.GetCompForce() << ", "
|
<< setprecision(10) << gear.GetCompForce() << delimeter
|
||||||
<< setprecision(6) << gear.GetWheelVel(eX) << ", "
|
<< setprecision(6) << gear.GetWheelVel(eX) << delimeter
|
||||||
<< gear.GetWheelVel(eY) << ", "
|
<< gear.GetWheelVel(eY) << delimeter
|
||||||
<< gear.GetWheelSideForce() << ", "
|
<< gear.GetWheelSideForce() << delimeter
|
||||||
<< gear.GetWheelRollForce() << ", "
|
<< gear.GetWheelRollForce() << delimeter
|
||||||
<< gear.GetBodyXForce() << ", "
|
<< gear.GetBodyXForce() << delimeter
|
||||||
<< gear.GetBodyYForce() << ", "
|
<< gear.GetBodyYForce() << delimeter
|
||||||
<< gear.GetWheelSlipAngle() << ", ";
|
<< gear.GetWheelSlipAngle() << delimeter;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf << vForces(eX) << ", "
|
buf << vForces(eX) << delimeter
|
||||||
<< vForces(eY) << ", "
|
<< vForces(eY) << delimeter
|
||||||
<< vForces(eZ) << ", "
|
<< vForces(eZ) << delimeter
|
||||||
<< vMoments(eX) << ", "
|
<< vMoments(eX) << delimeter
|
||||||
<< vMoments(eY) << ", "
|
<< vMoments(eY) << delimeter
|
||||||
<< vMoments(eZ);
|
<< vMoments(eZ);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
|
|
|
@ -85,8 +85,8 @@ public:
|
||||||
double GetForces(int idx) const {return vForces(idx);}
|
double GetForces(int idx) const {return vForces(idx);}
|
||||||
FGColumnVector3& GetMoments(void) {return vMoments;}
|
FGColumnVector3& GetMoments(void) {return vMoments;}
|
||||||
double GetMoments(int idx) const {return vMoments(idx);}
|
double GetMoments(int idx) const {return vMoments(idx);}
|
||||||
string GetGroundReactionStrings(void);
|
string GetGroundReactionStrings(string delimeter);
|
||||||
string GetGroundReactionValues(void);
|
string GetGroundReactionValues(string delimeter);
|
||||||
|
|
||||||
inline int GetNumGearUnits(void) const { return lGear.size(); }
|
inline int GetNumGearUnits(void) const { return lGear.size(); }
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,10 @@ CLASS DOCUMENTATION
|
||||||
same magnitude for all components in this representation which is
|
same magnitude for all components in this representation which is
|
||||||
an advantage for numerical stability in implicit time-stepping too.
|
an advantage for numerical stability in implicit time-stepping too.
|
||||||
|
|
||||||
|
Note: The latitude is a GEOCENTRIC value. FlightGear
|
||||||
|
converts latitude to a geodetic value and uses that. In order to get best
|
||||||
|
matching relative to a map, geocentric latitude must be converted to geodetic.
|
||||||
|
|
||||||
@see W. C. Durham "Aircraft Dynamics & Control", section 2.2
|
@see W. C. Durham "Aircraft Dynamics & Control", section 2.2
|
||||||
|
|
||||||
@author Mathias Froehlich
|
@author Mathias Froehlich
|
||||||
|
@ -141,7 +145,10 @@ public:
|
||||||
FGLocation() { mCacheValid = false; }
|
FGLocation() { mCacheValid = false; }
|
||||||
|
|
||||||
/** Constructor to set the longitude, latitude and the distance
|
/** Constructor to set the longitude, latitude and the distance
|
||||||
from the center of the earth. */
|
from the center of the earth.
|
||||||
|
@param lon longitude
|
||||||
|
@param lat GEOCENTRIC latitude
|
||||||
|
@param distance from center of earth to vehicle in feet*/
|
||||||
FGLocation(double lon, double lat, double radius);
|
FGLocation(double lon, double lat, double radius);
|
||||||
|
|
||||||
/** Copy constructor. */
|
/** Copy constructor. */
|
||||||
|
|
|
@ -113,17 +113,12 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Default initializer.
|
/** Default initializer.
|
||||||
|
Create a zero matrix. */
|
||||||
Create a zero matrix.
|
|
||||||
*/
|
|
||||||
FGMatrix33(void);
|
FGMatrix33(void);
|
||||||
|
|
||||||
/** Copy constructor.
|
/** Copy constructor.
|
||||||
|
|
||||||
@param M Matrix which is used for initialization.
|
@param M Matrix which is used for initialization.
|
||||||
|
Create copy of the matrix given in the argument. */
|
||||||
Create copy of the matrix given in the argument.
|
|
||||||
*/
|
|
||||||
FGMatrix33(const FGMatrix33& M) {
|
FGMatrix33(const FGMatrix33& M) {
|
||||||
Entry(1,1) = M.Entry(1,1);
|
Entry(1,1) = M.Entry(1,1);
|
||||||
Entry(2,1) = M.Entry(2,1);
|
Entry(2,1) = M.Entry(2,1);
|
||||||
|
@ -139,7 +134,6 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialization by given values.
|
/** Initialization by given values.
|
||||||
|
|
||||||
@param m11 value of the 1,1 Matrix element.
|
@param m11 value of the 1,1 Matrix element.
|
||||||
@param m12 value of the 1,2 Matrix element.
|
@param m12 value of the 1,2 Matrix element.
|
||||||
@param m13 value of the 1,3 Matrix element.
|
@param m13 value of the 1,3 Matrix element.
|
||||||
|
@ -149,9 +143,7 @@ public:
|
||||||
@param m31 value of the 3,1 Matrix element.
|
@param m31 value of the 3,1 Matrix element.
|
||||||
@param m32 value of the 3,2 Matrix element.
|
@param m32 value of the 3,2 Matrix element.
|
||||||
@param m33 value of the 3,3 Matrix element.
|
@param m33 value of the 3,3 Matrix element.
|
||||||
|
Create a matrix from the doubles given in the arguments. */
|
||||||
Create a matrix from the doubles given in the arguments.
|
|
||||||
*/
|
|
||||||
FGMatrix33(double m11, double m12, double m13,
|
FGMatrix33(double m11, double m12, double m13,
|
||||||
double m21, double m22, double m23,
|
double m21, double m22, double m23,
|
||||||
double m31, double m32, double m33) {
|
double m31, double m32, double m33) {
|
||||||
|
@ -168,30 +160,24 @@ public:
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Destructor.
|
/// Destructor.
|
||||||
*/
|
|
||||||
~FGMatrix33(void) { Debug(1); }
|
~FGMatrix33(void) { Debug(1); }
|
||||||
|
|
||||||
/** Read access the entries of the matrix.
|
/** Read access the entries of the matrix.
|
||||||
@param row Row index.
|
@param row Row index.
|
||||||
@param col Column index.
|
@param col Column index.
|
||||||
|
|
||||||
@return the value of the matrix entry at the given row and
|
@return the value of the matrix entry at the given row and
|
||||||
column indices. Indices are counted starting with 1.
|
column indices. Indices are counted starting with 1. */
|
||||||
*/
|
|
||||||
double operator()(unsigned int row, unsigned int col) const {
|
double operator()(unsigned int row, unsigned int col) const {
|
||||||
return Entry(row, col);
|
return Entry(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write access the entries of the matrix.
|
/** Write access the entries of the matrix.
|
||||||
Note that the indices given in the arguments are unchecked.
|
Note that the indices given in the arguments are unchecked.
|
||||||
|
|
||||||
@param row Row index.
|
@param row Row index.
|
||||||
@param col Column index.
|
@param col Column index.
|
||||||
|
|
||||||
@return a reference to the matrix entry at the given row and
|
@return a reference to the matrix entry at the given row and
|
||||||
column indices. Indices are counted starting with 1.
|
column indices. Indices are counted starting with 1. */
|
||||||
*/
|
|
||||||
double& operator()(unsigned int row, unsigned int col) {
|
double& operator()(unsigned int row, unsigned int col) {
|
||||||
return Entry(row, col);
|
return Entry(row, col);
|
||||||
}
|
}
|
||||||
|
@ -200,15 +186,11 @@ public:
|
||||||
This function is just a shortcut for the @ref double&
|
This function is just a shortcut for the @ref double&
|
||||||
operator()(unsigned int row, unsigned int col) function. It is
|
operator()(unsigned int row, unsigned int col) function. It is
|
||||||
used internally to access the elements in a more convenient way.
|
used internally to access the elements in a more convenient way.
|
||||||
|
|
||||||
Note that the indices given in the arguments are unchecked.
|
Note that the indices given in the arguments are unchecked.
|
||||||
|
|
||||||
@param row Row index.
|
@param row Row index.
|
||||||
@param col Column index.
|
@param col Column index.
|
||||||
|
|
||||||
@return the value of the matrix entry at the given row and
|
@return the value of the matrix entry at the given row and
|
||||||
column indices. Indices are counted starting with 1.
|
column indices. Indices are counted starting with 1. */
|
||||||
*/
|
|
||||||
double Entry(unsigned int row, unsigned int col) const {
|
double Entry(unsigned int row, unsigned int col) const {
|
||||||
return data[(col-1)*eRows+row-1];
|
return data[(col-1)*eRows+row-1];
|
||||||
}
|
}
|
||||||
|
@ -217,34 +199,27 @@ public:
|
||||||
This function is just a shortcut for the @ref double&
|
This function is just a shortcut for the @ref double&
|
||||||
operator()(unsigned int row, unsigned int col) function. It is
|
operator()(unsigned int row, unsigned int col) function. It is
|
||||||
used internally to access the elements in a more convenient way.
|
used internally to access the elements in a more convenient way.
|
||||||
|
|
||||||
Note that the indices given in the arguments are unchecked.
|
Note that the indices given in the arguments are unchecked.
|
||||||
|
|
||||||
@param row Row index.
|
@param row Row index.
|
||||||
@param col Column index.
|
@param col Column index.
|
||||||
|
|
||||||
@return a reference to the matrix entry at the given row and
|
@return a reference to the matrix entry at the given row and
|
||||||
column indices. Indices are counted starting with 1.
|
column indices. Indices are counted starting with 1. */
|
||||||
*/
|
|
||||||
double& Entry(unsigned int row, unsigned int col) {
|
double& Entry(unsigned int row, unsigned int col) {
|
||||||
return data[(col-1)*eRows+row-1];
|
return data[(col-1)*eRows+row-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Number of rows in the matrix.
|
/** Number of rows in the matrix.
|
||||||
@return the number of rows in the matrix.
|
@return the number of rows in the matrix. */
|
||||||
*/
|
|
||||||
unsigned int Rows(void) const { return eRows; }
|
unsigned int Rows(void) const { return eRows; }
|
||||||
|
|
||||||
/** Number of cloumns in the matrix.
|
/** Number of cloumns in the matrix.
|
||||||
@return the number of columns in the matrix.
|
@return the number of columns in the matrix. */
|
||||||
*/
|
|
||||||
unsigned int Cols(void) const { return eColumns; }
|
unsigned int Cols(void) const { return eColumns; }
|
||||||
|
|
||||||
/** Transposed matrix.
|
/** Transposed matrix.
|
||||||
This function only returns the transpose of this matrix. This matrix itself
|
This function only returns the transpose of this matrix. This matrix itself
|
||||||
remains unchanged.
|
remains unchanged.
|
||||||
@return the transposed matrix.
|
@return the transposed matrix. */
|
||||||
*/
|
|
||||||
FGMatrix33 Transposed(void) const {
|
FGMatrix33 Transposed(void) const {
|
||||||
return FGMatrix33( Entry(1,1), Entry(2,1), Entry(3,1),
|
return FGMatrix33( Entry(1,1), Entry(2,1), Entry(3,1),
|
||||||
Entry(1,2), Entry(2,2), Entry(3,2),
|
Entry(1,2), Entry(2,2), Entry(3,2),
|
||||||
|
@ -252,18 +227,15 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Transposes this matrix.
|
/** Transposes this matrix.
|
||||||
This function only transposes this matrix. Nothing is returned.
|
This function only transposes this matrix. Nothing is returned. */
|
||||||
*/
|
|
||||||
void T(void);
|
void T(void);
|
||||||
|
|
||||||
/** Initialize the matrix.
|
/** Initialize the matrix.
|
||||||
This function initializes a matrix to all 0.0.
|
This function initializes a matrix to all 0.0. */
|
||||||
*/
|
|
||||||
void InitMatrix(void);
|
void InitMatrix(void);
|
||||||
|
|
||||||
/** Initialize the matrix.
|
/** Initialize the matrix.
|
||||||
This function initializes a matrix to user specified values.
|
This function initializes a matrix to user specified values. */
|
||||||
*/
|
|
||||||
void InitMatrix(double m11, double m12, double m13,
|
void InitMatrix(double m11, double m12, double m13,
|
||||||
double m21, double m22, double m23,
|
double m21, double m22, double m23,
|
||||||
double m31, double m32, double m33) {
|
double m31, double m32, double m33) {
|
||||||
|
@ -279,8 +251,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Determinant of the matrix.
|
/** Determinant of the matrix.
|
||||||
@return the determinant of the matrix.
|
@return the determinant of the matrix. */
|
||||||
*/
|
|
||||||
double Determinant(void) const;
|
double Determinant(void) const;
|
||||||
|
|
||||||
/** Return if the matrix is invertible.
|
/** Return if the matrix is invertible.
|
||||||
|
@ -288,24 +259,19 @@ public:
|
||||||
invertible. This is done by simply computing the determinant and
|
invertible. This is done by simply computing the determinant and
|
||||||
check if it is zero. Note that this test does not cover any
|
check if it is zero. Note that this test does not cover any
|
||||||
instabilities caused by nearly singular matirces using finite
|
instabilities caused by nearly singular matirces using finite
|
||||||
arithmetics. It only checks exact singularity.
|
arithmetics. It only checks exact singularity. */
|
||||||
*/
|
|
||||||
bool Invertible(void) const { return 0.0 != Determinant(); }
|
bool Invertible(void) const { return 0.0 != Determinant(); }
|
||||||
|
|
||||||
/** Return the inverse of the matrix.
|
/** Return the inverse of the matrix.
|
||||||
Computes and returns if the inverse of the matrix. It is computed
|
Computes and returns if the inverse of the matrix. It is computed
|
||||||
by Cramers Rule. Also there are no checks performed if the matrix
|
by Cramers Rule. Also there are no checks performed if the matrix
|
||||||
is invertible. If you are not sure that it really is check this
|
is invertible. If you are not sure that it really is check this
|
||||||
with the @ref Invertible() call before.
|
with the @ref Invertible() call before. */
|
||||||
*/
|
|
||||||
FGMatrix33 Inverse(void) const;
|
FGMatrix33 Inverse(void) const;
|
||||||
|
|
||||||
/** Assignment operator.
|
/** Assignment operator.
|
||||||
|
|
||||||
@param A source matrix.
|
@param A source matrix.
|
||||||
|
Copy the content of the matrix given in the argument into *this. */
|
||||||
Copy the content of the matrix given in the argument into *this.
|
|
||||||
*/
|
|
||||||
FGMatrix33& operator=(const FGMatrix33& A) {
|
FGMatrix33& operator=(const FGMatrix33& A) {
|
||||||
data[0] = A.data[0];
|
data[0] = A.data[0];
|
||||||
data[1] = A.data[1];
|
data[1] = A.data[1];
|
||||||
|
@ -320,113 +286,80 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Matrix vector multiplication.
|
/** Matrix vector multiplication.
|
||||||
|
|
||||||
@param v vector to multiply with.
|
@param v vector to multiply with.
|
||||||
@return matric vector product.
|
@return matric vector product.
|
||||||
|
|
||||||
Compute and return the product of the current matrix with the
|
Compute and return the product of the current matrix with the
|
||||||
vector given in the argument.
|
vector given in the argument. */
|
||||||
*/
|
|
||||||
FGColumnVector3 operator*(const FGColumnVector3& v) const;
|
FGColumnVector3 operator*(const FGColumnVector3& v) const;
|
||||||
|
|
||||||
/** Matrix subtraction.
|
/** Matrix subtraction.
|
||||||
|
|
||||||
@param B matrix to add to.
|
@param B matrix to add to.
|
||||||
@return difference of the matrices.
|
@return difference of the matrices.
|
||||||
|
|
||||||
Compute and return the sum of the current matrix and the matrix
|
Compute and return the sum of the current matrix and the matrix
|
||||||
B given in the argument.
|
B given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33 operator-(const FGMatrix33& B) const;
|
FGMatrix33 operator-(const FGMatrix33& B) const;
|
||||||
|
|
||||||
/** Matrix addition.
|
/** Matrix addition.
|
||||||
|
|
||||||
@param B matrix to add to.
|
@param B matrix to add to.
|
||||||
@return sum of the matrices.
|
@return sum of the matrices.
|
||||||
|
|
||||||
Compute and return the sum of the current matrix and the matrix
|
Compute and return the sum of the current matrix and the matrix
|
||||||
B given in the argument.
|
B given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33 operator+(const FGMatrix33& B) const;
|
FGMatrix33 operator+(const FGMatrix33& B) const;
|
||||||
|
|
||||||
/** Matrix product.
|
/** Matrix product.
|
||||||
|
|
||||||
@param B matrix to add to.
|
@param B matrix to add to.
|
||||||
@return product of the matrices.
|
@return product of the matrices.
|
||||||
|
|
||||||
Compute and return the product of the current matrix and the matrix
|
Compute and return the product of the current matrix and the matrix
|
||||||
B given in the argument.
|
B given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33 operator*(const FGMatrix33& B) const;
|
FGMatrix33 operator*(const FGMatrix33& B) const;
|
||||||
|
|
||||||
/** Multiply the matrix with a scalar.
|
/** Multiply the matrix with a scalar.
|
||||||
|
|
||||||
@param scalar scalar factor to multiply with.
|
@param scalar scalar factor to multiply with.
|
||||||
@return scaled matrix.
|
@return scaled matrix.
|
||||||
|
|
||||||
Compute and return the product of the current matrix with the
|
Compute and return the product of the current matrix with the
|
||||||
scalar value scalar given in the argument.
|
scalar value scalar given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33 operator*(const double scalar) const;
|
FGMatrix33 operator*(const double scalar) const;
|
||||||
|
|
||||||
/** Multiply the matrix with 1.0/scalar.
|
/** Multiply the matrix with 1.0/scalar.
|
||||||
|
|
||||||
@param scalar scalar factor to divide through.
|
@param scalar scalar factor to divide through.
|
||||||
@return scaled matrix.
|
@return scaled matrix.
|
||||||
|
|
||||||
Compute and return the product of the current matrix with the
|
Compute and return the product of the current matrix with the
|
||||||
scalar value 1.0/scalar, where scalar is given in the argument.
|
scalar value 1.0/scalar, where scalar is given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33 operator/(const double scalar) const;
|
FGMatrix33 operator/(const double scalar) const;
|
||||||
|
|
||||||
/** In place matrix subtraction.
|
/** In place matrix subtraction.
|
||||||
|
|
||||||
@param B matrix to subtract.
|
@param B matrix to subtract.
|
||||||
@return reference to the current matrix.
|
@return reference to the current matrix.
|
||||||
|
|
||||||
Compute the diffence from the current matrix and the matrix B
|
Compute the diffence from the current matrix and the matrix B
|
||||||
given in the argument.
|
given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33& operator-=(const FGMatrix33 &B);
|
FGMatrix33& operator-=(const FGMatrix33 &B);
|
||||||
|
|
||||||
/** In place matrix addition.
|
/** In place matrix addition.
|
||||||
|
|
||||||
@param B matrix to add.
|
@param B matrix to add.
|
||||||
@return reference to the current matrix.
|
@return reference to the current matrix.
|
||||||
|
|
||||||
Compute the sum of the current matrix and the matrix B
|
Compute the sum of the current matrix and the matrix B
|
||||||
given in the argument.
|
given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33& operator+=(const FGMatrix33 &B);
|
FGMatrix33& operator+=(const FGMatrix33 &B);
|
||||||
|
|
||||||
/** In place matrix multiplication.
|
/** In place matrix multiplication.
|
||||||
|
|
||||||
@param B matrix to multiply with.
|
@param B matrix to multiply with.
|
||||||
@return reference to the current matrix.
|
@return reference to the current matrix.
|
||||||
|
|
||||||
Compute the product of the current matrix and the matrix B
|
Compute the product of the current matrix and the matrix B
|
||||||
given in the argument.
|
given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33& operator*=(const FGMatrix33 &B);
|
FGMatrix33& operator*=(const FGMatrix33 &B);
|
||||||
|
|
||||||
/** In place matrix scale.
|
/** In place matrix scale.
|
||||||
|
|
||||||
@param scalar scalar value to multiply with.
|
@param scalar scalar value to multiply with.
|
||||||
@return reference to the current matrix.
|
@return reference to the current matrix.
|
||||||
|
|
||||||
Compute the product of the current matrix and the scalar value scalar
|
Compute the product of the current matrix and the scalar value scalar
|
||||||
given in the argument.
|
given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33& operator*=(const double scalar);
|
FGMatrix33& operator*=(const double scalar);
|
||||||
|
|
||||||
/** In place matrix scale.
|
/** In place matrix scale.
|
||||||
|
|
||||||
@param scalar scalar value to divide through.
|
@param scalar scalar value to divide through.
|
||||||
@return reference to the current matrix.
|
@return reference to the current matrix.
|
||||||
|
|
||||||
Compute the product of the current matrix and the scalar value
|
Compute the product of the current matrix and the scalar value
|
||||||
1.0/scalar, where scalar is given in the argument.
|
1.0/scalar, where scalar is given in the argument. */
|
||||||
*/
|
|
||||||
FGMatrix33& operator/=(const double scalar);
|
FGMatrix33& operator/=(const double scalar);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -436,33 +369,24 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Scalar multiplication.
|
/** Scalar multiplication.
|
||||||
|
|
||||||
@param scalar scalar value to multiply with.
|
@param scalar scalar value to multiply with.
|
||||||
@param A Matrix to multiply.
|
@param A Matrix to multiply.
|
||||||
|
Multiply the Matrix with a scalar value.*/
|
||||||
Multiply the Matrix with a scalar value.
|
|
||||||
*/
|
|
||||||
inline FGMatrix33 operator*(double scalar, const FGMatrix33& A) {
|
inline FGMatrix33 operator*(double scalar, const FGMatrix33& A) {
|
||||||
// use already defined operation.
|
// use already defined operation.
|
||||||
return A*scalar;
|
return A*scalar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write matrix to a stream.
|
/** Write matrix to a stream.
|
||||||
|
|
||||||
@param os Stream to write to.
|
@param os Stream to write to.
|
||||||
@param M Matrix to write.
|
@param M Matrix to write.
|
||||||
|
Write the matrix to a stream.*/
|
||||||
Write the matrix to a stream.
|
|
||||||
*/
|
|
||||||
ostream& operator<<(ostream& os, const FGMatrix33& M);
|
ostream& operator<<(ostream& os, const FGMatrix33& M);
|
||||||
|
|
||||||
/** Read matrix from a stream.
|
/** Read matrix from a stream.
|
||||||
|
|
||||||
@param os Stream to read from.
|
@param os Stream to read from.
|
||||||
@param M Matrix to initialize with the values from the stream.
|
@param M Matrix to initialize with the values from the stream.
|
||||||
|
Read matrix from a stream.*/
|
||||||
Read matrix from a stream.
|
|
||||||
*/
|
|
||||||
istream& operator>>(istream& is, FGMatrix33& M);
|
istream& operator>>(istream& is, FGMatrix33& M);
|
||||||
|
|
||||||
} // namespace JSBSim
|
} // namespace JSBSim
|
||||||
|
|
|
@ -66,7 +66,6 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, FGConfigFile* Nzl_cfg, int num) : FGThrus
|
||||||
}
|
}
|
||||||
|
|
||||||
Thrust = 0;
|
Thrust = 0;
|
||||||
ReverserAngle = 0.0;
|
|
||||||
Type = ttNozzle;
|
Type = ttNozzle;
|
||||||
Area2 = (Diameter*Diameter/4.0)*M_PI;
|
Area2 = (Diameter*Diameter/4.0)*M_PI;
|
||||||
AreaT = Area2/ExpR;
|
AreaT = Area2/ExpR;
|
||||||
|
@ -95,7 +94,7 @@ double FGNozzle::Calculate(double CfPc)
|
||||||
{
|
{
|
||||||
double pAtm = fdmex->GetAtmosphere()->GetPressure();
|
double pAtm = fdmex->GetAtmosphere()->GetPressure();
|
||||||
Thrust = max((double)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
|
Thrust = max((double)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
|
||||||
vFn(1) = Thrust * cos(ReverserAngle);
|
vFn(1) = Thrust;
|
||||||
|
|
||||||
ThrustCoeff = max((double)0.0, CfPc / ((pAtm - PE) * Area2));
|
ThrustCoeff = max((double)0.0, CfPc / ((pAtm - PE) * Area2));
|
||||||
|
|
||||||
|
@ -111,7 +110,7 @@ double FGNozzle::GetPowerRequired(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGNozzle::GetThrusterLabels(int id)
|
string FGNozzle::GetThrusterLabels(int id, string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
|
@ -122,7 +121,7 @@ string FGNozzle::GetThrusterLabels(int id)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGNozzle::GetThrusterValues(int id)
|
string FGNozzle::GetThrusterValues(int id, string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
|
|
|
@ -75,11 +75,11 @@ public:
|
||||||
|
|
||||||
double Calculate(double CfPc);
|
double Calculate(double CfPc);
|
||||||
double GetPowerRequired(void);
|
double GetPowerRequired(void);
|
||||||
string GetThrusterLabels(int id);
|
string GetThrusterLabels(int id, string delimeter);
|
||||||
string GetThrusterValues(int id);
|
string GetThrusterValues(int id, string delimeter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double ReverserAngle;
|
|
||||||
double PE;
|
double PE;
|
||||||
double ExpR;
|
double ExpR;
|
||||||
double nzlEff;
|
double nzlEff;
|
||||||
|
|
|
@ -72,6 +72,7 @@ FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
|
||||||
SubSystems = 0;
|
SubSystems = 0;
|
||||||
enabled = true;
|
enabled = true;
|
||||||
outputInFileName = "";
|
outputInFileName = "";
|
||||||
|
delimeter = ", ";
|
||||||
|
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ bool FGOutput::Run(void)
|
||||||
if (FGModel::Run()) return true;
|
if (FGModel::Run()) return true;
|
||||||
if (Type == otSocket) {
|
if (Type == otSocket) {
|
||||||
SocketOutput();
|
SocketOutput();
|
||||||
} else if (Type == otCSV) {
|
} else if (Type == otCSV || Type == otTab) {
|
||||||
DelimitedOutput(Filename);
|
DelimitedOutput(Filename);
|
||||||
} else if (Type == otTerminal) {
|
} else if (Type == otTerminal) {
|
||||||
// Not done yet
|
// Not done yet
|
||||||
|
@ -113,8 +114,10 @@ void FGOutput::SetType(string type)
|
||||||
{
|
{
|
||||||
if (type == "CSV") {
|
if (type == "CSV") {
|
||||||
Type = otCSV;
|
Type = otCSV;
|
||||||
|
delimeter = ", ";
|
||||||
} else if (type == "TABULAR") {
|
} else if (type == "TABULAR") {
|
||||||
Type = otTab;
|
Type = otTab;
|
||||||
|
delimeter = "\t";
|
||||||
} else if (type == "SOCKET") {
|
} else if (type == "SOCKET") {
|
||||||
Type = otSocket;
|
Type = otSocket;
|
||||||
} else if (type == "TERMINAL") {
|
} else if (type == "TERMINAL") {
|
||||||
|
@ -147,89 +150,89 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
// Nothing here, yet
|
// Nothing here, yet
|
||||||
}
|
}
|
||||||
if (SubSystems & ssAerosurfaces) {
|
if (SubSystems & ssAerosurfaces) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "Aileron Cmd, ";
|
outstream << "Aileron Cmd" + delimeter;
|
||||||
outstream << "Elevator Cmd, ";
|
outstream << "Elevator Cmd" + delimeter;
|
||||||
outstream << "Rudder Cmd, ";
|
outstream << "Rudder Cmd" + delimeter;
|
||||||
outstream << "Flap Cmd, ";
|
outstream << "Flap Cmd" + delimeter;
|
||||||
outstream << "Left Aileron Pos, ";
|
outstream << "Left Aileron Pos" + delimeter;
|
||||||
outstream << "Right Aileron Pos, ";
|
outstream << "Right Aileron Pos" + delimeter;
|
||||||
outstream << "Elevator Pos, ";
|
outstream << "Elevator Pos" + delimeter;
|
||||||
outstream << "Rudder Pos, ";
|
outstream << "Rudder Pos" + delimeter;
|
||||||
outstream << "Flap Pos";
|
outstream << "Flap Pos";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssRates) {
|
if (SubSystems & ssRates) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "P, Q, R, ";
|
outstream << "P" + delimeter + "Q" + delimeter + "R" + delimeter;
|
||||||
outstream << "Pdot, Qdot, Rdot";
|
outstream << "Pdot" + delimeter + "Qdot" + delimeter + "Rdot";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssVelocities) {
|
if (SubSystems & ssVelocities) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "QBar, ";
|
outstream << "QBar" + delimeter;
|
||||||
outstream << "Vtotal, ";
|
outstream << "Vtotal" + delimeter;
|
||||||
outstream << "UBody, VBody, WBody, ";
|
outstream << "UBody" + delimeter + "VBody" + delimeter + "WBody" + delimeter;
|
||||||
outstream << "UAero, VAero, WAero, ";
|
outstream << "UAero" + delimeter + "VAero" + delimeter + "WAero" + delimeter;
|
||||||
outstream << "Vn, Ve, Vd";
|
outstream << "Vn" + delimeter + "Ve" + delimeter + "Vd";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssForces) {
|
if (SubSystems & ssForces) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "Drag, Side, Lift, ";
|
outstream << "Drag" + delimeter + "Side" + delimeter + "Lift" + delimeter;
|
||||||
outstream << "L/D, ";
|
outstream << "L/D" + delimeter;
|
||||||
outstream << "Xforce, Yforce, Zforce";
|
outstream << "Xforce" + delimeter + "Yforce" + delimeter + "Zforce";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssMoments) {
|
if (SubSystems & ssMoments) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "L, M, N";
|
outstream << "L" + delimeter + "M" + delimeter + "N";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssAtmosphere) {
|
if (SubSystems & ssAtmosphere) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "Rho, ";
|
outstream << "Rho" + delimeter;
|
||||||
outstream << "NWind, EWind, DWind";
|
outstream << "NWind" + delimeter + "EWind" + delimeter + "DWind";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssMassProps) {
|
if (SubSystems & ssMassProps) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "Ixx, ";
|
outstream << "Ixx" + delimeter;
|
||||||
outstream << "Ixy, ";
|
outstream << "Ixy" + delimeter;
|
||||||
outstream << "Ixz, ";
|
outstream << "Ixz" + delimeter;
|
||||||
outstream << "Iyx, ";
|
outstream << "Iyx" + delimeter;
|
||||||
outstream << "Iyy, ";
|
outstream << "Iyy" + delimeter;
|
||||||
outstream << "Iyz, ";
|
outstream << "Iyz" + delimeter;
|
||||||
outstream << "Izx, ";
|
outstream << "Izx" + delimeter;
|
||||||
outstream << "Izy, ";
|
outstream << "Izy" + delimeter;
|
||||||
outstream << "Izz, ";
|
outstream << "Izz" + delimeter;
|
||||||
outstream << "Mass, ";
|
outstream << "Mass" + delimeter;
|
||||||
outstream << "Xcg, Ycg, Zcg";
|
outstream << "Xcg" + delimeter + "Ycg" + delimeter + "Zcg";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssPropagate) {
|
if (SubSystems & ssPropagate) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << "Altitude, ";
|
outstream << "Altitude" + delimeter;
|
||||||
outstream << "Phi, Tht, Psi, ";
|
outstream << "Phi" + delimeter + "Tht" + delimeter + "Psi" + delimeter;
|
||||||
outstream << "Alpha, ";
|
outstream << "Alpha" + delimeter;
|
||||||
outstream << "Beta, ";
|
outstream << "Beta" + delimeter;
|
||||||
outstream << "Latitude (Deg), ";
|
outstream << "Latitude (Deg)" + delimeter;
|
||||||
outstream << "Longitude (Deg), ";
|
outstream << "Longitude (Deg)" + delimeter;
|
||||||
outstream << "Distance AGL, ";
|
outstream << "Distance AGL" + delimeter;
|
||||||
outstream << "Runway Radius";
|
outstream << "Runway Radius";
|
||||||
}
|
}
|
||||||
if (SubSystems & ssCoefficients) {
|
if (SubSystems & ssCoefficients) {
|
||||||
scratch = Aerodynamics->GetCoefficientStrings();
|
scratch = Aerodynamics->GetCoefficientStrings(delimeter);
|
||||||
if (scratch.length() != 0) outstream << ", " << scratch;
|
if (scratch.length() != 0) outstream << delimeter << scratch;
|
||||||
}
|
}
|
||||||
if (SubSystems & ssFCS) {
|
if (SubSystems & ssFCS) {
|
||||||
scratch = FCS->GetComponentStrings();
|
scratch = FCS->GetComponentStrings(delimeter);
|
||||||
if (scratch.length() != 0) outstream << ", " << scratch;
|
if (scratch.length() != 0) outstream << delimeter << scratch;
|
||||||
}
|
}
|
||||||
if (SubSystems & ssGroundReactions) {
|
if (SubSystems & ssGroundReactions) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << GroundReactions->GetGroundReactionStrings();
|
outstream << GroundReactions->GetGroundReactionStrings(delimeter);
|
||||||
}
|
}
|
||||||
if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
|
if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Propulsion->GetPropulsionStrings();
|
outstream << Propulsion->GetPropulsionStrings(delimeter);
|
||||||
}
|
}
|
||||||
if (OutputProperties.size() > 0) {
|
if (OutputProperties.size() > 0) {
|
||||||
for (unsigned int i=0;i<OutputProperties.size();i++) {
|
for (unsigned int i=0;i<OutputProperties.size();i++) {
|
||||||
outstream << ", " << OutputProperties[i]->GetName();
|
outstream << delimeter << OutputProperties[i]->GetName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,81 +244,81 @@ void FGOutput::DelimitedOutput(string fname)
|
||||||
if (SubSystems & ssSimulation) {
|
if (SubSystems & ssSimulation) {
|
||||||
}
|
}
|
||||||
if (SubSystems & ssAerosurfaces) {
|
if (SubSystems & ssAerosurfaces) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << FCS->GetDaCmd() << ", ";
|
outstream << FCS->GetDaCmd() << delimeter;
|
||||||
outstream << FCS->GetDeCmd() << ", ";
|
outstream << FCS->GetDeCmd() << delimeter;
|
||||||
outstream << FCS->GetDrCmd() << ", ";
|
outstream << FCS->GetDrCmd() << delimeter;
|
||||||
outstream << FCS->GetDfCmd() << ", ";
|
outstream << FCS->GetDfCmd() << delimeter;
|
||||||
outstream << FCS->GetDaLPos() << ", ";
|
outstream << FCS->GetDaLPos() << delimeter;
|
||||||
outstream << FCS->GetDaRPos() << ", ";
|
outstream << FCS->GetDaRPos() << delimeter;
|
||||||
outstream << FCS->GetDePos() << ", ";
|
outstream << FCS->GetDePos() << delimeter;
|
||||||
outstream << FCS->GetDrPos() << ", ";
|
outstream << FCS->GetDrPos() << delimeter;
|
||||||
outstream << FCS->GetDfPos();
|
outstream << FCS->GetDfPos();
|
||||||
}
|
}
|
||||||
if (SubSystems & ssRates) {
|
if (SubSystems & ssRates) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Propagate->GetPQR() << ", ";
|
outstream << Propagate->GetPQR().Dump(delimeter) << delimeter;
|
||||||
outstream << Propagate->GetPQRdot();
|
outstream << Propagate->GetPQRdot().Dump(delimeter);
|
||||||
}
|
}
|
||||||
if (SubSystems & ssVelocities) {
|
if (SubSystems & ssVelocities) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Auxiliary->Getqbar() << ", ";
|
outstream << Auxiliary->Getqbar() << delimeter;
|
||||||
outstream << setprecision(12) << Auxiliary->GetVt() << ", ";
|
outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
|
||||||
outstream << setprecision(12) << Propagate->GetUVW() << ", ";
|
outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
|
||||||
outstream << Auxiliary->GetAeroUVW() << ", ";
|
outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
|
||||||
outstream << Propagate->GetVel();
|
outstream << Propagate->GetVel().Dump(delimeter);
|
||||||
}
|
}
|
||||||
if (SubSystems & ssForces) {
|
if (SubSystems & ssForces) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Aerodynamics->GetvFs() << ", ";
|
outstream << Aerodynamics->GetvFs() << delimeter;
|
||||||
outstream << Aerodynamics->GetLoD() << ", ";
|
outstream << Aerodynamics->GetLoD() << delimeter;
|
||||||
outstream << Aircraft->GetForces();
|
outstream << Aircraft->GetForces().Dump(delimeter);
|
||||||
}
|
}
|
||||||
if (SubSystems & ssMoments) {
|
if (SubSystems & ssMoments) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Aircraft->GetMoments();
|
outstream << Aircraft->GetMoments().Dump(delimeter);
|
||||||
}
|
}
|
||||||
if (SubSystems & ssAtmosphere) {
|
if (SubSystems & ssAtmosphere) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Atmosphere->GetDensity() << ", ";
|
outstream << Atmosphere->GetDensity() << delimeter;
|
||||||
outstream << Atmosphere->GetWindNED();
|
outstream << Atmosphere->GetWindNED().Dump(delimeter);
|
||||||
}
|
}
|
||||||
if (SubSystems & ssMassProps) {
|
if (SubSystems & ssMassProps) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << MassBalance->GetJ() << ", ";
|
outstream << MassBalance->GetJ() << delimeter;
|
||||||
outstream << MassBalance->GetMass() << ", ";
|
outstream << MassBalance->GetMass() << delimeter;
|
||||||
outstream << MassBalance->GetXYZcg();
|
outstream << MassBalance->GetXYZcg();
|
||||||
}
|
}
|
||||||
if (SubSystems & ssPropagate) {
|
if (SubSystems & ssPropagate) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Propagate->Geth() << ", ";
|
outstream << Propagate->Geth() << delimeter;
|
||||||
outstream << Propagate->GetEuler() << ", ";
|
outstream << Propagate->GetEuler().Dump(delimeter) << delimeter;
|
||||||
outstream << Auxiliary->Getalpha(inDegrees) << ", ";
|
outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
|
||||||
outstream << Auxiliary->Getbeta(inDegrees) << ", ";
|
outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
|
||||||
outstream << Propagate->GetLocation().GetLatitudeDeg() << ", ";
|
outstream << Propagate->GetLocation().GetLatitudeDeg() << delimeter;
|
||||||
outstream << Propagate->GetLocation().GetLongitudeDeg() << ", ";
|
outstream << Propagate->GetLocation().GetLongitudeDeg() << delimeter;
|
||||||
outstream << Propagate->GetDistanceAGL() << ", ";
|
outstream << Propagate->GetDistanceAGL() << delimeter;
|
||||||
outstream << Propagate->GetRunwayRadius();
|
outstream << Propagate->GetRunwayRadius();
|
||||||
}
|
}
|
||||||
if (SubSystems & ssCoefficients) {
|
if (SubSystems & ssCoefficients) {
|
||||||
scratch = Aerodynamics->GetCoefficientValues();
|
scratch = Aerodynamics->GetCoefficientValues(delimeter);
|
||||||
if (scratch.length() != 0) outstream << ", " << scratch;
|
if (scratch.length() != 0) outstream << delimeter << scratch;
|
||||||
}
|
}
|
||||||
if (SubSystems & ssFCS) {
|
if (SubSystems & ssFCS) {
|
||||||
scratch = FCS->GetComponentValues();
|
scratch = FCS->GetComponentValues(delimeter);
|
||||||
if (scratch.length() != 0) outstream << ", " << scratch;
|
if (scratch.length() != 0) outstream << delimeter << scratch;
|
||||||
}
|
}
|
||||||
if (SubSystems & ssGroundReactions) {
|
if (SubSystems & ssGroundReactions) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << GroundReactions->GetGroundReactionValues();
|
outstream << GroundReactions->GetGroundReactionValues(delimeter);
|
||||||
}
|
}
|
||||||
if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
|
if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
|
||||||
outstream << ", ";
|
outstream << delimeter;
|
||||||
outstream << Propulsion->GetPropulsionValues();
|
outstream << Propulsion->GetPropulsionValues(delimeter);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i=0;i<OutputProperties.size();i++) {
|
for (unsigned int i=0;i<OutputProperties.size();i++) {
|
||||||
outstream << ", " << OutputProperties[i]->getDoubleValue();
|
outstream << delimeter << OutputProperties[i]->getDoubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
outstream << endl;
|
outstream << endl;
|
||||||
|
|
|
@ -161,7 +161,7 @@ public:
|
||||||
private:
|
private:
|
||||||
bool sFirstPass, dFirstPass, enabled;
|
bool sFirstPass, dFirstPass, enabled;
|
||||||
int SubSystems;
|
int SubSystems;
|
||||||
string Filename, outputInFileName;
|
string Filename, outputInFileName, delimeter;
|
||||||
enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type;
|
enum {otNone, otCSV, otTab, otSocket, otTerminal, otUnknown} Type;
|
||||||
ofstream datafile;
|
ofstream datafile;
|
||||||
FGfdmSocket* socket;
|
FGfdmSocket* socket;
|
||||||
|
|
|
@ -93,7 +93,7 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number)
|
||||||
bTakeoffBoost = false;
|
bTakeoffBoost = false;
|
||||||
TakeoffBoost = 0.0; // Default to no extra takeoff-boost
|
TakeoffBoost = 0.0; // Default to no extra takeoff-boost
|
||||||
int i;
|
int i;
|
||||||
for(i=0; i<FG_MAX_BOOST_SPEEDS; ++i) {
|
for (i=0; i<FG_MAX_BOOST_SPEEDS; i++) {
|
||||||
RatedBoost[i] = 0.0;
|
RatedBoost[i] = 0.0;
|
||||||
RatedPower[i] = 0.0;
|
RatedPower[i] = 0.0;
|
||||||
RatedAltitude[i] = 0.0;
|
RatedAltitude[i] = 0.0;
|
||||||
|
@ -102,6 +102,10 @@ FGPiston::FGPiston(FGFDMExec* exec, FGConfigFile* Eng_cfg, int engine_number)
|
||||||
RatedRPM[i] = 2500;
|
RatedRPM[i] = 2500;
|
||||||
TakeoffMAP[i] = 100000;
|
TakeoffMAP[i] = 100000;
|
||||||
}
|
}
|
||||||
|
for (i=0; i<FG_MAX_BOOST_SPEEDS-1; i++) {
|
||||||
|
BoostSwitchAltitude[i] = 0.0;
|
||||||
|
BoostSwitchPressure[i] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialisation
|
// Initialisation
|
||||||
volumetric_efficiency = 0.8; // Actually f(speed, load) but this will get us running
|
volumetric_efficiency = 0.8; // Actually f(speed, load) but this will get us running
|
||||||
|
@ -277,7 +281,7 @@ double FGPiston::Calculate(void)
|
||||||
|
|
||||||
PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
|
PowerAvailable = (HP * hptoftlbssec) - Thruster->GetPowerRequired();
|
||||||
|
|
||||||
return Thruster->Calculate(PowerAvailable);
|
return Thrust = Thruster->Calculate(PowerAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -698,23 +702,25 @@ void FGPiston::doOilPressure(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPiston::GetEngineLabels(void)
|
string FGPiston::GetEngineLabels(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
buf << Name << "_PwrAvail[" << EngineNumber << "], "
|
buf << Name << "_PwrAvail[" << EngineNumber << "]" << delimeter
|
||||||
<< Thruster->GetThrusterLabels(EngineNumber);
|
<< Name << "_HP[" << EngineNumber << "]" << delimeter
|
||||||
|
<< Thruster->GetThrusterLabels(EngineNumber, delimeter);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPiston::GetEngineValues(void)
|
string FGPiston::GetEngineValues(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
buf << PowerAvailable << ", " << Thruster->GetThrusterValues(EngineNumber);
|
buf << PowerAvailable << delimeter << HP << delimeter
|
||||||
|
<< Thruster->GetThrusterValues(EngineNumber, delimeter);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,8 +146,8 @@ public:
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~FGPiston();
|
~FGPiston();
|
||||||
|
|
||||||
string GetEngineLabels(void);
|
string GetEngineLabels(string delimeter);
|
||||||
string GetEngineValues(void);
|
string GetEngineValues(string delimeter);
|
||||||
|
|
||||||
double Calculate(void);
|
double Calculate(void);
|
||||||
double GetPowerAvailable(void) {return PowerAvailable;}
|
double GetPowerAvailable(void) {return PowerAvailable;}
|
||||||
|
|
|
@ -210,12 +210,12 @@ bool FGPropagate::Run(void)
|
||||||
// Compute body frame accelerations based on the current body forces
|
// Compute body frame accelerations based on the current body forces
|
||||||
vUVWdot = VState.vUVW*VState.vPQR + vForces/mass;
|
vUVWdot = VState.vUVW*VState.vPQR + vForces/mass;
|
||||||
|
|
||||||
// Centrifugal acceleration.
|
// Coriolis acceleration.
|
||||||
FGColumnVector3 ecVel = Tl2ec*vVel;
|
FGColumnVector3 ecVel = Tl2ec*vVel;
|
||||||
FGColumnVector3 ace = 2.0*omega*ecVel;
|
FGColumnVector3 ace = 2.0*omega*ecVel;
|
||||||
vUVWdot -= Tl2b*(Tec2l*ace);
|
vUVWdot -= Tl2b*(Tec2l*ace);
|
||||||
|
|
||||||
// Coriolis acceleration.
|
// Centrifugal acceleration.
|
||||||
FGColumnVector3 aeec = omega*(omega*VState.vLocation);
|
FGColumnVector3 aeec = omega*(omega*VState.vLocation);
|
||||||
vUVWdot -= Tl2b*(Tec2l*aeec);
|
vUVWdot -= Tl2b*(Tec2l*aeec);
|
||||||
|
|
||||||
|
|
|
@ -252,16 +252,16 @@ FGColumnVector3 FGPropeller::GetPFactor()
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPropeller::GetThrusterLabels(int id)
|
string FGPropeller::GetThrusterLabels(int id, string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
buf << Name << "_Torque[" << id << "], "
|
buf << Name << "_Torque[" << id << "]" << delimeter
|
||||||
<< Name << "_PFactor_Pitch[" << id << "], "
|
<< Name << "_PFactor_Pitch[" << id << "]" << delimeter
|
||||||
<< Name << "_PFactor_Yaw[" << id << "], "
|
<< Name << "_PFactor_Yaw[" << id << "]" << delimeter
|
||||||
<< Name << "_Thrust[" << id << "], ";
|
<< Name << "_Thrust[" << id << "]" << delimeter;
|
||||||
if (IsVPitch())
|
if (IsVPitch())
|
||||||
buf << Name << "_Pitch[" << id << "], ";
|
buf << Name << "_Pitch[" << id << "]" << delimeter;
|
||||||
buf << Name << "_RPM[" << id << "]";
|
buf << Name << "_RPM[" << id << "]";
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
|
@ -269,17 +269,17 @@ string FGPropeller::GetThrusterLabels(int id)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPropeller::GetThrusterValues(int id)
|
string FGPropeller::GetThrusterValues(int id, string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
FGColumnVector3 vPFactor = GetPFactor();
|
FGColumnVector3 vPFactor = GetPFactor();
|
||||||
buf << vTorque(eX) << ", "
|
buf << vTorque(eX) << delimeter
|
||||||
<< vPFactor(ePitch) << ", "
|
<< vPFactor(ePitch) << delimeter
|
||||||
<< vPFactor(eYaw) << ", "
|
<< vPFactor(eYaw) << delimeter
|
||||||
<< Thrust << ", ";
|
<< Thrust << delimeter;
|
||||||
if (IsVPitch())
|
if (IsVPitch())
|
||||||
buf << Pitch << ", ";
|
buf << Pitch << delimeter;
|
||||||
buf << RPM;
|
buf << RPM;
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
|
|
|
@ -153,8 +153,8 @@ public:
|
||||||
@return the thrust in pounds */
|
@return the thrust in pounds */
|
||||||
double Calculate(double PowerAvailable);
|
double Calculate(double PowerAvailable);
|
||||||
FGColumnVector3 GetPFactor(void);
|
FGColumnVector3 GetPFactor(void);
|
||||||
string GetThrusterLabels(int id);
|
string GetThrusterLabels(int id, string delimeter);
|
||||||
string GetThrusterValues(int id);
|
string GetThrusterValues(int id, string delimeter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int numBlades;
|
int numBlades;
|
||||||
|
|
|
@ -75,9 +75,9 @@ FGPropertyManager*
|
||||||
FGPropertyManager::GetNode (const string &path, bool create)
|
FGPropertyManager::GetNode (const string &path, bool create)
|
||||||
{
|
{
|
||||||
SGPropertyNode* node=this->getNode(path.c_str(), create);
|
SGPropertyNode* node=this->getNode(path.c_str(), create);
|
||||||
if(node == 0)
|
//if(node == 0)
|
||||||
cout << "FGPropertyManager::GetNode() No node found for "
|
// cout << "FGPropertyManager::GetNode() No node found for "
|
||||||
<< path << endl;
|
// << path << endl;
|
||||||
return (FGPropertyManager*)node;
|
return (FGPropertyManager*)node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ INCLUDES
|
||||||
#include "FGPiston.h"
|
#include "FGPiston.h"
|
||||||
#include "FGElectric.h"
|
#include "FGElectric.h"
|
||||||
#include "FGPropertyManager.h"
|
#include "FGPropertyManager.h"
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
|
@ -73,6 +74,7 @@ FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
|
||||||
ActiveEngine = -1; // -1: ALL, 0: Engine 1, 1: Engine 2 ...
|
ActiveEngine = -1; // -1: ALL, 0: Engine 1, 1: Engine 2 ...
|
||||||
tankJ.InitMatrix();
|
tankJ.InitMatrix();
|
||||||
refuel = false;
|
refuel = false;
|
||||||
|
fuel_freeze = false;
|
||||||
|
|
||||||
bind();
|
bind();
|
||||||
|
|
||||||
|
@ -93,6 +95,8 @@ FGPropulsion::~FGPropulsion()
|
||||||
|
|
||||||
bool FGPropulsion::Run(void)
|
bool FGPropulsion::Run(void)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
if (FGModel::Run()) return true;
|
if (FGModel::Run()) return true;
|
||||||
|
|
||||||
double dt = State->Getdt();
|
double dt = State->Getdt();
|
||||||
|
@ -100,13 +104,13 @@ bool FGPropulsion::Run(void)
|
||||||
vForces.InitMatrix();
|
vForces.InitMatrix();
|
||||||
vMoments.InitMatrix();
|
vMoments.InitMatrix();
|
||||||
|
|
||||||
for (unsigned int i=0; i<numEngines; i++) {
|
for (i=0; i<numEngines; i++) {
|
||||||
Engines[i]->Calculate();
|
Engines[i]->Calculate();
|
||||||
vForces += Engines[i]->GetBodyForces(); // sum body frame forces
|
vForces += Engines[i]->GetBodyForces(); // sum body frame forces
|
||||||
vMoments += Engines[i]->GetMoments(); // sum body frame moments
|
vMoments += Engines[i]->GetMoments(); // sum body frame moments
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int i=0; i<numTanks; i++) {
|
for (i=0; i<numTanks; i++) {
|
||||||
Tanks[i]->Calculate( dt * rate );
|
Tanks[i]->Calculate( dt * rate );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,16 +322,23 @@ bool FGPropulsion::Load(FGConfigFile* AC_cfg)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPropulsion::GetPropulsionStrings(void)
|
string FGPropulsion::GetPropulsionStrings(string delimeter)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
string PropulsionStrings = "";
|
string PropulsionStrings = "";
|
||||||
bool firstime = true;
|
bool firstime = true;
|
||||||
|
stringstream buf;
|
||||||
|
|
||||||
for (unsigned int i=0;i<Engines.size();i++) {
|
for (i=0; i<Engines.size(); i++) {
|
||||||
if (firstime) firstime = false;
|
if (firstime) firstime = false;
|
||||||
else PropulsionStrings += ", ";
|
else PropulsionStrings += delimeter;
|
||||||
|
|
||||||
PropulsionStrings += Engines[i]->GetEngineLabels();
|
PropulsionStrings += Engines[i]->GetEngineLabels(delimeter);
|
||||||
|
}
|
||||||
|
for (i=0; i<Tanks.size(); i++) {
|
||||||
|
if (Tanks[i]->GetType() == FGTank::ttFUEL) buf << delimeter << "Fuel Tank " << i;
|
||||||
|
else if (Tanks[i]->GetType() == FGTank::ttOXIDIZER) buf << delimeter << "Oxidizer Tank " << i;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PropulsionStrings;
|
return PropulsionStrings;
|
||||||
|
@ -335,16 +346,23 @@ string FGPropulsion::GetPropulsionStrings(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGPropulsion::GetPropulsionValues(void)
|
string FGPropulsion::GetPropulsionValues(string delimeter)
|
||||||
{
|
{
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
string PropulsionValues = "";
|
string PropulsionValues = "";
|
||||||
bool firstime = true;
|
bool firstime = true;
|
||||||
|
stringstream buf;
|
||||||
|
|
||||||
for (unsigned int i=0;i<Engines.size();i++) {
|
for (i=0; i<Engines.size(); i++) {
|
||||||
if (firstime) firstime = false;
|
if (firstime) firstime = false;
|
||||||
else PropulsionValues += ", ";
|
else PropulsionValues += delimeter;
|
||||||
|
|
||||||
PropulsionValues += Engines[i]->GetEngineValues();
|
PropulsionValues += Engines[i]->GetEngineValues(delimeter);
|
||||||
|
}
|
||||||
|
for (i=0; i<Tanks.size(); i++) {
|
||||||
|
buf << delimeter;
|
||||||
|
buf << Tanks[i]->GetContents();
|
||||||
}
|
}
|
||||||
|
|
||||||
return PropulsionValues;
|
return PropulsionValues;
|
||||||
|
@ -498,6 +516,16 @@ void FGPropulsion::DoRefuel(double time_slice)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
void FGPropulsion::SetFuelFreeze(bool f)
|
||||||
|
{
|
||||||
|
fuel_freeze = f;
|
||||||
|
for (unsigned int i=0; i<numEngines; i++) {
|
||||||
|
Engines[i]->SetFuelFreeze(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGPropulsion::bind(void)
|
void FGPropulsion::bind(void)
|
||||||
{
|
{
|
||||||
typedef double (FGPropulsion::*PMF)(int) const;
|
typedef double (FGPropulsion::*PMF)(int) const;
|
||||||
|
|
|
@ -150,8 +150,8 @@ public:
|
||||||
be done before calling this (i.e. magnetos, starter engage, etc.) */
|
be done before calling this (i.e. magnetos, starter engage, etc.) */
|
||||||
bool ICEngineStart(void);
|
bool ICEngineStart(void);
|
||||||
|
|
||||||
string GetPropulsionStrings(void);
|
string GetPropulsionStrings(string delimeter);
|
||||||
string GetPropulsionValues(void);
|
string GetPropulsionValues(string delimeter);
|
||||||
|
|
||||||
inline FGColumnVector3& GetForces(void) {return vForces; }
|
inline FGColumnVector3& GetForces(void) {return vForces; }
|
||||||
inline double GetForces(int n) const { return vForces(n);}
|
inline double GetForces(int n) const { return vForces(n);}
|
||||||
|
@ -172,11 +172,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int GetActiveEngine(void);
|
inline int GetActiveEngine(void);
|
||||||
|
inline bool GetFuelFreeze(void) {return fuel_freeze;}
|
||||||
|
|
||||||
void SetMagnetos(int setting);
|
void SetMagnetos(int setting);
|
||||||
void SetStarter(int setting);
|
void SetStarter(int setting);
|
||||||
void SetCutoff(int setting=0);
|
void SetCutoff(int setting=0);
|
||||||
void SetActiveEngine(int engine);
|
void SetActiveEngine(int engine);
|
||||||
|
void SetFuelFreeze(bool f);
|
||||||
FGMatrix33& CalculateTankInertias(void);
|
FGMatrix33& CalculateTankInertias(void);
|
||||||
|
|
||||||
void bind();
|
void bind();
|
||||||
|
@ -199,6 +201,7 @@ private:
|
||||||
FGColumnVector3 vXYZtank_arm;
|
FGColumnVector3 vXYZtank_arm;
|
||||||
FGMatrix33 tankJ;
|
FGMatrix33 tankJ;
|
||||||
bool refuel;
|
bool refuel;
|
||||||
|
bool fuel_freeze;
|
||||||
|
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
};
|
};
|
||||||
|
|
|
@ -113,28 +113,28 @@ double FGRocket::Calculate(void)
|
||||||
Flameout = false;
|
Flameout = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Thruster->Calculate(Cf*maxPC*PctPower*propEff);
|
return Thrust = Thruster->Calculate(Cf*maxPC*PctPower*propEff);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGRocket::GetEngineLabels(void)
|
string FGRocket::GetEngineLabels(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
buf << Name << "_ChamberPress[" << EngineNumber << "], "
|
buf << Name << "_ChamberPress[" << EngineNumber << "]" << delimeter
|
||||||
<< Thruster->GetThrusterLabels(EngineNumber);
|
<< Thruster->GetThrusterLabels(EngineNumber, delimeter);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGRocket::GetEngineValues(void)
|
string FGRocket::GetEngineValues(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
buf << PC << ", " << Thruster->GetThrusterValues(EngineNumber);
|
buf << PC << delimeter << Thruster->GetThrusterValues(EngineNumber, delimeter);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,8 +123,8 @@ public:
|
||||||
sustainable setting.
|
sustainable setting.
|
||||||
@return true if engine has flamed out. */
|
@return true if engine has flamed out. */
|
||||||
bool GetFlameout(void) {return Flameout;}
|
bool GetFlameout(void) {return Flameout;}
|
||||||
string GetEngineLabels(void);
|
string GetEngineLabels(string delimeter);
|
||||||
string GetEngineValues(void);
|
string GetEngineValues(string delimeter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double SHR;
|
double SHR;
|
||||||
|
|
|
@ -68,14 +68,14 @@ double FGRotor::Calculate(double PowerAvailable)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGRotor::GetThrusterLabels(int id)
|
string FGRotor::GetThrusterLabels(int id, string delimeter)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGRotor::GetThrusterValues(int id)
|
string FGRotor::GetThrusterValues(int id, string delimeter)
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,8 @@ public:
|
||||||
~FGRotor();
|
~FGRotor();
|
||||||
|
|
||||||
double Calculate(double);
|
double Calculate(double);
|
||||||
string GetThrusterLabels(int id);
|
string GetThrusterLabels(int id, string delimeter);
|
||||||
string GetThrusterValues(int id);
|
string GetThrusterValues(int id, string delimeter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Debug(int from);
|
void Debug(int from);
|
||||||
|
|
|
@ -56,6 +56,7 @@ INCLUDES
|
||||||
|
|
||||||
#include "FGScript.h"
|
#include "FGScript.h"
|
||||||
#include "FGConfigFile.h"
|
#include "FGConfigFile.h"
|
||||||
|
#include "FGTrim.h"
|
||||||
|
|
||||||
namespace JSBSim {
|
namespace JSBSim {
|
||||||
|
|
||||||
|
@ -212,6 +213,12 @@ bool FGScript::LoadScript( string script )
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FGTrim fgt(FDMExec, tFull);
|
||||||
|
if ( !fgt.DoTrim() ) {
|
||||||
|
cout << "Trim Failed" << endl;
|
||||||
|
}
|
||||||
|
fgt.Report();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,11 +72,15 @@ FGThruster::FGThruster(FGFDMExec *FDMExec,
|
||||||
|
|
||||||
EngineNum = num;
|
EngineNum = num;
|
||||||
ThrustCoeff = 0.0;
|
ThrustCoeff = 0.0;
|
||||||
|
ReverserAngle = 0.0;
|
||||||
PropertyManager = FDMExec->GetPropertyManager();
|
PropertyManager = FDMExec->GetPropertyManager();
|
||||||
|
|
||||||
char property_name[80];
|
char property_name[80];
|
||||||
snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
|
snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
|
||||||
PropertyManager->Tie( property_name, &ThrustCoeff );
|
PropertyManager->Tie( property_name, &ThrustCoeff );
|
||||||
|
snprintf(property_name, 80, "propulsion/engine[%u]/reverser-angle", EngineNum);
|
||||||
|
PropertyManager->Tie( property_name, &ReverserAngle );
|
||||||
|
|
||||||
|
|
||||||
Debug(0);
|
Debug(0);
|
||||||
}
|
}
|
||||||
|
@ -88,13 +92,15 @@ FGThruster::~FGThruster()
|
||||||
char property_name[80];
|
char property_name[80];
|
||||||
snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
|
snprintf(property_name, 80, "propulsion/c-thrust[%u]", EngineNum);
|
||||||
PropertyManager->Untie( property_name );
|
PropertyManager->Untie( property_name );
|
||||||
|
snprintf(property_name, 80, "propulsion/engine[%u]/reverser-angle", EngineNum);
|
||||||
|
PropertyManager->Untie( property_name );
|
||||||
|
|
||||||
Debug(1);
|
Debug(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGThruster::GetThrusterLabels(int id)
|
string FGThruster::GetThrusterLabels(int id, string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
|
@ -105,7 +111,7 @@ string FGThruster::GetThrusterLabels(int id)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGThruster::GetThrusterValues(int id)
|
string FGThruster::GetThrusterValues(int id, string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
|
|
|
@ -80,8 +80,9 @@ public:
|
||||||
enum eType {ttNozzle, ttRotor, ttPropeller, ttDirect};
|
enum eType {ttNozzle, ttRotor, ttPropeller, ttDirect};
|
||||||
|
|
||||||
virtual double Calculate(double tt) {
|
virtual double Calculate(double tt) {
|
||||||
Thrust = tt; vFn(1) = Thrust;
|
Thrust = tt;
|
||||||
return 0.0;
|
vFn(1) = Thrust * cos(ReverserAngle);
|
||||||
|
return vFn(1);
|
||||||
}
|
}
|
||||||
void SetName(string name) {Name = name;}
|
void SetName(string name) {Name = name;}
|
||||||
virtual void SetRPM(double rpm) {};
|
virtual void SetRPM(double rpm) {};
|
||||||
|
@ -92,8 +93,11 @@ public:
|
||||||
string GetName(void) {return Name;}
|
string GetName(void) {return Name;}
|
||||||
virtual double GetRPM(void) { return 0.0; };
|
virtual double GetRPM(void) { return 0.0; };
|
||||||
double GetGearRatio(void) {return GearRatio; }
|
double GetGearRatio(void) {return GearRatio; }
|
||||||
virtual string GetThrusterLabels(int id);
|
virtual string GetThrusterLabels(int id, string delimeter);
|
||||||
virtual string GetThrusterValues(int id);
|
virtual string GetThrusterValues(int id, string delimeter);
|
||||||
|
void SetReverserAngle(double radians) { ReverserAngle = radians; }
|
||||||
|
double GetReverserAngle(void) {return ReverserAngle;}
|
||||||
|
|
||||||
|
|
||||||
inline void SetThrustCoefficient(double ct) { ThrustCoeff = ct; }
|
inline void SetThrustCoefficient(double ct) { ThrustCoeff = ct; }
|
||||||
|
|
||||||
|
@ -105,6 +109,7 @@ protected:
|
||||||
double deltaT;
|
double deltaT;
|
||||||
double GearRatio;
|
double GearRatio;
|
||||||
double ThrustCoeff;
|
double ThrustCoeff;
|
||||||
|
double ReverserAngle;
|
||||||
int EngineNum;
|
int EngineNum;
|
||||||
FGPropertyManager* PropertyManager;
|
FGPropertyManager* PropertyManager;
|
||||||
virtual void Debug(int from);
|
virtual void Debug(int from);
|
||||||
|
|
|
@ -113,14 +113,14 @@ CLASS DOCUMENTATION
|
||||||
FGFDMExec* FDMExec = new FGFDMExec();
|
FGFDMExec* FDMExec = new FGFDMExec();
|
||||||
|
|
||||||
FGInitialCondition* fgic = new FGInitialCondition(FDMExec);
|
FGInitialCondition* fgic = new FGInitialCondition(FDMExec);
|
||||||
FGTrim *fgt(FDMExec,fgic,tFull);
|
FGTrim fgt(FDMExec, fgic, tFull);
|
||||||
fgic->SetVcaibratedKtsIC(100);
|
fgic->SetVcaibratedKtsIC(100);
|
||||||
fgic->SetAltitudeFtIC(1000);
|
fgic->SetAltitudeFtIC(1000);
|
||||||
fgic->SetClimbRate(500);
|
fgic->SetClimbRate(500);
|
||||||
if( !fgt->DoTrim() ) {
|
if( !fgt.DoTrim() ) {
|
||||||
cout << "Trim Failed" << endl;
|
cout << "Trim Failed" << endl;
|
||||||
}
|
}
|
||||||
fgt->ReportState(); </pre>
|
fgt.Report(); </pre>
|
||||||
@author Tony Peden
|
@author Tony Peden
|
||||||
@version "$Id$"
|
@version "$Id$"
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -113,21 +113,19 @@ double FGTurbine::Calculate(void)
|
||||||
if (Stalled) phase = tpStall;
|
if (Stalled) phase = tpStall;
|
||||||
if (Seized) phase = tpSeize;
|
if (Seized) phase = tpSeize;
|
||||||
|
|
||||||
double CT = 0.0;
|
|
||||||
switch (phase) {
|
switch (phase) {
|
||||||
case tpOff: Thrust = Off(); break;
|
case tpOff: Thrust = Off(); break;
|
||||||
case tpRun: Thrust = Run(CT); break;
|
case tpRun: Thrust = Run(); break;
|
||||||
case tpSpinUp: Thrust = SpinUp(); break;
|
case tpSpinUp: Thrust = SpinUp(); break;
|
||||||
case tpStart: Thrust = Start(); break;
|
case tpStart: Thrust = Start(); break;
|
||||||
case tpStall: Thrust = Stall(); break;
|
case tpStall: Thrust = Stall(); break;
|
||||||
case tpSeize: Thrust = Seize(); break;
|
case tpSeize: Thrust = Seize(); break;
|
||||||
case tpTrim: Thrust = Trim(CT); break;
|
case tpTrim: Thrust = Trim(); break;
|
||||||
default: Thrust = Off();
|
default: Thrust = Off();
|
||||||
}
|
}
|
||||||
|
|
||||||
Thruster->SetThrustCoefficient(CT);
|
// The thruster can modify the thrust, eg. thrust reverser
|
||||||
|
return Thrust = Thruster->Calculate(Thrust);
|
||||||
return Thruster->Calculate(Thrust);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -150,13 +148,12 @@ double FGTurbine::Off(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
double FGTurbine::Run(double &TC)
|
double FGTurbine::Run(void)
|
||||||
{
|
{
|
||||||
double idlethrust, milthrust, thrust;
|
double idlethrust, milthrust, thrust;
|
||||||
double N2norm; // 0.0 = idle N2, 1.0 = maximum N2
|
double N2norm; // 0.0 = idle N2, 1.0 = maximum N2
|
||||||
|
idlethrust = MilThrust * ThrustTables[0]->TotalValue();
|
||||||
idlethrust = ThrustTables[0]->TotalValue();
|
milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
|
||||||
milthrust = (1.0 - idlethrust) * ThrustTables[1]->TotalValue();
|
|
||||||
|
|
||||||
Running = true;
|
Running = true;
|
||||||
Starter = false;
|
Starter = false;
|
||||||
|
@ -164,19 +161,18 @@ double FGTurbine::Run(double &TC)
|
||||||
N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, delay, delay * 3.0);
|
N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, delay, delay * 3.0);
|
||||||
N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, delay, delay * 2.4);
|
N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, delay, delay * 2.4);
|
||||||
N2norm = (N2 - IdleN2) / N2_factor;
|
N2norm = (N2 - IdleN2) / N2_factor;
|
||||||
TC = idlethrust + (milthrust * N2norm * N2norm);
|
thrust = idlethrust + (milthrust * N2norm * N2norm);
|
||||||
thrust = TC * MilThrust;
|
|
||||||
EGT_degC = TAT + 363.1 + ThrottlePos * 357.1;
|
EGT_degC = TAT + 363.1 + ThrottlePos * 357.1;
|
||||||
OilPressure_psi = N2 * 0.62;
|
OilPressure_psi = N2 * 0.62;
|
||||||
OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
|
OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
|
||||||
|
|
||||||
if (!Augmentation) {
|
if (!Augmentation) {
|
||||||
double correctedTSFC = TSFC + TSFC - (N2norm * TSFC);
|
double correctedTSFC = TSFC * (0.84 + (1-N2norm)*(1-N2norm));
|
||||||
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 100000);
|
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 100000);
|
||||||
if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
|
if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
|
||||||
NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
|
NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
|
||||||
TC = TC * (1.0 - BleedDemand);
|
thrust = thrust * (1.0 - BleedDemand);
|
||||||
EPR = 1.0 + TC;
|
EPR = 1.0 + thrust/MilThrust;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AugMethod == 1) {
|
if (AugMethod == 1) {
|
||||||
|
@ -185,8 +181,7 @@ double FGTurbine::Run(double &TC)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Augmented == 1) && Augmentation && (AugMethod < 2)) {
|
if ((Augmented == 1) && Augmentation && (AugMethod < 2)) {
|
||||||
TC = ThrustTables[2]->TotalValue();
|
thrust = MaxThrust * ThrustTables[2]->TotalValue();
|
||||||
thrust = TC * MaxThrust;
|
|
||||||
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
|
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
|
||||||
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
||||||
}
|
}
|
||||||
|
@ -194,9 +189,8 @@ double FGTurbine::Run(double &TC)
|
||||||
if (AugMethod == 2) {
|
if (AugMethod == 2) {
|
||||||
if (AugmentCmd > 0.0) {
|
if (AugmentCmd > 0.0) {
|
||||||
Augmentation = true;
|
Augmentation = true;
|
||||||
double tdiff = ThrustTables[2]->TotalValue() - TC;
|
double tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
|
||||||
TC += (tdiff * AugmentCmd);
|
thrust += (tdiff * AugmentCmd);
|
||||||
thrust = TC * MaxThrust;
|
|
||||||
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
|
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
|
||||||
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
|
||||||
} else {
|
} else {
|
||||||
|
@ -205,7 +199,6 @@ double FGTurbine::Run(double &TC)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Injected == 1) && Injection) {
|
if ((Injected == 1) && Injection) {
|
||||||
TC = TC * ThrustTables[3]->TotalValue();
|
|
||||||
thrust = thrust * ThrustTables[3]->TotalValue();
|
thrust = thrust * ThrustTables[3]->TotalValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,6 +237,7 @@ double FGTurbine::Start(void)
|
||||||
EGT_degC = Seek(&EGT_degC, TAT + 363.1, 21.3, 7.3);
|
EGT_degC = Seek(&EGT_degC, TAT + 363.1, 21.3, 7.3);
|
||||||
FuelFlow_pph = Seek(&FuelFlow_pph, IdleFF, 103.7, 103.7);
|
FuelFlow_pph = Seek(&FuelFlow_pph, IdleFF, 103.7, 103.7);
|
||||||
OilPressure_psi = N2 * 0.62;
|
OilPressure_psi = N2 * 0.62;
|
||||||
|
ConsumeFuel();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
phase = tpRun;
|
phase = tpRun;
|
||||||
|
@ -269,6 +263,7 @@ double FGTurbine::Stall(void)
|
||||||
FuelFlow_pph = IdleFF;
|
FuelFlow_pph = IdleFF;
|
||||||
N1 = Seek(&N1, qbar/10.0, 0, N1/10.0);
|
N1 = Seek(&N1, qbar/10.0, 0, N1/10.0);
|
||||||
N2 = Seek(&N2, qbar/15.0, 0, N2/10.0);
|
N2 = Seek(&N2, qbar/15.0, 0, N2/10.0);
|
||||||
|
ConsumeFuel();
|
||||||
if (ThrottlePos < 0.01) phase = tpRun; // clear the stall with throttle
|
if (ThrottlePos < 0.01) phase = tpRun; // clear the stall with throttle
|
||||||
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
@ -282,6 +277,7 @@ double FGTurbine::Seize(void)
|
||||||
N2 = 0.0;
|
N2 = 0.0;
|
||||||
N1 = Seek(&N1, qbar/20.0, 0, N1/15.0);
|
N1 = Seek(&N1, qbar/20.0, 0, N1/15.0);
|
||||||
FuelFlow_pph = IdleFF;
|
FuelFlow_pph = IdleFF;
|
||||||
|
ConsumeFuel();
|
||||||
OilPressure_psi = 0.0;
|
OilPressure_psi = 0.0;
|
||||||
OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0, 0.2);
|
OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0, 0.2);
|
||||||
Running = false;
|
Running = false;
|
||||||
|
@ -290,20 +286,17 @@ double FGTurbine::Seize(void)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
double FGTurbine::Trim(double &TC)
|
double FGTurbine::Trim(void)
|
||||||
{
|
{
|
||||||
double idlethrust, milthrust, thrust, tdiff;
|
double idlethrust, milthrust, thrust, tdiff;
|
||||||
idlethrust = ThrustTables[0]->TotalValue();;
|
idlethrust = MilThrust * ThrustTables[0]->TotalValue();;
|
||||||
milthrust = (1.0 - TC) * ThrustTables[1]->TotalValue();
|
milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
|
||||||
TC = (idlethrust + (milthrust * ThrottlePos * ThrottlePos))
|
thrust = (idlethrust + (milthrust * ThrottlePos * ThrottlePos))
|
||||||
* (1.0 - BleedDemand);
|
* (1.0 - BleedDemand);
|
||||||
if (AugmentCmd > 0.0) {
|
if (AugmentCmd > 0.0) {
|
||||||
tdiff = ThrustTables[2]->TotalValue() - TC;
|
tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
|
||||||
TC += (tdiff * AugmentCmd);
|
thrust += (tdiff * AugmentCmd);
|
||||||
thrust = TC * MaxThrust;
|
}
|
||||||
|
|
||||||
} else
|
|
||||||
thrust = TC * MilThrust;
|
|
||||||
|
|
||||||
return thrust;
|
return thrust;
|
||||||
}
|
}
|
||||||
|
@ -427,26 +420,26 @@ bool FGTurbine::Load(FGConfigFile *Eng_cfg)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGTurbine::GetEngineLabels(void)
|
string FGTurbine::GetEngineLabels(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
buf << Name << "_N1[" << EngineNumber << "], "
|
buf << Name << "_N1[" << EngineNumber << "]" << delimeter
|
||||||
<< Name << "_N2[" << EngineNumber << "], "
|
<< Name << "_N2[" << EngineNumber << "]" << delimeter
|
||||||
<< Thruster->GetThrusterLabels(EngineNumber);
|
<< Thruster->GetThrusterLabels(EngineNumber, delimeter);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
string FGTurbine::GetEngineValues(void)
|
string FGTurbine::GetEngineValues(string delimeter)
|
||||||
{
|
{
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
|
|
||||||
buf << N1 << ", "
|
buf << N1 << delimeter
|
||||||
<< N2 << ", "
|
<< N2 << delimeter
|
||||||
<< Thruster->GetThrusterValues(EngineNumber);
|
<< Thruster->GetThrusterValues(EngineNumber, delimeter);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
@ -457,10 +450,12 @@ void FGTurbine::bindmodel()
|
||||||
{
|
{
|
||||||
char property_name[80];
|
char property_name[80];
|
||||||
|
|
||||||
snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
|
snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
|
||||||
PropertyManager->Tie( property_name, &N1);
|
PropertyManager->Tie( property_name, &N1);
|
||||||
snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
|
snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
|
||||||
PropertyManager->Tie( property_name, &N2);
|
PropertyManager->Tie( property_name, &N2);
|
||||||
|
snprintf(property_name, 80, "propulsion/engine[%u]/fuel-flow", EngineNumber);
|
||||||
|
PropertyManager->Tie( property_name, &FuelFlow_pph);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
@ -469,10 +464,12 @@ void FGTurbine::unbind()
|
||||||
{
|
{
|
||||||
char property_name[80];
|
char property_name[80];
|
||||||
|
|
||||||
snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
|
snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
|
||||||
PropertyManager->Untie(property_name);
|
PropertyManager->Untie(property_name);
|
||||||
snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
|
snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
|
||||||
PropertyManager->Untie(property_name);
|
PropertyManager->Untie(property_name);
|
||||||
|
snprintf(property_name, 80, "propulsion/engine[%u]/fuel-flow", EngineNumber);
|
||||||
|
PropertyManager->Untie( property_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
|
@ -182,8 +182,8 @@ public:
|
||||||
void SetReverse(bool reversed) { Reversed = reversed; }
|
void SetReverse(bool reversed) { Reversed = reversed; }
|
||||||
void SetCutoff(bool cutoff) { Cutoff = cutoff; }
|
void SetCutoff(bool cutoff) { Cutoff = cutoff; }
|
||||||
|
|
||||||
string GetEngineLabels(void);
|
string GetEngineLabels(string delimeter);
|
||||||
string GetEngineValues(void);
|
string GetEngineValues(string delimeter);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -233,12 +233,12 @@ private:
|
||||||
double NozzlePosition;
|
double NozzlePosition;
|
||||||
|
|
||||||
double Off(void);
|
double Off(void);
|
||||||
double Run(double &CT);
|
double Run();
|
||||||
double SpinUp(void);
|
double SpinUp(void);
|
||||||
double Start(void);
|
double Start(void);
|
||||||
double Stall(void);
|
double Stall(void);
|
||||||
double Seize(void);
|
double Seize(void);
|
||||||
double Trim(double &CT);
|
double Trim();
|
||||||
|
|
||||||
void SetDefaults(void);
|
void SetDefaults(void);
|
||||||
bool Load(FGConfigFile *ENG_cfg);
|
bool Load(FGConfigFile *ENG_cfg);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// Written by Curtis Olson, started February 1999.
|
// Written by Curtis Olson, started February 1999.
|
||||||
//
|
//
|
||||||
// Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt
|
// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
|
||||||
//
|
//
|
||||||
// This program is free software; you can redistribute it and/or
|
// This program is free software; you can redistribute it and/or
|
||||||
// modify it under the terms of the GNU General Public License as
|
// modify it under the terms of the GNU General Public License as
|
||||||
|
@ -171,6 +171,7 @@ FGJSBsim::FGJSBsim( double dt )
|
||||||
node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / 6.6);
|
node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / 6.6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
|
||||||
|
|
||||||
fgSetDouble("/fdm/trim/pitch-trim", FCS->GetPitchTrimCmd());
|
fgSetDouble("/fdm/trim/pitch-trim", FCS->GetPitchTrimCmd());
|
||||||
fgSetDouble("/fdm/trim/throttle", FCS->GetThrottleCmd(0));
|
fgSetDouble("/fdm/trim/throttle", FCS->GetThrottleCmd(0));
|
||||||
|
@ -503,6 +504,7 @@ bool FGJSBsim::copy_to_JSBsim()
|
||||||
}
|
}
|
||||||
SGPropertyNode* node = fgGetNode("/systems/refuel", true);
|
SGPropertyNode* node = fgGetNode("/systems/refuel", true);
|
||||||
Propulsion->SetRefuel(node->getDoubleValue("contact"));
|
Propulsion->SetRefuel(node->getDoubleValue("contact"));
|
||||||
|
Propulsion->SetFuelFreeze((fgGetNode("/sim/freeze/fuel",true))->getBoolValue());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -692,11 +694,9 @@ bool FGJSBsim::copy_from_JSBsim()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const SGPropertyNode *fuel_freeze = fgGetNode("/sim/freeze/fuel");
|
|
||||||
|
|
||||||
// Copy the fuel levels from JSBSim if fuel
|
// Copy the fuel levels from JSBSim if fuel
|
||||||
// freeze not enabled.
|
// freeze not enabled.
|
||||||
if ( ! fuel_freeze->getBoolValue() ) {
|
if ( ! Propulsion->GetFuelFreeze() ) {
|
||||||
for (i = 0; i < Propulsion->GetNumTanks(); i++) {
|
for (i = 0; i < Propulsion->GetNumTanks(); i++) {
|
||||||
SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
|
SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
|
||||||
FGTank* tank = Propulsion->GetTank(i);
|
FGTank* tank = Propulsion->GetTank(i);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
Maintained by: Tony Peden, Curt Olson
|
Maintained by: Tony Peden, Curt Olson
|
||||||
Date started: 02/01/1999
|
Date started: 02/01/1999
|
||||||
|
|
||||||
------ Copyright (C) 1999 - 2000 Curtis L. Olson (http://www.flightgear.org/~curt) ------
|
------ Copyright (C) 1999 - 2000 Curtis L. Olson (curt@flightgear.org) ------
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public License as
|
modify it under the terms of the GNU General Public License as
|
||||||
|
|
|
@ -89,7 +89,7 @@ FGPropertyManager* FGFCSComponent::resolveSymbol(string token)
|
||||||
FGPropertyManager* tmp = PropertyManager->GetNode(token,false);
|
FGPropertyManager* tmp = PropertyManager->GetNode(token,false);
|
||||||
if (!tmp) {
|
if (!tmp) {
|
||||||
if (token.find("/") == token.npos) prop = "model/" + token;
|
if (token.find("/") == token.npos) prop = "model/" + token;
|
||||||
cerr << "Creating new property " << prop << endl;
|
//cerr << "Creating new property " << prop << endl;
|
||||||
tmp = PropertyManager->GetNode(token,true);
|
tmp = PropertyManager->GetNode(token,true);
|
||||||
}
|
}
|
||||||
return tmp;
|
return tmp;
|
||||||
|
|
Loading…
Reference in a new issue