Date started: 01/21/08
Purpose: Encapsulates the buoyant forces
- ------------- Copyright (C) 2008 - 2010 Anders Gidenstam -------------
+ ------------- Copyright (C) 2008 - 2011 Anders Gidenstam -------------
------------- Copyright (C) 2008 Jon S. Berndt (jon@jsbsim.org) -------------
This program is free software; you can redistribute it and/or modify it under
namespace JSBSim {
-static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.12 2010/05/07 18:59:55 andgi Exp $";
+static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.21 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_BUOYANTFORCES;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGBuoyantForces::InitModel(void)
{
- if (!FGModel::InitModel()) return false;
-
return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGBuoyantForces::Run(void)
+bool FGBuoyantForces::Run(bool Holding)
{
- if (FGModel::Run()) return true;
- if (FDMExec->Holding()) return false; // if paused don't execute
+ if (FGModel::Run(Holding)) return true;
+ if (Holding) return false; // if paused don't execute
if (NoneDefined) return true;
RunPreFunctions();
gas_cell_element = document->FindElement("gas_cell");
while (gas_cell_element) {
NoneDefined = false;
- Cells.push_back(new FGGasCell(FDMExec, gas_cell_element, Cells.size()));
+ Cells.push_back(new FGGasCell(FDMExec, gas_cell_element, Cells.size(), in));
gas_cell_element = document->FindNextElement("gas_cell");
}
- FGModel::PostLoad(element);
+ PostLoad(element, PropertyManager);
if (!NoneDefined) {
bind();
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGBuoyantForces::GetGasMass(void)
+double FGBuoyantForces::GetGasMass(void) const
{
double Gw = 0.0;
gasCellJ = FGMatrix33();
for (unsigned int i=0; i < size; i++) {
- FGColumnVector3 v = MassBalance->StructuralToBody( Cells[i]->GetXYZ() );
- // Body basis is in FT.
- const double mass = Cells[i]->GetMass();
-
- // FIXME: Verify that this is the correct way to change between the
- // coordinate frames.
- gasCellJ += Cells[i]->GetInertia() +
- FGMatrix33( 0, - mass*v(1)*v(2), - mass*v(1)*v(3),
- - mass*v(2)*v(1), 0, - mass*v(2)*v(3),
- - mass*v(3)*v(1), - mass*v(3)*v(2), 0 );
+ gasCellJ += Cells[i]->GetInertia();
}
return gasCellJ;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGBuoyantForces::GetBuoyancyStrings(string delimeter)
+string FGBuoyantForces::GetBuoyancyStrings(const string& delimeter)
{
string CoeffStrings = "";
/*
}
for (axis = 0; axis < 6; axis++) {
- for (sd = 0; sd < Coeff[axis].size(); sd++) {
+ for (sd = 0; sd < AeroFunctions[axis].size(); sd++) {
if (firstime) {
firstime = false;
} else {
CoeffStrings += delimeter;
}
- CoeffStrings += Coeff[axis][sd]->GetName();
+ CoeffStrings += AeroFunctions[axis][sd]->GetName();
}
}
*/
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGBuoyantForces::GetBuoyancyValues(string delimeter)
+string FGBuoyantForces::GetBuoyancyValues(const string& delimeter)
{
string SDValues = "";
/*
}
for (unsigned int axis = 0; axis < 6; axis++) {
- for (unsigned int sd = 0; sd < Coeff[axis].size(); sd++) {
+ for (unsigned int sd = 0; sd < AeroFunctions[axis].size(); sd++) {
if (firstime) {
firstime = false;
} else {
SDValues += delimeter;
}
- SDValues += Coeff[axis][sd]->GetValueAsString();
+ SDValues += AeroFunctions[axis][sd]->GetValueAsString();
}
}
*/
void FGBuoyantForces::bind(void)
{
- typedef double (FGBuoyantForces::*PMF)(int) const;
+ typedef double (FGBuoyantForces::*PGF)(int) const;
+ typedef void (FGBuoyantForces::*PSF)(int, double);
PropertyManager->Tie("moments/l-buoyancy-lbsft", this, eL,
- (PMF)&FGBuoyantForces::GetMoments);
+ (PGF)&FGBuoyantForces::GetMoments, (PSF)0, false);
PropertyManager->Tie("moments/m-buoyancy-lbsft", this, eM,
- (PMF)&FGBuoyantForces::GetMoments);
+ (PGF)&FGBuoyantForces::GetMoments, (PSF)0, false);
PropertyManager->Tie("moments/n-buoyancy-lbsft", this, eN,
- (PMF)&FGBuoyantForces::GetMoments);
+ (PGF)&FGBuoyantForces::GetMoments, (PSF)0, false);
PropertyManager->Tie("forces/fbx-buoyancy-lbs", this, eX,
- (PMF)&FGBuoyantForces::GetForces);
+ (PGF)&FGBuoyantForces::GetForces, (PSF)0, false);
PropertyManager->Tie("forces/fby-buoyancy-lbs", this, eY,
- (PMF)&FGBuoyantForces::GetForces);
+ (PGF)&FGBuoyantForces::GetForces, (PSF)0, false);
PropertyManager->Tie("forces/fbz-buoyancy-lbs", this, eZ,
- (PMF)&FGBuoyantForces::GetForces);
+ (PGF)&FGBuoyantForces::GetForces, (PSF)0, false);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%