sync again
This commit is contained in:
parent
71fbacc6dc
commit
63b3f802ec
7 changed files with 63 additions and 49 deletions
|
@ -74,7 +74,7 @@ FGPropertyManager::GetNode (const string &path, bool create)
|
|||
{
|
||||
SGPropertyNode* node=this->getNode(path.c_str(), create);
|
||||
if (node == 0 && !suppress_warning) {
|
||||
cout << "FGPropertyManager::GetNode() No node found for " << path << endl;
|
||||
cerr << "FGPropertyManager::GetNode() No node found for " << path << endl;
|
||||
}
|
||||
return (FGPropertyManager*)node;
|
||||
}
|
||||
|
@ -256,8 +256,8 @@ void FGPropertyManager::SetArchivable (const string &name, bool state )
|
|||
{
|
||||
SGPropertyNode * node = getNode(name.c_str());
|
||||
if (node == 0)
|
||||
cout <<
|
||||
"Attempt to set archive flag for non-existant property "
|
||||
cerr <<
|
||||
"Attempt to set archive flag for non-existent property "
|
||||
<< name << endl;
|
||||
else
|
||||
node->setAttribute(SGPropertyNode::ARCHIVE, state);
|
||||
|
@ -269,7 +269,7 @@ void FGPropertyManager::SetReadable (const string &name, bool state )
|
|||
{
|
||||
SGPropertyNode * node = getNode(name.c_str());
|
||||
if (node == 0)
|
||||
cout <<
|
||||
cerr <<
|
||||
"Attempt to set read flag for non-existant property "
|
||||
<< name << endl;
|
||||
else
|
||||
|
@ -282,7 +282,7 @@ void FGPropertyManager::SetWritable (const string &name, bool state )
|
|||
{
|
||||
SGPropertyNode * node = getNode(name.c_str());
|
||||
if (node == 0)
|
||||
cout <<
|
||||
cerr <<
|
||||
"Attempt to set write flag for non-existant property "
|
||||
<< name << endl;
|
||||
else
|
||||
|
@ -294,7 +294,7 @@ void FGPropertyManager::SetWritable (const string &name, bool state )
|
|||
void FGPropertyManager::Untie (const string &name)
|
||||
{
|
||||
if (!untie(name.c_str()))
|
||||
cout << "Failed to untie property " << name << endl;
|
||||
cerr << "Failed to untie property " << name << endl;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -302,7 +302,7 @@ void FGPropertyManager::Untie (const string &name)
|
|||
void FGPropertyManager::Tie (const string &name, bool *pointer, bool useDefault)
|
||||
{
|
||||
if (!tie(name.c_str(), SGRawValuePointer<bool>(pointer), useDefault))
|
||||
cout << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
cerr << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
else if (debug_lvl & 0x20)
|
||||
cout << name << endl;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void FGPropertyManager::Tie (const string &name, int *pointer,
|
|||
bool useDefault )
|
||||
{
|
||||
if (!tie(name.c_str(), SGRawValuePointer<int>(pointer), useDefault))
|
||||
cout << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
cerr << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
else if (debug_lvl & 0x20)
|
||||
cout << name << endl;
|
||||
}
|
||||
|
@ -324,7 +324,7 @@ void FGPropertyManager::Tie (const string &name, long *pointer,
|
|||
bool useDefault )
|
||||
{
|
||||
if (!tie(name.c_str(), SGRawValuePointer<long>(pointer), useDefault))
|
||||
cout << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
cerr << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
else if (debug_lvl & 0x20)
|
||||
cout << name << endl;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ void FGPropertyManager::Tie (const string &name, float *pointer,
|
|||
bool useDefault )
|
||||
{
|
||||
if (!tie(name.c_str(), SGRawValuePointer<float>(pointer), useDefault))
|
||||
cout << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
cerr << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
else if (debug_lvl & 0x20)
|
||||
cout << name << endl;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ void FGPropertyManager::Tie (const string &name, float *pointer,
|
|||
void FGPropertyManager::Tie (const string &name, double *pointer, bool useDefault)
|
||||
{
|
||||
if (!tie(name.c_str(), SGRawValuePointer<double>(pointer), useDefault))
|
||||
cout << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
cerr << "Failed to tie property " << name << " to a pointer" << endl;
|
||||
else if (debug_lvl & 0x20)
|
||||
cout << name << endl;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGColumnVector3.cpp,v 1.12 2010/06/30 03:13:40 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGColumnVector3.cpp,v 1.13 2010/08/08 00:19:21 jberndt Exp $";
|
||||
static const char *IdHdr = ID_COLUMNVECTOR3;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -110,9 +110,6 @@ FGColumnVector3& FGColumnVector3::operator/=(const double scalar)
|
|||
|
||||
double FGColumnVector3::Magnitude(void) const
|
||||
{
|
||||
if (data[0] == 0.0 && data[1] == 0.0 && data[2] == 0.0)
|
||||
return 0.0;
|
||||
else
|
||||
return sqrt( data[0]*data[0] + data[1]*data[1] + data[2]*data[2] );
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGAtmosphere.cpp,v 1.33 2010/02/25 05:21:36 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGAtmosphere.cpp,v 1.35 2010/08/11 11:51:33 jberndt Exp $";
|
||||
static const char *IdHdr = ID_ATMOSPHERE;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -277,7 +277,9 @@ void FGAtmosphere::Calculate(double altitude)
|
|||
void FGAtmosphere::CalculateDerived(void)
|
||||
{
|
||||
T_dev = (*temperature) - GetTemperature(h);
|
||||
density_altitude = h + T_dev * 66.7;
|
||||
|
||||
if (T_dev == 0.0) density_altitude = h;
|
||||
else density_altitude = 518.4/0.00357 * (1.0 - pow(GetDensityRatio(),0.235));
|
||||
|
||||
if (turbType != ttNone) Turbulence();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGFCS.cpp,v 1.68 2010/03/18 13:21:24 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGFCS.cpp,v 1.69 2010/08/10 12:39:07 jberndt Exp $";
|
||||
static const char *IdHdr = ID_FCS;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -705,19 +705,19 @@ string FGFCS::FindSystemFullPathname(const string& sysfilename)
|
|||
system_filename.append(".xml");
|
||||
}
|
||||
|
||||
system_file.open(string(fullpath + system_filename).c_str());
|
||||
if ( !system_file.is_open()) {
|
||||
system_file.open(string(localpath + system_filename).c_str());
|
||||
if ( !system_file.is_open()) {
|
||||
system_file.open(string(fullpath + system_filename).c_str());
|
||||
if ( !system_file.is_open()) {
|
||||
cerr << " Could not open system file: " << system_filename << " in path "
|
||||
<< fullpath << " or " << localpath << endl;
|
||||
return string("");
|
||||
} else {
|
||||
return string(localpath + system_filename);
|
||||
}
|
||||
}
|
||||
return string(fullpath + system_filename);
|
||||
}
|
||||
}
|
||||
return string(localpath + system_filename);
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
|
@ -736,9 +736,9 @@ ifstream* FGFCS::FindSystemFile(const string& sysfilename)
|
|||
system_filename.append(".xml");
|
||||
}
|
||||
|
||||
system_file->open(string(fullpath + system_filename).c_str());
|
||||
if ( !system_file->is_open()) {
|
||||
system_file->open(string(localpath + system_filename).c_str());
|
||||
if ( !system_file->is_open()) {
|
||||
system_file->open(string(fullpath + system_filename).c_str());
|
||||
if ( !system_file->is_open()) {
|
||||
cerr << " Could not open system file: " << system_filename << " in path "
|
||||
<< fullpath << " or " << localpath << endl;
|
||||
|
|
|
@ -51,7 +51,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.31 2010/02/19 00:30:00 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.32 2010/08/12 04:07:11 jberndt Exp $";
|
||||
static const char *IdHdr = ID_MASSBALANCE;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -280,6 +280,10 @@ void FGMassBalance::AddPointMass(Element* el)
|
|||
pm->SetPointMassShapeType(PointMass::esSphere);
|
||||
pm->SetRadius(radius);
|
||||
pm->CalculateShapeInertia();
|
||||
} else if (shape == "ball") {
|
||||
pm->SetPointMassShapeType(PointMass::esBall);
|
||||
pm->SetRadius(radius);
|
||||
pm->CalculateShapeInertia();
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ INCLUDES
|
|||
DEFINITIONS
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||
|
||||
#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.20 2010/02/04 13:09:26 jberndt Exp $"
|
||||
#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.21 2010/08/12 04:07:11 jberndt Exp $"
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
FORWARD DECLARATIONSS
|
||||
|
@ -65,7 +65,11 @@ CLASS DOCUMENTATION
|
|||
|
||||
/** Models weight, balance and moment of inertia information. Maintains a vector
|
||||
of point masses. Sums the contribution of all, and provides this to FGPropagate.
|
||||
Loads the \<mass_balance> section of the aircraft configuration file.
|
||||
Loads the \<mass_balance> section of the aircraft configuration file. There
|
||||
can be any number of <pointmasses>. Each can also have a shape which - if
|
||||
present - causes an associated moment of inertia to be calculated based on
|
||||
the shape. Note that a cylinder is solid, a tube is hollow, a ball is solid
|
||||
and a sphere is hollow.
|
||||
|
||||
<h3>Configuration File Format:</h3>
|
||||
@code
|
||||
|
@ -77,20 +81,24 @@ CLASS DOCUMENTATION
|
|||
<ixz unit="{SLUG*FT2 | KG*M2}"> {number} </ixz>
|
||||
<iyz unit="{SLUG*FT2 | KG*M2}"> {number} </iyz>
|
||||
<emptywt unit="{LBS | KG"> {number} </emptywt>
|
||||
<location name="CG" unit="{IN | M}">
|
||||
<location name="CG" unit="{IN | FT | M}">
|
||||
<x> {number} </x>
|
||||
<y> {number} </y>
|
||||
<z> {number} </z>
|
||||
</location>
|
||||
<pointmass name="{string}">
|
||||
[<pointmass name="{string}">
|
||||
<form shape="{tube | cylinder | sphere | ball}">
|
||||
<radius unit="{IN | FT | M}"> {number} </radius>
|
||||
<length unit="{IN | FT | M}"> {number} </length>
|
||||
</form>
|
||||
<weight unit="{LBS | KG}"> {number} </weight>
|
||||
<location name="POINTMASS" unit="{IN | M}">
|
||||
<location name="{string}" unit="{IN | FT | M}">
|
||||
<x> {number} </x>
|
||||
<y> {number} </y>
|
||||
<z> {number} </z>
|
||||
</location>
|
||||
</pointmass>
|
||||
... other point masses ...
|
||||
... other point masses ...]
|
||||
</mass_balance>
|
||||
@endcode
|
||||
*/
|
||||
|
@ -197,21 +205,30 @@ private:
|
|||
void CalculateShapeInertia(void) {
|
||||
switch(eShapeType) {
|
||||
case esTube:
|
||||
mPMInertia(1,1) = (Weight/(32.16))*Radius*Radius; // mr^2
|
||||
mPMInertia(2,2) = (Weight/(32.16*12))*(6*Radius*Radius + Length*Length);
|
||||
mPMInertia(1,1) = (Weight/(slugtolb))*Radius*Radius; // mr^2
|
||||
mPMInertia(2,2) = (Weight/(slugtolb*12))*(6*Radius*Radius + Length*Length);
|
||||
mPMInertia(3,3) = mPMInertia(2,2);
|
||||
break;
|
||||
case esCylinder:
|
||||
mPMInertia(1,1) = (Weight/(32.16*2))*Radius*Radius; // 0.5*mr^2
|
||||
mPMInertia(2,2) = (Weight/(32.16*12))*(3*Radius*Radius + Length*Length);
|
||||
mPMInertia(1,1) = (Weight/(slugtolb*2))*Radius*Radius; // 0.5*mr^2
|
||||
mPMInertia(2,2) = (Weight/(slugtolb*12))*(3*Radius*Radius + Length*Length);
|
||||
mPMInertia(3,3) = mPMInertia(2,2);
|
||||
break;
|
||||
case esSphere:
|
||||
mPMInertia(1,1) = (Weight/(slugtolb*3))*Radius*Radius*2; // (2mr^2)/3
|
||||
mPMInertia(2,2) = mPMInertia(1,1);
|
||||
mPMInertia(3,3) = mPMInertia(1,1);
|
||||
case esBall:
|
||||
mPMInertia(1,1) = (Weight/(slugtolb*5))*Radius*Radius*2; // (2mr^2)/5
|
||||
mPMInertia(2,2) = mPMInertia(1,1);
|
||||
mPMInertia(3,3) = mPMInertia(1,1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
enum esShape {esUnspecified, esTube, esCylinder, esSphere} eShapeType;
|
||||
enum esShape {esUnspecified, esTube, esCylinder, esSphere, esBall} eShapeType;
|
||||
FGColumnVector3 Location;
|
||||
double Weight; /// Weight in pounds.
|
||||
double Radius; /// Radius in feet.
|
||||
|
|
|
@ -71,7 +71,7 @@ using namespace std;
|
|||
|
||||
namespace JSBSim {
|
||||
|
||||
static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.59 2010/07/30 11:50:01 jberndt Exp $";
|
||||
static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.60 2010/08/12 19:11:22 andgi Exp $";
|
||||
static const char *IdHdr = ID_PROPAGATE;
|
||||
|
||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -259,8 +259,6 @@ Inertial.
|
|||
|
||||
bool FGPropagate::Run(void)
|
||||
{
|
||||
static int ctr;
|
||||
|
||||
if (FGModel::Run()) return true; // Fast return if we have nothing to do ...
|
||||
if (FDMExec->Holding()) return false;
|
||||
|
||||
|
@ -498,11 +496,11 @@ void FGPropagate::ResolveFrictionForces(double dt)
|
|||
// If no gears are in contact with the ground then return
|
||||
if (!n) return;
|
||||
|
||||
double *a = new double[n*n]; // Will contain J*M^-1*J^T
|
||||
double *eta = new double[n];
|
||||
double *lambda = new double[n];
|
||||
double *lambdaMin = new double[n];
|
||||
double *lambdaMax = new double[n];
|
||||
vector<double> a(n*n); // Will contain J*M^-1*J^T
|
||||
vector<double> eta(n);
|
||||
vector<double> lambda(n);
|
||||
vector<double> lambdaMin(n);
|
||||
vector<double> lambdaMax(n);
|
||||
|
||||
// Initializes the Lagrange multipliers
|
||||
i = 0;
|
||||
|
@ -519,8 +517,6 @@ void FGPropagate::ResolveFrictionForces(double dt)
|
|||
// First compute the ground velocity below the aircraft center of gravity
|
||||
FGLocation contact;
|
||||
FGColumnVector3 normal, cvel;
|
||||
double t = FDMExec->GetSimTime();
|
||||
double height = FDMExec->GetGroundCallback()->GetAGLevel(t, VState.vLocation, contact, normal, cvel);
|
||||
|
||||
// Instruct the algorithm to zero out the relative movement between the
|
||||
// aircraft and the ground.
|
||||
|
@ -587,8 +583,6 @@ void FGPropagate::ResolveFrictionForces(double dt)
|
|||
(*it)->value = lambda[i++];
|
||||
|
||||
GroundReactions->UpdateForcesAndMoments();
|
||||
|
||||
delete a, eta, lambda, lambdaMin, lambdaMax;
|
||||
}
|
||||
|
||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
Loading…
Reference in a new issue