From: Erik Hofman Date: Sat, 18 Jan 2014 09:56:15 +0000 (+0100) Subject: Sync. with JSBSim CVS: although it looks a large part it is mostly bug fixes and... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e3e44e49ee121123963a8a4dba7c43c2745f08d0;p=flightgear.git Sync. with JSBSim CVS: although it looks a large part it is mostly bug fixes and fixing compiler warnings --- diff --git a/src/FDM/JSBSim/CMakeLists.txt b/src/FDM/JSBSim/CMakeLists.txt index c31b355ba..550d1eca8 100644 --- a/src/FDM/JSBSim/CMakeLists.txt +++ b/src/FDM/JSBSim/CMakeLists.txt @@ -12,6 +12,7 @@ set(HEADERS initialization/FGLinearization.h input_output/FGXMLParse.h input_output/FGXMLFileRead.h + input_output/FGPropertyReader.h input_output/FGPropertyManager.h input_output/FGScript.h input_output/FGfdmSocket.h @@ -49,6 +50,7 @@ set(HEADERS models/FGExternalReactions.h models/FGFCS.h models/FGGasCell.h + models/FGSurface.h models/FGGroundReactions.h models/FGInertial.h models/FGInput.h @@ -106,6 +108,7 @@ set(SOURCES initialization/FGTrimmer.cpp initialization/FGLinearization.cpp input_output/FGGroundCallback.cpp + input_output/FGPropertyReader.cpp input_output/FGPropertyManager.cpp input_output/FGScript.cpp input_output/FGXMLElement.cpp @@ -139,6 +142,7 @@ set(SOURCES models/FGExternalReactions.cpp models/FGFCS.cpp models/FGGasCell.cpp + models/FGSurface.cpp models/FGGroundReactions.cpp models/FGInertial.cpp models/FGInput.cpp diff --git a/src/FDM/JSBSim/FGFDMExec.cpp b/src/FDM/JSBSim/FGFDMExec.cpp index b61529229..2f05d2f1d 100644 --- a/src/FDM/JSBSim/FGFDMExec.cpp +++ b/src/FDM/JSBSim/FGFDMExec.cpp @@ -75,8 +75,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.150 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_FDMEXEC; +IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.154 2014/01/13 10:45:59 ehofman Exp $"); +IDENT(IdHdr,ID_FDMEXEC); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -101,6 +101,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root) holding = false; Terminate = false; StandAlone = false; + ResetMode = 0; IncrementThenHolding = false; // increment then hold is off by default TimeStepsUntilHold = -1; @@ -152,13 +153,13 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root) Constructing = true; typedef int (FGFDMExec::*iPMF)(void) const; - typedef double (FGFDMExec::*dPMF)(void) const; +// typedef double (FGFDMExec::*dPMF)(void) const; // typedef unsigned int (FGFDMExec::*uiPMF)(void) const; // instance->Tie("simulation/do_trim_analysis", this, (iPMF)0, &FGFDMExec::DoTrimAnalysis, false); instance->Tie("simulation/do_simple_trim", this, (iPMF)0, &FGFDMExec::DoTrim, false); instance->Tie("simulation/do_simplex_trim", this, (iPMF)0, &FGFDMExec::DoSimplexTrim); instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization); - instance->Tie("simulation/reset", this, (iPMF)0, &FGFDMExec::ResetToInitialConditions, false); + instance->Tie("simulation/reset", (int*)&ResetMode); instance->Tie("simulation/randomseed", this, (iPMF)0, &FGFDMExec::SRand, false); instance->Tie("simulation/terminate", (int *)&Terminate); instance->Tie("simulation/sim-time-sec", this, &FGFDMExec::GetSimTime); @@ -360,9 +361,16 @@ bool FGFDMExec::Run(void) Models[i]->Run(holding); } + if (ResetMode) { + if (ResetMode == 1) Output->SetStartNewOutput(); + + ResetMode = 0; + ResetToInitialConditions(); + } + if (Terminate) success = false; - return (success); + return success; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -583,7 +591,8 @@ bool FGFDMExec::RunIC(void) { FGPropulsion* propulsion = (FGPropulsion*)Models[ePropulsion]; - Models[eOutput]->InitModel(); + if (!trim_status) + Models[eOutput]->InitModel(); SuspendIntegration(); // saves the integration rate, dt, then sets it to 0.0. Initialize(IC); @@ -603,26 +612,15 @@ void FGFDMExec::Initialize(FGInitialCondition *FGIC) Setsim_time(0.0); Propagate->SetInitialState( FGIC ); + LoadInputs(eInertial); + Inertial->Run(false); LoadInputs(eAccelerations); Accelerations->Run(false); LoadInputs(ePropagate); Propagate->InitializeDerivatives(); - LoadInputs(eAtmosphere); - Atmosphere->Run(false); Winds->SetWindNED(FGIC->GetWindNEDFpsIC()); - Auxiliary->Run(false); -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -// -// A private, internal function call for Tie-ing to a property, so it needs an -// argument. - -void FGFDMExec::ResetToInitialConditions(int mode) -{ - if (mode == 1) Output->SetStartNewOutput(); - - ResetToInitialConditions(); + LoadInputs(eMassBalance); + MassBalance->Run(false); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -639,9 +637,9 @@ void FGFDMExec::ResetToInitialConditions(void) Models[i]->InitModel(); } - RunIC(); - if (Script) Script->ResetEvents(); + + RunIC(); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/FGFDMExec.h b/src/FDM/JSBSim/FGFDMExec.h index bf4215523..408abef15 100644 --- a/src/FDM/JSBSim/FGFDMExec.h +++ b/src/FDM/JSBSim/FGFDMExec.h @@ -55,7 +55,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.85 2013/11/24 11:40:55 bcoconni Exp $" +#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.86 2014/01/02 21:37:14 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -178,7 +178,7 @@ CLASS DOCUMENTATION property actually maps toa function call of DoTrim(). @author Jon S. Berndt - @version $Revision: 1.85 $ + @version $Revision: 1.86 $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -621,6 +621,7 @@ private: bool trim_status; int ta_mode; + unsigned int ResetMode; FGScript* Script; FGInitialCondition* IC; @@ -640,7 +641,6 @@ private: bool ReadFileHeader(Element*); bool ReadChild(Element*); bool ReadPrologue(Element*); - void ResetToInitialConditions(int mode); void SRand(int sr); void LoadInputs(unsigned int idx); void LoadPlanetConstants(void); diff --git a/src/FDM/JSBSim/FGJSBBase.cpp b/src/FDM/JSBSim/FGJSBBase.cpp index 7a2ad6714..b509fd1b8 100644 --- a/src/FDM/JSBSim/FGJSBBase.cpp +++ b/src/FDM/JSBSim/FGJSBBase.cpp @@ -44,8 +44,8 @@ INCLUDES namespace JSBSim { -static const char *IdSrc = "$Id: FGJSBBase.cpp,v 1.36 2013/01/25 13:39:11 jberndt Exp $"; -static const char *IdHdr = ID_JSBBASE; +IDENT(IdSrc,"$Id: FGJSBBase.cpp,v 1.38 2014/01/13 10:45:59 ehofman Exp $"); +IDENT(IdHdr,ID_JSBBASE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/FGJSBBase.h b/src/FDM/JSBSim/FGJSBBase.h index bcc6e3fdf..3dd78df9d 100644 --- a/src/FDM/JSBSim/FGJSBBase.h +++ b/src/FDM/JSBSim/FGJSBBase.h @@ -51,12 +51,13 @@ using std::max; #ifndef M_PI # define M_PI 3.14159265358979323846 #endif +#define IDENT(a,b) static const char* const (a)[] = {b,(a)[0]} /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.38 2013/06/20 13:01:48 jberndt Exp $" +#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -72,7 +73,7 @@ CLASS DOCUMENTATION * This class provides universal constants, utility functions, messaging * functions, and enumerated constants to JSBSim. @author Jon S. Berndt - @version $Id: FGJSBBase.h,v 1.38 2013/06/20 13:01:48 jberndt Exp $ + @version $Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx index c276c2c48..f6faecb6c 100644 --- a/src/FDM/JSBSim/JSBSim.cxx +++ b/src/FDM/JSBSim/JSBSim.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include @@ -1335,9 +1336,30 @@ FGJSBsim::get_agl_ft(double t, const double pt[3], double alt_off, if (!FGInterface::get_agl_ft(t, pt, alt_off, contact, normal, vel, angularVel, material, id)) return false; + SGGeod geodPt = SGGeod::fromCart(SG_FEET_TO_METER*SGVec3d(pt)); SGQuatd hlToEc = SGQuatd::fromLonLat(geodPt); *agl = dot(hlToEc.rotate(SGVec3d(0, 0, 1)), SGVec3d(contact) - SGVec3d(pt)); + + static SGPropertyNode_ptr terrain_nas = fgGetNode("/fdm/jsbsim/environment/terrain-hight", false); + if (!terrain_nas && material) { + double frictionFactor = (*material).get_friction_factor(); + double rollingFriction = (*material).get_rolling_friction(); + + if ((rollingFriction != 1.0) && (rollingFriction > 0.001)) { + frictionFactor = rollingFriction/0.02; + } + GroundReactions->SetFrictionFactor(frictionFactor); + + // 1 Pascal = 0.00014503773800721815 lbs/in^2 + double pressure = (*material).get_load_resistance(); // N/m^2 (or Pascal) + GroundReactions->SetMaximumForce(pressure*0.00014503773800721815); + + GroundReactions->SetBumpiness((*material).get_bumpiness()); + GroundReactions->SetSolid((*material).get_solid()); + GroundReactions->SetPosition(pt); + } + return true; } diff --git a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp index 804a61ed8..4df18d631 100644 --- a/src/FDM/JSBSim/initialization/FGInitialCondition.cpp +++ b/src/FDM/JSBSim/initialization/FGInitialCondition.cpp @@ -55,6 +55,7 @@ INCLUDES #include "models/FGAtmosphere.h" #include "models/FGPropagate.h" #include "models/FGPropulsion.h" +#include "models/FGAccelerations.h" #include "models/FGFCS.h" #include "input_output/FGPropertyManager.h" #include "input_output/string_utilities.h" @@ -65,8 +66,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.89 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_INITIALCONDITION; +IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.93 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_INITIALCONDITION); //****************************************************************************** @@ -886,9 +887,12 @@ bool FGInitialCondition::Load(string rstfile, bool useStoredPath) exit(-1); } - double version = document->GetAttributeValueAsNumber("version"); + double version = HUGE_VAL; bool result = false; + if (document->HasAttribute("version")) + version = document->GetAttributeValueAsNumber("version"); + if (version == HUGE_VAL) { result = Load_v1(document); // Default to the old version } else if (version >= 3.0) { @@ -1002,10 +1006,19 @@ bool FGInitialCondition::Load_v2(Element* document) { FGColumnVector3 vOrient; bool result = true; - FGColumnVector3 vOmegaEarth = fdmex->GetInertial()->GetOmegaPlanet(); + // support both earth_position_angle and planet_position_angle, for now. if (document->FindElement("earth_position_angle")) position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("earth_position_angle", "RAD")); + if (document->FindElement("planet_position_angle")) + position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("planet_position_angle", "RAD")); + + if (document->FindElement("planet_rotation_rate")) { + fdmex->GetInertial()->SetOmegaPlanet(document->FindElementValueAsNumberConvertTo("planet_rotation_rate", "RAD")); + fdmex->GetPropagate()->in.vOmegaPlanet = fdmex->GetInertial()->GetOmegaPlanet(); + fdmex->GetAccelerations()->in.vOmegaPlanet = fdmex->GetInertial()->GetOmegaPlanet(); + } + FGColumnVector3 vOmegaEarth = fdmex->GetInertial()->GetOmegaPlanet(); // Initialize vehicle position // diff --git a/src/FDM/JSBSim/initialization/FGSimplexTrim.cpp b/src/FDM/JSBSim/initialization/FGSimplexTrim.cpp old mode 100644 new mode 100755 index b8e645a4c..1f8a1967c --- a/src/FDM/JSBSim/initialization/FGSimplexTrim.cpp +++ b/src/FDM/JSBSim/initialization/FGSimplexTrim.cpp @@ -23,7 +23,7 @@ namespace JSBSim { FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode) { - std::clock_t time_start=clock(), time_trimDone, time_linDone; + std::clock_t time_start=clock(), time_trimDone; // variables FGTrimmer::Constraints constraints; @@ -43,12 +43,10 @@ FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode) bool showConvergence = node->GetBool("trim/solver/showConvergence"); bool pause = node->GetBool("trim/solver/pause"); bool showSimplex = node->GetBool("trim/solver/showSimplex"); - bool variablePropPitch = node->GetBool("trim/solver/variablePropPitch"); // flight conditions double phi = fdm->GetIC()->GetPhiRadIC(); double theta = fdm->GetIC()->GetThetaRadIC(); - double psi = fdm->GetIC()->GetPsiRadIC(); double gd = fdm->GetInertial()->gravity(); constraints.velocity = fdm->GetIC()->GetVtrueFpsIC(); @@ -110,8 +108,8 @@ FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode) std::cout << "\ntrim computation time: " << (time_trimDone - time_start)/double(CLOCKS_PER_SEC) << "s \n" << std::endl; } - if (solver) delete solver; - if (trimmer) delete trimmer; + delete solver; + delete trimmer; } } // JSBSim diff --git a/src/FDM/JSBSim/initialization/FGTrim.cpp b/src/FDM/JSBSim/initialization/FGTrim.cpp index bb346598a..d4b1112e3 100644 --- a/src/FDM/JSBSim/initialization/FGTrim.cpp +++ b/src/FDM/JSBSim/initialization/FGTrim.cpp @@ -57,8 +57,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGTrim.cpp,v 1.18 2013/11/24 16:53:15 bcoconni Exp $"; -static const char *IdHdr = ID_TRIM; +IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.22 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_TRIM); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -242,8 +242,8 @@ bool FGTrim::DoTrim(void) { fdmex->DisableOutput(); - fdmex->RunIC(); fdmex->SetTrimStatus(true); + fdmex->RunIC(); fdmex->SuspendIntegration(); fgic->SetPRadpsIC(0.0); @@ -381,9 +381,9 @@ bool FGTrim::DoTrim(void) { cout << endl << " Trim failed" << endl; } - fdmex->SetTrimStatus(false); fdmex->ResumeIntegration(); fdmex->RunIC(); + fdmex->SetTrimStatus(false); fdmex->EnableOutput(); for(i=0;i < fdmex->GetGroundReactions()->GetNumGearUnits();i++){ diff --git a/src/FDM/JSBSim/initialization/FGTrimAxis.cpp b/src/FDM/JSBSim/initialization/FGTrimAxis.cpp index 2fbaec8a2..4eb1d63d5 100644 --- a/src/FDM/JSBSim/initialization/FGTrimAxis.cpp +++ b/src/FDM/JSBSim/initialization/FGTrimAxis.cpp @@ -56,8 +56,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGTrimAxis.cpp,v 1.15 2013/11/24 16:53:15 bcoconni Exp $"; -static const char *IdHdr = ID_TRIMAXIS; +IDENT(IdSrc,"$Id: FGTrimAxis.cpp,v 1.17 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_TRIMAXIS); /*****************************************************************************/ diff --git a/src/FDM/JSBSim/initialization/FGTrimmer.cpp b/src/FDM/JSBSim/initialization/FGTrimmer.cpp old mode 100644 new mode 100755 index b0194865a..f64326c1d --- a/src/FDM/JSBSim/initialization/FGTrimmer.cpp +++ b/src/FDM/JSBSim/initialization/FGTrimmer.cpp @@ -189,7 +189,6 @@ void FGTrimmer::printSolution(std::ostream & stream, const std::vector & eval(v); //double dt = m_fdm->GetDeltaT(); - double thrust = m_fdm->GetPropulsion()->GetEngine(0)->GetThruster()->GetThrust(); double elevator = m_fdm->GetFCS()->GetDePos(ofNorm); double aileron = m_fdm->GetFCS()->GetDaLPos(ofNorm); double rudder = m_fdm->GetFCS()->GetDrPos(ofNorm); diff --git a/src/FDM/JSBSim/input_output/FGOutputFG.cpp b/src/FDM/JSBSim/input_output/FGOutputFG.cpp index b6a2964e1..99c98dca3 100644 --- a/src/FDM/JSBSim/input_output/FGOutputFG.cpp +++ b/src/FDM/JSBSim/input_output/FGOutputFG.cpp @@ -71,8 +71,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGOutputFG.cpp,v 1.6 2013/11/09 14:06:36 bcoconni Exp $"; -static const char *IdHdr = ID_OUTPUTFG; +IDENT(IdSrc,"$Id: FGOutputFG.cpp,v 1.8 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_OUTPUTFG); // (stolen from FGFS native_fdm.cxx) // The function htond is defined this way due to the way some diff --git a/src/FDM/JSBSim/input_output/FGOutputFile.cpp b/src/FDM/JSBSim/input_output/FGOutputFile.cpp index c1cfc7d32..431c2ebe0 100644 --- a/src/FDM/JSBSim/input_output/FGOutputFile.cpp +++ b/src/FDM/JSBSim/input_output/FGOutputFile.cpp @@ -47,8 +47,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGOutputFile.cpp,v 1.4 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_OUTPUTFILE; +IDENT(IdSrc,"$Id: FGOutputFile.cpp,v 1.6 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_OUTPUTFILE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/input_output/FGOutputSocket.cpp b/src/FDM/JSBSim/input_output/FGOutputSocket.cpp index 7e913ff66..60b3e7a3b 100644 --- a/src/FDM/JSBSim/input_output/FGOutputSocket.cpp +++ b/src/FDM/JSBSim/input_output/FGOutputSocket.cpp @@ -60,8 +60,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGOutputSocket.cpp,v 1.6 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_OUTPUTSOCKET; +IDENT(IdSrc,"$Id: FGOutputSocket.cpp,v 1.8 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_OUTPUTSOCKET); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/input_output/FGOutputTextFile.cpp b/src/FDM/JSBSim/input_output/FGOutputTextFile.cpp index 03c593bad..e6abcef35 100644 --- a/src/FDM/JSBSim/input_output/FGOutputTextFile.cpp +++ b/src/FDM/JSBSim/input_output/FGOutputTextFile.cpp @@ -64,8 +64,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGOutputTextFile.cpp,v 1.7 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_OUTPUTTEXTFILE; +IDENT(IdSrc,"$Id: FGOutputTextFile.cpp,v 1.10 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_OUTPUTTEXTFILE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -76,7 +76,7 @@ bool FGOutputTextFile::Load(Element* el) if(!FGOutputFile::Load(el)) return false; - PreLoad(el, PropertyManager); +// PreLoad(el, PropertyManager); string type = el->GetAttributeValue("type"); string delim; diff --git a/src/FDM/JSBSim/input_output/FGOutputType.cpp b/src/FDM/JSBSim/input_output/FGOutputType.cpp index 90b9c2c7a..09cbc62b6 100644 --- a/src/FDM/JSBSim/input_output/FGOutputType.cpp +++ b/src/FDM/JSBSim/input_output/FGOutputType.cpp @@ -46,8 +46,8 @@ INCLUDES namespace JSBSim { -static const char *IdSrc = "$Id: FGOutputType.cpp,v 1.7 2013/09/27 19:45:40 jberndt Exp $"; -static const char *IdHdr = ID_OUTPUTTYPE; +IDENT(IdSrc,"$Id: FGOutputType.cpp,v 1.10 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_OUTPUTTYPE); using namespace std; @@ -101,7 +101,7 @@ void FGOutputType::SetIdx(int idx) bool FGOutputType::Load(Element* element) { // Perform base class Load. -// if(!FGModel::Load(element)) return false; + PreLoad(element, PropertyManager); if (element->FindElementValue("simulation") == string("ON")) SubSystems += ssSimulation; diff --git a/src/FDM/JSBSim/input_output/FGPropertyReader.cpp b/src/FDM/JSBSim/input_output/FGPropertyReader.cpp new file mode 100644 index 000000000..b6c001a53 --- /dev/null +++ b/src/FDM/JSBSim/input_output/FGPropertyReader.cpp @@ -0,0 +1,134 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Module: FGPropertyReader.cpp + Author: Bertrand Coconnier + Date started: 12/30/13 + Purpose: Read and manage properties from XML data + + ------------- Copyright (C) 2013 Bertrand Coconnier ------------- + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA. + + Further information about the GNU Lesser General Public License can also be found on + the world wide web at http://www.gnu.org. + +FUNCTIONAL DESCRIPTION +-------------------------------------------------------------------------------- +This class reads and manages properties defined in XML data + +HISTORY +-------------------------------------------------------------------------------- +12/30/13 BC Created + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +INCLUDES +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#include "FGPropertyReader.h" +#include "FGPropertyManager.h" +#include "FGXMLElement.h" +#include "FGJSBBase.h" + +using namespace std; + +namespace JSBSim { + +IDENT(IdSrc,"$Id: FGPropertyReader.cpp,v 1.3 2014/01/13 10:46:00 ehofman Exp $"); +IDENT(IdHdr,ID_PROPERTYREADER); + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CLASS IMPLEMENTATION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +bool FGPropertyReader::ResetToIC(void) +{ + map::iterator it = interface_prop_initial_value.begin(); + for (;it != interface_prop_initial_value.end(); ++it) { + FGPropertyNode* node = it->first; + if (!node->getAttribute(SGPropertyNode::PRESERVE)) + node->setDoubleValue(it->second); + } + + return true; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +void FGPropertyReader::LoadProperties(Element* el, FGPropertyManager* PM, + bool override) +{ + // Interface properties are all stored in the interface properties array. + string interface_property_string = ""; + + Element *property_element = el->FindElement("property"); + if (property_element && FGJSBBase::debug_lvl > 0) { + cout << endl << " "; + if (override) + cout << "Overriding"; + else + cout << "Declared"; + cout << " properties" << endl << endl; + } + + while (property_element) { + FGPropertyNode* node = 0; + double value=0.0; + if ( ! property_element->GetAttributeValue("value").empty()) + value = property_element->GetAttributeValueAsNumber("value"); + + interface_property_string = property_element->GetDataLine(); + if (PM->HasNode(interface_property_string)) { + if (override) { + node = PM->GetNode(interface_property_string); + + if (FGJSBBase::debug_lvl > 0) { + if (interface_prop_initial_value.find(node) == interface_prop_initial_value.end()) { + cout << property_element->ReadFrom() + << " The following property will be overridden but it has not been" << endl + << " defined in the current model '" << el->GetName() << "'" << endl; + } + + cout << " " << "Overriding value for property " << interface_property_string << endl + << " (old value: " << node->getDoubleValue() << " new value: " << value << ")" + << endl << endl; + } + + node->setDoubleValue(value); + } + else { + cerr << property_element->ReadFrom() + << " Property " << interface_property_string + << " is already defined." << endl; + property_element = el->FindNextElement("property"); + continue; + } + } else { + interface_properties.push_back(value); + PM->Tie(interface_property_string, &interface_properties.back()); + if (FGJSBBase::debug_lvl > 0) + cout << " " << interface_property_string << " (initial value: " + << value << ")" << endl << endl; + node = PM->GetNode(interface_property_string); + } + interface_prop_initial_value[node] = value; + if (property_element->GetAttributeValue("persistent") == string("true")) + node->setAttribute(SGPropertyNode::PRESERVE, true); + + property_element = el->FindNextElement("property"); + } + + // End of interface property loading logic +} +} diff --git a/src/FDM/JSBSim/input_output/FGPropertyReader.h b/src/FDM/JSBSim/input_output/FGPropertyReader.h new file mode 100644 index 000000000..c50b363f2 --- /dev/null +++ b/src/FDM/JSBSim/input_output/FGPropertyReader.h @@ -0,0 +1,82 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Header: FGPropertyReader.h + Author: Bertrand Coconnier + Date started: 12/30/13 + + ------------- Copyright (C) 2013 Bertrand Coconnier ------------- + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA. + + Further information about the GNU Lesser General Public License can also be found on + the world wide web at http://www.gnu.org. + +HISTORY +-------------------------------------------------------------------------------- +12/30/13 BC Created + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +SENTRY +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#ifndef FGPROPERTYREADER_H +#define FGPROPERTYREADER_H + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +INCLUDES +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#include +#include + +#include "simgear/structure/SGSharedPtr.hxx" + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +DEFINITIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#define ID_PROPERTYREADER "$Id: FGPropertyReader.h,v 1.1 2014/01/02 22:37:47 bcoconni Exp $" + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +FORWARD DECLARATIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +namespace JSBSim { + +class Element; +class FGPropertyManager; +class FGPropertyNode; + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CLASS DOCUMENTATION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CLASS DECLARATION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +class FGPropertyReader +{ +public: + void LoadProperties(Element* el, FGPropertyManager* PropertyManager, bool override); + bool ResetToIC(void); + +protected: + std::list interface_properties; + std::map, double> interface_prop_initial_value; +}; +} +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +#endif diff --git a/src/FDM/JSBSim/input_output/FGScript.cpp b/src/FDM/JSBSim/input_output/FGScript.cpp index 5a0e548e8..72438c296 100755 --- a/src/FDM/JSBSim/input_output/FGScript.cpp +++ b/src/FDM/JSBSim/input_output/FGScript.cpp @@ -55,8 +55,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGScript.cpp,v 1.53 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_FGSCRIPT; +IDENT(IdSrc,"$Id: FGScript.cpp,v 1.56 2014/01/13 10:46:01 ehofman Exp $"); +IDENT(IdHdr,ID_FGSCRIPT); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GLOBAL DECLARATIONS @@ -81,12 +81,6 @@ FGScript::~FGScript() { unsigned int i, j; - for (i=0; ivalue; - delete local_properties[i]; - } - local_properties.clear(); - for (i=0; iFindElement("property"); - while (property_element) { - - double value=0.0; - string title=""; - - title = property_element->GetDataLine(); - if ( ! property_element->GetAttributeValue("value").empty()) - value = property_element->GetAttributeValueAsNumber("value"); - - LocalProps *localProp = new LocalProps(value); - localProp->title = title; - local_properties.push_back(localProp); - if (PropertyManager->HasNode(title)) { - PropertyManager->GetNode(title)->setDoubleValue(value); - } else { - PropertyManager->Tie(localProp->title, localProp->value); - } - property_element = run_element->FindNextElement("property"); - } + int saved_debug_lvl = debug_lvl; + debug_lvl = 0; // Disable messages + LoadProperties(run_element, PropertyManager, true); + debug_lvl = saved_debug_lvl; // Read "events" from script @@ -365,6 +342,16 @@ bool FGScript::LoadScript(string script, double deltaT, const string initfile) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGScript::ResetEvents(void) +{ + //ResetToIC(); + + for (unsigned int i=0; iGetDeltaT()) << " Hz)" << endl; cout << endl; - for (unsigned int i=0; ititle - << " = " << PropertyManager->GetNode(local_properties[i]->title)->getDoubleValue() + map::iterator it = interface_prop_initial_value.begin(); + for (; it != interface_prop_initial_value.end(); ++it) { + FGPropertyNode* node = it->first; + cout << "Local property: " << node->GetName() + << " = " << node->getDoubleValue() << endl; } - if (local_properties.size() > 0) cout << endl; + if (!interface_prop_initial_value.empty()) cout << endl; for (unsigned i=0; i +#include #include "FGFDMExec.h" #include "FGJSBBase.h" #include "math/FGFunction.h" #include "math/FGCondition.h" +#include "FGPropertyReader.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_FGSCRIPT "$Id: FGScript.h,v 1.27 2013/11/24 11:40:55 bcoconni Exp $" +#define ID_FGSCRIPT "$Id: FGScript.h,v 1.28 2014/01/02 22:37:47 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -157,14 +159,14 @@ CLASS DOCUMENTATION comes the "run" section, where the conditions are described in "event" clauses.

@author Jon S. Berndt - @version "$Id: FGScript.h,v 1.27 2013/11/24 11:40:55 bcoconni Exp $" + @version "$Id: FGScript.h,v 1.28 2014/01/02 22:37:47 bcoconni Exp $" */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -class FGScript : public FGJSBBase +class FGScript : public FGPropertyReader, public FGJSBBase { public: /// Default constructor @@ -190,9 +192,7 @@ public: @return false if script should exit (i.e. if time limits are violated */ bool RunScript(void); - void ResetEvents(void) { - for (unsigned int i=0; i Events; - std::vector local_properties; FGFDMExec* FDMExec; FGPropertyManager* PropertyManager; diff --git a/src/FDM/JSBSim/input_output/FGXMLElement.cpp b/src/FDM/JSBSim/input_output/FGXMLElement.cpp index 4f7c9d5aa..2e3215692 100755 --- a/src/FDM/JSBSim/input_output/FGXMLElement.cpp +++ b/src/FDM/JSBSim/input_output/FGXMLElement.cpp @@ -44,8 +44,8 @@ FORWARD DECLARATIONS namespace JSBSim { -static const char *IdSrc = "$Id: FGXMLElement.cpp,v 1.41 2013/11/16 14:51:20 bcoconni Exp $"; -static const char *IdHdr = ID_XMLELEMENT; +IDENT(IdSrc,"$Id: FGXMLElement.cpp,v 1.45 2014/01/13 10:46:02 ehofman Exp $"); +IDENT(IdHdr,ID_XMLELEMENT); bool Element::converterIsInitialized = false; map > Element::convert; @@ -233,7 +233,6 @@ Element::Element(const string& nm) convert["KG/L"]["KG/L"] = 1.0; convert["LBS/GAL"]["LBS/GAL"] = 1.0; } - attribute_key.resize(0); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -243,7 +242,6 @@ Element::~Element(void) for (unsigned int i=0; i::iterator found = attributes.find(attr); - unsigned int attr_cnt = attribute_key.size(); - - for (unsigned int i=0; i" << endl + << " from multiple lines:" << endl; + for(unsigned int i=0; ifirst << " = " << it->second; + cout << endl; for (i=0; i #include +#include "FGJSBBase.h" #include "math/FGColumnVector3.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_XMLELEMENT "$Id: FGXMLElement.h,v 1.18 2013/11/16 14:51:20 bcoconni Exp $" +#define ID_XMLELEMENT "$Id: FGXMLElement.h,v 1.20 2014/01/13 10:46:02 ehofman Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -136,7 +137,7 @@ CLASS DOCUMENTATION - GAL = gallon (U.S. liquid) @author Jon S. Berndt - @version $Id: FGXMLElement.h,v 1.18 2013/11/16 14:51:20 bcoconni Exp $ + @version $Id: FGXMLElement.h,v 1.20 2014/01/13 10:46:02 ehofman Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -363,7 +364,6 @@ private: std::map attributes; std::vector data_lines; std::vector children; - std::vector attribute_key; Element *parent; unsigned int element_index; std::string file_name; diff --git a/src/FDM/JSBSim/input_output/FGXMLFileRead.h b/src/FDM/JSBSim/input_output/FGXMLFileRead.h index c92142702..1c912862a 100755 --- a/src/FDM/JSBSim/input_output/FGXMLFileRead.h +++ b/src/FDM/JSBSim/input_output/FGXMLFileRead.h @@ -43,7 +43,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.8 2013/11/24 11:40:55 bcoconni Exp $" +#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.9 2013/12/01 14:33:51 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -58,7 +58,7 @@ public: Element* LoadXMLDocument(std::string XML_filename, bool verbose=true) { - return LoadXMLDocument(XML_filename, file_parser, true); + return LoadXMLDocument(XML_filename, file_parser, verbose); } Element* LoadXMLDocument(std::string XML_filename, FGXMLParse& fparse, bool verbose=true) diff --git a/src/FDM/JSBSim/input_output/FGXMLParse.cpp b/src/FDM/JSBSim/input_output/FGXMLParse.cpp index 3710f14f5..e6b4c87c0 100755 --- a/src/FDM/JSBSim/input_output/FGXMLParse.cpp +++ b/src/FDM/JSBSim/input_output/FGXMLParse.cpp @@ -40,8 +40,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGXMLParse.cpp,v 1.12 2013/11/16 14:51:20 bcoconni Exp $"; -static const char *IdHdr = ID_XMLPARSE; +IDENT(IdSrc,"$Id: FGXMLParse.cpp,v 1.14 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_XMLPARSE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/input_output/FGfdmSocket.cpp b/src/FDM/JSBSim/input_output/FGfdmSocket.cpp index d1edb6739..843fb75d5 100644 --- a/src/FDM/JSBSim/input_output/FGfdmSocket.cpp +++ b/src/FDM/JSBSim/input_output/FGfdmSocket.cpp @@ -52,8 +52,8 @@ using std::string; namespace JSBSim { -static const char *IdSrc = "$Id: FGfdmSocket.cpp,v 1.27 2010/05/13 03:07:59 jberndt Exp $"; -static const char *IdHdr = ID_FDMSOCKET; +IDENT(IdSrc,"$Id: FGfdmSocket.cpp,v 1.29 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_FDMSOCKET); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/input_output/string_utilities.h b/src/FDM/JSBSim/input_output/string_utilities.h index aa64f64c4..d25e258b3 100644 --- a/src/FDM/JSBSim/input_output/string_utilities.h +++ b/src/FDM/JSBSim/input_output/string_utilities.h @@ -44,11 +44,12 @@ INCLUDES #include #include + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_STRINGUTILS "$Id: string_utilities.h,v 1.16 2013/11/17 05:14:21 jberndt Exp $" +#define ID_STRINGUTILS "$Id: string_utilities.h,v 1.18 2014/01/13 10:46:03 ehofman Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -168,16 +169,16 @@ CLASS DECLARATION string to_string(float x) { - std::ostringstream o; - if (!(o << x)) cerr << "Bad float to string conversion" << endl; - return o.str(); + std::ostringstream o; + if (!(o << x)) cerr << "Bad float to string conversion" << endl; + return o.str(); } string to_string(double x) { - std::ostringstream o; - if (!(o << x)) cerr << "Bad double to string conversion" << endl; - return o.str(); + std::ostringstream o; + if (!(o << x)) cerr << "Bad double to string conversion" << endl; + return o.str(); } string replace(string str, const string& oldstr, const string& newstr) diff --git a/src/FDM/JSBSim/math/FGColumnVector3.cpp b/src/FDM/JSBSim/math/FGColumnVector3.cpp index beab994f5..95f97135f 100644 --- a/src/FDM/JSBSim/math/FGColumnVector3.cpp +++ b/src/FDM/JSBSim/math/FGColumnVector3.cpp @@ -37,6 +37,7 @@ HISTORY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#include "FGJSBBase.h" #include "FGColumnVector3.h" #include #include @@ -47,8 +48,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGColumnVector3.cpp,v 1.15 2012/02/07 00:27:51 jentron Exp $"; -static const char *IdHdr = ID_COLUMNVECTOR3; +IDENT(IdSrc,"$Id: FGColumnVector3.cpp,v 1.17 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_COLUMNVECTOR3); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/math/FGColumnVector3.h b/src/FDM/JSBSim/math/FGColumnVector3.h index d0f83cc62..cd66076c6 100644 --- a/src/FDM/JSBSim/math/FGColumnVector3.h +++ b/src/FDM/JSBSim/math/FGColumnVector3.h @@ -46,7 +46,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_COLUMNVECTOR3 "$Id: FGColumnVector3.h,v 1.17 2011/12/10 15:49:21 bcoconni Exp $" +#define ID_COLUMNVECTOR3 "$Id: FGColumnVector3.h,v 1.18 2013/11/30 10:25:33 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -60,7 +60,7 @@ CLASS DOCUMENTATION /** This class implements a 3 element column vector. @author Jon S. Berndt, Tony Peden, et. al. - @version $Id: FGColumnVector3.h,v 1.17 2011/12/10 15:49:21 bcoconni Exp $ + @version $Id: FGColumnVector3.h,v 1.18 2013/11/30 10:25:33 bcoconni Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -240,17 +240,17 @@ public: is equal to zero it is left untouched. */ FGColumnVector3& Normalize(void); - /** Dot product of two vectors - Compute and return the euclidean dot (or scalar) product of two vectors - v1 and v2 */ - friend double DotProduct(const FGColumnVector3& v1, const FGColumnVector3& v2) { - return v1.data[0]*v2.data[0] + v1.data[1]*v2.data[1] + v1.data[2]*v2.data[2]; - } - private: double data[3]; }; +/** Dot product of two vectors + Compute and return the euclidean dot (or scalar) product of two vectors + v1 and v2 */ +inline double DotProduct(const FGColumnVector3& v1, const FGColumnVector3& v2) { + return v1(1)*v2(1) + v1(2)*v2(2) + v1(3)*v2(3); +} + /** Scalar multiplication. @param scalar scalar value to multiply with. @param A Vector to multiply. diff --git a/src/FDM/JSBSim/math/FGCondition.cpp b/src/FDM/JSBSim/math/FGCondition.cpp index e24cd2f62..34b298827 100644 --- a/src/FDM/JSBSim/math/FGCondition.cpp +++ b/src/FDM/JSBSim/math/FGCondition.cpp @@ -45,8 +45,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGCondition.cpp,v 1.18 2013/01/26 17:06:49 bcoconni Exp $"; -static const char *IdHdr = ID_CONDITION; +IDENT(IdSrc,"$Id: FGCondition.cpp,v 1.20 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_CONDITION); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/math/FGFunction.cpp b/src/FDM/JSBSim/math/FGFunction.cpp index 6beeedb89..2aeef75c0 100755 --- a/src/FDM/JSBSim/math/FGFunction.cpp +++ b/src/FDM/JSBSim/math/FGFunction.cpp @@ -43,8 +43,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGFunction.cpp,v 1.53 2013/09/27 19:42:08 jberndt Exp $"; -static const char *IdHdr = ID_FUNCTION; +IDENT(IdSrc,"$Id: FGFunction.cpp,v 1.55 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_FUNCTION); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/math/FGLocation.cpp b/src/FDM/JSBSim/math/FGLocation.cpp index 12afdadde..88a1946b7 100644 --- a/src/FDM/JSBSim/math/FGLocation.cpp +++ b/src/FDM/JSBSim/math/FGLocation.cpp @@ -47,8 +47,8 @@ INCLUDES namespace JSBSim { -static const char *IdSrc = "$Id: FGLocation.cpp,v 1.30 2013/10/19 17:59:51 bcoconni Exp $"; -static const char *IdHdr = ID_LOCATION; +IDENT(IdSrc,"$Id: FGLocation.cpp,v 1.32 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_LOCATION); using std::cerr; using std::endl; diff --git a/src/FDM/JSBSim/math/FGMatrix33.cpp b/src/FDM/JSBSim/math/FGMatrix33.cpp index ef41cfb78..1cc0d46ae 100644 --- a/src/FDM/JSBSim/math/FGMatrix33.cpp +++ b/src/FDM/JSBSim/math/FGMatrix33.cpp @@ -49,8 +49,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGMatrix33.cpp,v 1.14 2012/11/22 22:04:06 bcoconni Exp $"; -static const char *IdHdr = ID_MATRIX33; +IDENT(IdSrc,"$Id: FGMatrix33.cpp,v 1.16 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_MATRIX33); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/math/FGModelFunctions.cpp b/src/FDM/JSBSim/math/FGModelFunctions.cpp index 200a67db1..957bf0697 100755 --- a/src/FDM/JSBSim/math/FGModelFunctions.cpp +++ b/src/FDM/JSBSim/math/FGModelFunctions.cpp @@ -41,14 +41,15 @@ INCLUDES #include #include #include "FGModelFunctions.h" +#include "FGFunction.h" #include "input_output/FGXMLElement.h" using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGModelFunctions.cpp,v 1.7 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_MODELFUNCTIONS; +IDENT(IdSrc,"$Id: FGModelFunctions.cpp,v 1.12 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_MODELFUNCTIONS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -56,9 +57,6 @@ CLASS IMPLEMENTATION FGModelFunctions::~FGModelFunctions() { - for (unsigned int i=0; iFindElement("property"); - if (property_element && debug_lvl > 0) cout << endl << " Declared properties" - << endl << endl; - while (property_element) { - interface_property_string = property_element->GetDataLine(); - if (PM->HasNode(interface_property_string)) { - cerr << " Property " << interface_property_string - << " is already defined." << endl; - } else { - double value=0.0; - if ( ! property_element->GetAttributeValue("value").empty()) - value = property_element->GetAttributeValueAsNumber("value"); - interface_properties.push_back(new double(value)); - PM->Tie(interface_property_string, interface_properties.back()); - if (debug_lvl > 0) - cout << " " << interface_property_string << " (initial value: " - << value << ")" << endl << endl; - } - property_element = el->FindNextElement("property"); - } - - // End of interface property loading logic + ResetToIC(); + return true; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +bool FGModelFunctions::Load(Element* el, FGPropertyManager* PM, string prefix) +{ + LoadProperties(el, PM, false); PreLoad(el, PM, prefix); return true; // TODO: Need to make this value mean something. diff --git a/src/FDM/JSBSim/math/FGModelFunctions.h b/src/FDM/JSBSim/math/FGModelFunctions.h index 6b56e2483..f67c203fb 100755 --- a/src/FDM/JSBSim/math/FGModelFunctions.h +++ b/src/FDM/JSBSim/math/FGModelFunctions.h @@ -34,16 +34,18 @@ SENTRY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#include "FGJSBBase.h" #include -#include "math/FGFunction.h" -#include "input_output/FGPropertyManager.h" +#include +#include + +#include "FGJSBBase.h" +#include "input_output/FGPropertyReader.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_MODELFUNCTIONS "$Id: FGModelFunctions.h,v 1.6 2013/11/24 11:40:55 bcoconni Exp $" +#define ID_MODELFUNCTIONS "$Id: FGModelFunctions.h,v 1.9 2014/01/02 22:37:48 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -51,6 +53,10 @@ FORWARD DECLARATIONS namespace JSBSim { +class FGFunction; +class Element; +class FGPropertyManager; + /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS DOCUMENTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ @@ -72,7 +78,7 @@ CLASS DOCUMENTATION DECLARATION: FGModelFunctions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -class FGModelFunctions : public FGJSBBase +class FGModelFunctions : public FGPropertyReader, public FGJSBBase { public: virtual ~FGModelFunctions(); @@ -96,7 +102,8 @@ public: protected: std::vector PreFunctions; std::vector PostFunctions; - std::vector interface_properties; + + virtual bool InitModel(void); }; } // namespace JSBSim diff --git a/src/FDM/JSBSim/math/FGNelderMead.cpp b/src/FDM/JSBSim/math/FGNelderMead.cpp old mode 100644 new mode 100755 index c38cb5d50..9484994c8 --- a/src/FDM/JSBSim/math/FGNelderMead.cpp +++ b/src/FDM/JSBSim/math/FGNelderMead.cpp @@ -68,9 +68,8 @@ void FGNelderMead::update() { if (std::abs(minCost-minCostPrevResize) < std::numeric_limits::epsilon()) { - throw std::runtime_error("unable to escape local minimum!"); m_status = -1; - return; + throw std::runtime_error("unable to escape local minimum!"); } //std::cout << "reinitializing step size" << std::endl; guess = m_simplex[m_iMin]; @@ -90,7 +89,6 @@ void FGNelderMead::update() { m_status = -1; throw; - return; } } @@ -120,7 +118,6 @@ void FGNelderMead::update() { m_status = -1; throw std::runtime_error("max iterations exceeded!"); - return; } // check for convergence break condition else if ( m_cost[m_iMin] < abstol ) @@ -243,9 +240,8 @@ void FGNelderMead::update() catch (const std::exception & e) { - throw; m_status = -1; - return; + throw; } // iteration @@ -374,9 +370,8 @@ double FGNelderMead::eval(const std::vector & vertex, bool check) } else { return cost1; } - } else { - return m_f->eval(vertex); } + return m_f->eval(vertex); } } // JSBSim diff --git a/src/FDM/JSBSim/math/FGPropertyValue.cpp b/src/FDM/JSBSim/math/FGPropertyValue.cpp index f4b759154..ff25cb379 100755 --- a/src/FDM/JSBSim/math/FGPropertyValue.cpp +++ b/src/FDM/JSBSim/math/FGPropertyValue.cpp @@ -34,8 +34,8 @@ INCLUDES namespace JSBSim { -static const char *IdSrc = "$Id: FGPropertyValue.cpp,v 1.9 2013/09/27 19:42:53 jberndt Exp $"; -static const char *IdHdr = ID_PROPERTYVALUE; +IDENT(IdSrc,"$Id: FGPropertyValue.cpp,v 1.11 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_PROPERTYVALUE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/math/FGQuaternion.cpp b/src/FDM/JSBSim/math/FGQuaternion.cpp index 6f0295555..7dfbc538e 100644 --- a/src/FDM/JSBSim/math/FGQuaternion.cpp +++ b/src/FDM/JSBSim/math/FGQuaternion.cpp @@ -58,8 +58,8 @@ using std::endl; namespace JSBSim { -static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.22 2012/09/17 12:27:44 jberndt Exp $"; -static const char *IdHdr = ID_QUATERNION; +IDENT(IdSrc,"$Id: FGQuaternion.cpp,v 1.24 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_QUATERNION); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/math/FGRealValue.cpp b/src/FDM/JSBSim/math/FGRealValue.cpp old mode 100644 new mode 100755 index a30f9fcce..54d185799 --- a/src/FDM/JSBSim/math/FGRealValue.cpp +++ b/src/FDM/JSBSim/math/FGRealValue.cpp @@ -32,8 +32,8 @@ INCLUDES namespace JSBSim { -static const char *IdSrc = "$Id: FGRealValue.cpp,v 1.4 2009/08/30 03:51:28 jberndt Exp $"; -static const char *IdHdr = ID_REALVALUE; +IDENT(IdSrc,"$Id: FGRealValue.cpp,v 1.6 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_REALVALUE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/math/FGRungeKutta.cpp b/src/FDM/JSBSim/math/FGRungeKutta.cpp index bc3dabc07..da2117c4d 100644 --- a/src/FDM/JSBSim/math/FGRungeKutta.cpp +++ b/src/FDM/JSBSim/math/FGRungeKutta.cpp @@ -33,6 +33,7 @@ #include #include +#include "FGJSBBase.h" #include "FGRungeKutta.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -44,8 +45,8 @@ using std::endl; namespace JSBSim { -static const char *IdSrc = "$Id: FGRungeKutta.cpp,v 1.1 2010/06/02 04:05:13 jberndt Exp $"; -static const char *IdHdr = ID_RUNGEKUTTA; +IDENT(IdSrc,"$Id: FGRungeKutta.cpp,v 1.3 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_RUNGEKUTTA); const double FGRungeKutta::RealLimit = 1e30; diff --git a/src/FDM/JSBSim/math/FGTable.cpp b/src/FDM/JSBSim/math/FGTable.cpp index 2bc2b7499..8b951f86e 100644 --- a/src/FDM/JSBSim/math/FGTable.cpp +++ b/src/FDM/JSBSim/math/FGTable.cpp @@ -47,8 +47,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGTable.cpp,v 1.29 2013/01/26 17:06:49 bcoconni Exp $"; -static const char *IdHdr = ID_TABLE; +IDENT(IdSrc,"$Id: FGTable.cpp,v 1.31 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_TABLE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/FGAccelerations.cpp b/src/FDM/JSBSim/models/FGAccelerations.cpp index 605d1974f..bc5c71196 100644 --- a/src/FDM/JSBSim/models/FGAccelerations.cpp +++ b/src/FDM/JSBSim/models/FGAccelerations.cpp @@ -60,8 +60,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGAccelerations.cpp,v 1.14 2012/09/15 17:00:56 bcoconni Exp $"; -static const char *IdHdr = ID_ACCELERATIONS; +IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.19 2014/01/13 10:46:03 ehofman Exp $"); +IDENT(IdHdr,ID_ACCELERATIONS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -97,6 +97,8 @@ FGAccelerations::~FGAccelerations(void) bool FGAccelerations::InitModel(void) { + if (!FGModel::InitModel()) return false; + vPQRidot.InitMatrix(); vUVWidot.InitMatrix(); vGravAccel.InitMatrix(); @@ -364,6 +366,7 @@ void FGAccelerations::bind(void) PropertyManager->Tie("accelerations/vdot-ft_sec2", this, eV, (PMF)&FGAccelerations::GetUVWdot); PropertyManager->Tie("accelerations/wdot-ft_sec2", this, eW, (PMF)&FGAccelerations::GetUVWdot); + PropertyManager->Tie("accelerations/gravity-ft_sec2", this, &FGAccelerations::GetGravAccelMagnitude); PropertyManager->Tie("simulation/gravity-model", &gravType); PropertyManager->Tie("simulation/gravitational-torque", &gravTorque); diff --git a/src/FDM/JSBSim/models/FGAccelerations.h b/src/FDM/JSBSim/models/FGAccelerations.h index 0a83d55a8..2fd4386b3 100644 --- a/src/FDM/JSBSim/models/FGAccelerations.h +++ b/src/FDM/JSBSim/models/FGAccelerations.h @@ -50,7 +50,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.14 2012/09/25 12:44:36 jberndt Exp $" +#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.15 2013/11/29 18:56:30 jberndt Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -97,7 +97,7 @@ CLASS DOCUMENTATION NASA SP-8024, May 1969 @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier - @version $Id: FGAccelerations.h,v 1.14 2012/09/25 12:44:36 jberndt Exp $ + @version $Id: FGAccelerations.h,v 1.15 2013/11/29 18:56:30 jberndt Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -235,6 +235,8 @@ public: const FGColumnVector3& GetGravAccel(void) const {return vGravAccel; } + double GetGravAccelMagnitude(void) const { return vGravAccel.Magnitude(); } + /** Retrieves a component of the acceleration resulting from the applied forces. Retrieves a component of the ratio between the sum of all forces applied on the craft to its mass. The value returned is extracted from the vBodyAccel diff --git a/src/FDM/JSBSim/models/FGAerodynamics.cpp b/src/FDM/JSBSim/models/FGAerodynamics.cpp index 494fa41ca..9d97c937a 100644 --- a/src/FDM/JSBSim/models/FGAerodynamics.cpp +++ b/src/FDM/JSBSim/models/FGAerodynamics.cpp @@ -40,6 +40,7 @@ INCLUDES #include #include #include + #include "FGFDMExec.h" #include "FGAerodynamics.h" #include "input_output/FGPropertyManager.h" @@ -50,8 +51,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGAerodynamics.cpp,v 1.49 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_AERODYNAMICS; +IDENT(IdSrc,"$Id: FGAerodynamics.cpp,v 1.52 2014/01/13 10:46:04 ehofman Exp $"); +IDENT(IdHdr,ID_AERODYNAMICS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -130,7 +131,8 @@ bool FGAerodynamics::InitModel(void) bi2vel = ci2vel = 0.0; AeroRPShift = 0; vDeltaRP.InitMatrix(); - + vForces.InitMatrix(); + vMoments.InitMatrix(); return true; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/FGAircraft.cpp b/src/FDM/JSBSim/models/FGAircraft.cpp index fe46509df..0c7d90f5e 100644 --- a/src/FDM/JSBSim/models/FGAircraft.cpp +++ b/src/FDM/JSBSim/models/FGAircraft.cpp @@ -60,8 +60,8 @@ DEFINITIONS GLOBAL DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -static const char *IdSrc = "$Id: FGAircraft.cpp,v 1.35 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_AIRCRAFT; +IDENT(IdSrc,"$Id: FGAircraft.cpp,v 1.39 2014/01/13 10:46:04 ehofman Exp $"); +IDENT(IdHdr,ID_AIRCRAFT); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -95,6 +95,11 @@ FGAircraft::~FGAircraft() bool FGAircraft::InitModel(void) { + if (!FGModel::InitModel()) return false; + + vForces.InitMatrix(); + vMoments.InitMatrix(); + return true; } @@ -131,7 +136,7 @@ bool FGAircraft::Load(Element* el) string element_name; Element* element; - FGModel::Load(el); + if (!FGModel::Load(el)) return false; if (el->FindElement("wingarea")) WingArea = el->FindElementValueAsNumberConvertTo("wingarea", "FT2"); diff --git a/src/FDM/JSBSim/models/FGAtmosphere.cpp b/src/FDM/JSBSim/models/FGAtmosphere.cpp index 9ac2439fd..5ad8ad3b2 100644 --- a/src/FDM/JSBSim/models/FGAtmosphere.cpp +++ b/src/FDM/JSBSim/models/FGAtmosphere.cpp @@ -50,8 +50,8 @@ INCLUDES namespace JSBSim { -static const char *IdSrc = "$Id: FGAtmosphere.cpp,v 1.55 2013/01/26 17:06:49 bcoconni Exp $"; -static const char *IdHdr = ID_ATMOSPHERE; +IDENT(IdSrc,"$Id: FGAtmosphere.cpp,v 1.58 2014/01/13 10:46:04 ehofman Exp $"); +IDENT(IdHdr,ID_ATMOSPHERE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -80,6 +80,8 @@ FGAtmosphere::~FGAtmosphere() bool FGAtmosphere::InitModel(void) { + if (!FGModel::InitModel()) return false; + Calculate(0.0); SLtemperature = Temperature = 518.67; SLpressure = Pressure = 2116.22; diff --git a/src/FDM/JSBSim/models/FGAuxiliary.cpp b/src/FDM/JSBSim/models/FGAuxiliary.cpp old mode 100644 new mode 100755 index 492458d91..07133bcac --- a/src/FDM/JSBSim/models/FGAuxiliary.cpp +++ b/src/FDM/JSBSim/models/FGAuxiliary.cpp @@ -50,8 +50,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.62 2013/09/11 12:43:20 jberndt Exp $"; -static const char *IdHdr = ID_AUXILIARY; +IDENT(IdSrc,"$Id: FGAuxiliary.cpp,v 1.65 2014/01/13 10:46:06 ehofman Exp $"); +IDENT(IdHdr,ID_AUXILIARY); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -96,6 +96,8 @@ FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex) bool FGAuxiliary::InitModel(void) { + if (!FGModel::InitModel()) return false; + pt = in.Pressure; tat = in.Temperature; tatc = RankineToCelsius(tat); diff --git a/src/FDM/JSBSim/models/FGBuoyantForces.cpp b/src/FDM/JSBSim/models/FGBuoyantForces.cpp index 078acbd71..68c945adc 100644 --- a/src/FDM/JSBSim/models/FGBuoyantForces.cpp +++ b/src/FDM/JSBSim/models/FGBuoyantForces.cpp @@ -48,8 +48,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.22 2013/11/24 11:40:55 bcoconni Exp $"; -static const char *IdHdr = ID_BUOYANTFORCES; +IDENT(IdSrc,"$Id: FGBuoyantForces.cpp,v 1.26 2014/01/13 10:46:06 ehofman Exp $"); +IDENT(IdHdr,ID_BUOYANTFORCES); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -83,6 +83,11 @@ FGBuoyantForces::~FGBuoyantForces() bool FGBuoyantForces::InitModel(void) { + if (!FGModel::InitModel()) return false; + + vTotalForces.InitMatrix(); + vTotalMoments.InitMatrix(); + return true; } @@ -140,7 +145,7 @@ bool FGBuoyantForces::Load(Element *element) gas_cell_element = document->FindNextElement("gas_cell"); } - PostLoad(element, PropertyManager); + PostLoad(document, PropertyManager); if (!NoneDefined) { bind(); diff --git a/src/FDM/JSBSim/models/FGExternalForce.cpp b/src/FDM/JSBSim/models/FGExternalForce.cpp old mode 100644 new mode 100755 index 249325765..010b311b1 --- a/src/FDM/JSBSim/models/FGExternalForce.cpp +++ b/src/FDM/JSBSim/models/FGExternalForce.cpp @@ -60,8 +60,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.12 2012/12/23 14:56:58 bcoconni Exp $"; -static const char *IdHdr = ID_EXTERNALFORCE; +IDENT(IdSrc,"$Id: FGExternalForce.cpp,v 1.14 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_EXTERNALFORCE); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/FGExternalReactions.cpp b/src/FDM/JSBSim/models/FGExternalReactions.cpp index 730b79013..6e72838b6 100755 --- a/src/FDM/JSBSim/models/FGExternalReactions.cpp +++ b/src/FDM/JSBSim/models/FGExternalReactions.cpp @@ -55,8 +55,8 @@ DEFINITIONS GLOBAL DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -static const char *IdSrc = "$Id: FGExternalReactions.cpp,v 1.13 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_EXTERNALREACTIONS; +IDENT(IdSrc,"$Id: FGExternalReactions.cpp,v 1.17 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_EXTERNALREACTIONS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -119,6 +119,11 @@ FGExternalReactions::~FGExternalReactions() bool FGExternalReactions::InitModel(void) { + if (!FGModel::InitModel()) return false; + + vTotalForces.InitMatrix(); + vTotalMoments.InitMatrix(); + return true; } diff --git a/src/FDM/JSBSim/models/FGFCS.cpp b/src/FDM/JSBSim/models/FGFCS.cpp index 59deaafa2..fcb9a3f35 100644 --- a/src/FDM/JSBSim/models/FGFCS.cpp +++ b/src/FDM/JSBSim/models/FGFCS.cpp @@ -71,8 +71,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGFCS.cpp,v 1.83 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_FCS; +IDENT(IdSrc,"$Id: FGFCS.cpp,v 1.87 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_FCS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -124,6 +124,8 @@ FGFCS::~FGFCS() bool FGFCS::InitModel(void) { + if (!FGModel::InitModel()) return false; + unsigned int i; for (i=0; iFindElement("property"); - if (property_element && debug_lvl > 0) cout << endl << " Overriding properties" << endl << endl; - while (property_element) { - double value=0.0; - if ( ! property_element->GetAttributeValue("value").empty()) - value = property_element->GetAttributeValueAsNumber("value"); - - interface_property_string = property_element->GetDataLine(); - if (PropertyManager->HasNode(interface_property_string)) { - FGPropertyNode* node = PropertyManager->GetNode(interface_property_string); - if (debug_lvl > 0) - cout << " " << "Overriding value for property " << interface_property_string - << " (old value: " << node->getDoubleValue() << " new value: " << value << ")" << endl; - node->setDoubleValue(value); - } else { - interface_properties.push_back(new double(value)); - PropertyManager->Tie(interface_property_string, interface_properties.back()); - if (debug_lvl > 0) - cout << " " << interface_property_string << " (initial value: " << value << ")" << endl; - } - - property_element = el->FindNextElement("property"); - } - } + if (!fname.empty()) + LoadProperties(el, PropertyManager, true); channel_element = document->FindElement("channel"); diff --git a/src/FDM/JSBSim/models/FGFCSChannel.h b/src/FDM/JSBSim/models/FGFCSChannel.h index cb2686f0b..6d9b44085 100755 --- a/src/FDM/JSBSim/models/FGFCSChannel.h +++ b/src/FDM/JSBSim/models/FGFCSChannel.h @@ -44,7 +44,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.3 2013/09/27 19:44:45 jberndt Exp $" +#define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.4 2013/12/22 15:21:51 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -97,18 +97,8 @@ public: } /// Reset the components that can be reset void Reset() { - for (unsigned int i=0; iGetType() == "LAG" || - FCSComponents[i]->GetType() == "LEAD_LAG" || - FCSComponents[i]->GetType() == "WASHOUT" || - FCSComponents[i]->GetType() == "SECOND_ORDER_FILTER" || - FCSComponents[i]->GetType() == "INTEGRATOR") - { - ((FGFilter*)FCSComponents[i])->ResetPastStates(); - } else if (FCSComponents[i]->GetType() == "PID" ) { - ((FGPID*)FCSComponents[i])->ResetPastStates(); - } - } + for (unsigned int i=0; iResetPastStates(); } /// Executes all the components in a channel. void Execute() { diff --git a/src/FDM/JSBSim/models/FGGasCell.cpp b/src/FDM/JSBSim/models/FGGasCell.cpp index 77e547412..7a5626650 100644 --- a/src/FDM/JSBSim/models/FGGasCell.cpp +++ b/src/FDM/JSBSim/models/FGGasCell.cpp @@ -50,8 +50,8 @@ using std::max; namespace JSBSim { -static const char *IdSrc = "$Id: FGGasCell.cpp,v 1.18 2013/04/17 20:24:27 andgi Exp $"; -static const char *IdHdr = ID_GASCELL; +IDENT(IdSrc,"$Id: FGGasCell.cpp,v 1.20 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_GASCELL); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/FGGroundReactions.cpp b/src/FDM/JSBSim/models/FGGroundReactions.cpp index 1a0970af1..42a66f293 100644 --- a/src/FDM/JSBSim/models/FGGroundReactions.cpp +++ b/src/FDM/JSBSim/models/FGGroundReactions.cpp @@ -49,8 +49,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGGroundReactions.cpp,v 1.43 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_GROUNDREACTIONS; +IDENT(IdSrc,"$Id: FGGroundReactions.cpp,v 1.47 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_GROUNDREACTIONS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -79,6 +79,16 @@ FGGroundReactions::~FGGroundReactions(void) bool FGGroundReactions::InitModel(void) { + if (!FGModel::InitModel()) return false; + + vForces.InitMatrix(); + vMoments.InitMatrix(); + + multipliers.clear(); + + for (unsigned int i=0; iResetToIC(); + return true; } @@ -102,7 +112,7 @@ bool FGGroundReactions::Run(bool Holding) // Perhaps there is some commonality for things which only need to be // calculated once. for (unsigned int i=0; iGetBodyForces(); + vForces += lGear[i]->GetBodyForces(this); vMoments += lGear[i]->GetMoments(); } @@ -251,7 +261,6 @@ string FGGroundReactions::GetGroundReactionValues(string delimeter) const void FGGroundReactions::bind(void) { - typedef double (FGGroundReactions::*PMF)(int) const; PropertyManager->Tie("gear/num-units", this, &FGGroundReactions::GetNumGearUnits); PropertyManager->Tie("gear/wow", this, &FGGroundReactions::GetWOW); } diff --git a/src/FDM/JSBSim/models/FGGroundReactions.h b/src/FDM/JSBSim/models/FGGroundReactions.h index 0619a8771..339b1c5f8 100644 --- a/src/FDM/JSBSim/models/FGGroundReactions.h +++ b/src/FDM/JSBSim/models/FGGroundReactions.h @@ -40,11 +40,12 @@ INCLUDES #include +#include "FGSurface.h" #include "FGModel.h" #include "FGLGear.h" #include "math/FGColumnVector3.h" -#define ID_GROUNDREACTIONS "$Id: FGGroundReactions.h,v 1.27 2013/11/24 11:40:56 bcoconni Exp $" +#define ID_GROUNDREACTIONS "$Id: FGGroundReactions.h,v 1.28 2014/01/16 09:03:04 ehofman Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -77,7 +78,7 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -class FGGroundReactions : public FGModel +class FGGroundReactions : public FGModel, public FGSurface { public: FGGroundReactions(FGFDMExec*); diff --git a/src/FDM/JSBSim/models/FGInertial.cpp b/src/FDM/JSBSim/models/FGInertial.cpp index 42f2b7711..8a6aeec3f 100644 --- a/src/FDM/JSBSim/models/FGInertial.cpp +++ b/src/FDM/JSBSim/models/FGInertial.cpp @@ -43,8 +43,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGInertial.cpp,v 1.26 2011/12/11 17:03:05 bcoconni Exp $"; -static const char *IdHdr = ID_INERTIAL; +IDENT(IdSrc,"$Id: FGInertial.cpp,v 1.29 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_INERTIAL); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -95,7 +95,7 @@ FGInertial::~FGInertial(void) bool FGInertial::InitModel(void) { - return true; + return FGModel::InitModel(); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/FGInertial.h b/src/FDM/JSBSim/models/FGInertial.h index f4b5328cc..d283fc728 100644 --- a/src/FDM/JSBSim/models/FGInertial.h +++ b/src/FDM/JSBSim/models/FGInertial.h @@ -47,7 +47,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_INERTIAL "$Id: FGInertial.h,v 1.21 2012/11/23 21:42:29 bcoconni Exp $" +#define ID_INERTIAL "$Id: FGInertial.h,v 1.22 2013/11/30 21:22:08 jberndt Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -87,6 +87,10 @@ public: double gravity(void) const {return gAccel;} double omega(void) const {return RotationRate;} const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;} + void SetOmegaPlanet(double rate) { + RotationRate = rate; + vOmegaPlanet = FGColumnVector3( 0.0, 0.0, RotationRate ); + } double GetGAccel(double r) const; FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const; double GetRefRadius(void) const {return RadiusReference;} diff --git a/src/FDM/JSBSim/models/FGInput.cpp b/src/FDM/JSBSim/models/FGInput.cpp old mode 100644 new mode 100755 index d10ceacee..6b8c961ba --- a/src/FDM/JSBSim/models/FGInput.cpp +++ b/src/FDM/JSBSim/models/FGInput.cpp @@ -53,8 +53,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGInput.cpp,v 1.25 2013/01/26 17:06:50 bcoconni Exp $"; -static const char *IdHdr = ID_INPUT; +IDENT(IdSrc,"$Id: FGInput.cpp,v 1.28 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_INPUT); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -81,7 +81,7 @@ FGInput::~FGInput() bool FGInput::InitModel(void) { - return true; + return FGModel::InitModel(); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/FGLGear.cpp b/src/FDM/JSBSim/models/FGLGear.cpp index 3796bffe3..631d42c9e 100644 --- a/src/FDM/JSBSim/models/FGLGear.cpp +++ b/src/FDM/JSBSim/models/FGLGear.cpp @@ -62,8 +62,8 @@ DEFINITIONS GLOBAL DATA %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -static const char *IdSrc = "$Id: FGLGear.cpp,v 1.106 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_LGEAR; +IDENT(IdSrc,"$Id: FGLGear.cpp,v 1.111 2014/01/16 14:00:30 ehofman Exp $"); +IDENT(IdHdr,ID_LGEAR); // Body To Structural (body frame is rotated 180 deg about Y and lengths are given in // ft instead of inches) @@ -210,28 +210,12 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number, const struct Inputs& << sBrakeGroup << " is undefined." << endl; } - GearPos = 1.0; - useFCSGearPos = false; - // Add some AI here to determine if gear is located properly according to its // brake group type ?? - WOW = lastWOW = false; + useFCSGearPos = false; ReportEnable = true; - FirstContact = false; - StartedGroundRun = false; TakeoffReported = LandingReported = false; - LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0; - MaximumStrutForce = MaximumStrutTravel = 0.0; - SinkRate = GroundSpeed = 0.0; - - vWhlVelVec.InitMatrix(); - - compressLength = 0.0; - compressSpeed = 0.0; - maxCompLen = 0.0; - - WheelSlip = 0.0; // Set Pacejka terms @@ -240,8 +224,7 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number, const struct Inputs& Peak = staticFCoeff; Curvature = 1.03; - // Initialize Lagrange multipliers - memset(LMultiplier, 0, sizeof(LMultiplier)); + ResetToIC(); Debug(0); } @@ -257,7 +240,32 @@ FGLGear::~FGLGear() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -const FGColumnVector3& FGLGear::GetBodyForces(void) +void FGLGear::ResetToIC(void) +{ + GearPos = 1.0; + + WOW = lastWOW = false; + FirstContact = false; + StartedGroundRun = false; + LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0; + MaximumStrutForce = MaximumStrutTravel = 0.0; + SinkRate = GroundSpeed = 0.0; + + vWhlVelVec.InitMatrix(); + + compressLength = 0.0; + compressSpeed = 0.0; + maxCompLen = 0.0; + + WheelSlip = 0.0; + + // Initialize Lagrange multipliers + memset(LMultiplier, 0, sizeof(LMultiplier)); +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +const FGColumnVector3& FGLGear::GetBodyForces(FGSurface *surface) { double gearPos = 1.0; double t = fdmex->GetSimTime(); @@ -278,8 +286,17 @@ const FGColumnVector3& FGLGear::GetBodyForces(void) // not compressed) with respect to the ground level double height = gearLoc.GetContactPoint(t, contact, normal, terrainVel, dummy); + double maxForce = DBL_MAX; + bool isSolid = true; + if (surface) { + height -= (*surface).GetBumpHeight(); + frictionFactor = (*surface).GetFrictionFactor(); + maxForce = (*surface).GetMaximumForce(); + isSolid = (*surface).GetSolid(); + } + if (height < 0.0) { - WOW = true; + WOW = isSolid; vGroundNormal = in.Tec2b * normal; // The height returned by GetGroundCallback() is the AGL and is expressed @@ -294,8 +311,14 @@ const FGColumnVector3& FGLGear::GetBodyForces(void) // including the strut compression. switch(eContactType) { case ctBOGEY: - compressLength = LGearProj > 0.0 ? height * normalZ / LGearProj : 0.0; - vWhlDisplVec = mTGear * FGColumnVector3(0., 0., -compressLength); + if (isSolid) { + compressLength = LGearProj > 0.0 ? height * normalZ / LGearProj : 0.0; + vWhlDisplVec = mTGear * FGColumnVector3(0., 0., -compressLength); + } else { + // Gears don't (or hardly) compress is liquids + compressLength = 0.0; + vWhlDisplVec = 0.0 * vGroundNormal; + } break; case ctSTRUCTURE: compressLength = height * normalZ / DotProduct(normal, normal); @@ -308,7 +331,13 @@ const FGColumnVector3& FGLGear::GetBodyForces(void) FGColumnVector3 vBodyWhlVel = in.PQR * vWhlContactVec; vBodyWhlVel += in.UVW - in.Tec2b * terrainVel; - vWhlVelVec = mTGear.Transposed() * vBodyWhlVel; + if (isSolid) { + vWhlVelVec = mTGear.Transposed() * vBodyWhlVel; + } else { + // wheels don't spin up in liquids: let wheel spin down slowly + vWhlVelVec(eX) -= 13.0 * in.TotalDeltaT; + if (vWhlVelVec(eX) < 0.0) vWhlVelVec(eX) = 0.0; + } InitializeReporting(); ComputeSteeringAngle(); @@ -324,7 +353,7 @@ const FGColumnVector3& FGLGear::GetBodyForces(void) compressSpeed /= LGearProj; } - ComputeVerticalStrutForce(); + ComputeVerticalStrutForce(maxForce); // Compute the friction coefficients in the wheel ground plane. if (eContactType == ctBOGEY) { @@ -546,10 +575,10 @@ void FGLGear::CrashDetect(void) void FGLGear::ComputeBrakeForceCoefficient(void) { - BrakeFCoeff = rollingFCoeff; + BrakeFCoeff = frictionFactor * rollingFCoeff; if (eBrakeGrp != bgNone) - BrakeFCoeff += in.BrakePos[eBrakeGrp] * (staticFCoeff - rollingFCoeff); + BrakeFCoeff += in.BrakePos[eBrakeGrp] * frictionFactor * (staticFCoeff - rollingFCoeff); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -570,6 +599,7 @@ void FGLGear::ComputeSideForceCoefficient(void) double StiffSlip = Stiffness*WheelSlip; FCoeff = Peak * sin(Shape*atan(StiffSlip - Curvature*(StiffSlip - atan(StiffSlip)))); } + FCoeff *= frictionFactor; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -579,7 +609,7 @@ void FGLGear::ComputeSideForceCoefficient(void) // possibly give a "rebound damping factor" that differs from the compression // case. -void FGLGear::ComputeVerticalStrutForce(void) +void FGLGear::ComputeVerticalStrutForce(double maxForce) { double springForce = 0; double dampForce = 0; @@ -606,6 +636,10 @@ void FGLGear::ComputeVerticalStrutForce(void) } StrutForce = min(springForce + dampForce, (double)0.0); + if (StrutForce > maxForce) { + StrutForce = maxForce; + compressLength = -StrutForce / kSpring; + } } // The reaction force of the wheel is always normal to the ground @@ -657,7 +691,7 @@ void FGLGear::ComputeJacobian(const FGColumnVector3& vWhlContactVec) LMultiplier[ftDynamic].ForceJacobian = mT * velocityDirection; LMultiplier[ftDynamic].MomentJacobian = vWhlContactVec * LMultiplier[ftDynamic].ForceJacobian; LMultiplier[ftDynamic].Max = 0.; - LMultiplier[ftDynamic].Min = -fabs(dynamicFCoeff * vFn(eZ)); + LMultiplier[ftDynamic].Min = -fabs(frictionFactor * dynamicFCoeff * vFn(eZ)); // The Lagrange multiplier value obtained from the previous iteration is kept // This is supposed to accelerate the convergence of the projected Gauss-Seidel diff --git a/src/FDM/JSBSim/models/FGLGear.h b/src/FDM/JSBSim/models/FGLGear.h index 45844e424..791a6a30a 100644 --- a/src/FDM/JSBSim/models/FGLGear.h +++ b/src/FDM/JSBSim/models/FGLGear.h @@ -43,12 +43,13 @@ INCLUDES #include "models/propulsion/FGForce.h" #include "math/FGColumnVector3.h" #include "math/LagrangeMultiplier.h" +#include "FGSurface.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_LGEAR "$Id: FGLGear.h,v 1.58 2013/11/15 22:43:01 bcoconni Exp $" +#define ID_LGEAR "$Id: FGLGear.h,v 1.61 2014/01/16 14:00:42 ehofman Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -177,7 +178,7 @@ CLASS DOCUMENTATION @endcode @author Jon S. Berndt - @version $Id: FGLGear.h,v 1.58 2013/11/15 22:43:01 bcoconni Exp $ + @version $Id: FGLGear.h,v 1.61 2014/01/16 14:00:42 ehofman Exp $ @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at NASA-Ames", NASA CR-2497, January 1975 @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics", @@ -190,7 +191,7 @@ CLASS DOCUMENTATION CLASS DECLARATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -class FGLGear : public FGForce +class FGLGear : public FGForce, protected FGSurface { public: struct Inputs { @@ -237,7 +238,7 @@ public: ~FGLGear(); /// The Force vector for this gear - const FGColumnVector3& GetBodyForces(void); + const FGColumnVector3& GetBodyForces(FGSurface *surface = NULL); /// Gets the location of the gear in Body axes FGColumnVector3 GetBodyLocation(void) const { @@ -315,6 +316,7 @@ public: const struct Inputs& in; + void ResetToIC(void); void bind(void); private: @@ -332,7 +334,6 @@ private: double bDampRebound; double compressLength; double compressSpeed; - double staticFCoeff, dynamicFCoeff, rollingFCoeff; double Stiffness, Shape, Peak, Curvature; // Pacejka factors double BrakeFCoeff; double maxCompLen; @@ -376,7 +377,7 @@ private: void ComputeSteeringAngle(void); void ComputeSlipAngle(void); void ComputeSideForceCoefficient(void); - void ComputeVerticalStrutForce(void); + void ComputeVerticalStrutForce(double maxForce = DBL_MAX); void ComputeGroundFrame(void); void ComputeJacobian(const FGColumnVector3& vWhlContactVec); void UpdateForces(void); diff --git a/src/FDM/JSBSim/models/FGMassBalance.cpp b/src/FDM/JSBSim/models/FGMassBalance.cpp index 0226cabd4..3d24d1b3b 100644 --- a/src/FDM/JSBSim/models/FGMassBalance.cpp +++ b/src/FDM/JSBSim/models/FGMassBalance.cpp @@ -41,6 +41,7 @@ INCLUDES #include #include #include + #include "FGMassBalance.h" #include "FGFDMExec.h" #include "input_output/FGPropertyManager.h" @@ -51,8 +52,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.43 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_MASSBALANCE; +IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.47 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_MASSBALANCE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -92,6 +93,8 @@ FGMassBalance::~FGMassBalance() bool FGMassBalance::InitModel(void) { + if (!FGModel::InitModel()) return false; + vLastXYZcg.InitMatrix(0.0); vDeltaXYZcg.InitMatrix(0.0); diff --git a/src/FDM/JSBSim/models/FGModel.cpp b/src/FDM/JSBSim/models/FGModel.cpp index 79f0cc9e4..d3b6c1387 100644 --- a/src/FDM/JSBSim/models/FGModel.cpp +++ b/src/FDM/JSBSim/models/FGModel.cpp @@ -46,8 +46,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGModel.cpp,v 1.21 2013/01/14 22:44:52 bcoconni Exp $"; -static const char *IdHdr = ID_MODEL; +IDENT(IdSrc,"$Id: FGModel.cpp,v 1.24 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_MODEL); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GLOBAL DECLARATIONS @@ -84,7 +84,7 @@ FGModel::~FGModel() bool FGModel::InitModel(void) { exe_ctr = 1; - return true; + return FGModelFunctions::InitModel(); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/FGOutput.cpp b/src/FDM/JSBSim/models/FGOutput.cpp index 159362181..668011d36 100644 --- a/src/FDM/JSBSim/models/FGOutput.cpp +++ b/src/FDM/JSBSim/models/FGOutput.cpp @@ -51,8 +51,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGOutput.cpp,v 1.74 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_OUTPUT; +IDENT(IdSrc,"$Id: FGOutput.cpp,v 1.77 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_OUTPUT); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -86,6 +86,8 @@ bool FGOutput::InitModel(void) { bool ret = false; + if (!FGModel::InitModel()) return false; + vector::iterator it; for (it = OutputTypes.begin(); it != OutputTypes.end(); ++it) ret &= (*it)->InitModel(); diff --git a/src/FDM/JSBSim/models/FGPropagate.cpp b/src/FDM/JSBSim/models/FGPropagate.cpp index 12efa827a..6564df5e4 100644 --- a/src/FDM/JSBSim/models/FGPropagate.cpp +++ b/src/FDM/JSBSim/models/FGPropagate.cpp @@ -78,8 +78,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.119 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_PROPAGATE; +IDENT(IdSrc,"$Id: FGPropagate.cpp,v 1.123 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_PROPAGATE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -120,6 +120,8 @@ FGPropagate::~FGPropagate(void) bool FGPropagate::InitModel(void) { + if (!FGModel::InitModel()) return false; + // For initialization ONLY: VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor); VState.vLocation.SetAltitudeAGL(4.0, FDMExec->GetSimTime()); @@ -719,6 +721,10 @@ void FGPropagate::bind(void) PropertyManager->Tie("velocities/qi-rad_sec", this, eQ, (PMF)&FGPropagate::GetPQRi); PropertyManager->Tie("velocities/ri-rad_sec", this, eR, (PMF)&FGPropagate::GetPQRi); + PropertyManager->Tie("velocities/eci-x-fps", this, eX, (PMF)&FGPropagate::GetInertialVelocity); + PropertyManager->Tie("velocities/eci-y-fps", this, eY, (PMF)&FGPropagate::GetInertialVelocity); + PropertyManager->Tie("velocities/eci-z-fps", this, eZ, (PMF)&FGPropagate::GetInertialVelocity); + PropertyManager->Tie("velocities/eci-velocity-mag-fps", this, &FGPropagate::GetInertialVelocityMagnitude); PropertyManager->Tie("velocities/ned-velocity-mag-fps", this, &FGPropagate::GetNEDVelocityMagnitude); @@ -739,6 +745,14 @@ void FGPropagate::bind(void) &FGPropagate::GetTerrainElevation, &FGPropagate::SetTerrainElevation, false); + PropertyManager->Tie("position/eci-x-ft", this, eX, (PMF)&FGPropagate::GetInertialPosition); + PropertyManager->Tie("position/eci-y-ft", this, eY, (PMF)&FGPropagate::GetInertialPosition); + PropertyManager->Tie("position/eci-z-ft", this, eZ, (PMF)&FGPropagate::GetInertialPosition); + + PropertyManager->Tie("position/ecef-x-ft", this, eX, (PMF)&FGPropagate::GetLocation); + PropertyManager->Tie("position/ecef-y-ft", this, eY, (PMF)&FGPropagate::GetLocation); + PropertyManager->Tie("position/ecef-z-ft", this, eZ, (PMF)&FGPropagate::GetLocation); + PropertyManager->Tie("position/epa-rad", this, &FGPropagate::GetEarthPositionAngle); PropertyManager->Tie("metrics/terrain-radius", this, &FGPropagate::GetLocalTerrainRadius); diff --git a/src/FDM/JSBSim/models/FGPropagate.h b/src/FDM/JSBSim/models/FGPropagate.h index 5d4acf868..f0f012928 100644 --- a/src/FDM/JSBSim/models/FGPropagate.h +++ b/src/FDM/JSBSim/models/FGPropagate.h @@ -49,7 +49,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.78 2013/09/14 11:26:04 bcoconni Exp $" +#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.80 2013/12/22 17:08:59 jberndt Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -93,7 +93,7 @@ CLASS DOCUMENTATION @endcode @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier - @version $Id: FGPropagate.h,v 1.78 2013/09/14 11:26:04 bcoconni Exp $ + @version $Id: FGPropagate.h,v 1.80 2013/12/22 17:08:59 jberndt Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -301,10 +301,12 @@ public: /** Retrieves the inertial velocity vector in ft/sec. */ const FGColumnVector3& GetInertialVelocity(void) const { return VState.vInertialVelocity; } + double GetInertialVelocity(int i) const { return VState.vInertialVelocity(i); } /** Retrieves the inertial position vector. */ const FGColumnVector3& GetInertialPosition(void) const { return VState.vInertialPosition; } + double GetInertialPosition(int i) const { return VState.vInertialPosition(i); } /** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame. */ @@ -440,6 +442,7 @@ public: double GetLongitudeDeg(void) const { return VState.vLocation.GetLongitudeDeg(); } double GetLatitudeDeg(void) const { return VState.vLocation.GetLatitudeDeg(); } const FGLocation& GetLocation(void) const { return VState.vLocation; } + double GetLocation(int i) const { return VState.vLocation(i); } /** Retrieves the local-to-body transformation matrix. The quaternion class, being the means by which the orientation of the @@ -596,7 +599,6 @@ private: struct VehicleState VState; FGColumnVector3 vVel; - FGColumnVector3 vLocation; FGMatrix33 Tec2b; FGMatrix33 Tb2ec; FGMatrix33 Tl2b; // local to body frame matrix copy for immediate local use diff --git a/src/FDM/JSBSim/models/FGPropulsion.cpp b/src/FDM/JSBSim/models/FGPropulsion.cpp index 8066846d6..580653a62 100644 --- a/src/FDM/JSBSim/models/FGPropulsion.cpp +++ b/src/FDM/JSBSim/models/FGPropulsion.cpp @@ -67,8 +67,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.71 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_PROPULSION; +IDENT(IdSrc,"$Id: FGPropulsion.cpp,v 1.76 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_PROPULSION); extern short debug_lvl; @@ -119,12 +119,17 @@ bool FGPropulsion::InitModel(void) { bool result = true; + if (!FGModel::InitModel()) return false; + + vForces.InitMatrix(); + vMoments.InitMatrix(); + for (unsigned int i=0; iResetToIC(); for (unsigned int i=0; iGetType()) { case FGEngine::etPiston: - ((FGPiston*)Engines[i])->ResetToIC(); + Engines[i]->ResetToIC(); try { if (HasInitializedEngines && (InitializedEngines & i)) InitRunning(i); } catch (string str) { @@ -133,7 +138,7 @@ bool FGPropulsion::InitModel(void) } break; case FGEngine::etTurbine: - ((FGTurbine*)Engines[i])->ResetToIC(); + Engines[i]->ResetToIC(); try { if (HasInitializedEngines && (InitializedEngines & i)) InitRunning(i); } catch (string str) { diff --git a/src/FDM/JSBSim/models/FGSurface.cpp b/src/FDM/JSBSim/models/FGSurface.cpp new file mode 100644 index 000000000..70a89fcf6 --- /dev/null +++ b/src/FDM/JSBSim/models/FGSurface.cpp @@ -0,0 +1,137 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Module: FGSurface.cpp + Author: Erik Hofman + Date started: 01/15/14 + Purpose: Base class for all surface properties + Called by: GroundReactions + + ------------- Copyright (C) 2014 Jon S. Berndt (jon@jsbsim.org) ------------- + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA. + + Further information about the GNU Lesser General Public License can also be found on + the world wide web at http://www.gnu.org. + +FUNCTIONAL DESCRIPTION +-------------------------------------------------------------------------------- +This base class for the GroundReactions class defines methoed and holds data +for all surface types. + +HISTORY +-------------------------------------------------------------------------------- +01/15/14 EMH Created + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +INCLUDES +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#include "FGSurface.h" + +using namespace std; + +namespace JSBSim { + +IDENT(IdSrc,"$Id: FGSurface.cpp,v 1.2 2014/01/16 12:31:50 ehofman Exp $"); +IDENT(IdHdr,ID_SURFACE); + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +GLOBAL DECLARATIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CLASS IMPLEMENTATION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +FGSurface::FGSurface() +{ + frictionFactor = 1.0; + rollingFCoeff = 0.02; + MaximumForce = DBL_MAX; + bumpiness = 0.0; + isSolid = true; +} + +FGSurface::FGSurface(FGFDMExec* fdmex = NULL) +{ + frictionFactor = 1.0; + rollingFCoeff = 0.02; + MaximumForce = DBL_MAX; + bumpiness = 0.0; + isSolid = true; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +FGSurface::~FGSurface() +{ +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +float FGSurface::GetBumpHeight() +{ + if (bumpiness < 0.001) return 0.0f; + + double x = pos[0]*0.1; + double y = pos[1]*0.1; + x -= floor(x); + y -= floor(y); + x *= 2*M_PI; + y *= 2*M_PI; + //now x and y are in the range of 0..2pi + //we need a function, that is periodically on 2pi and gives some + //height. This is not very fast, but for a beginning. + //maybe this should be done by interpolating between some precalculated + //values + static const float maxGroundBumpAmplitude=0.4; + float h = sin(x)+sin(7*x)+sin(8*x)+sin(13*x); + h += sin(2*y)+sin(5*y)+sin(9*y*x)+sin(17*y); + + return h*(1/8.)*bumpiness*maxGroundBumpAmplitude; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +string FGSurface::GetSurfaceStrings(string delimeter) const +{ + std::ostringstream buf; + + buf << "FrictionFactor" << delimeter + << "RollingFriction" << delimeter + << "MaximumForce" << delimeter + << "Bumpiness" << delimeter + << "IsSolid"; + + return buf.str(); +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +string FGSurface::GetSurfaceValues(string delimeter) const +{ + std::ostringstream buf; + + buf << GetFrictionFactor() << delimeter + << GetRollingFriction() << delimeter + << GetMaximumForce() << delimeter + << GetBumpiness() << delimeter + << (GetSolid() ? "1" : "0"); + + return buf.str(); +} + +} + diff --git a/src/FDM/JSBSim/models/FGSurface.h b/src/FDM/JSBSim/models/FGSurface.h new file mode 100644 index 000000000..232c59c62 --- /dev/null +++ b/src/FDM/JSBSim/models/FGSurface.h @@ -0,0 +1,138 @@ +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + Header: FGSurface.h + Author: Erik Hofman + Date started: 01/15/14 + + ------------- Copyright (C) 2014 Jon S. Berndt (jon@jsbsim.org) ------------- + + This program is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any later + version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License along with + this program; if not, write to the Free Software Foundation, Inc., 59 Temple + Place - Suite 330, Boston, MA 02111-1307, USA. + + Further information about the GNU Lesser General Public License can also be found on + the world wide web at http://www.gnu.org. + +HISTORY +-------------------------------------------------------------------------------- +01/15/14 EMH Created + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +SENTRY +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#ifndef FGSURFACE_H +#define FGSURFACE_H + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +INCLUDES +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#include "FGFDMExec.h" + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +DEFINITIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +#define ID_SURFACE "$Id: FGSurface.h,v 1.2 2014/01/16 12:31:50 ehofman Exp $" + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +FORWARD DECLARATIONS +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +namespace JSBSim { + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CLASS DOCUMENTATION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +/** Base class for all surface properties + @author Erik M. Hofman + */ + +/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +CLASS DECLARATION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ + +class FGSurface +{ +public: + + /// Constructor + FGSurface(); + + /// Constructor + FGSurface(FGFDMExec* fdmex); + /// Destructor + ~FGSurface(); + + /// Sets the friction factor of the surface area + void SetFrictionFactor(double friction) { frictionFactor = friction; } + + /// Sets the load capacity of the surface area + void SetMaximumForce(double force ) { MaximumForce = force; } + + /// Sets the bumpiness factor associated with the surface + void SetBumpiness(double bump) { bumpiness = bump; } + + /// Sets the surface is a solid flag value + void SetSolid(bool solid) { isSolid = solid; } + + /// Set the currect position for bumpiness calulcation + void SetPosition(const double pt[3]) { + pos[0] = pt[0]; pos[1] = pt[1]; pos[2] = pt[2]; + } + + + /// Gets the friction factor of the surface area + double GetFrictionFactor(void) const { return frictionFactor; } + + /// Gets the rolling friction of the surface area + double GetRollingFriction(void) const { return rollingFCoeff; } + + /// Gets the static friction of the surface area + double GetStaticFriction(void) const { return staticFCoeff; } + + /// Gets the dynamic friction of the surface area + double GetDynamicFriction(void) const { return dynamicFCoeff; } + + /// Gets the maximum force for this surface point + double GetMaximumForce(void) const { return MaximumForce; } + + /// Gets the bumpiness factor associated with the surface + double GetBumpiness(void) const { return bumpiness; } + + /// Gets the surface is a solid flag value + bool GetSolid(void) const { return isSolid; } + + /// Returns the height of the bump at the provided offset + float GetBumpHeight(); + + std::string GetSurfaceStrings(std::string delimeter) const; + std::string GetSurfaceValues(std::string delimeter) const; + +protected: + double staticFCoeff, dynamicFCoeff, rollingFCoeff; + double frictionFactor; + double MaximumForce; + double bumpiness; + bool isSolid; + +private: + double pos[3]; +}; + +} +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +#endif + diff --git a/src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp b/src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp old mode 100644 new mode 100755 index 562b08d64..38ff4f833 --- a/src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp +++ b/src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp @@ -66,8 +66,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGMSIS.cpp,v 1.19 2011/12/11 17:03:05 bcoconni Exp $"; -static const char *IdHdr = ID_MSIS; +IDENT(IdSrc,"$Id: FGMSIS.cpp,v 1.24 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_MSIS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EXTERNAL GLOBAL DATA @@ -464,7 +464,7 @@ void MSIS::spline (double *x, double *y, int n, double yp1, double ypn, double * for (k=n-2;k>=0;k--) y2[k] = y2[k] * y2[k+1] + u[k]; - delete u; + delete[] u; } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -739,9 +739,7 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input, * Upper Thermosphere Parameters */ double t[15]; int i,j; - int sw9=1; double apd; - double xlong; double tloc; double c, s, c2, c4, s2; double sr = 7.2722E-5; @@ -749,7 +747,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input, double dr = 1.72142E-2; double hr = 0.2618; double cd32, cd18, cd14, cd39; - double p32, p18, p14, p39; double df; double f1, f2; double tinf; @@ -758,11 +755,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input, tloc=input->lst; for (j=0;j<14;j++) t[j]=0; - if (flags->sw[9]>0) - sw9=1; - else if (flags->sw[9]<0) - sw9=-1; - xlong = input->g_long; /* calculate legendre polynomials */ c = sin(input->g_lat * dgtr); @@ -810,10 +802,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input, cd18 = cos(2.0*dr*(input->doy-p[17])); cd14 = cos(dr*(input->doy-p[13])); cd39 = cos(2.0*dr*(input->doy-p[38])); - p32=p[31]; - p18=p[17]; - p14=p[13]; - p39=p[38]; /* F10.7 EFFECT */ df = input->f107 - input->f107A; @@ -971,7 +959,6 @@ double MSIS::glob7s(double *p, struct nrlmsise_input *input, double t[14] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,}; double tt=0.0; double cd32=0.0, cd18=0.0, cd14=0.0, cd39=0.0; - double p32=0.0, p18=0.0, p14=0.0, p39=0.0; int i=0,j=0; double dr=1.72142E-2; double dgtr=1.74533E-2; @@ -988,10 +975,6 @@ double MSIS::glob7s(double *p, struct nrlmsise_input *input, cd18 = cos(2.0*dr*(input->doy-p[17])); cd14 = cos(dr*(input->doy-p[13])); cd39 = cos(2.0*dr*(input->doy-p[38])); - p32=p[31]; - p18=p[17]; - p14=p[13]; - p39=p[38]; /* F10.7 */ t[0] = p[21]*dfa; @@ -1295,14 +1278,14 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, */ double za=0.0; int i, j; - double ddum=0.0, z=0.0; + double z=0.0; double zn1[5] = {120.0, 110.0, 100.0, 90.0, 72.5}; double tinf=0.0; int mn1 = 5; double g0=0.0; double tlb=0.0; - double s=0.0, z0=0.0, t0=0.0, tr12=0.0; - double db01=0.0, db04=0.0, db14=0.0, db16=0.0, db28=0.0, db32=0.0, db40=0.0, db48=0.0; + double s=0.0; + double db01=0.0, db04=0.0, db14=0.0, db16=0.0, db28=0.0, db32=0.0, db40=0.0; double zh28=0.0, zh04=0.0, zh16=0.0, zh32=0.0, zh40=0.0, zh01=0.0, zh14=0.0; double zhm28=0.0, zhm04=0.0, zhm16=0.0, zhm32=0.0, zhm40=0.0, zhm01=0.0, zhm14=0.0; double xmd=0.0; @@ -1361,10 +1344,6 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, meso_tgn1[1]=ptm[8]*pma[8][0]*meso_tn1[4]*meso_tn1[4]/(pow((ptm[4]*ptl[3][0]),2.0)); } - z0 = zn1[3]; - t0 = meso_tn1[3]; - tr12 = 1.0; - /* N2 variation factor at Zlb */ g28=flags->sw[21]*globe7(pd[2], input, flags); @@ -1601,13 +1580,12 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags, /* total mass density */ output->d[5] = 1.66E-24*(4.0*output->d[0]+16.0*output->d[1]+28.0*output->d[2]+32.0*output->d[3]+40.0*output->d[4]+ output->d[6]+14.0*output->d[7]); - db48=1.66E-24*(4.0*db04+16.0*db16+28.0*db28+32.0*db32+40.0*db40+db01+14.0*db14); /* temperature */ z = sqrt(input->alt*input->alt); - ddum = densu(z,1.0, tinf, tlb, 0.0, 0.0, &output->t[1], ptm[5], s, mn1, zn1, meso_tn1, meso_tgn1); + densu(z,1.0, tinf, tlb, 0.0, 0.0, &output->t[1], ptm[5], s, mn1, zn1, meso_tn1, meso_tgn1); if (flags->sw[0]) { for(i=0;i<9;i++) output->d[i]=output->d[i]*1.0E6; diff --git a/src/FDM/JSBSim/models/atmosphere/FGMars.cpp b/src/FDM/JSBSim/models/atmosphere/FGMars.cpp old mode 100644 new mode 100755 index 28673d3c8..8bc320fd9 --- a/src/FDM/JSBSim/models/atmosphere/FGMars.cpp +++ b/src/FDM/JSBSim/models/atmosphere/FGMars.cpp @@ -48,8 +48,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGMars.cpp,v 1.11 2011/06/21 13:54:40 jberndt Exp $"; -static const char *IdHdr = ID_MARS; +IDENT(IdSrc,"$Id: FGMars.cpp,v 1.13 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_MARS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp b/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp index 86f648859..664b3274a 100644 --- a/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp +++ b/src/FDM/JSBSim/models/atmosphere/FGStandardAtmosphere.cpp @@ -50,8 +50,8 @@ INCLUDES namespace JSBSim { -static const char *IdSrc = "$Id: FGStandardAtmosphere.cpp,v 1.21 2012/04/13 13:18:27 jberndt Exp $"; -static const char *IdHdr = ID_STANDARDATMOSPHERE; +IDENT(IdSrc,"$Id: FGStandardAtmosphere.cpp,v 1.23 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_STANDARDATMOSPHERE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp b/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp index ef732c514..18237ce7a 100644 --- a/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp +++ b/src/FDM/JSBSim/models/atmosphere/FGWinds.cpp @@ -51,8 +51,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGWinds.cpp,v 1.8 2012/12/02 12:59:19 bcoconni Exp $"; -static const char *IdHdr = ID_WINDS; +IDENT(IdSrc,"$Id: FGWinds.cpp,v 1.11 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_WINDS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -120,7 +120,7 @@ FGWinds::~FGWinds() bool FGWinds::InitModel(void) { - return true; + return FGModel::InitModel(); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp b/src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp index e4113aa6f..11f39835f 100755 --- a/src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGAccelerometer.cpp @@ -51,8 +51,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGAccelerometer.cpp,v 1.12 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_ACCELEROMETER; +IDENT(IdSrc,"$Id: FGAccelerometer.cpp,v 1.15 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_ACCELEROMETER); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -65,7 +65,6 @@ FGAccelerometer::FGAccelerometer(FGFCS* fcs, Element* element) Propagate = fcs->GetExec()->GetPropagate(); Accelerations = fcs->GetExec()->GetAccelerations(); MassBalance = fcs->GetExec()->GetMassBalance(); - Inertial = fcs->GetExec()->GetInertial(); Element* location_element = element->FindElement("location"); if (location_element) vLocation = location_element->FindElementTripletConvertTo("IN"); diff --git a/src/FDM/JSBSim/models/flight_control/FGAccelerometer.h b/src/FDM/JSBSim/models/flight_control/FGAccelerometer.h index 70aabd3fc..7b59bc152 100755 --- a/src/FDM/JSBSim/models/flight_control/FGAccelerometer.h +++ b/src/FDM/JSBSim/models/flight_control/FGAccelerometer.h @@ -39,14 +39,13 @@ INCLUDES #include "FGSensor.h" #include "math/FGColumnVector3.h" -#include "math/FGMatrix33.h" #include "FGSensorOrientation.h" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_ACCELEROMETER "$Id: FGAccelerometer.h,v 1.7 2013/11/24 11:40:56 bcoconni Exp $" +#define ID_ACCELEROMETER "$Id: FGAccelerometer.h,v 1.8 2013/12/07 12:21:14 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -57,7 +56,6 @@ namespace JSBSim { class FGFCS; class FGPropagate; class FGAccelerations; -class FGInertial; class FGMassBalance; /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -119,14 +117,14 @@ The only required element in the accelerometer definition is the input element. case, no degradation would be modeled, and the output would simply be the input. For noise, if the type is PERCENT, then the value supplied is understood to be a -percentage variance. That is, if the number given is 0.05, the the variance is +percentage variance. That is, if the number given is 0.05, the variance is understood to be +/-0.05 percent maximum variance. So, the actual value for the accelerometer will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time - even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta time. @author Jon S. Berndt -@version $Revision: 1.7 $ +@version $Revision: 1.8 $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -145,7 +143,6 @@ private: FGPropagate* Propagate; FGAccelerations* Accelerations; FGMassBalance* MassBalance; - FGInertial* Inertial; FGColumnVector3 vLocation; FGColumnVector3 vRadius; FGColumnVector3 vAccel; diff --git a/src/FDM/JSBSim/models/flight_control/FGActuator.cpp b/src/FDM/JSBSim/models/flight_control/FGActuator.cpp index 1be3971b4..e917e3aca 100644 --- a/src/FDM/JSBSim/models/flight_control/FGActuator.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGActuator.cpp @@ -44,8 +44,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGActuator.cpp,v 1.29 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_ACTUATOR; +IDENT(IdSrc,"$Id: FGActuator.cpp,v 1.32 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_ACTUATOR); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -138,6 +138,16 @@ FGActuator::~FGActuator() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGActuator::ResetPastStates(void) +{ + FGFCSComponent::ResetPastStates(); + + PreviousOutput = PreviousHystOutput = PreviousRateLimOutput + = PreviousLagInput = PreviousLagOutput = Output = 0.0; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + bool FGActuator::Run(void ) { Input = InputNodes[0]->getDoubleValue() * InputSigns[0]; diff --git a/src/FDM/JSBSim/models/flight_control/FGActuator.h b/src/FDM/JSBSim/models/flight_control/FGActuator.h index 6c3fff546..d131d7ab9 100644 --- a/src/FDM/JSBSim/models/flight_control/FGActuator.h +++ b/src/FDM/JSBSim/models/flight_control/FGActuator.h @@ -43,7 +43,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_ACTUATOR "$Id: FGActuator.h,v 1.16 2013/11/24 11:40:56 bcoconni Exp $" +#define ID_ACTUATOR "$Id: FGActuator.h,v 1.18 2014/01/02 21:58:42 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -119,7 +119,7 @@ Example: @endcode @author Jon S. Berndt -@version $Revision: 1.16 $ +@version $Revision: 1.18 $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -138,6 +138,7 @@ public: It calls private functions if needed to perform the hysteresis, lag, limiting, etc. functions. */ bool Run (void); + void ResetPastStates(void); // these may need to have the bool argument replaced with a double /** This function fails the actuator to zero. The motion to zero diff --git a/src/FDM/JSBSim/models/flight_control/FGAngles.cpp b/src/FDM/JSBSim/models/flight_control/FGAngles.cpp index fea7f68a3..4c17a07a6 100755 --- a/src/FDM/JSBSim/models/flight_control/FGAngles.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGAngles.cpp @@ -74,8 +74,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGAngles.cpp,v 1.2 2013/09/27 19:36:28 jberndt Exp $"; -static const char *IdHdr = ID_ANGLES; +IDENT(IdSrc,"$Id: FGAngles.cpp,v 1.4 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_ANGLES); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGDeadBand.cpp b/src/FDM/JSBSim/models/flight_control/FGDeadBand.cpp index 5507ecfd3..6fa9d3bef 100644 --- a/src/FDM/JSBSim/models/flight_control/FGDeadBand.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGDeadBand.cpp @@ -46,8 +46,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGDeadBand.cpp,v 1.12 2012/11/17 18:03:19 jberndt Exp $"; -static const char *IdHdr = ID_DEADBAND; +IDENT(IdSrc,"$Id: FGDeadBand.cpp,v 1.14 2014/01/13 10:46:07 ehofman Exp $"); +IDENT(IdHdr,ID_DEADBAND); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGDistributor.cpp b/src/FDM/JSBSim/models/flight_control/FGDistributor.cpp index da16ddbf3..a78a3dbd3 100755 --- a/src/FDM/JSBSim/models/flight_control/FGDistributor.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGDistributor.cpp @@ -48,8 +48,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGDistributor.cpp,v 1.3 2013/11/24 11:40:56 bcoconni Exp $"; -static const char *IdHdr = ID_DISTRIBUTOR; +IDENT(IdSrc,"$Id: FGDistributor.cpp,v 1.5 2014/01/13 10:46:08 ehofman Exp $"); +IDENT(IdHdr,ID_DISTRIBUTOR); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGFCSComponent.cpp b/src/FDM/JSBSim/models/flight_control/FGFCSComponent.cpp index 630f5cb8c..39d586972 100644 --- a/src/FDM/JSBSim/models/flight_control/FGFCSComponent.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGFCSComponent.cpp @@ -48,8 +48,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.37 2013/09/27 19:38:36 jberndt Exp $"; -static const char *IdHdr = ID_FCSCOMPONENT; +IDENT(IdSrc,"$Id: FGFCSComponent.cpp,v 1.40 2014/01/13 10:46:08 ehofman Exp $"); +IDENT(IdHdr,ID_FCSCOMPONENT); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -236,6 +236,15 @@ FGFCSComponent::~FGFCSComponent() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGFCSComponent::ResetPastStates(void) +{ + index = 0; + for (unsigned int i = 0; i < output_array.size(); ++i) + output_array[i] = 0.0; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + void FGFCSComponent::SetOutput(void) { for (unsigned int i=0; isetDoubleValue(Output); diff --git a/src/FDM/JSBSim/models/flight_control/FGFCSComponent.h b/src/FDM/JSBSim/models/flight_control/FGFCSComponent.h index 77b014095..7ccaebf26 100644 --- a/src/FDM/JSBSim/models/flight_control/FGFCSComponent.h +++ b/src/FDM/JSBSim/models/flight_control/FGFCSComponent.h @@ -46,7 +46,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.23 2013/09/27 19:38:44 jberndt Exp $" +#define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.25 2014/01/02 21:58:42 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -82,7 +82,7 @@ CLASS DOCUMENTATION - FGAngle @author Jon S. Berndt - @version $Id: FGFCSComponent.h,v 1.23 2013/09/27 19:38:44 jberndt Exp $ + @version $Id: FGFCSComponent.h,v 1.25 2014/01/02 21:58:42 bcoconni Exp $ @see Documentation for the FGFCS class, and for the configuration file class */ @@ -104,6 +104,7 @@ public: std::string GetName(void) const {return Name;} std::string GetType(void) const { return Type; } virtual double GetOutputPct(void) const { return 0; } + virtual void ResetPastStates(void); protected: FGFCS* fcs; diff --git a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp index 6d21a055f..118267c05 100755 --- a/src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGFCSFunction.cpp @@ -47,8 +47,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGFCSFunction.cpp,v 1.13 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_FCSFUNCTION; +IDENT(IdSrc,"$Id: FGFCSFunction.cpp,v 1.15 2014/01/13 10:46:08 ehofman Exp $"); +IDENT(IdHdr,ID_FCSFUNCTION); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGFilter.cpp b/src/FDM/JSBSim/models/flight_control/FGFilter.cpp index 54739e837..906068896 100644 --- a/src/FDM/JSBSim/models/flight_control/FGFilter.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGFilter.cpp @@ -48,8 +48,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGFilter.cpp,v 1.15 2009/10/24 22:59:30 jberndt Exp $"; -static const char *IdHdr = ID_FILTER; +IDENT(IdSrc,"$Id: FGFilter.cpp,v 1.20 2014/01/13 10:46:09 ehofman Exp $"); +IDENT(IdHdr,ID_FILTER); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -96,6 +96,15 @@ FGFilter::~FGFilter() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGFilter::ResetPastStates(void) +{ + FGFCSComponent::ResetPastStates(); + + Input = 0.0; Initialize = true; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + void FGFilter::ReadFilterCoefficients(Element* element, int index) { // index is known to be 1-7. diff --git a/src/FDM/JSBSim/models/flight_control/FGFilter.h b/src/FDM/JSBSim/models/flight_control/FGFilter.h index 4211ccc72..b899126d3 100644 --- a/src/FDM/JSBSim/models/flight_control/FGFilter.h +++ b/src/FDM/JSBSim/models/flight_control/FGFilter.h @@ -43,7 +43,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_FILTER "$Id: FGFilter.h,v 1.13 2013/01/26 17:06:50 bcoconni Exp $" +#define ID_FILTER "$Id: FGFilter.h,v 1.14 2014/01/02 21:58:42 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -228,7 +228,7 @@ is so that the last component in a "string" can copy its value to the appropriat output, such as the elevator, or speedbrake, etc. @author Jon S. Berndt -@version $Revision: 1.13 $ +@version $Revision: 1.14 $ */ @@ -247,7 +247,7 @@ public: /** When true, causes previous values to be set to current values. This is particularly useful for first pass. */ bool Initialize; - void ResetPastStates(void) {Input = 0.0; Initialize = true;} + void ResetPastStates(void); enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType; diff --git a/src/FDM/JSBSim/models/flight_control/FGGain.cpp b/src/FDM/JSBSim/models/flight_control/FGGain.cpp index fb864e06b..0a2cad21d 100644 --- a/src/FDM/JSBSim/models/flight_control/FGGain.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGGain.cpp @@ -47,8 +47,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGGain.cpp,v 1.23 2011/04/18 08:51:12 andgi Exp $"; -static const char *IdHdr = ID_GAIN; +IDENT(IdSrc,"$Id: FGGain.cpp,v 1.25 2014/01/13 10:46:09 ehofman Exp $"); +IDENT(IdHdr,ID_GAIN); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGGyro.cpp b/src/FDM/JSBSim/models/flight_control/FGGyro.cpp index cc5ce5360..ceaafef32 100755 --- a/src/FDM/JSBSim/models/flight_control/FGGyro.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGGyro.cpp @@ -47,8 +47,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGGyro.cpp,v 1.8 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_GYRO; +IDENT(IdSrc,"$Id: FGGyro.cpp,v 1.10 2014/01/13 10:46:09 ehofman Exp $"); +IDENT(IdHdr,ID_GYRO); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGKinemat.cpp b/src/FDM/JSBSim/models/flight_control/FGKinemat.cpp index 4a597f7b4..56bdecd24 100644 --- a/src/FDM/JSBSim/models/flight_control/FGKinemat.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGKinemat.cpp @@ -46,8 +46,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGKinemat.cpp,v 1.10 2009/10/24 22:59:30 jberndt Exp $"; -static const char *IdHdr = ID_FLAPS; +IDENT(IdSrc,"$Id: FGKinemat.cpp,v 1.14 2014/01/13 10:46:09 ehofman Exp $"); +IDENT(IdHdr,ID_FLAPS); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp b/src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp index 8eefb8ce8..eeb2b1c1c 100755 --- a/src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGMagnetometer.cpp @@ -49,8 +49,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGMagnetometer.cpp,v 1.7 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_MAGNETOMETER; +IDENT(IdSrc,"$Id: FGMagnetometer.cpp,v 1.9 2014/01/13 10:46:09 ehofman Exp $"); +IDENT(IdHdr,ID_MAGNETOMETER); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGPID.cpp b/src/FDM/JSBSim/models/flight_control/FGPID.cpp old mode 100644 new mode 100755 index 95efe6039..20bd629da --- a/src/FDM/JSBSim/models/flight_control/FGPID.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGPID.cpp @@ -44,8 +44,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGPID.cpp,v 1.21 2013/02/02 06:05:26 jberndt Exp $"; -static const char *IdHdr = ID_PID; +IDENT(IdSrc,"$Id: FGPID.cpp,v 1.24 2014/01/13 10:46:09 ehofman Exp $"); +IDENT(IdHdr,ID_PID); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -156,6 +156,15 @@ FGPID::~FGPID() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGPID::ResetPastStates(void) +{ + FGFCSComponent::ResetPastStates(); + + Input_prev = Input_prev2 = Output = I_out_total = 0.0; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + bool FGPID::Run(void ) { double I_out_delta = 0.0; diff --git a/src/FDM/JSBSim/models/flight_control/FGPID.h b/src/FDM/JSBSim/models/flight_control/FGPID.h old mode 100644 new mode 100755 index 6069d3b52..6961859bf --- a/src/FDM/JSBSim/models/flight_control/FGPID.h +++ b/src/FDM/JSBSim/models/flight_control/FGPID.h @@ -44,7 +44,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_PID "$Id: FGPID.h,v 1.15 2013/02/02 06:05:26 jberndt Exp $" +#define ID_PID "$Id: FGPID.h,v 1.16 2014/01/02 21:58:42 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -116,7 +116,7 @@ For example, @author Jon S. Berndt - @version $Revision: 1.15 $ + @version $Revision: 1.16 $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -130,7 +130,7 @@ public: ~FGPID(); bool Run (void); - void ResetPastStates(void) {Input_prev = Input_prev2 = Output = I_out_total = 0.0;} + void ResetPastStates(void); /// These define the indices use to select the various integrators. enum eIntegrateType {eNone = 0, eRectEuler, eTrapezoidal, eAdamsBashforth2, eAdamsBashforth3}; diff --git a/src/FDM/JSBSim/models/flight_control/FGSensor.cpp b/src/FDM/JSBSim/models/flight_control/FGSensor.cpp old mode 100644 new mode 100755 index 9aedc65b0..93187953a --- a/src/FDM/JSBSim/models/flight_control/FGSensor.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGSensor.cpp @@ -46,8 +46,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGSensor.cpp,v 1.24 2012/11/17 18:03:19 jberndt Exp $"; -static const char *IdHdr = ID_SENSOR; +IDENT(IdSrc,"$Id: FGSensor.cpp,v 1.27 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_SENSOR); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -137,6 +137,15 @@ FGSensor::~FGSensor() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGSensor::ResetPastStates(void) +{ + FGFCSComponent::ResetPastStates(); + + PreviousOutput = PreviousInput = Output = 0.0; +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + bool FGSensor::Run(void) { Input = InputNodes[0]->getDoubleValue() * InputSigns[0]; diff --git a/src/FDM/JSBSim/models/flight_control/FGSensor.h b/src/FDM/JSBSim/models/flight_control/FGSensor.h old mode 100644 new mode 100755 index be0eea212..a183c2525 --- a/src/FDM/JSBSim/models/flight_control/FGSensor.h +++ b/src/FDM/JSBSim/models/flight_control/FGSensor.h @@ -44,7 +44,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_SENSOR "$Id: FGSensor.h,v 1.22 2013/06/10 01:59:16 jberndt Exp $" +#define ID_SENSOR "$Id: FGSensor.h,v 1.24 2014/01/02 21:58:42 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -124,7 +124,7 @@ The delay element can specify a frame delay. The integer number provided is the number of frames to delay the output signal. @author Jon S. Berndt -@version $Revision: 1.22 $ +@version $Revision: 1.24 $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -147,6 +147,7 @@ public: int GetQuantized(void) const {return quantized;} virtual bool Run (void); + void ResetPastStates(void); protected: enum eNoiseType {ePercent=0, eAbsolute} NoiseType; diff --git a/src/FDM/JSBSim/models/flight_control/FGSummer.cpp b/src/FDM/JSBSim/models/flight_control/FGSummer.cpp index b67cbf70d..37d7dffff 100644 --- a/src/FDM/JSBSim/models/flight_control/FGSummer.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGSummer.cpp @@ -45,8 +45,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGSummer.cpp,v 1.8 2010/08/21 22:56:11 jberndt Exp $"; -static const char *IdHdr = ID_SUMMER; +IDENT(IdSrc,"$Id: FGSummer.cpp,v 1.10 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_SUMMER); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGSwitch.cpp b/src/FDM/JSBSim/models/flight_control/FGSwitch.cpp index 4d91a30d8..0ca9d07dc 100644 --- a/src/FDM/JSBSim/models/flight_control/FGSwitch.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGSwitch.cpp @@ -70,8 +70,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGSwitch.cpp,v 1.27 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_SWITCH; +IDENT(IdSrc,"$Id: FGSwitch.cpp,v 1.29 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_SWITCH); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/flight_control/FGWaypoint.cpp b/src/FDM/JSBSim/models/flight_control/FGWaypoint.cpp index 35f398746..5f4d62397 100755 --- a/src/FDM/JSBSim/models/flight_control/FGWaypoint.cpp +++ b/src/FDM/JSBSim/models/flight_control/FGWaypoint.cpp @@ -45,8 +45,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGWaypoint.cpp,v 1.2 2013/08/30 04:44:59 jberndt Exp $"; -static const char *IdHdr = ID_WAYPOINT; +IDENT(IdSrc,"$Id: FGWaypoint.cpp,v 1.5 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_WAYPOINT); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGElectric.cpp b/src/FDM/JSBSim/models/propulsion/FGElectric.cpp index 088a41993..b211981d6 100644 --- a/src/FDM/JSBSim/models/propulsion/FGElectric.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGElectric.cpp @@ -50,8 +50,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGElectric.cpp,v 1.14 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_ELECTRIC; +IDENT(IdSrc,"$Id: FGElectric.cpp,v 1.16 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_ELECTRIC); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGElectric.h b/src/FDM/JSBSim/models/propulsion/FGElectric.h index cfbdf1678..fc4b064df 100644 --- a/src/FDM/JSBSim/models/propulsion/FGElectric.h +++ b/src/FDM/JSBSim/models/propulsion/FGElectric.h @@ -44,7 +44,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_ELECTRIC "$Id: FGElectric.h,v 1.12 2013/11/24 11:40:57 bcoconni Exp $"; +#define ID_ELECTRIC "$Id: FGElectric.h,v 1.12 2013/11/24 11:40:57 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS diff --git a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp index 62917a7bc..75f07bd3e 100644 --- a/src/FDM/JSBSim/models/propulsion/FGEngine.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGEngine.cpp @@ -54,8 +54,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGEngine.cpp,v 1.54 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_ENGINE; +IDENT(IdSrc,"$Id: FGEngine.cpp,v 1.57 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_ENGINE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -76,8 +76,6 @@ FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number, MaxThrottle = 1.0; MinThrottle = 0.0; - ResetToIC(); // initialize dynamic terms - FDMExec = exec; PropertyManager = FDMExec->GetPropertyManager(); @@ -112,6 +110,8 @@ FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number, cerr << "No thruster definition supplied with engine definition." << endl; } + ResetToIC(); // initialize dynamic terms + // Load feed tank[s] references local_element = engine_element->GetParent()->FindElement("feed"); while (local_element) { @@ -160,6 +160,7 @@ void FGEngine::ResetToIC(void) FuelFlowRate = 0.0; FuelFreeze = false; FuelUsedLbs = 0.0; + Thruster->ResetToIC(); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/propulsion/FGEngine.h b/src/FDM/JSBSim/models/propulsion/FGEngine.h index a27583395..942a6b4fa 100644 --- a/src/FDM/JSBSim/models/propulsion/FGEngine.h +++ b/src/FDM/JSBSim/models/propulsion/FGEngine.h @@ -53,7 +53,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_ENGINE "$Id: FGEngine.h,v 1.38 2013/11/24 11:40:57 bcoconni Exp $" +#define ID_ENGINE "$Id: FGEngine.h,v 1.39 2013/12/22 17:14:37 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -111,7 +111,7 @@ CLASS DOCUMENTATION documentation for engine and thruster classes. @author Jon S. Berndt - @version $Id: FGEngine.h,v 1.38 2013/11/24 11:40:57 bcoconni Exp $ + @version $Id: FGEngine.h,v 1.39 2013/12/22 17:14:37 bcoconni Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -184,7 +184,7 @@ public: virtual int InitRunning(void){ return 1; } /** Resets the Engine parameters to the initial conditions */ - void ResetToIC(void); + virtual void ResetToIC(void); /** Calculates the thrust of the engine, and other engine functions. */ virtual void Calculate(void) = 0; diff --git a/src/FDM/JSBSim/models/propulsion/FGForce.cpp b/src/FDM/JSBSim/models/propulsion/FGForce.cpp index 787e184a1..a579f7773 100644 --- a/src/FDM/JSBSim/models/propulsion/FGForce.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGForce.cpp @@ -53,8 +53,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGForce.cpp,v 1.17 2011/10/31 14:54:41 bcoconni Exp $"; -static const char *IdHdr = ID_FORCE; +IDENT(IdSrc,"$Id: FGForce.cpp,v 1.19 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_FORCE); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/propulsion/FGNozzle.cpp b/src/FDM/JSBSim/models/propulsion/FGNozzle.cpp index c9616e1a2..4a1171b9a 100644 --- a/src/FDM/JSBSim/models/propulsion/FGNozzle.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGNozzle.cpp @@ -46,8 +46,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGNozzle.cpp,v 1.15 2012/03/18 15:48:35 jentron Exp $"; -static const char *IdHdr = ID_NOZZLE; +IDENT(IdSrc,"$Id: FGNozzle.cpp,v 1.17 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_NOZZLE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGNozzle.h b/src/FDM/JSBSim/models/propulsion/FGNozzle.h index 68f5d28f1..2ef6e851f 100644 --- a/src/FDM/JSBSim/models/propulsion/FGNozzle.h +++ b/src/FDM/JSBSim/models/propulsion/FGNozzle.h @@ -44,7 +44,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_NOZZLE "$Id: FGNozzle.h,v 1.10 2012/03/18 15:48:36 jentron Exp $"; +#define ID_NOZZLE "$Id: FGNozzle.h,v 1.10 2012/03/18 15:48:36 jentron Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS diff --git a/src/FDM/JSBSim/models/propulsion/FGPiston.cpp b/src/FDM/JSBSim/models/propulsion/FGPiston.cpp index 10e43820e..48e723728 100644 --- a/src/FDM/JSBSim/models/propulsion/FGPiston.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGPiston.cpp @@ -51,8 +51,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGPiston.cpp,v 1.72 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_PISTON; +IDENT(IdSrc,"$Id: FGPiston.cpp,v 1.74 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_PISTON); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGPiston.h b/src/FDM/JSBSim/models/propulsion/FGPiston.h index 8c56ace3d..3f3ae8900 100644 --- a/src/FDM/JSBSim/models/propulsion/FGPiston.h +++ b/src/FDM/JSBSim/models/propulsion/FGPiston.h @@ -46,7 +46,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_PISTON "$Id: FGPiston.h,v 1.35 2012/04/07 01:50:54 jentron Exp $"; +#define ID_PISTON "$Id: FGPiston.h,v 1.35 2012/04/07 01:50:54 jentron Exp $" #define FG_MAX_BOOST_SPEEDS 3 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp index 9d341ef82..33066c74b 100644 --- a/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGPropeller.cpp @@ -45,8 +45,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.46 2013/01/06 22:11:42 jentron Exp $"; -static const char *IdHdr = ID_PROPELLER; +IDENT(IdSrc,"$Id: FGPropeller.cpp,v 1.48 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_PROPELLER); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGRocket.cpp b/src/FDM/JSBSim/models/propulsion/FGRocket.cpp index 6d4123ab3..c7310b734 100644 --- a/src/FDM/JSBSim/models/propulsion/FGRocket.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGRocket.cpp @@ -49,8 +49,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGRocket.cpp,v 1.31 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_ROCKET; +IDENT(IdSrc,"$Id: FGRocket.cpp,v 1.33 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_ROCKET); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGRotor.cpp b/src/FDM/JSBSim/models/propulsion/FGRotor.cpp index 977c96726..2c6141330 100644 --- a/src/FDM/JSBSim/models/propulsion/FGRotor.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGRotor.cpp @@ -57,8 +57,8 @@ using std::ostringstream; namespace JSBSim { -static const char *IdSrc = "$Id: FGRotor.cpp,v 1.21 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_ROTOR; +IDENT(IdSrc,"$Id: FGRotor.cpp,v 1.23 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_ROTOR); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% MISC diff --git a/src/FDM/JSBSim/models/propulsion/FGTank.cpp b/src/FDM/JSBSim/models/propulsion/FGTank.cpp index c59be5c92..95829d3c4 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTank.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTank.cpp @@ -47,8 +47,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGTank.cpp,v 1.37 2013/06/10 02:04:12 jberndt Exp $"; -static const char *IdHdr = ID_TANK; +IDENT(IdSrc,"$Id: FGTank.cpp,v 1.39 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_TANK); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGThruster.cpp b/src/FDM/JSBSim/models/propulsion/FGThruster.cpp index 7bd53efb9..516f1b4e0 100644 --- a/src/FDM/JSBSim/models/propulsion/FGThruster.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGThruster.cpp @@ -45,8 +45,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGThruster.cpp,v 1.18 2013/01/12 21:11:59 jberndt Exp $"; -static const char *IdHdr = ID_THRUSTER; +IDENT(IdSrc,"$Id: FGThruster.cpp,v 1.21 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_THRUSTER); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION @@ -65,8 +65,6 @@ FGThruster::FGThruster(FGFDMExec *FDMExec, Element *el, int num ): FGForce(FDMEx Name = el->GetAttributeValue("name"); GearRatio = 1.0; - ReverserAngle = 0.0; - Thrust = 0.0; EngineNum = num; PropertyManager = FDMExec->GetPropertyManager(); @@ -95,25 +93,26 @@ FGThruster::FGThruster(FGFDMExec *FDMExec, Element *el, int num ): FGForce(FDMEx } else { - element = thruster_element->FindElement("orient"); - if (element) orientation = element->FindElementTripletConvertTo("RAD"); - - SetAnglesToBody(orientation); - property_name = base_property_name + "/pitch-angle-rad"; - PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetPitch, &FGForce::SetPitch); - property_name = base_property_name + "/yaw-angle-rad"; - PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetYaw, &FGForce::SetYaw); - - if (el->GetName() == "direct") // this is a direct thruster. At this time - // only a direct thruster can be reversed. - { - property_name = base_property_name + "/reverser-angle-rad"; - PropertyManager->Tie( property_name.c_str(), (FGThruster *)this, &FGThruster::GetReverserAngle, - &FGThruster::SetReverserAngle); - } + element = thruster_element->FindElement("orient"); + if (element) orientation = element->FindElementTripletConvertTo("RAD"); + + SetAnglesToBody(orientation); + property_name = base_property_name + "/pitch-angle-rad"; + PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetPitch, &FGForce::SetPitch); + property_name = base_property_name + "/yaw-angle-rad"; + PropertyManager->Tie( property_name.c_str(), (FGForce *)this, &FGForce::GetYaw, &FGForce::SetYaw); + + if (el->GetName() == "direct") // this is a direct thruster. At this time + // only a direct thruster can be reversed. + { + property_name = base_property_name + "/reverser-angle-rad"; + PropertyManager->Tie( property_name.c_str(), (FGThruster *)this, &FGThruster::GetReverserAngle, + &FGThruster::SetReverserAngle); + } } + ResetToIC(); Debug(0); } @@ -127,6 +126,15 @@ FGThruster::~FGThruster() //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +void FGThruster::ResetToIC(void) +{ + ReverserAngle = 0.0; + Thrust = 0.0; + SetActingLocation(vXYZn); +} + +//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + string FGThruster::GetThrusterLabels(int id, const string& delimeter) { std::ostringstream buf; diff --git a/src/FDM/JSBSim/models/propulsion/FGThruster.h b/src/FDM/JSBSim/models/propulsion/FGThruster.h index b783d4060..0ac1dafe6 100644 --- a/src/FDM/JSBSim/models/propulsion/FGThruster.h +++ b/src/FDM/JSBSim/models/propulsion/FGThruster.h @@ -46,7 +46,7 @@ INCLUDES DEFINITIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ -#define ID_THRUSTER "$Id: FGThruster.h,v 1.20 2012/03/18 15:48:36 jentron Exp $" +#define ID_THRUSTER "$Id: FGThruster.h,v 1.22 2013/12/22 17:14:37 bcoconni Exp $" /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FORWARD DECLARATIONS @@ -74,7 +74,7 @@ CLASS DOCUMENTATION 1.57 (pi/2) results in no thrust at all. @author Jon Berndt - @version $Id: FGThruster.h,v 1.20 2012/03/18 15:48:36 jentron Exp $ + @version $Id: FGThruster.h,v 1.22 2013/12/22 17:14:37 bcoconni Exp $ */ /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -112,6 +112,8 @@ public: virtual std::string GetThrusterLabels(int id, const std::string& delimeter); virtual std::string GetThrusterValues(int id, const std::string& delimeter); + virtual void ResetToIC(void); + struct Inputs { double TotalDeltaT; double H_agl; diff --git a/src/FDM/JSBSim/models/propulsion/FGTransmission.cpp b/src/FDM/JSBSim/models/propulsion/FGTransmission.cpp index a887dcd3e..6822b22a9 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTransmission.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTransmission.cpp @@ -48,8 +48,8 @@ using std::endl; namespace JSBSim { -static const char *IdSrc = "$Id: FGTransmission.cpp,v 1.2 2013/11/15 22:43:03 bcoconni Exp $"; -static const char *IdHdr = ID_TRANSMISSION; +IDENT(IdSrc,"$Id: FGTransmission.cpp,v 1.4 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_TRANSMISSION); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp b/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp index d48439103..6ab51091d 100644 --- a/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp @@ -50,8 +50,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.38 2013/11/24 11:40:57 bcoconni Exp $"; -static const char *IdHdr = ID_TURBINE; +IDENT(IdSrc,"$Id: FGTurbine.cpp,v 1.40 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_TURBINE); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION diff --git a/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp b/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp index fa3109c66..f19205545 100755 --- a/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp +++ b/src/FDM/JSBSim/models/propulsion/FGTurboProp.cpp @@ -54,8 +54,8 @@ using namespace std; namespace JSBSim { -static const char *IdSrc = "$Id: FGTurboProp.cpp,v 1.26 2013/11/24 14:22:22 bcoconni Exp $"; -static const char *IdHdr = ID_TURBOPROP; +IDENT(IdSrc,"$Id: FGTurboProp.cpp,v 1.28 2014/01/13 10:46:10 ehofman Exp $"); +IDENT(IdHdr,ID_TURBOPROP); /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CLASS IMPLEMENTATION