Skip to content

Commit

Permalink
Fixed the moments computation to match the CG update from FGMassBalan…
Browse files Browse the repository at this point in the history
…ce (issue reported by Marta Marimon). The MassBalance model execution has been moved earlier in the main loop so that models executed afterwards get an up to date value of the CG.
  • Loading branch information
bcoconni committed Jan 31, 2015
1 parent e00d291 commit 88b7def
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
14 changes: 3 additions & 11 deletions src/FGFDMExec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ using namespace std;

namespace JSBSim {

IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.168 2015/01/31 14:56:21 bcoconni Exp $");
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.169 2015/01/31 15:08:59 bcoconni Exp $");
IDENT(IdHdr,ID_FDMEXEC);

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -282,14 +282,14 @@ bool FGFDMExec::Allocate(void)
Models[eInput] = new FGInput(this);
Models[eAtmosphere] = new FGStandardAtmosphere(this);
Models[eWinds] = new FGWinds(this);
Models[eMassBalance] = new FGMassBalance(this);
Models[eAuxiliary] = new FGAuxiliary(this);
Models[eSystems] = new FGFCS(this);
Models[ePropulsion] = new FGPropulsion(this);
Models[eAerodynamics] = new FGAerodynamics (this);
Models[eGroundReactions] = new FGGroundReactions(this);
Models[eExternalReactions] = new FGExternalReactions(this);
Models[eBuoyantForces] = new FGBuoyantForces(this);
Models[eMassBalance] = new FGMassBalance(this);
Models[eAircraft] = new FGAircraft(this);
Models[eAccelerations] = new FGAccelerations(this);
Models[eOutput] = new FGOutput(this);
Expand All @@ -299,14 +299,14 @@ bool FGFDMExec::Allocate(void)
Inertial = (FGInertial*)Models[eInertial];
Atmosphere = (FGAtmosphere*)Models[eAtmosphere];
Winds = (FGWinds*)Models[eWinds];
MassBalance = (FGMassBalance*)Models[eMassBalance];
Auxiliary = (FGAuxiliary*)Models[eAuxiliary];
FCS = (FGFCS*)Models[eSystems];
Propulsion = (FGPropulsion*)Models[ePropulsion];
Aerodynamics = (FGAerodynamics*)Models[eAerodynamics];
GroundReactions = (FGGroundReactions*)Models[eGroundReactions];
ExternalReactions = (FGExternalReactions*)Models[eExternalReactions];
BuoyantForces = (FGBuoyantForces*)Models[eBuoyantForces];
MassBalance = (FGMassBalance*)Models[eMassBalance];
Aircraft = (FGAircraft*)Models[eAircraft];
Accelerations = (FGAccelerations*)Models[eAccelerations];
Output = (FGOutput*)Models[eOutput];
Expand Down Expand Up @@ -351,14 +351,6 @@ bool FGFDMExec::DeAllocate(void)

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

void FGFDMExec::Schedule(FGModel* model, int rate)
{
model->SetRate(rate);
Models.push_back(model);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

bool FGFDMExec::Run(void)
{
bool success=true;
Expand Down
19 changes: 3 additions & 16 deletions src/FGFDMExec.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.93 2014/11/30 13:06:05 bcoconni Exp $"
#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.94 2015/01/31 15:08:59 bcoconni Exp $"

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
Expand Down Expand Up @@ -178,7 +178,7 @@ CLASS DOCUMENTATION
property actually maps toa function call of DoTrim().
@author Jon S. Berndt
@version $Revision: 1.93 $
@version $Revision: 1.94 $
*/

/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -228,14 +228,14 @@ class FGFDMExec : public FGJSBBase
eInertial,
eAtmosphere,
eWinds,
eMassBalance,
eAuxiliary,
eSystems,
ePropulsion,
eAerodynamics,
eGroundReactions,
eExternalReactions,
eBuoyantForces,
eMassBalance,
eAircraft,
eAccelerations,
eOutput,
Expand All @@ -244,19 +244,6 @@ class FGFDMExec : public FGJSBBase
/** Unbind all tied JSBSim properties. */
void Unbind(void) {instance->Unbind();}

/** This routine places a model into the runlist at the specified rate. The
"rate" is not really a clock rate. It represents how many calls to the
FGFDMExec::Run() method must be made before the model is executed. A
value of 1 means that the model will be executed for each call to the
exec's Run() method. A value of 5 means that the model will only be
executed every 5th call to the exec's Run() method. Use of a rate other than
one is at this time not recommended.
@param model A pointer to the model being scheduled.
@param rate The rate at which to execute the model as described above.
Default is every frame (rate=1).
@return Currently returns 0 always. */
void Schedule(FGModel* model, int rate=1);

/** This function executes each scheduled model in succession.
@return true if successful, false if sim should be ended */
bool Run(void);
Expand Down

0 comments on commit 88b7def

Please sign in to comment.