1
0
Fork 0

Sync. with JSBSim CVS: although it looks a large part it is mostly bug fixes and fixing compiler warnings

This commit is contained in:
Erik Hofman 2014-01-18 10:56:15 +01:00
parent a5cc6353b3
commit e3e44e49ee
112 changed files with 1085 additions and 491 deletions

View file

@ -12,6 +12,7 @@ set(HEADERS
initialization/FGLinearization.h
input_output/FGXMLParse.h
input_output/FGXMLFileRead.h
input_output/FGPropertyReader.h
input_output/FGPropertyManager.h
input_output/FGScript.h
input_output/FGfdmSocket.h
@ -49,6 +50,7 @@ set(HEADERS
models/FGExternalReactions.h
models/FGFCS.h
models/FGGasCell.h
models/FGSurface.h
models/FGGroundReactions.h
models/FGInertial.h
models/FGInput.h
@ -106,6 +108,7 @@ set(SOURCES
initialization/FGTrimmer.cpp
initialization/FGLinearization.cpp
input_output/FGGroundCallback.cpp
input_output/FGPropertyReader.cpp
input_output/FGPropertyManager.cpp
input_output/FGScript.cpp
input_output/FGXMLElement.cpp
@ -139,6 +142,7 @@ set(SOURCES
models/FGExternalReactions.cpp
models/FGFCS.cpp
models/FGGasCell.cpp
models/FGSurface.cpp
models/FGGroundReactions.cpp
models/FGInertial.cpp
models/FGInput.cpp

View file

@ -75,8 +75,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.150 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_FDMEXEC;
IDENT(IdSrc,"$Id: FGFDMExec.cpp,v 1.154 2014/01/13 10:45:59 ehofman Exp $");
IDENT(IdHdr,ID_FDMEXEC);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -101,6 +101,7 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
holding = false;
Terminate = false;
StandAlone = false;
ResetMode = 0;
IncrementThenHolding = false; // increment then hold is off by default
TimeStepsUntilHold = -1;
@ -152,13 +153,13 @@ FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root)
Constructing = true;
typedef int (FGFDMExec::*iPMF)(void) const;
typedef double (FGFDMExec::*dPMF)(void) const;
// typedef double (FGFDMExec::*dPMF)(void) const;
// typedef unsigned int (FGFDMExec::*uiPMF)(void) const;
// instance->Tie("simulation/do_trim_analysis", this, (iPMF)0, &FGFDMExec::DoTrimAnalysis, false);
instance->Tie("simulation/do_simple_trim", this, (iPMF)0, &FGFDMExec::DoTrim, false);
instance->Tie("simulation/do_simplex_trim", this, (iPMF)0, &FGFDMExec::DoSimplexTrim);
instance->Tie("simulation/do_linearization", this, (iPMF)0, &FGFDMExec::DoLinearization);
instance->Tie("simulation/reset", this, (iPMF)0, &FGFDMExec::ResetToInitialConditions, false);
instance->Tie("simulation/reset", (int*)&ResetMode);
instance->Tie("simulation/randomseed", this, (iPMF)0, &FGFDMExec::SRand, false);
instance->Tie("simulation/terminate", (int *)&Terminate);
instance->Tie("simulation/sim-time-sec", this, &FGFDMExec::GetSimTime);
@ -360,9 +361,16 @@ bool FGFDMExec::Run(void)
Models[i]->Run(holding);
}
if (ResetMode) {
if (ResetMode == 1) Output->SetStartNewOutput();
ResetMode = 0;
ResetToInitialConditions();
}
if (Terminate) success = false;
return (success);
return success;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -583,7 +591,8 @@ bool FGFDMExec::RunIC(void)
{
FGPropulsion* propulsion = (FGPropulsion*)Models[ePropulsion];
Models[eOutput]->InitModel();
if (!trim_status)
Models[eOutput]->InitModel();
SuspendIntegration(); // saves the integration rate, dt, then sets it to 0.0.
Initialize(IC);
@ -603,26 +612,15 @@ void FGFDMExec::Initialize(FGInitialCondition *FGIC)
Setsim_time(0.0);
Propagate->SetInitialState( FGIC );
LoadInputs(eInertial);
Inertial->Run(false);
LoadInputs(eAccelerations);
Accelerations->Run(false);
LoadInputs(ePropagate);
Propagate->InitializeDerivatives();
LoadInputs(eAtmosphere);
Atmosphere->Run(false);
Winds->SetWindNED(FGIC->GetWindNEDFpsIC());
Auxiliary->Run(false);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
// A private, internal function call for Tie-ing to a property, so it needs an
// argument.
void FGFDMExec::ResetToInitialConditions(int mode)
{
if (mode == 1) Output->SetStartNewOutput();
ResetToInitialConditions();
LoadInputs(eMassBalance);
MassBalance->Run(false);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -639,9 +637,9 @@ void FGFDMExec::ResetToInitialConditions(void)
Models[i]->InitModel();
}
RunIC();
if (Script) Script->ResetEvents();
RunIC();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -55,7 +55,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.85 2013/11/24 11:40:55 bcoconni Exp $"
#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.86 2014/01/02 21:37:14 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -178,7 +178,7 @@ CLASS DOCUMENTATION
property actually maps toa function call of DoTrim().
@author Jon S. Berndt
@version $Revision: 1.85 $
@version $Revision: 1.86 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -621,6 +621,7 @@ private:
bool trim_status;
int ta_mode;
unsigned int ResetMode;
FGScript* Script;
FGInitialCondition* IC;
@ -640,7 +641,6 @@ private:
bool ReadFileHeader(Element*);
bool ReadChild(Element*);
bool ReadPrologue(Element*);
void ResetToInitialConditions(int mode);
void SRand(int sr);
void LoadInputs(unsigned int idx);
void LoadPlanetConstants(void);

View file

@ -44,8 +44,8 @@ INCLUDES
namespace JSBSim {
static const char *IdSrc = "$Id: FGJSBBase.cpp,v 1.36 2013/01/25 13:39:11 jberndt Exp $";
static const char *IdHdr = ID_JSBBASE;
IDENT(IdSrc,"$Id: FGJSBBase.cpp,v 1.38 2014/01/13 10:45:59 ehofman Exp $");
IDENT(IdHdr,ID_JSBBASE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -51,12 +51,13 @@ using std::max;
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
#define IDENT(a,b) static const char* const (a)[] = {b,(a)[0]}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.38 2013/06/20 13:01:48 jberndt Exp $"
#define ID_JSBBASE "$Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -72,7 +73,7 @@ CLASS DOCUMENTATION
* This class provides universal constants, utility functions, messaging
* functions, and enumerated constants to JSBSim.
@author Jon S. Berndt
@version $Id: FGJSBBase.h,v 1.38 2013/06/20 13:01:48 jberndt Exp $
@version $Id: FGJSBBase.h,v 1.39 2014/01/13 10:45:59 ehofman Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -36,6 +36,7 @@
#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>
@ -1335,9 +1336,30 @@ FGJSBsim::get_agl_ft(double t, const double pt[3], double alt_off,
if (!FGInterface::get_agl_ft(t, pt, alt_off, contact, normal, vel,
angularVel, material, id))
return false;
SGGeod geodPt = SGGeod::fromCart(SG_FEET_TO_METER*SGVec3d(pt));
SGQuatd hlToEc = SGQuatd::fromLonLat(geodPt);
*agl = dot(hlToEc.rotate(SGVec3d(0, 0, 1)), SGVec3d(contact) - SGVec3d(pt));
static SGPropertyNode_ptr terrain_nas = fgGetNode("/fdm/jsbsim/environment/terrain-hight", false);
if (!terrain_nas && material) {
double frictionFactor = (*material).get_friction_factor();
double rollingFriction = (*material).get_rolling_friction();
if ((rollingFriction != 1.0) && (rollingFriction > 0.001)) {
frictionFactor = rollingFriction/0.02;
}
GroundReactions->SetFrictionFactor(frictionFactor);
// 1 Pascal = 0.00014503773800721815 lbs/in^2
double pressure = (*material).get_load_resistance(); // N/m^2 (or Pascal)
GroundReactions->SetMaximumForce(pressure*0.00014503773800721815);
GroundReactions->SetBumpiness((*material).get_bumpiness());
GroundReactions->SetSolid((*material).get_solid());
GroundReactions->SetPosition(pt);
}
return true;
}

View file

@ -55,6 +55,7 @@ INCLUDES
#include "models/FGAtmosphere.h"
#include "models/FGPropagate.h"
#include "models/FGPropulsion.h"
#include "models/FGAccelerations.h"
#include "models/FGFCS.h"
#include "input_output/FGPropertyManager.h"
#include "input_output/string_utilities.h"
@ -65,8 +66,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.89 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_INITIALCONDITION;
IDENT(IdSrc,"$Id: FGInitialCondition.cpp,v 1.93 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_INITIALCONDITION);
//******************************************************************************
@ -886,9 +887,12 @@ bool FGInitialCondition::Load(string rstfile, bool useStoredPath)
exit(-1);
}
double version = document->GetAttributeValueAsNumber("version");
double version = HUGE_VAL;
bool result = false;
if (document->HasAttribute("version"))
version = document->GetAttributeValueAsNumber("version");
if (version == HUGE_VAL) {
result = Load_v1(document); // Default to the old version
} else if (version >= 3.0) {
@ -1002,10 +1006,19 @@ bool FGInitialCondition::Load_v2(Element* document)
{
FGColumnVector3 vOrient;
bool result = true;
FGColumnVector3 vOmegaEarth = fdmex->GetInertial()->GetOmegaPlanet();
// support both earth_position_angle and planet_position_angle, for now.
if (document->FindElement("earth_position_angle"))
position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("earth_position_angle", "RAD"));
if (document->FindElement("planet_position_angle"))
position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("planet_position_angle", "RAD"));
if (document->FindElement("planet_rotation_rate")) {
fdmex->GetInertial()->SetOmegaPlanet(document->FindElementValueAsNumberConvertTo("planet_rotation_rate", "RAD"));
fdmex->GetPropagate()->in.vOmegaPlanet = fdmex->GetInertial()->GetOmegaPlanet();
fdmex->GetAccelerations()->in.vOmegaPlanet = fdmex->GetInertial()->GetOmegaPlanet();
}
FGColumnVector3 vOmegaEarth = fdmex->GetInertial()->GetOmegaPlanet();
// Initialize vehicle position
//

8
src/FDM/JSBSim/initialization/FGSimplexTrim.cpp Normal file → Executable file
View file

@ -23,7 +23,7 @@ namespace JSBSim {
FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode)
{
std::clock_t time_start=clock(), time_trimDone, time_linDone;
std::clock_t time_start=clock(), time_trimDone;
// variables
FGTrimmer::Constraints constraints;
@ -43,12 +43,10 @@ FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode)
bool showConvergence = node->GetBool("trim/solver/showConvergence");
bool pause = node->GetBool("trim/solver/pause");
bool showSimplex = node->GetBool("trim/solver/showSimplex");
bool variablePropPitch = node->GetBool("trim/solver/variablePropPitch");
// flight conditions
double phi = fdm->GetIC()->GetPhiRadIC();
double theta = fdm->GetIC()->GetThetaRadIC();
double psi = fdm->GetIC()->GetPsiRadIC();
double gd = fdm->GetInertial()->gravity();
constraints.velocity = fdm->GetIC()->GetVtrueFpsIC();
@ -110,8 +108,8 @@ FGSimplexTrim::FGSimplexTrim(FGFDMExec * fdm, TrimMode mode)
std::cout << "\ntrim computation time: " << (time_trimDone - time_start)/double(CLOCKS_PER_SEC) << "s \n" << std::endl;
}
if (solver) delete solver;
if (trimmer) delete trimmer;
delete solver;
delete trimmer;
}
} // JSBSim

View file

@ -57,8 +57,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGTrim.cpp,v 1.18 2013/11/24 16:53:15 bcoconni Exp $";
static const char *IdHdr = ID_TRIM;
IDENT(IdSrc,"$Id: FGTrim.cpp,v 1.22 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_TRIM);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -242,8 +242,8 @@ bool FGTrim::DoTrim(void) {
fdmex->DisableOutput();
fdmex->RunIC();
fdmex->SetTrimStatus(true);
fdmex->RunIC();
fdmex->SuspendIntegration();
fgic->SetPRadpsIC(0.0);
@ -381,9 +381,9 @@ bool FGTrim::DoTrim(void) {
cout << endl << " Trim failed" << endl;
}
fdmex->SetTrimStatus(false);
fdmex->ResumeIntegration();
fdmex->RunIC();
fdmex->SetTrimStatus(false);
fdmex->EnableOutput();
for(i=0;i < fdmex->GetGroundReactions()->GetNumGearUnits();i++){

View file

@ -56,8 +56,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGTrimAxis.cpp,v 1.15 2013/11/24 16:53:15 bcoconni Exp $";
static const char *IdHdr = ID_TRIMAXIS;
IDENT(IdSrc,"$Id: FGTrimAxis.cpp,v 1.17 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_TRIMAXIS);
/*****************************************************************************/

1
src/FDM/JSBSim/initialization/FGTrimmer.cpp Normal file → Executable file
View file

@ -189,7 +189,6 @@ void FGTrimmer::printSolution(std::ostream & stream, const std::vector<double> &
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);

View file

@ -71,8 +71,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGOutputFG.cpp,v 1.6 2013/11/09 14:06:36 bcoconni Exp $";
static const char *IdHdr = ID_OUTPUTFG;
IDENT(IdSrc,"$Id: FGOutputFG.cpp,v 1.8 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_OUTPUTFG);
// (stolen from FGFS native_fdm.cxx)
// The function htond is defined this way due to the way some

View file

@ -47,8 +47,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGOutputFile.cpp,v 1.4 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_OUTPUTFILE;
IDENT(IdSrc,"$Id: FGOutputFile.cpp,v 1.6 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_OUTPUTFILE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -60,8 +60,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGOutputSocket.cpp,v 1.6 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_OUTPUTSOCKET;
IDENT(IdSrc,"$Id: FGOutputSocket.cpp,v 1.8 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_OUTPUTSOCKET);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -64,8 +64,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGOutputTextFile.cpp,v 1.7 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_OUTPUTTEXTFILE;
IDENT(IdSrc,"$Id: FGOutputTextFile.cpp,v 1.10 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_OUTPUTTEXTFILE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -76,7 +76,7 @@ bool FGOutputTextFile::Load(Element* el)
if(!FGOutputFile::Load(el))
return false;
PreLoad(el, PropertyManager);
// PreLoad(el, PropertyManager);
string type = el->GetAttributeValue("type");
string delim;

View file

@ -46,8 +46,8 @@ INCLUDES
namespace JSBSim {
static const char *IdSrc = "$Id: FGOutputType.cpp,v 1.7 2013/09/27 19:45:40 jberndt Exp $";
static const char *IdHdr = ID_OUTPUTTYPE;
IDENT(IdSrc,"$Id: FGOutputType.cpp,v 1.10 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_OUTPUTTYPE);
using namespace std;
@ -101,7 +101,7 @@ void FGOutputType::SetIdx(int idx)
bool FGOutputType::Load(Element* element)
{
// Perform base class Load.
// if(!FGModel::Load(element)) return false;
PreLoad(element, PropertyManager);
if (element->FindElementValue("simulation") == string("ON"))
SubSystems += ssSimulation;

View file

@ -0,0 +1,134 @@
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Module: FGPropertyReader.cpp
Author: Bertrand Coconnier
Date started: 12/30/13
Purpose: Read and manage properties from XML data
------------- Copyright (C) 2013 Bertrand Coconnier -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
FUNCTIONAL DESCRIPTION
--------------------------------------------------------------------------------
This class reads and manages properties defined in XML data
HISTORY
--------------------------------------------------------------------------------
12/30/13 BC Created
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGPropertyReader.h"
#include "FGPropertyManager.h"
#include "FGXMLElement.h"
#include "FGJSBBase.h"
using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGPropertyReader.cpp,v 1.3 2014/01/13 10:46:00 ehofman Exp $");
IDENT(IdHdr,ID_PROPERTYREADER);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
bool FGPropertyReader::ResetToIC(void)
{
map<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
}
}

View file

@ -0,0 +1,82 @@
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGPropertyReader.h
Author: Bertrand Coconnier
Date started: 12/30/13
------------- Copyright (C) 2013 Bertrand Coconnier -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
HISTORY
--------------------------------------------------------------------------------
12/30/13 BC Created
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGPROPERTYREADER_H
#define FGPROPERTYREADER_H
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <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

View file

@ -55,8 +55,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGScript.cpp,v 1.53 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_FGSCRIPT;
IDENT(IdSrc,"$Id: FGScript.cpp,v 1.56 2014/01/13 10:46:01 ehofman Exp $");
IDENT(IdHdr,ID_FGSCRIPT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GLOBAL DECLARATIONS
@ -81,12 +81,6 @@ FGScript::~FGScript()
{
unsigned int i, j;
for (i=0; 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++)
@ -106,7 +100,6 @@ bool FGScript::LoadScript(string script, double deltaT, const string initfile)
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;
@ -207,26 +200,10 @@ bool FGScript::LoadScript(string script, double deltaT, const string initfile)
}
// 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
@ -365,6 +342,16 @@ bool FGScript::LoadScript(string script, double deltaT, const string initfile)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGScript::ResetEvents(void)
{
//ResetToIC();
for (unsigned int i=0; i<Events.size(); i++)
Events[i].reset();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGScript::RunScript(void)
{
unsigned i, j;
@ -557,13 +544,15 @@ void FGScript::Debug(int from)
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;

View file

@ -38,17 +38,19 @@ INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#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
@ -157,14 +159,14 @@ CLASS DOCUMENTATION
comes the &quot;run&quot; section, where the conditions are
described in &quot;event&quot; 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
@ -190,9 +192,7 @@ public:
@return false if script should exit (i.e. if time limits are violated */
bool RunScript(void);
void ResetEvents(void) {
for (unsigned int i=0; i<Events.size(); i++) Events[i].reset();
}
void ResetEvents(void);
private:
enum eAction {
@ -253,20 +253,10 @@ private:
}
};
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;

View file

@ -44,8 +44,8 @@ FORWARD DECLARATIONS
namespace JSBSim {
static const char *IdSrc = "$Id: FGXMLElement.cpp,v 1.41 2013/11/16 14:51:20 bcoconni Exp $";
static const char *IdHdr = ID_XMLELEMENT;
IDENT(IdSrc,"$Id: FGXMLElement.cpp,v 1.45 2014/01/13 10:46:02 ehofman Exp $");
IDENT(IdHdr,ID_XMLELEMENT);
bool Element::converterIsInitialized = false;
map <string, map <string, double> > Element::convert;
@ -233,7 +233,6 @@ Element::Element(const string& nm)
convert["KG/L"]["KG/L"] = 1.0;
convert["LBS/GAL"]["LBS/GAL"] = 1.0;
}
attribute_key.resize(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -243,7 +242,6 @@ Element::~Element(void)
for (unsigned int i=0; i<children.size(); i++) delete children[i];
data_lines.clear();
attributes.clear();
attribute_key.clear();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -258,16 +256,9 @@ string Element::GetAttributeValue(const string& attr)
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();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -276,7 +267,11 @@ double Element::GetAttributeValueAsNumber(const string& attr)
{
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)))
@ -342,11 +337,15 @@ double Element::GetDataAsNumber(void)
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);
}
}
@ -634,9 +633,11 @@ void Element::Print(unsigned int level)
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
@ -651,7 +652,6 @@ void Element::Print(unsigned int level)
void Element::AddAttribute(const string& name, const string& value)
{
attribute_key.push_back(name);
attributes[name] = value;
}

View file

@ -38,13 +38,14 @@ INCLUDES
#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
@ -136,7 +137,7 @@ CLASS DOCUMENTATION
- GAL = gallon (U.S. liquid)
@author Jon S. Berndt
@version $Id: FGXMLElement.h,v 1.18 2013/11/16 14:51:20 bcoconni Exp $
@version $Id: FGXMLElement.h,v 1.20 2014/01/13 10:46:02 ehofman Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -363,7 +364,6 @@ private:
std::map <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;

View file

@ -43,7 +43,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.8 2013/11/24 11:40:55 bcoconni Exp $"
#define ID_XMLFILEREAD "$Id: FGXMLFileRead.h,v 1.9 2013/12/01 14:33:51 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -58,7 +58,7 @@ public:
Element* LoadXMLDocument(std::string XML_filename, bool verbose=true)
{
return LoadXMLDocument(XML_filename, file_parser, true);
return LoadXMLDocument(XML_filename, file_parser, verbose);
}
Element* LoadXMLDocument(std::string XML_filename, FGXMLParse& fparse, bool verbose=true)

View file

@ -40,8 +40,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGXMLParse.cpp,v 1.12 2013/11/16 14:51:20 bcoconni Exp $";
static const char *IdHdr = ID_XMLPARSE;
IDENT(IdSrc,"$Id: FGXMLParse.cpp,v 1.14 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_XMLPARSE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -52,8 +52,8 @@ using std::string;
namespace JSBSim {
static const char *IdSrc = "$Id: FGfdmSocket.cpp,v 1.27 2010/05/13 03:07:59 jberndt Exp $";
static const char *IdHdr = ID_FDMSOCKET;
IDENT(IdSrc,"$Id: FGfdmSocket.cpp,v 1.29 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_FDMSOCKET);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -44,11 +44,12 @@ INCLUDES
#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
@ -168,16 +169,16 @@ CLASS DECLARATION
string to_string(float x)
{
std::ostringstream o;
if (!(o << x)) cerr << "Bad float to string conversion" << endl;
return o.str();
std::ostringstream o;
if (!(o << x)) cerr << "Bad float to string conversion" << endl;
return o.str();
}
string to_string(double x)
{
std::ostringstream o;
if (!(o << x)) cerr << "Bad double to string conversion" << endl;
return o.str();
std::ostringstream o;
if (!(o << x)) cerr << "Bad double to string conversion" << endl;
return o.str();
}
string replace(string str, const string& oldstr, const string& newstr)

View file

@ -37,6 +37,7 @@ HISTORY
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGJSBBase.h"
#include "FGColumnVector3.h"
#include <iostream>
#include <sstream>
@ -47,8 +48,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGColumnVector3.cpp,v 1.15 2012/02/07 00:27:51 jentron Exp $";
static const char *IdHdr = ID_COLUMNVECTOR3;
IDENT(IdSrc,"$Id: FGColumnVector3.cpp,v 1.17 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_COLUMNVECTOR3);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -46,7 +46,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_COLUMNVECTOR3 "$Id: FGColumnVector3.h,v 1.17 2011/12/10 15:49:21 bcoconni Exp $"
#define ID_COLUMNVECTOR3 "$Id: FGColumnVector3.h,v 1.18 2013/11/30 10:25:33 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -60,7 +60,7 @@ CLASS DOCUMENTATION
/** This class implements a 3 element column vector.
@author Jon S. Berndt, Tony Peden, et. al.
@version $Id: FGColumnVector3.h,v 1.17 2011/12/10 15:49:21 bcoconni Exp $
@version $Id: FGColumnVector3.h,v 1.18 2013/11/30 10:25:33 bcoconni Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -240,17 +240,17 @@ public:
is equal to zero it is left untouched. */
FGColumnVector3& Normalize(void);
/** Dot product of two vectors
Compute and return the euclidean dot (or scalar) product of two vectors
v1 and v2 */
friend double DotProduct(const FGColumnVector3& v1, const FGColumnVector3& v2) {
return v1.data[0]*v2.data[0] + v1.data[1]*v2.data[1] + v1.data[2]*v2.data[2];
}
private:
double data[3];
};
/** Dot product of two vectors
Compute and return the euclidean dot (or scalar) product of two vectors
v1 and v2 */
inline double DotProduct(const FGColumnVector3& v1, const FGColumnVector3& v2) {
return v1(1)*v2(1) + v1(2)*v2(2) + v1(3)*v2(3);
}
/** Scalar multiplication.
@param scalar scalar value to multiply with.
@param A Vector to multiply.

View file

@ -45,8 +45,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGCondition.cpp,v 1.18 2013/01/26 17:06:49 bcoconni Exp $";
static const char *IdHdr = ID_CONDITION;
IDENT(IdSrc,"$Id: FGCondition.cpp,v 1.20 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_CONDITION);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -43,8 +43,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGFunction.cpp,v 1.53 2013/09/27 19:42:08 jberndt Exp $";
static const char *IdHdr = ID_FUNCTION;
IDENT(IdSrc,"$Id: FGFunction.cpp,v 1.55 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_FUNCTION);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -47,8 +47,8 @@ INCLUDES
namespace JSBSim {
static const char *IdSrc = "$Id: FGLocation.cpp,v 1.30 2013/10/19 17:59:51 bcoconni Exp $";
static const char *IdHdr = ID_LOCATION;
IDENT(IdSrc,"$Id: FGLocation.cpp,v 1.32 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_LOCATION);
using std::cerr;
using std::endl;

View file

@ -49,8 +49,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGMatrix33.cpp,v 1.14 2012/11/22 22:04:06 bcoconni Exp $";
static const char *IdHdr = ID_MATRIX33;
IDENT(IdSrc,"$Id: FGMatrix33.cpp,v 1.16 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_MATRIX33);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -41,14 +41,15 @@ INCLUDES
#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
@ -56,9 +57,6 @@ 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];
@ -67,34 +65,18 @@ FGModelFunctions::~FGModelFunctions()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGModelFunctions::InitModel(void)
{
ResetToIC();
return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGModelFunctions::Load(Element* el, FGPropertyManager* PM, string prefix)
{
// 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
LoadProperties(el, PM, false);
PreLoad(el, PM, prefix);
return true; // TODO: Need to make this value mean something.

View file

@ -34,16 +34,18 @@ SENTRY
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
@ -51,6 +53,10 @@ FORWARD DECLARATIONS
namespace JSBSim {
class FGFunction;
class Element;
class FGPropertyManager;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@ -72,7 +78,7 @@ CLASS DOCUMENTATION
DECLARATION: FGModelFunctions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGModelFunctions : public FGJSBBase
class FGModelFunctions : public FGPropertyReader, public FGJSBBase
{
public:
virtual ~FGModelFunctions();
@ -96,7 +102,8 @@ public:
protected:
std::vector <FGFunction*> PreFunctions;
std::vector <FGFunction*> PostFunctions;
std::vector <double*> interface_properties;
virtual bool InitModel(void);
};
} // namespace JSBSim

11
src/FDM/JSBSim/math/FGNelderMead.cpp Normal file → Executable file
View file

@ -68,9 +68,8 @@ void FGNelderMead::update()
{
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];
@ -90,7 +89,6 @@ void FGNelderMead::update()
{
m_status = -1;
throw;
return;
}
}
@ -120,7 +118,6 @@ void FGNelderMead::update()
{
m_status = -1;
throw std::runtime_error("max iterations exceeded!");
return;
}
// check for convergence break condition
else if ( m_cost[m_iMin] < abstol )
@ -243,9 +240,8 @@ void FGNelderMead::update()
catch (const std::exception & e)
{
throw;
m_status = -1;
return;
throw;
}
// iteration
@ -374,9 +370,8 @@ double FGNelderMead::eval(const std::vector<double> & vertex, bool check)
} else {
return cost1;
}
} else {
return m_f->eval(vertex);
}
return m_f->eval(vertex);
}
} // JSBSim

View file

@ -34,8 +34,8 @@ INCLUDES
namespace JSBSim {
static const char *IdSrc = "$Id: FGPropertyValue.cpp,v 1.9 2013/09/27 19:42:53 jberndt Exp $";
static const char *IdHdr = ID_PROPERTYVALUE;
IDENT(IdSrc,"$Id: FGPropertyValue.cpp,v 1.11 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_PROPERTYVALUE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -58,8 +58,8 @@ using std::endl;
namespace JSBSim {
static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.22 2012/09/17 12:27:44 jberndt Exp $";
static const char *IdHdr = ID_QUATERNION;
IDENT(IdSrc,"$Id: FGQuaternion.cpp,v 1.24 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_QUATERNION);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

4
src/FDM/JSBSim/math/FGRealValue.cpp Normal file → Executable file
View file

@ -32,8 +32,8 @@ INCLUDES
namespace JSBSim {
static const char *IdSrc = "$Id: FGRealValue.cpp,v 1.4 2009/08/30 03:51:28 jberndt Exp $";
static const char *IdHdr = ID_REALVALUE;
IDENT(IdSrc,"$Id: FGRealValue.cpp,v 1.6 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_REALVALUE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -33,6 +33,7 @@
#include <iostream>
#include <cmath>
#include "FGJSBBase.h"
#include "FGRungeKutta.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -44,8 +45,8 @@ using std::endl;
namespace JSBSim {
static const char *IdSrc = "$Id: FGRungeKutta.cpp,v 1.1 2010/06/02 04:05:13 jberndt Exp $";
static const char *IdHdr = ID_RUNGEKUTTA;
IDENT(IdSrc,"$Id: FGRungeKutta.cpp,v 1.3 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_RUNGEKUTTA);
const double FGRungeKutta::RealLimit = 1e30;

View file

@ -47,8 +47,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGTable.cpp,v 1.29 2013/01/26 17:06:49 bcoconni Exp $";
static const char *IdHdr = ID_TABLE;
IDENT(IdSrc,"$Id: FGTable.cpp,v 1.31 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_TABLE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -60,8 +60,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGAccelerations.cpp,v 1.14 2012/09/15 17:00:56 bcoconni Exp $";
static const char *IdHdr = ID_ACCELERATIONS;
IDENT(IdSrc,"$Id: FGAccelerations.cpp,v 1.19 2014/01/13 10:46:03 ehofman Exp $");
IDENT(IdHdr,ID_ACCELERATIONS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -97,6 +97,8 @@ FGAccelerations::~FGAccelerations(void)
bool FGAccelerations::InitModel(void)
{
if (!FGModel::InitModel()) return false;
vPQRidot.InitMatrix();
vUVWidot.InitMatrix();
vGravAccel.InitMatrix();
@ -364,6 +366,7 @@ void FGAccelerations::bind(void)
PropertyManager->Tie("accelerations/vdot-ft_sec2", this, eV, (PMF)&FGAccelerations::GetUVWdot);
PropertyManager->Tie("accelerations/wdot-ft_sec2", this, eW, (PMF)&FGAccelerations::GetUVWdot);
PropertyManager->Tie("accelerations/gravity-ft_sec2", this, &FGAccelerations::GetGravAccelMagnitude);
PropertyManager->Tie("simulation/gravity-model", &gravType);
PropertyManager->Tie("simulation/gravitational-torque", &gravTorque);

View file

@ -50,7 +50,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.14 2012/09/25 12:44:36 jberndt Exp $"
#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.15 2013/11/29 18:56:30 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -97,7 +97,7 @@ CLASS DOCUMENTATION
NASA SP-8024, May 1969
@author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
@version $Id: FGAccelerations.h,v 1.14 2012/09/25 12:44:36 jberndt Exp $
@version $Id: FGAccelerations.h,v 1.15 2013/11/29 18:56:30 jberndt Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -235,6 +235,8 @@ public:
const FGColumnVector3& GetGravAccel(void) const {return vGravAccel; }
double GetGravAccelMagnitude(void) const { return vGravAccel.Magnitude(); }
/** Retrieves a component of the acceleration resulting from the applied forces.
Retrieves a component of the ratio between the sum of all forces applied
on the craft to its mass. The value returned is extracted from the vBodyAccel

View file

@ -40,6 +40,7 @@ INCLUDES
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include "FGFDMExec.h"
#include "FGAerodynamics.h"
#include "input_output/FGPropertyManager.h"
@ -50,8 +51,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGAerodynamics.cpp,v 1.49 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_AERODYNAMICS;
IDENT(IdSrc,"$Id: FGAerodynamics.cpp,v 1.52 2014/01/13 10:46:04 ehofman Exp $");
IDENT(IdHdr,ID_AERODYNAMICS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -130,7 +131,8 @@ bool FGAerodynamics::InitModel(void)
bi2vel = ci2vel = 0.0;
AeroRPShift = 0;
vDeltaRP.InitMatrix();
vForces.InitMatrix();
vMoments.InitMatrix();
return true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -60,8 +60,8 @@ DEFINITIONS
GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
static const char *IdSrc = "$Id: FGAircraft.cpp,v 1.35 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_AIRCRAFT;
IDENT(IdSrc,"$Id: FGAircraft.cpp,v 1.39 2014/01/13 10:46:04 ehofman Exp $");
IDENT(IdHdr,ID_AIRCRAFT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -95,6 +95,11 @@ FGAircraft::~FGAircraft()
bool FGAircraft::InitModel(void)
{
if (!FGModel::InitModel()) return false;
vForces.InitMatrix();
vMoments.InitMatrix();
return true;
}
@ -131,7 +136,7 @@ bool FGAircraft::Load(Element* el)
string element_name;
Element* element;
FGModel::Load(el);
if (!FGModel::Load(el)) return false;
if (el->FindElement("wingarea"))
WingArea = el->FindElementValueAsNumberConvertTo("wingarea", "FT2");

View file

@ -50,8 +50,8 @@ INCLUDES
namespace JSBSim {
static const char *IdSrc = "$Id: FGAtmosphere.cpp,v 1.55 2013/01/26 17:06:49 bcoconni Exp $";
static const char *IdHdr = ID_ATMOSPHERE;
IDENT(IdSrc,"$Id: FGAtmosphere.cpp,v 1.58 2014/01/13 10:46:04 ehofman Exp $");
IDENT(IdHdr,ID_ATMOSPHERE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -80,6 +80,8 @@ FGAtmosphere::~FGAtmosphere()
bool FGAtmosphere::InitModel(void)
{
if (!FGModel::InitModel()) return false;
Calculate(0.0);
SLtemperature = Temperature = 518.67;
SLpressure = Pressure = 2116.22;

6
src/FDM/JSBSim/models/FGAuxiliary.cpp Normal file → Executable file
View file

@ -50,8 +50,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.62 2013/09/11 12:43:20 jberndt Exp $";
static const char *IdHdr = ID_AUXILIARY;
IDENT(IdSrc,"$Id: FGAuxiliary.cpp,v 1.65 2014/01/13 10:46:06 ehofman Exp $");
IDENT(IdHdr,ID_AUXILIARY);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -96,6 +96,8 @@ FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
bool FGAuxiliary::InitModel(void)
{
if (!FGModel::InitModel()) return false;
pt = in.Pressure;
tat = in.Temperature;
tatc = RankineToCelsius(tat);

View file

@ -48,8 +48,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.22 2013/11/24 11:40:55 bcoconni Exp $";
static const char *IdHdr = ID_BUOYANTFORCES;
IDENT(IdSrc,"$Id: FGBuoyantForces.cpp,v 1.26 2014/01/13 10:46:06 ehofman Exp $");
IDENT(IdHdr,ID_BUOYANTFORCES);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -83,6 +83,11 @@ FGBuoyantForces::~FGBuoyantForces()
bool FGBuoyantForces::InitModel(void)
{
if (!FGModel::InitModel()) return false;
vTotalForces.InitMatrix();
vTotalMoments.InitMatrix();
return true;
}
@ -140,7 +145,7 @@ bool FGBuoyantForces::Load(Element *element)
gas_cell_element = document->FindNextElement("gas_cell");
}
PostLoad(element, PropertyManager);
PostLoad(document, PropertyManager);
if (!NoneDefined) {
bind();

4
src/FDM/JSBSim/models/FGExternalForce.cpp Normal file → Executable file
View file

@ -60,8 +60,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.12 2012/12/23 14:56:58 bcoconni Exp $";
static const char *IdHdr = ID_EXTERNALFORCE;
IDENT(IdSrc,"$Id: FGExternalForce.cpp,v 1.14 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_EXTERNALFORCE);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -55,8 +55,8 @@ DEFINITIONS
GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
static const char *IdSrc = "$Id: FGExternalReactions.cpp,v 1.13 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_EXTERNALREACTIONS;
IDENT(IdSrc,"$Id: FGExternalReactions.cpp,v 1.17 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_EXTERNALREACTIONS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -119,6 +119,11 @@ FGExternalReactions::~FGExternalReactions()
bool FGExternalReactions::InitModel(void)
{
if (!FGModel::InitModel()) return false;
vTotalForces.InitMatrix();
vTotalMoments.InitMatrix();
return true;
}

View file

@ -71,8 +71,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGFCS.cpp,v 1.83 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_FCS;
IDENT(IdSrc,"$Id: FGFCS.cpp,v 1.87 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_FCS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -124,6 +124,8 @@ FGFCS::~FGFCS()
bool FGFCS::InitModel(void)
{
if (!FGModel::InitModel()) return false;
unsigned int i;
for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = 0.0;
@ -539,33 +541,8 @@ bool FGFCS::Load(Element* el, SystemType systype)
// 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");

View file

@ -44,7 +44,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.3 2013/09/27 19:44:45 jberndt Exp $"
#define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.4 2013/12/22 15:21:51 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -97,18 +97,8 @@ public:
}
/// Reset the components that can be reset
void Reset() {
for (unsigned int i=0; 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() {

View file

@ -50,8 +50,8 @@ using std::max;
namespace JSBSim {
static const char *IdSrc = "$Id: FGGasCell.cpp,v 1.18 2013/04/17 20:24:27 andgi Exp $";
static const char *IdHdr = ID_GASCELL;
IDENT(IdSrc,"$Id: FGGasCell.cpp,v 1.20 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_GASCELL);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -49,8 +49,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGGroundReactions.cpp,v 1.43 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_GROUNDREACTIONS;
IDENT(IdSrc,"$Id: FGGroundReactions.cpp,v 1.47 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_GROUNDREACTIONS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -79,6 +79,16 @@ FGGroundReactions::~FGGroundReactions(void)
bool FGGroundReactions::InitModel(void)
{
if (!FGModel::InitModel()) return false;
vForces.InitMatrix();
vMoments.InitMatrix();
multipliers.clear();
for (unsigned int i=0; i<lGear.size(); i++)
lGear[i]->ResetToIC();
return true;
}
@ -102,7 +112,7 @@ bool FGGroundReactions::Run(bool Holding)
// Perhaps there is some commonality for things which only need to be
// calculated once.
for (unsigned int i=0; i<lGear.size(); i++) {
vForces += lGear[i]->GetBodyForces();
vForces += lGear[i]->GetBodyForces(this);
vMoments += lGear[i]->GetMoments();
}
@ -251,7 +261,6 @@ string FGGroundReactions::GetGroundReactionValues(string delimeter) const
void FGGroundReactions::bind(void)
{
typedef double (FGGroundReactions::*PMF)(int) const;
PropertyManager->Tie("gear/num-units", this, &FGGroundReactions::GetNumGearUnits);
PropertyManager->Tie("gear/wow", this, &FGGroundReactions::GetWOW);
}

View file

@ -40,11 +40,12 @@ INCLUDES
#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
@ -77,7 +78,7 @@ CLASS DOCUMENTATION
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGGroundReactions : public FGModel
class FGGroundReactions : public FGModel, public FGSurface
{
public:
FGGroundReactions(FGFDMExec*);

View file

@ -43,8 +43,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGInertial.cpp,v 1.26 2011/12/11 17:03:05 bcoconni Exp $";
static const char *IdHdr = ID_INERTIAL;
IDENT(IdSrc,"$Id: FGInertial.cpp,v 1.29 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_INERTIAL);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -95,7 +95,7 @@ FGInertial::~FGInertial(void)
bool FGInertial::InitModel(void)
{
return true;
return FGModel::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -47,7 +47,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_INERTIAL "$Id: FGInertial.h,v 1.21 2012/11/23 21:42:29 bcoconni Exp $"
#define ID_INERTIAL "$Id: FGInertial.h,v 1.22 2013/11/30 21:22:08 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -87,6 +87,10 @@ public:
double gravity(void) const {return gAccel;}
double omega(void) const {return RotationRate;}
const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;}
void SetOmegaPlanet(double rate) {
RotationRate = rate;
vOmegaPlanet = FGColumnVector3( 0.0, 0.0, RotationRate );
}
double GetGAccel(double r) const;
FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const;
double GetRefRadius(void) const {return RadiusReference;}

6
src/FDM/JSBSim/models/FGInput.cpp Normal file → Executable file
View file

@ -53,8 +53,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGInput.cpp,v 1.25 2013/01/26 17:06:50 bcoconni Exp $";
static const char *IdHdr = ID_INPUT;
IDENT(IdSrc,"$Id: FGInput.cpp,v 1.28 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_INPUT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -81,7 +81,7 @@ FGInput::~FGInput()
bool FGInput::InitModel(void)
{
return true;
return FGModel::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -62,8 +62,8 @@ DEFINITIONS
GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
static const char *IdSrc = "$Id: FGLGear.cpp,v 1.106 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_LGEAR;
IDENT(IdSrc,"$Id: FGLGear.cpp,v 1.111 2014/01/16 14:00:30 ehofman Exp $");
IDENT(IdHdr,ID_LGEAR);
// Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
// ft instead of inches)
@ -210,28 +210,12 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number, const struct Inputs&
<< sBrakeGroup << " is undefined." << endl;
}
GearPos = 1.0;
useFCSGearPos = false;
// Add some AI here to determine if gear is located properly according to its
// brake group type ??
WOW = lastWOW = false;
useFCSGearPos = false;
ReportEnable = true;
FirstContact = false;
StartedGroundRun = false;
TakeoffReported = LandingReported = false;
LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
MaximumStrutForce = MaximumStrutTravel = 0.0;
SinkRate = GroundSpeed = 0.0;
vWhlVelVec.InitMatrix();
compressLength = 0.0;
compressSpeed = 0.0;
maxCompLen = 0.0;
WheelSlip = 0.0;
// Set Pacejka terms
@ -240,8 +224,7 @@ FGLGear::FGLGear(Element* el, FGFDMExec* fdmex, int number, const struct Inputs&
Peak = staticFCoeff;
Curvature = 1.03;
// Initialize Lagrange multipliers
memset(LMultiplier, 0, sizeof(LMultiplier));
ResetToIC();
Debug(0);
}
@ -257,7 +240,32 @@ FGLGear::~FGLGear()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
const FGColumnVector3& FGLGear::GetBodyForces(void)
void FGLGear::ResetToIC(void)
{
GearPos = 1.0;
WOW = lastWOW = false;
FirstContact = false;
StartedGroundRun = false;
LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
MaximumStrutForce = MaximumStrutTravel = 0.0;
SinkRate = GroundSpeed = 0.0;
vWhlVelVec.InitMatrix();
compressLength = 0.0;
compressSpeed = 0.0;
maxCompLen = 0.0;
WheelSlip = 0.0;
// Initialize Lagrange multipliers
memset(LMultiplier, 0, sizeof(LMultiplier));
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
const FGColumnVector3& FGLGear::GetBodyForces(FGSurface *surface)
{
double gearPos = 1.0;
double t = fdmex->GetSimTime();
@ -278,8 +286,17 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
// not compressed) with respect to the ground level
double height = gearLoc.GetContactPoint(t, contact, normal, terrainVel, dummy);
double maxForce = DBL_MAX;
bool isSolid = true;
if (surface) {
height -= (*surface).GetBumpHeight();
frictionFactor = (*surface).GetFrictionFactor();
maxForce = (*surface).GetMaximumForce();
isSolid = (*surface).GetSolid();
}
if (height < 0.0) {
WOW = true;
WOW = isSolid;
vGroundNormal = in.Tec2b * normal;
// The height returned by GetGroundCallback() is the AGL and is expressed
@ -294,8 +311,14 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
// including the strut compression.
switch(eContactType) {
case ctBOGEY:
compressLength = LGearProj > 0.0 ? height * normalZ / LGearProj : 0.0;
vWhlDisplVec = mTGear * FGColumnVector3(0., 0., -compressLength);
if (isSolid) {
compressLength = LGearProj > 0.0 ? height * normalZ / LGearProj : 0.0;
vWhlDisplVec = mTGear * FGColumnVector3(0., 0., -compressLength);
} else {
// Gears don't (or hardly) compress is liquids
compressLength = 0.0;
vWhlDisplVec = 0.0 * vGroundNormal;
}
break;
case ctSTRUCTURE:
compressLength = height * normalZ / DotProduct(normal, normal);
@ -308,7 +331,13 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
FGColumnVector3 vBodyWhlVel = in.PQR * vWhlContactVec;
vBodyWhlVel += in.UVW - in.Tec2b * terrainVel;
vWhlVelVec = mTGear.Transposed() * vBodyWhlVel;
if (isSolid) {
vWhlVelVec = mTGear.Transposed() * vBodyWhlVel;
} else {
// wheels don't spin up in liquids: let wheel spin down slowly
vWhlVelVec(eX) -= 13.0 * in.TotalDeltaT;
if (vWhlVelVec(eX) < 0.0) vWhlVelVec(eX) = 0.0;
}
InitializeReporting();
ComputeSteeringAngle();
@ -324,7 +353,7 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)
compressSpeed /= LGearProj;
}
ComputeVerticalStrutForce();
ComputeVerticalStrutForce(maxForce);
// Compute the friction coefficients in the wheel ground plane.
if (eContactType == ctBOGEY) {
@ -546,10 +575,10 @@ void FGLGear::CrashDetect(void)
void FGLGear::ComputeBrakeForceCoefficient(void)
{
BrakeFCoeff = rollingFCoeff;
BrakeFCoeff = frictionFactor * rollingFCoeff;
if (eBrakeGrp != bgNone)
BrakeFCoeff += in.BrakePos[eBrakeGrp] * (staticFCoeff - rollingFCoeff);
BrakeFCoeff += in.BrakePos[eBrakeGrp] * frictionFactor * (staticFCoeff - rollingFCoeff);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -570,6 +599,7 @@ void FGLGear::ComputeSideForceCoefficient(void)
double StiffSlip = Stiffness*WheelSlip;
FCoeff = Peak * sin(Shape*atan(StiffSlip - Curvature*(StiffSlip - atan(StiffSlip))));
}
FCoeff *= frictionFactor;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -579,7 +609,7 @@ void FGLGear::ComputeSideForceCoefficient(void)
// possibly give a "rebound damping factor" that differs from the compression
// case.
void FGLGear::ComputeVerticalStrutForce(void)
void FGLGear::ComputeVerticalStrutForce(double maxForce)
{
double springForce = 0;
double dampForce = 0;
@ -606,6 +636,10 @@ void FGLGear::ComputeVerticalStrutForce(void)
}
StrutForce = min(springForce + dampForce, (double)0.0);
if (StrutForce > maxForce) {
StrutForce = maxForce;
compressLength = -StrutForce / kSpring;
}
}
// The reaction force of the wheel is always normal to the ground
@ -657,7 +691,7 @@ void FGLGear::ComputeJacobian(const FGColumnVector3& vWhlContactVec)
LMultiplier[ftDynamic].ForceJacobian = mT * velocityDirection;
LMultiplier[ftDynamic].MomentJacobian = vWhlContactVec * LMultiplier[ftDynamic].ForceJacobian;
LMultiplier[ftDynamic].Max = 0.;
LMultiplier[ftDynamic].Min = -fabs(dynamicFCoeff * vFn(eZ));
LMultiplier[ftDynamic].Min = -fabs(frictionFactor * dynamicFCoeff * vFn(eZ));
// The Lagrange multiplier value obtained from the previous iteration is kept
// This is supposed to accelerate the convergence of the projected Gauss-Seidel

View file

@ -43,12 +43,13 @@ INCLUDES
#include "models/propulsion/FGForce.h"
#include "math/FGColumnVector3.h"
#include "math/LagrangeMultiplier.h"
#include "FGSurface.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_LGEAR "$Id: FGLGear.h,v 1.58 2013/11/15 22:43:01 bcoconni Exp $"
#define ID_LGEAR "$Id: FGLGear.h,v 1.61 2014/01/16 14:00:42 ehofman Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -177,7 +178,7 @@ CLASS DOCUMENTATION
</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",
@ -190,7 +191,7 @@ CLASS DOCUMENTATION
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGLGear : public FGForce
class FGLGear : public FGForce, protected FGSurface
{
public:
struct Inputs {
@ -237,7 +238,7 @@ public:
~FGLGear();
/// The Force vector for this gear
const FGColumnVector3& GetBodyForces(void);
const FGColumnVector3& GetBodyForces(FGSurface *surface = NULL);
/// Gets the location of the gear in Body axes
FGColumnVector3 GetBodyLocation(void) const {
@ -315,6 +316,7 @@ public:
const struct Inputs& in;
void ResetToIC(void);
void bind(void);
private:
@ -332,7 +334,6 @@ private:
double bDampRebound;
double compressLength;
double compressSpeed;
double staticFCoeff, dynamicFCoeff, rollingFCoeff;
double Stiffness, Shape, Peak, Curvature; // Pacejka factors
double BrakeFCoeff;
double maxCompLen;
@ -376,7 +377,7 @@ private:
void ComputeSteeringAngle(void);
void ComputeSlipAngle(void);
void ComputeSideForceCoefficient(void);
void ComputeVerticalStrutForce(void);
void ComputeVerticalStrutForce(double maxForce = DBL_MAX);
void ComputeGroundFrame(void);
void ComputeJacobian(const FGColumnVector3& vWhlContactVec);
void UpdateForces(void);

View file

@ -41,6 +41,7 @@ INCLUDES
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include "FGMassBalance.h"
#include "FGFDMExec.h"
#include "input_output/FGPropertyManager.h"
@ -51,8 +52,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.43 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_MASSBALANCE;
IDENT(IdSrc,"$Id: FGMassBalance.cpp,v 1.47 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_MASSBALANCE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -92,6 +93,8 @@ FGMassBalance::~FGMassBalance()
bool FGMassBalance::InitModel(void)
{
if (!FGModel::InitModel()) return false;
vLastXYZcg.InitMatrix(0.0);
vDeltaXYZcg.InitMatrix(0.0);

View file

@ -46,8 +46,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGModel.cpp,v 1.21 2013/01/14 22:44:52 bcoconni Exp $";
static const char *IdHdr = ID_MODEL;
IDENT(IdSrc,"$Id: FGModel.cpp,v 1.24 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_MODEL);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GLOBAL DECLARATIONS
@ -84,7 +84,7 @@ FGModel::~FGModel()
bool FGModel::InitModel(void)
{
exe_ctr = 1;
return true;
return FGModelFunctions::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -51,8 +51,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGOutput.cpp,v 1.74 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_OUTPUT;
IDENT(IdSrc,"$Id: FGOutput.cpp,v 1.77 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_OUTPUT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -86,6 +86,8 @@ bool FGOutput::InitModel(void)
{
bool ret = false;
if (!FGModel::InitModel()) return false;
vector<FGOutputType*>::iterator it;
for (it = OutputTypes.begin(); it != OutputTypes.end(); ++it)
ret &= (*it)->InitModel();

View file

@ -78,8 +78,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.119 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_PROPAGATE;
IDENT(IdSrc,"$Id: FGPropagate.cpp,v 1.123 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_PROPAGATE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -120,6 +120,8 @@ FGPropagate::~FGPropagate(void)
bool FGPropagate::InitModel(void)
{
if (!FGModel::InitModel()) return false;
// For initialization ONLY:
VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor);
VState.vLocation.SetAltitudeAGL(4.0, FDMExec->GetSimTime());
@ -719,6 +721,10 @@ void FGPropagate::bind(void)
PropertyManager->Tie("velocities/qi-rad_sec", this, eQ, (PMF)&FGPropagate::GetPQRi);
PropertyManager->Tie("velocities/ri-rad_sec", this, eR, (PMF)&FGPropagate::GetPQRi);
PropertyManager->Tie("velocities/eci-x-fps", this, eX, (PMF)&FGPropagate::GetInertialVelocity);
PropertyManager->Tie("velocities/eci-y-fps", this, eY, (PMF)&FGPropagate::GetInertialVelocity);
PropertyManager->Tie("velocities/eci-z-fps", this, eZ, (PMF)&FGPropagate::GetInertialVelocity);
PropertyManager->Tie("velocities/eci-velocity-mag-fps", this, &FGPropagate::GetInertialVelocityMagnitude);
PropertyManager->Tie("velocities/ned-velocity-mag-fps", this, &FGPropagate::GetNEDVelocityMagnitude);
@ -739,6 +745,14 @@ void FGPropagate::bind(void)
&FGPropagate::GetTerrainElevation,
&FGPropagate::SetTerrainElevation, false);
PropertyManager->Tie("position/eci-x-ft", this, eX, (PMF)&FGPropagate::GetInertialPosition);
PropertyManager->Tie("position/eci-y-ft", this, eY, (PMF)&FGPropagate::GetInertialPosition);
PropertyManager->Tie("position/eci-z-ft", this, eZ, (PMF)&FGPropagate::GetInertialPosition);
PropertyManager->Tie("position/ecef-x-ft", this, eX, (PMF)&FGPropagate::GetLocation);
PropertyManager->Tie("position/ecef-y-ft", this, eY, (PMF)&FGPropagate::GetLocation);
PropertyManager->Tie("position/ecef-z-ft", this, eZ, (PMF)&FGPropagate::GetLocation);
PropertyManager->Tie("position/epa-rad", this, &FGPropagate::GetEarthPositionAngle);
PropertyManager->Tie("metrics/terrain-radius", this, &FGPropagate::GetLocalTerrainRadius);

View file

@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.78 2013/09/14 11:26:04 bcoconni Exp $"
#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.80 2013/12/22 17:08:59 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -93,7 +93,7 @@ CLASS DOCUMENTATION
@endcode
@author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
@version $Id: FGPropagate.h,v 1.78 2013/09/14 11:26:04 bcoconni Exp $
@version $Id: FGPropagate.h,v 1.80 2013/12/22 17:08:59 jberndt Exp $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -301,10 +301,12 @@ public:
/** Retrieves the inertial velocity vector in ft/sec.
*/
const FGColumnVector3& GetInertialVelocity(void) const { return VState.vInertialVelocity; }
double GetInertialVelocity(int i) const { return VState.vInertialVelocity(i); }
/** Retrieves the inertial position vector.
*/
const FGColumnVector3& GetInertialPosition(void) const { return VState.vInertialPosition; }
double GetInertialPosition(int i) const { return VState.vInertialPosition(i); }
/** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame.
*/
@ -440,6 +442,7 @@ public:
double GetLongitudeDeg(void) const { return VState.vLocation.GetLongitudeDeg(); }
double GetLatitudeDeg(void) const { return VState.vLocation.GetLatitudeDeg(); }
const FGLocation& GetLocation(void) const { return VState.vLocation; }
double GetLocation(int i) const { return VState.vLocation(i); }
/** Retrieves the local-to-body transformation matrix.
The quaternion class, being the means by which the orientation of the
@ -596,7 +599,6 @@ private:
struct VehicleState VState;
FGColumnVector3 vVel;
FGColumnVector3 vLocation;
FGMatrix33 Tec2b;
FGMatrix33 Tb2ec;
FGMatrix33 Tl2b; // local to body frame matrix copy for immediate local use

View file

@ -67,8 +67,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.71 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_PROPULSION;
IDENT(IdSrc,"$Id: FGPropulsion.cpp,v 1.76 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_PROPULSION);
extern short debug_lvl;
@ -119,12 +119,17 @@ bool FGPropulsion::InitModel(void)
{
bool result = true;
if (!FGModel::InitModel()) return false;
vForces.InitMatrix();
vMoments.InitMatrix();
for (unsigned int i=0; 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) {
@ -133,7 +138,7 @@ bool FGPropulsion::InitModel(void)
}
break;
case FGEngine::etTurbine:
((FGTurbine*)Engines[i])->ResetToIC();
Engines[i]->ResetToIC();
try {
if (HasInitializedEngines && (InitializedEngines & i)) InitRunning(i);
} catch (string str) {

View file

@ -0,0 +1,137 @@
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Module: FGSurface.cpp
Author: Erik Hofman
Date started: 01/15/14
Purpose: Base class for all surface properties
Called by: GroundReactions
------------- Copyright (C) 2014 Jon S. Berndt (jon@jsbsim.org) -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
FUNCTIONAL DESCRIPTION
--------------------------------------------------------------------------------
This base class for the GroundReactions class defines methoed and holds data
for all surface types.
HISTORY
--------------------------------------------------------------------------------
01/15/14 EMH Created
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGSurface.h"
using namespace std;
namespace JSBSim {
IDENT(IdSrc,"$Id: FGSurface.cpp,v 1.2 2014/01/16 12:31:50 ehofman Exp $");
IDENT(IdHdr,ID_SURFACE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
GLOBAL DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGSurface::FGSurface()
{
frictionFactor = 1.0;
rollingFCoeff = 0.02;
MaximumForce = DBL_MAX;
bumpiness = 0.0;
isSolid = true;
}
FGSurface::FGSurface(FGFDMExec* fdmex = NULL)
{
frictionFactor = 1.0;
rollingFCoeff = 0.02;
MaximumForce = DBL_MAX;
bumpiness = 0.0;
isSolid = true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGSurface::~FGSurface()
{
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
float FGSurface::GetBumpHeight()
{
if (bumpiness < 0.001) return 0.0f;
double x = pos[0]*0.1;
double y = pos[1]*0.1;
x -= floor(x);
y -= floor(y);
x *= 2*M_PI;
y *= 2*M_PI;
//now x and y are in the range of 0..2pi
//we need a function, that is periodically on 2pi and gives some
//height. This is not very fast, but for a beginning.
//maybe this should be done by interpolating between some precalculated
//values
static const float maxGroundBumpAmplitude=0.4;
float h = sin(x)+sin(7*x)+sin(8*x)+sin(13*x);
h += sin(2*y)+sin(5*y)+sin(9*y*x)+sin(17*y);
return h*(1/8.)*bumpiness*maxGroundBumpAmplitude;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGSurface::GetSurfaceStrings(string delimeter) const
{
std::ostringstream buf;
buf << "FrictionFactor" << delimeter
<< "RollingFriction" << delimeter
<< "MaximumForce" << delimeter
<< "Bumpiness" << delimeter
<< "IsSolid";
return buf.str();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGSurface::GetSurfaceValues(string delimeter) const
{
std::ostringstream buf;
buf << GetFrictionFactor() << delimeter
<< GetRollingFriction() << delimeter
<< GetMaximumForce() << delimeter
<< GetBumpiness() << delimeter
<< (GetSolid() ? "1" : "0");
return buf.str();
}
}

View file

@ -0,0 +1,138 @@
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGSurface.h
Author: Erik Hofman
Date started: 01/15/14
------------- Copyright (C) 2014 Jon S. Berndt (jon@jsbsim.org) -------------
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.
Further information about the GNU Lesser General Public License can also be found on
the world wide web at http://www.gnu.org.
HISTORY
--------------------------------------------------------------------------------
01/15/14 EMH Created
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGSURFACE_H
#define FGSURFACE_H
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGFDMExec.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_SURFACE "$Id: FGSurface.h,v 1.2 2014/01/16 12:31:50 ehofman Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Base class for all surface properties
@author Erik M. Hofman
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGSurface
{
public:
/// Constructor
FGSurface();
/// Constructor
FGSurface(FGFDMExec* fdmex);
/// Destructor
~FGSurface();
/// Sets the friction factor of the surface area
void SetFrictionFactor(double friction) { frictionFactor = friction; }
/// Sets the load capacity of the surface area
void SetMaximumForce(double force ) { MaximumForce = force; }
/// Sets the bumpiness factor associated with the surface
void SetBumpiness(double bump) { bumpiness = bump; }
/// Sets the surface is a solid flag value
void SetSolid(bool solid) { isSolid = solid; }
/// Set the currect position for bumpiness calulcation
void SetPosition(const double pt[3]) {
pos[0] = pt[0]; pos[1] = pt[1]; pos[2] = pt[2];
}
/// Gets the friction factor of the surface area
double GetFrictionFactor(void) const { return frictionFactor; }
/// Gets the rolling friction of the surface area
double GetRollingFriction(void) const { return rollingFCoeff; }
/// Gets the static friction of the surface area
double GetStaticFriction(void) const { return staticFCoeff; }
/// Gets the dynamic friction of the surface area
double GetDynamicFriction(void) const { return dynamicFCoeff; }
/// Gets the maximum force for this surface point
double GetMaximumForce(void) const { return MaximumForce; }
/// Gets the bumpiness factor associated with the surface
double GetBumpiness(void) const { return bumpiness; }
/// Gets the surface is a solid flag value
bool GetSolid(void) const { return isSolid; }
/// Returns the height of the bump at the provided offset
float GetBumpHeight();
std::string GetSurfaceStrings(std::string delimeter) const;
std::string GetSurfaceValues(std::string delimeter) const;
protected:
double staticFCoeff, dynamicFCoeff, rollingFCoeff;
double frictionFactor;
double MaximumForce;
double bumpiness;
bool isSolid;
private:
double pos[3];
};
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif

36
src/FDM/JSBSim/models/atmosphere/FGMSIS.cpp Normal file → Executable file
View file

@ -66,8 +66,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGMSIS.cpp,v 1.19 2011/12/11 17:03:05 bcoconni Exp $";
static const char *IdHdr = ID_MSIS;
IDENT(IdSrc,"$Id: FGMSIS.cpp,v 1.24 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_MSIS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
EXTERNAL GLOBAL DATA
@ -464,7 +464,7 @@ void MSIS::spline (double *x, double *y, int n, double yp1, double ypn, double *
for (k=n-2;k>=0;k--)
y2[k] = y2[k] * y2[k+1] + u[k];
delete u;
delete[] u;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -739,9 +739,7 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
* Upper Thermosphere Parameters */
double t[15];
int i,j;
int sw9=1;
double apd;
double xlong;
double tloc;
double c, s, c2, c4, s2;
double sr = 7.2722E-5;
@ -749,7 +747,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
double dr = 1.72142E-2;
double hr = 0.2618;
double cd32, cd18, cd14, cd39;
double p32, p18, p14, p39;
double df;
double f1, f2;
double tinf;
@ -758,11 +755,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
tloc=input->lst;
for (j=0;j<14;j++)
t[j]=0;
if (flags->sw[9]>0)
sw9=1;
else if (flags->sw[9]<0)
sw9=-1;
xlong = input->g_long;
/* calculate legendre polynomials */
c = sin(input->g_lat * dgtr);
@ -810,10 +802,6 @@ double MSIS::globe7(double *p, struct nrlmsise_input *input,
cd18 = cos(2.0*dr*(input->doy-p[17]));
cd14 = cos(dr*(input->doy-p[13]));
cd39 = cos(2.0*dr*(input->doy-p[38]));
p32=p[31];
p18=p[17];
p14=p[13];
p39=p[38];
/* F10.7 EFFECT */
df = input->f107 - input->f107A;
@ -971,7 +959,6 @@ double MSIS::glob7s(double *p, struct nrlmsise_input *input,
double t[14] = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,};
double tt=0.0;
double cd32=0.0, cd18=0.0, cd14=0.0, cd39=0.0;
double p32=0.0, p18=0.0, p14=0.0, p39=0.0;
int i=0,j=0;
double dr=1.72142E-2;
double dgtr=1.74533E-2;
@ -988,10 +975,6 @@ double MSIS::glob7s(double *p, struct nrlmsise_input *input,
cd18 = cos(2.0*dr*(input->doy-p[17]));
cd14 = cos(dr*(input->doy-p[13]));
cd39 = cos(2.0*dr*(input->doy-p[38]));
p32=p[31];
p18=p[17];
p14=p[13];
p39=p[38];
/* F10.7 */
t[0] = p[21]*dfa;
@ -1295,14 +1278,14 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags,
*/
double za=0.0;
int i, j;
double ddum=0.0, z=0.0;
double z=0.0;
double zn1[5] = {120.0, 110.0, 100.0, 90.0, 72.5};
double tinf=0.0;
int mn1 = 5;
double g0=0.0;
double tlb=0.0;
double s=0.0, z0=0.0, t0=0.0, tr12=0.0;
double db01=0.0, db04=0.0, db14=0.0, db16=0.0, db28=0.0, db32=0.0, db40=0.0, db48=0.0;
double s=0.0;
double db01=0.0, db04=0.0, db14=0.0, db16=0.0, db28=0.0, db32=0.0, db40=0.0;
double zh28=0.0, zh04=0.0, zh16=0.0, zh32=0.0, zh40=0.0, zh01=0.0, zh14=0.0;
double zhm28=0.0, zhm04=0.0, zhm16=0.0, zhm32=0.0, zhm40=0.0, zhm01=0.0, zhm14=0.0;
double xmd=0.0;
@ -1361,10 +1344,6 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags,
meso_tgn1[1]=ptm[8]*pma[8][0]*meso_tn1[4]*meso_tn1[4]/(pow((ptm[4]*ptl[3][0]),2.0));
}
z0 = zn1[3];
t0 = meso_tn1[3];
tr12 = 1.0;
/* N2 variation factor at Zlb */
g28=flags->sw[21]*globe7(pd[2], input, flags);
@ -1601,13 +1580,12 @@ void MSIS::gts7(struct nrlmsise_input *input, struct nrlmsise_flags *flags,
/* total mass density */
output->d[5] = 1.66E-24*(4.0*output->d[0]+16.0*output->d[1]+28.0*output->d[2]+32.0*output->d[3]+40.0*output->d[4]+ output->d[6]+14.0*output->d[7]);
db48=1.66E-24*(4.0*db04+16.0*db16+28.0*db28+32.0*db32+40.0*db40+db01+14.0*db14);
/* temperature */
z = sqrt(input->alt*input->alt);
ddum = densu(z,1.0, tinf, tlb, 0.0, 0.0, &output->t[1], ptm[5], s, mn1, zn1, meso_tn1, meso_tgn1);
densu(z,1.0, tinf, tlb, 0.0, 0.0, &output->t[1], ptm[5], s, mn1, zn1, meso_tn1, meso_tgn1);
if (flags->sw[0]) {
for(i=0;i<9;i++)
output->d[i]=output->d[i]*1.0E6;

4
src/FDM/JSBSim/models/atmosphere/FGMars.cpp Normal file → Executable file
View file

@ -48,8 +48,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGMars.cpp,v 1.11 2011/06/21 13:54:40 jberndt Exp $";
static const char *IdHdr = ID_MARS;
IDENT(IdSrc,"$Id: FGMars.cpp,v 1.13 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_MARS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -50,8 +50,8 @@ INCLUDES
namespace JSBSim {
static const char *IdSrc = "$Id: FGStandardAtmosphere.cpp,v 1.21 2012/04/13 13:18:27 jberndt Exp $";
static const char *IdHdr = ID_STANDARDATMOSPHERE;
IDENT(IdSrc,"$Id: FGStandardAtmosphere.cpp,v 1.23 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_STANDARDATMOSPHERE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -51,8 +51,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGWinds.cpp,v 1.8 2012/12/02 12:59:19 bcoconni Exp $";
static const char *IdHdr = ID_WINDS;
IDENT(IdSrc,"$Id: FGWinds.cpp,v 1.11 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_WINDS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -120,7 +120,7 @@ FGWinds::~FGWinds()
bool FGWinds::InitModel(void)
{
return true;
return FGModel::InitModel();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -51,8 +51,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGAccelerometer.cpp,v 1.12 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_ACCELEROMETER;
IDENT(IdSrc,"$Id: FGAccelerometer.cpp,v 1.15 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_ACCELEROMETER);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -65,7 +65,6 @@ FGAccelerometer::FGAccelerometer(FGFCS* fcs, Element* element)
Propagate = fcs->GetExec()->GetPropagate();
Accelerations = fcs->GetExec()->GetAccelerations();
MassBalance = fcs->GetExec()->GetMassBalance();
Inertial = fcs->GetExec()->GetInertial();
Element* location_element = element->FindElement("location");
if (location_element) vLocation = location_element->FindElementTripletConvertTo("IN");

View file

@ -39,14 +39,13 @@ INCLUDES
#include "FGSensor.h"
#include "math/FGColumnVector3.h"
#include "math/FGMatrix33.h"
#include "FGSensorOrientation.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ACCELEROMETER "$Id: FGAccelerometer.h,v 1.7 2013/11/24 11:40:56 bcoconni Exp $"
#define ID_ACCELEROMETER "$Id: FGAccelerometer.h,v 1.8 2013/12/07 12:21:14 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -57,7 +56,6 @@ namespace JSBSim {
class FGFCS;
class FGPropagate;
class FGAccelerations;
class FGInertial;
class FGMassBalance;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -119,14 +117,14 @@ The only required element in the accelerometer definition is the input element.
case, no degradation would be modeled, and the output would simply be the input.
For noise, if the type is PERCENT, then the value supplied is understood to be a
percentage variance. That is, if the number given is 0.05, the the variance is
percentage variance. That is, if the number given is 0.05, the variance is
understood to be +/-0.05 percent maximum variance. So, the actual value for the accelerometer
will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
time.
@author Jon S. Berndt
@version $Revision: 1.7 $
@version $Revision: 1.8 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -145,7 +143,6 @@ private:
FGPropagate* Propagate;
FGAccelerations* Accelerations;
FGMassBalance* MassBalance;
FGInertial* Inertial;
FGColumnVector3 vLocation;
FGColumnVector3 vRadius;
FGColumnVector3 vAccel;

View file

@ -44,8 +44,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGActuator.cpp,v 1.29 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_ACTUATOR;
IDENT(IdSrc,"$Id: FGActuator.cpp,v 1.32 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_ACTUATOR);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -138,6 +138,16 @@ FGActuator::~FGActuator()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGActuator::ResetPastStates(void)
{
FGFCSComponent::ResetPastStates();
PreviousOutput = PreviousHystOutput = PreviousRateLimOutput
= PreviousLagInput = PreviousLagOutput = Output = 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGActuator::Run(void )
{
Input = InputNodes[0]->getDoubleValue() * InputSigns[0];

View file

@ -43,7 +43,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ACTUATOR "$Id: FGActuator.h,v 1.16 2013/11/24 11:40:56 bcoconni Exp $"
#define ID_ACTUATOR "$Id: FGActuator.h,v 1.18 2014/01/02 21:58:42 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -119,7 +119,7 @@ Example:
@endcode
@author Jon S. Berndt
@version $Revision: 1.16 $
@version $Revision: 1.18 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -138,6 +138,7 @@ public:
It calls private functions if needed to perform the hysteresis, lag,
limiting, etc. functions. */
bool Run (void);
void ResetPastStates(void);
// these may need to have the bool argument replaced with a double
/** This function fails the actuator to zero. The motion to zero

View file

@ -74,8 +74,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGAngles.cpp,v 1.2 2013/09/27 19:36:28 jberndt Exp $";
static const char *IdHdr = ID_ANGLES;
IDENT(IdSrc,"$Id: FGAngles.cpp,v 1.4 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_ANGLES);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -46,8 +46,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGDeadBand.cpp,v 1.12 2012/11/17 18:03:19 jberndt Exp $";
static const char *IdHdr = ID_DEADBAND;
IDENT(IdSrc,"$Id: FGDeadBand.cpp,v 1.14 2014/01/13 10:46:07 ehofman Exp $");
IDENT(IdHdr,ID_DEADBAND);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -48,8 +48,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGDistributor.cpp,v 1.3 2013/11/24 11:40:56 bcoconni Exp $";
static const char *IdHdr = ID_DISTRIBUTOR;
IDENT(IdSrc,"$Id: FGDistributor.cpp,v 1.5 2014/01/13 10:46:08 ehofman Exp $");
IDENT(IdHdr,ID_DISTRIBUTOR);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -48,8 +48,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGFCSComponent.cpp,v 1.37 2013/09/27 19:38:36 jberndt Exp $";
static const char *IdHdr = ID_FCSCOMPONENT;
IDENT(IdSrc,"$Id: FGFCSComponent.cpp,v 1.40 2014/01/13 10:46:08 ehofman Exp $");
IDENT(IdHdr,ID_FCSCOMPONENT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -236,6 +236,15 @@ FGFCSComponent::~FGFCSComponent()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGFCSComponent::ResetPastStates(void)
{
index = 0;
for (unsigned int i = 0; i < output_array.size(); ++i)
output_array[i] = 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGFCSComponent::SetOutput(void)
{
for (unsigned int i=0; i<OutputNodes.size(); i++) OutputNodes[i]->setDoubleValue(Output);

View file

@ -46,7 +46,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.23 2013/09/27 19:38:44 jberndt Exp $"
#define ID_FCSCOMPONENT "$Id: FGFCSComponent.h,v 1.25 2014/01/02 21:58:42 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -82,7 +82,7 @@ CLASS DOCUMENTATION
- FGAngle
@author Jon S. Berndt
@version $Id: FGFCSComponent.h,v 1.23 2013/09/27 19:38:44 jberndt Exp $
@version $Id: FGFCSComponent.h,v 1.25 2014/01/02 21:58:42 bcoconni Exp $
@see Documentation for the FGFCS class, and for the configuration file class
*/
@ -104,6 +104,7 @@ public:
std::string GetName(void) const {return Name;}
std::string GetType(void) const { return Type; }
virtual double GetOutputPct(void) const { return 0; }
virtual void ResetPastStates(void);
protected:
FGFCS* fcs;

View file

@ -47,8 +47,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGFCSFunction.cpp,v 1.13 2013/11/24 11:40:57 bcoconni Exp $";
static const char *IdHdr = ID_FCSFUNCTION;
IDENT(IdSrc,"$Id: FGFCSFunction.cpp,v 1.15 2014/01/13 10:46:08 ehofman Exp $");
IDENT(IdHdr,ID_FCSFUNCTION);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -48,8 +48,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGFilter.cpp,v 1.15 2009/10/24 22:59:30 jberndt Exp $";
static const char *IdHdr = ID_FILTER;
IDENT(IdSrc,"$Id: FGFilter.cpp,v 1.20 2014/01/13 10:46:09 ehofman Exp $");
IDENT(IdHdr,ID_FILTER);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -96,6 +96,15 @@ FGFilter::~FGFilter()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGFilter::ResetPastStates(void)
{
FGFCSComponent::ResetPastStates();
Input = 0.0; Initialize = true;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGFilter::ReadFilterCoefficients(Element* element, int index)
{
// index is known to be 1-7.

View file

@ -43,7 +43,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FILTER "$Id: FGFilter.h,v 1.13 2013/01/26 17:06:50 bcoconni Exp $"
#define ID_FILTER "$Id: FGFilter.h,v 1.14 2014/01/02 21:58:42 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -228,7 +228,7 @@ is so that the last component in a "string" can copy its value to the appropriat
output, such as the elevator, or speedbrake, etc.
@author Jon S. Berndt
@version $Revision: 1.13 $
@version $Revision: 1.14 $
*/
@ -247,7 +247,7 @@ public:
/** When true, causes previous values to be set to current values. This
is particularly useful for first pass. */
bool Initialize;
void ResetPastStates(void) {Input = 0.0; Initialize = true;}
void ResetPastStates(void);
enum {eLag, eLeadLag, eOrder2, eWashout, eIntegrator, eUnknown} FilterType;

View file

@ -47,8 +47,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGGain.cpp,v 1.23 2011/04/18 08:51:12 andgi Exp $";
static const char *IdHdr = ID_GAIN;
IDENT(IdSrc,"$Id: FGGain.cpp,v 1.25 2014/01/13 10:46:09 ehofman Exp $");
IDENT(IdHdr,ID_GAIN);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -47,8 +47,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGGyro.cpp,v 1.8 2013/11/24 11:40:57 bcoconni Exp $";
static const char *IdHdr = ID_GYRO;
IDENT(IdSrc,"$Id: FGGyro.cpp,v 1.10 2014/01/13 10:46:09 ehofman Exp $");
IDENT(IdHdr,ID_GYRO);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -46,8 +46,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGKinemat.cpp,v 1.10 2009/10/24 22:59:30 jberndt Exp $";
static const char *IdHdr = ID_FLAPS;
IDENT(IdSrc,"$Id: FGKinemat.cpp,v 1.14 2014/01/13 10:46:09 ehofman Exp $");
IDENT(IdHdr,ID_FLAPS);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -49,8 +49,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGMagnetometer.cpp,v 1.7 2013/11/24 11:40:57 bcoconni Exp $";
static const char *IdHdr = ID_MAGNETOMETER;
IDENT(IdSrc,"$Id: FGMagnetometer.cpp,v 1.9 2014/01/13 10:46:09 ehofman Exp $");
IDENT(IdHdr,ID_MAGNETOMETER);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

13
src/FDM/JSBSim/models/flight_control/FGPID.cpp Normal file → Executable file
View file

@ -44,8 +44,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGPID.cpp,v 1.21 2013/02/02 06:05:26 jberndt Exp $";
static const char *IdHdr = ID_PID;
IDENT(IdSrc,"$Id: FGPID.cpp,v 1.24 2014/01/13 10:46:09 ehofman Exp $");
IDENT(IdHdr,ID_PID);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -156,6 +156,15 @@ FGPID::~FGPID()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPID::ResetPastStates(void)
{
FGFCSComponent::ResetPastStates();
Input_prev = Input_prev2 = Output = I_out_total = 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGPID::Run(void )
{
double I_out_delta = 0.0;

6
src/FDM/JSBSim/models/flight_control/FGPID.h Normal file → Executable file
View file

@ -44,7 +44,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PID "$Id: FGPID.h,v 1.15 2013/02/02 06:05:26 jberndt Exp $"
#define ID_PID "$Id: FGPID.h,v 1.16 2014/01/02 21:58:42 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -116,7 +116,7 @@ For example,
</pre>
@author Jon S. Berndt
@version $Revision: 1.15 $
@version $Revision: 1.16 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -130,7 +130,7 @@ public:
~FGPID();
bool Run (void);
void ResetPastStates(void) {Input_prev = Input_prev2 = Output = I_out_total = 0.0;}
void ResetPastStates(void);
/// These define the indices use to select the various integrators.
enum eIntegrateType {eNone = 0, eRectEuler, eTrapezoidal, eAdamsBashforth2, eAdamsBashforth3};

13
src/FDM/JSBSim/models/flight_control/FGSensor.cpp Normal file → Executable file
View file

@ -46,8 +46,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGSensor.cpp,v 1.24 2012/11/17 18:03:19 jberndt Exp $";
static const char *IdHdr = ID_SENSOR;
IDENT(IdSrc,"$Id: FGSensor.cpp,v 1.27 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_SENSOR);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -137,6 +137,15 @@ FGSensor::~FGSensor()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGSensor::ResetPastStates(void)
{
FGFCSComponent::ResetPastStates();
PreviousOutput = PreviousInput = Output = 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGSensor::Run(void)
{
Input = InputNodes[0]->getDoubleValue() * InputSigns[0];

5
src/FDM/JSBSim/models/flight_control/FGSensor.h Normal file → Executable file
View file

@ -44,7 +44,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_SENSOR "$Id: FGSensor.h,v 1.22 2013/06/10 01:59:16 jberndt Exp $"
#define ID_SENSOR "$Id: FGSensor.h,v 1.24 2014/01/02 21:58:42 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -124,7 +124,7 @@ The delay element can specify a frame delay. The integer number provided is
the number of frames to delay the output signal.
@author Jon S. Berndt
@version $Revision: 1.22 $
@version $Revision: 1.24 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -147,6 +147,7 @@ public:
int GetQuantized(void) const {return quantized;}
virtual bool Run (void);
void ResetPastStates(void);
protected:
enum eNoiseType {ePercent=0, eAbsolute} NoiseType;

View file

@ -45,8 +45,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGSummer.cpp,v 1.8 2010/08/21 22:56:11 jberndt Exp $";
static const char *IdHdr = ID_SUMMER;
IDENT(IdSrc,"$Id: FGSummer.cpp,v 1.10 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_SUMMER);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -70,8 +70,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGSwitch.cpp,v 1.27 2013/11/24 11:40:57 bcoconni Exp $";
static const char *IdHdr = ID_SWITCH;
IDENT(IdSrc,"$Id: FGSwitch.cpp,v 1.29 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_SWITCH);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -45,8 +45,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGWaypoint.cpp,v 1.2 2013/08/30 04:44:59 jberndt Exp $";
static const char *IdHdr = ID_WAYPOINT;
IDENT(IdSrc,"$Id: FGWaypoint.cpp,v 1.5 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_WAYPOINT);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -50,8 +50,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGElectric.cpp,v 1.14 2013/11/24 11:40:57 bcoconni Exp $";
static const char *IdHdr = ID_ELECTRIC;
IDENT(IdSrc,"$Id: FGElectric.cpp,v 1.16 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_ELECTRIC);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

View file

@ -44,7 +44,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ELECTRIC "$Id: FGElectric.h,v 1.12 2013/11/24 11:40:57 bcoconni Exp $";
#define ID_ELECTRIC "$Id: FGElectric.h,v 1.12 2013/11/24 11:40:57 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS

View file

@ -54,8 +54,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGEngine.cpp,v 1.54 2013/11/24 11:40:57 bcoconni Exp $";
static const char *IdHdr = ID_ENGINE;
IDENT(IdSrc,"$Id: FGEngine.cpp,v 1.57 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_ENGINE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
@ -76,8 +76,6 @@ FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number,
MaxThrottle = 1.0;
MinThrottle = 0.0;
ResetToIC(); // initialize dynamic terms
FDMExec = exec;
PropertyManager = FDMExec->GetPropertyManager();
@ -112,6 +110,8 @@ FGEngine::FGEngine(FGFDMExec* exec, Element* engine_element, int engine_number,
cerr << "No thruster definition supplied with engine definition." << endl;
}
ResetToIC(); // initialize dynamic terms
// Load feed tank[s] references
local_element = engine_element->GetParent()->FindElement("feed");
while (local_element) {
@ -160,6 +160,7 @@ void FGEngine::ResetToIC(void)
FuelFlowRate = 0.0;
FuelFreeze = false;
FuelUsedLbs = 0.0;
Thruster->ResetToIC();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -53,7 +53,7 @@ INCLUDES
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ENGINE "$Id: FGEngine.h,v 1.38 2013/11/24 11:40:57 bcoconni Exp $"
#define ID_ENGINE "$Id: FGEngine.h,v 1.39 2013/12/22 17:14:37 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
@ -111,7 +111,7 @@ CLASS DOCUMENTATION
documentation for engine and thruster classes.
</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 $
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -184,7 +184,7 @@ public:
virtual int InitRunning(void){ return 1; }
/** Resets the Engine parameters to the initial conditions */
void ResetToIC(void);
virtual void ResetToIC(void);
/** Calculates the thrust of the engine, and other engine functions. */
virtual void Calculate(void) = 0;

View file

@ -53,8 +53,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGForce.cpp,v 1.17 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_FORCE;
IDENT(IdSrc,"$Id: FGForce.cpp,v 1.19 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_FORCE);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -46,8 +46,8 @@ using namespace std;
namespace JSBSim {
static const char *IdSrc = "$Id: FGNozzle.cpp,v 1.15 2012/03/18 15:48:35 jentron Exp $";
static const char *IdHdr = ID_NOZZLE;
IDENT(IdSrc,"$Id: FGNozzle.cpp,v 1.17 2014/01/13 10:46:10 ehofman Exp $");
IDENT(IdHdr,ID_NOZZLE);
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION

Some files were not shown because too many files have changed in this diff Show more