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
models/FGExternalReactions.h
models/FGFCS.h
models/FGGasCell.h
+ models/FGSurface.h
models/FGGroundReactions.h
models/FGInertial.h
models/FGInput.h
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
models/FGExternalReactions.cpp
models/FGFCS.cpp
models/FGGasCell.cpp
+ models/FGSurface.cpp
models/FGGroundReactions.cpp
models/FGInertial.cpp
models/FGInput.cpp
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
holding = false;
Terminate = false;
StandAlone = false;
+ ResetMode = 0;
IncrementThenHolding = false; // increment then hold is off by default
TimeStepsUntilHold = -1;
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);
Models[i]->Run(holding);
}
+ if (ResetMode) {
+ if (ResetMode == 1) Output->SetStartNewOutput();
+
+ ResetMode = 0;
+ ResetToInitialConditions();
+ }
+
if (Terminate) success = false;
- return (success);
+ return success;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
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);
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);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Models[i]->InitModel();
}
- RunIC();
-
if (Script) Script->ResetEvents();
+
+ RunIC();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
property actually maps toa function call of DoTrim().
@author Jon S. Berndt
- @version $Revision: 1.85 $
+ @version $Revision: 1.86 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool trim_status;
int ta_mode;
+ unsigned int ResetMode;
FGScript* Script;
FGInitialCondition* IC;
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);
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
#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
* 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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#include <simgear/math/sg_geodesy.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/structure/commands.hxx>
+#include <simgear/bvh/BVHMaterial.hxx>
#include <FDM/flight.hxx>
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;
}
#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"
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);
//******************************************************************************
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) {
{
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
//
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;
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();
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
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);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fdmex->DisableOutput();
- fdmex->RunIC();
fdmex->SetTrimStatus(true);
+ fdmex->RunIC();
fdmex->SuspendIntegration();
fgic->SetPRadpsIC(0.0);
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++){
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);
/*****************************************************************************/
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);
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
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
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
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
if(!FGOutputFile::Load(el))
return false;
- PreLoad(el, PropertyManager);
+// PreLoad(el, PropertyManager);
string type = el->GetAttributeValue("type");
string delim;
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;
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;
--- /dev/null
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ 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<FGPropertyNode_ptr, double>::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
+}
+}
--- /dev/null
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ 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 <list>
+#include <map>
+
+#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<double> interface_properties;
+ std::map<SGSharedPtr<FGPropertyNode>, double> interface_prop_initial_value;
+};
+}
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+#endif
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
{
unsigned int i, j;
- for (i=0; i<local_properties.size(); i++) {
- delete local_properties[i]->value;
- delete local_properties[i];
- }
- local_properties.clear();
-
for (i=0; i<Events.size(); i++) {
delete Events[i].Condition;
for (j=0; j<Events[i].Functions.size(); j++)
Element *element=0, *run_element=0, *event_element=0;
Element *condition_element=0, *set_element=0, *delay_element=0;
Element *notify_element = 0L, *notify_property_element = 0L;
- Element *property_element = 0L;
Element *output_element = 0L;
Element *input_element = 0L;
bool result = false;
}
// Read local property/value declarations
- property_element = run_element->FindElement("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
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+void FGScript::ResetEvents(void)
+{
+ //ResetToIC();
+
+ for (unsigned int i=0; i<Events.size(); i++)
+ Events[i].reset();
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
bool FGScript::RunScript(void)
{
unsigned i, j;
ceil(1.0/FDMExec->GetDeltaT()) << " Hz)" << endl;
cout << endl;
- for (unsigned int i=0; i<local_properties.size(); i++) {
- cout << "Local property: " << local_properties[i]->title
- << " = " << PropertyManager->GetNode(local_properties[i]->title)->getDoubleValue()
+ map<FGPropertyNode_ptr, double>::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<Events.size(); i++) {
cout << "Event " << i;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <vector>
+#include <map>
#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
comes the "run" section, where the conditions are
described in "event" clauses.</p>
@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
@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.size(); i++) Events[i].reset();
- }
+ void ResetEvents(void);
private:
enum eAction {
}
};
- struct LocalProps {
- double *value;
- std::string title;
- LocalProps(double initial_value=0) {
- value = new double(initial_value);
- title = "";
- }
- };
-
std::string ScriptName;
double StartTime;
double EndTime;
std::vector <struct event> Events;
- std::vector <LocalProps*> local_properties;
FGFDMExec* FDMExec;
FGPropertyManager* PropertyManager;
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 <string, map <string, double> > Element::convert;
convert["KG/L"]["KG/L"] = 1.0;
convert["LBS/GAL"]["LBS/GAL"] = 1.0;
}
- attribute_key.resize(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for (unsigned int i=0; i<children.size(); i++) delete children[i];
data_lines.clear();
attributes.clear();
- attribute_key.clear();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool Element::HasAttribute(const string& attr)
{
- bool status=true;
- int select=-1;
+ map<string, string>::iterator found = attributes.find(attr);
- unsigned int attr_cnt = attribute_key.size();
-
- for (unsigned int i=0; i<attr_cnt; i++) {
- if (attribute_key[i] == attr) select = i;
- }
- if (select < 0) status=false;
- return status;
+ return found != attributes.end();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
string attribute = GetAttributeValue(attr);
- if (attribute.empty()) return HUGE_VAL;
+ if (attribute.empty()) {
+ cerr << ReadFrom() << "Expecting numeric attribute value, but got no data"
+ << endl;
+ exit(-1);
+ }
else {
double number=0;
if (is_number(trim(attribute)))
return number;
} else if (data_lines.size() == 0) {
- return HUGE_VAL;
+ cerr << ReadFrom() << "Expected numeric value, but got no data" << endl;
+ exit(-1);
} else {
- cerr << ReadFrom() << "Attempting to get single data value from multiple lines in element "
- << name << endl;
- return HUGE_VAL;
+ cerr << ReadFrom() << "Attempting to get single data value in element "
+ << "<" << name << ">" << endl
+ << " from multiple lines:" << endl;
+ for(unsigned int i=0; i<data_lines.size(); ++i)
+ cerr << data_lines[i] << endl;
+ exit(-1);
}
}
level+=2;
for (spaces=0; spaces<=level; spaces++) cout << " "; // format output
cout << "Element Name: " << name;
- for (i=0; i<attributes.size(); i++) {
- cout << " " << attribute_key[i] << " = " << attributes[attribute_key[i]];
- }
+
+ map<string, string>::iterator it;
+ for (it = attributes.begin(); it != attributes.end(); ++it)
+ cout << " " << it->first << " = " << it->second;
+
cout << endl;
for (i=0; i<data_lines.size(); i++) {
for (spaces=0; spaces<=level; spaces++) cout << " "; // format output
void Element::AddAttribute(const string& name, const string& value)
{
- attribute_key.push_back(name);
attributes[name] = value;
}
#include <map>
#include <vector>
+#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
- 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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
std::map <std::string, std::string> attributes;
std::vector <std::string> data_lines;
std::vector <Element*> children;
- std::vector <std::string> attribute_key;
Element *parent;
unsigned int element_index;
std::string file_name;
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
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)
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
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
#include <vector>
#include <stdio.h>
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
string to_string(float x)
{
- std::ostringstream o;\r
- if (!(o << x)) cerr << "Bad float to string conversion" << endl;\r
- return o.str();\r
+ std::ostringstream o;
+ if (!(o << x)) cerr << "Bad float to string conversion" << endl;
+ return o.str();
}
string to_string(double x)
{
- std::ostringstream o;\r
- if (!(o << x)) cerr << "Bad double to string conversion" << endl;\r
- return o.str();\r
+ 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)
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+#include "FGJSBBase.h"
#include "FGColumnVector3.h"
#include <iostream>
#include <sstream>
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
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
/** 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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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.
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
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
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;
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
#include <sstream>
#include <string>
#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
FGModelFunctions::~FGModelFunctions()
{
- for (unsigned int i=0; i<interface_properties.size(); i++) delete interface_properties[i];
- interface_properties.clear();
-
for (unsigned int i=0; i<PreFunctions.size(); i++) delete PreFunctions[i];
for (unsigned int i=0; i<PostFunctions.size(); i++) delete PostFunctions[i];
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-bool FGModelFunctions::Load(Element* el, FGPropertyManager* PM, string prefix)
+bool FGModelFunctions::InitModel(void)
{
- // Interface properties are all stored in the interface properties array.
- string interface_property_string = "";
-
- Element *property_element = el->FindElement("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.
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#include "FGJSBBase.h"
#include <vector>
-#include "math/FGFunction.h"
-#include "input_output/FGPropertyManager.h"
+#include <map>
+#include <list>
+
+#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
namespace JSBSim {
+class FGFunction;
+class Element;
+class FGPropertyManager;
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
DECLARATION: FGModelFunctions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class FGModelFunctions : public FGJSBBase
+class FGModelFunctions : public FGPropertyReader, public FGJSBBase
{
public:
virtual ~FGModelFunctions();
protected:
std::vector <FGFunction*> PreFunctions;
std::vector <FGFunction*> PostFunctions;
- std::vector <double*> interface_properties;
+
+ virtual bool InitModel(void);
};
} // namespace JSBSim
{
if (std::abs(minCost-minCostPrevResize) < std::numeric_limits<float>::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];
{
m_status = -1;
throw;
- return;
}
}
{
m_status = -1;
throw std::runtime_error("max iterations exceeded!");
- return;
}
// check for convergence break condition
else if ( m_cost[m_iMin] < abstol )
catch (const std::exception & e)
{
- throw;
m_status = -1;
- return;
+ throw;
}
// iteration
} else {
return cost1;
}
- } else {
- return m_f->eval(vertex);
}
+ return m_f->eval(vertex);
}
} // JSBSim
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
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);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
#include <iostream>
#include <cmath>
+#include "FGJSBBase.h"
#include "FGRungeKutta.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
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
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
bool FGAccelerations::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
vPQRidot.InitMatrix();
vUVWidot.InitMatrix();
vGravAccel.InitMatrix();
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);
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
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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
#include <sstream>
#include <iomanip>
#include <cstdlib>
+
#include "FGFDMExec.h"
#include "FGAerodynamics.h"
#include "input_output/FGPropertyManager.h"
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
bi2vel = ci2vel = 0.0;
AeroRPShift = 0;
vDeltaRP.InitMatrix();
-
+ vForces.InitMatrix();
+ vMoments.InitMatrix();
return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
bool FGAircraft::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
+ vForces.InitMatrix();
+ vMoments.InitMatrix();
+
return true;
}
string element_name;
Element* element;
- FGModel::Load(el);
+ if (!FGModel::Load(el)) return false;
if (el->FindElement("wingarea"))
WingArea = el->FindElementValueAsNumberConvertTo("wingarea", "FT2");
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
bool FGAtmosphere::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
Calculate(0.0);
SLtemperature = Temperature = 518.67;
SLpressure = Pressure = 2116.22;
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
bool FGAuxiliary::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
pt = in.Pressure;
tat = in.Temperature;
tatc = RankineToCelsius(tat);
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
bool FGBuoyantForces::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
+ vTotalForces.InitMatrix();
+ vTotalMoments.InitMatrix();
+
return true;
}
gas_cell_element = document->FindNextElement("gas_cell");
}
- PostLoad(element, PropertyManager);
+ PostLoad(document, PropertyManager);
if (!NoneDefined) {
bind();
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);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
bool FGExternalReactions::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
+ vTotalForces.InitMatrix();
+ vTotalMoments.InitMatrix();
+
return true;
}
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
bool FGFCS::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
unsigned int i;
for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = 0.0;
// systems to be defined in a file, with overrides or initial loaded constants
// supplied in the relevant element of the aircraft configuration file.
- Element* property_element = 0;
-
- if (!fname.empty()) {
- property_element = el->FindElement("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");
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
}
/// Reset the components that can be reset
void Reset() {
- for (unsigned int i=0; i<FCSComponents.size(); i++) {
- if (FCSComponents[i]->GetType() == "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; i<FCSComponents.size(); i++)
+ FCSComponents[i]->ResetPastStates();
}
/// Executes all the components in a channel.
void Execute() {
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
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
bool FGGroundReactions::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
+ vForces.InitMatrix();
+ vMoments.InitMatrix();
+
+ multipliers.clear();
+
+ for (unsigned int i=0; i<lGear.size(); i++)
+ lGear[i]->ResetToIC();
+
return true;
}
// Perhaps there is some commonality for things which only need to be
// calculated once.
for (unsigned int i=0; i<lGear.size(); i++) {
- vForces += lGear[i]->GetBodyForces();
+ vForces += lGear[i]->GetBodyForces(this);
vMoments += lGear[i]->GetMoments();
}
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);
}
#include <vector>
+#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
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class FGGroundReactions : public FGModel
+class FGGroundReactions : public FGModel, public FGSurface
{
public:
FGGroundReactions(FGFDMExec*);
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
bool FGInertial::InitModel(void)
{
- return true;
+ return FGModel::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
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;}
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
bool FGInput::InitModel(void)
{
- return true;
+ return FGModel::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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)
<< 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
Peak = staticFCoeff;
Curvature = 1.03;
- // Initialize Lagrange multipliers
- memset(LMultiplier, 0, sizeof(LMultiplier));
+ ResetToIC();
Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-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();
// 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
// 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);
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();
compressSpeed /= LGearProj;
}
- ComputeVerticalStrutForce();
+ ComputeVerticalStrutForce(maxForce);
// Compute the friction coefficients in the wheel ground plane.
if (eContactType == ctBOGEY) {
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);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double StiffSlip = Stiffness*WheelSlip;
FCoeff = Peak * sin(Shape*atan(StiffSlip - Curvature*(StiffSlip - atan(StiffSlip))));
}
+ FCoeff *= frictionFactor;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// 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;
}
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
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
#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
</contact>
@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",
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-class FGLGear : public FGForce
+class FGLGear : public FGForce, protected FGSurface
{
public:
struct Inputs {
~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 {
const struct Inputs& in;
+ void ResetToIC(void);
void bind(void);
private:
double bDampRebound;
double compressLength;
double compressSpeed;
- double staticFCoeff, dynamicFCoeff, rollingFCoeff;
double Stiffness, Shape, Peak, Curvature; // Pacejka factors
double BrakeFCoeff;
double maxCompLen;
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);
#include <iostream>
#include <iomanip>
#include <cstdlib>
+
#include "FGMassBalance.h"
#include "FGFDMExec.h"
#include "input_output/FGPropertyManager.h"
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
bool FGMassBalance::InitModel(void)
{
+ if (!FGModel::InitModel()) return false;
+
vLastXYZcg.InitMatrix(0.0);
vDeltaXYZcg.InitMatrix(0.0);
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
bool FGModel::InitModel(void)
{
exe_ctr = 1;
- return true;
+ return FGModelFunctions::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
{
bool ret = false;
+ if (!FGModel::InitModel()) return false;
+
vector<FGOutputType*>::iterator it;
for (it = OutputTypes.begin(); it != OutputTypes.end(); ++it)
ret &= (*it)->InitModel();
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
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());
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);
&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);
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
@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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/** 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.
*/
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
struct VehicleState VState;
FGColumnVector3 vVel;
- FGColumnVector3 vLocation;
FGMatrix33 Tec2b;
FGMatrix33 Tb2ec;
FGMatrix33 Tl2b; // local to body frame matrix copy for immediate local use
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;
{
bool result = true;
+ if (!FGModel::InitModel()) return false;
+
+ vForces.InitMatrix();
+ vMoments.InitMatrix();
+
for (unsigned int i=0; i<numTanks; i++) Tanks[i]->ResetToIC();
for (unsigned int i=0; i<numEngines; i++) {
switch (Engines[i]->GetType()) {
case FGEngine::etPiston:
- ((FGPiston*)Engines[i])->ResetToIC();
+ Engines[i]->ResetToIC();
try {
if (HasInitializedEngines && (InitializedEngines & i)) InitRunning(i);
} catch (string str) {
}
break;
case FGEngine::etTurbine:
- ((FGTurbine*)Engines[i])->ResetToIC();
+ Engines[i]->ResetToIC();
try {
if (HasInitializedEngines && (InitializedEngines & i)) InitRunning(i);
} catch (string str) {
--- /dev/null
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ 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();
+}
+
+}
+
--- /dev/null
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+ 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
+
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
for (k=n-2;k>=0;k--)
y2[k] = y2[k] * y2[k+1] + u[k];
- delete u;
+ delete[] u;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* 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;
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;
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);
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;
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;
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;
*/
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;
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);
/* 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;
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
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
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
bool FGWinds::InitModel(void)
{
- return true;
+ return FGModel::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
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");
#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
class FGFCS;
class FGPropagate;
class FGAccelerations;
-class FGInertial;
class FGMassBalance;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGPropagate* Propagate;
FGAccelerations* Accelerations;
FGMassBalance* MassBalance;
- FGInertial* Inertial;
FGColumnVector3 vLocation;
FGColumnVector3 vRadius;
FGColumnVector3 vAccel;
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
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+void FGActuator::ResetPastStates(void)
+{
+ FGFCSComponent::ResetPastStates();
+
+ PreviousOutput = PreviousHystOutput = PreviousRateLimOutput
+ = PreviousLagInput = PreviousLagOutput = Output = 0.0;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
bool FGActuator::Run(void )
{
Input = InputNodes[0]->getDoubleValue() * InputSigns[0];
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
@endcode
@author Jon S. Berndt
-@version $Revision: 1.16 $
+@version $Revision: 1.18 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
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
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
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
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
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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; i<OutputNodes.size(); i++) OutputNodes[i]->setDoubleValue(Output);
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
- 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
*/
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;
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
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
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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.
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
output, such as the elevator, or speedbrake, etc.
@author Jon S. Berndt
-@version $Revision: 1.13 $
+@version $Revision: 1.14 $
*/
/** 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;
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
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
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
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
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
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+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;
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
</pre>
@author Jon S. Berndt
- @version $Revision: 1.15 $
+ @version $Revision: 1.16 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
~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};
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
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+void FGSensor::ResetPastStates(void)
+{
+ FGFCSComponent::ResetPastStates();
+
+ PreviousOutput = PreviousInput = Output = 0.0;
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
bool FGSensor::Run(void)
{
Input = InputNodes[0]->getDoubleValue() * InputSigns[0];
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
the number of frames to delay the output signal.
@author Jon S. Berndt
-@version $Revision: 1.22 $
+@version $Revision: 1.24 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
int GetQuantized(void) const {return quantized;}
virtual bool Run (void);
+ void ResetPastStates(void);
protected:
enum eNoiseType {ePercent=0, eAbsolute} NoiseType;
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
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
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
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
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
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
MaxThrottle = 1.0;
MinThrottle = 0.0;
- ResetToIC(); // initialize dynamic terms
-
FDMExec = exec;
PropertyManager = FDMExec->GetPropertyManager();
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) {
FuelFlowRate = 0.0;
FuelFreeze = false;
FuelUsedLbs = 0.0;
+ Thruster->ResetToIC();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
documentation for engine and thruster classes.
</pre>
@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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
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);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
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
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
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
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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
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
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
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
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
Name = el->GetAttributeValue("name");
GearRatio = 1.0;
- ReverserAngle = 0.0;
- Thrust = 0.0;
EngineNum = num;
PropertyManager = FDMExec->GetPropertyManager();
} 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);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+void FGThruster::ResetToIC(void)
+{
+ ReverserAngle = 0.0;
+ Thrust = 0.0;
+ SetActingLocation(vXYZn);
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
string FGThruster::GetThrusterLabels(int id, const string& delimeter)
{
std::ostringstream buf;
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
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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
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;
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
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
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