1
0
Fork 0

Merge branch 'next' into attenuation

This commit is contained in:
adrian 2011-12-01 13:36:53 +02:00
commit c112b8b8e1
58 changed files with 771 additions and 497 deletions

View file

@ -5,9 +5,19 @@ include (CheckCSourceCompiles)
include (CheckCXXSourceCompiles) include (CheckCXXSourceCompiles)
include (CheckIncludeFile) include (CheckIncludeFile)
project(FlightGear) project(FlightGear)
# We have some custom .cmake scripts not in the official distribution.
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
# use official include provided by latest CMake
include(GNUInstallDirs)
else(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
# backward compatibility: use our own module for older cmake versions
include(OldGNUInstallDirs)
endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows") set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
@ -18,9 +28,15 @@ file(READ version versionFile)
string(STRIP ${versionFile} FLIGHTGEAR_VERSION) string(STRIP ${versionFile} FLIGHTGEAR_VERSION)
#packaging #packaging
if(EXISTS ${PROJECT_SOURCE_DIR}/.gitignore)
file(READ .gitignore CPACK_SOURCE_IGNORE_FILES)
else()
# clean tar-balls do not contain SCM (.git/.gitignore/...) files.
set(CPACK_SOURCE_IGNORE_FILES
"^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}")
endif()
# split version string into components, note CMAKE_MATCH_0 is the entire regexp match # split version string into components, note CMAKE_MATCH_0 is the entire regexp match
file(READ .gitignore CPACK_SOURCE_IGNORE_FILES)
string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${FLIGHTGEAR_VERSION} ) string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)" CPACK_PACKAGE_VERSION ${FLIGHTGEAR_VERSION} )
set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1}) set(CPACK_PACKAGE_VERSION_MAJOR ${CMAKE_MATCH_1})
set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2}) set(CPACK_PACKAGE_VERSION_MINOR ${CMAKE_MATCH_2})
@ -30,14 +46,9 @@ SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")
set(CPACK_SOURCE_GENERATOR TBZ2 ZIP) set(CPACK_SOURCE_GENERATOR TBZ2 ZIP)
set(CPACK_SOURCE_PACKAGE_FILE_NAME "flightgear-${FLIGHTGEAR_VERSION}" CACHE INTERNAL "tarball basename") set(CPACK_SOURCE_PACKAGE_FILE_NAME "flightgear-${FLIGHTGEAR_VERSION}" CACHE INTERNAL "tarball basename")
#set(CPACK_SOURCE_IGNORE_FILES
# "^${PROJECT_SOURCE_DIR}/.git;\\\\.gitignore;Makefile.am;~$;${CPACK_SOURCE_IGNORE_FILES}")
include (CPack) include (CPack)
# We have some custom .cmake scripts not in the official distribution.
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
if (FG_DATA_DIR) if (FG_DATA_DIR)
message(STATUS "Using explicit data-dir: ${FG_DATA_DIR}") message(STATUS "Using explicit data-dir: ${FG_DATA_DIR}")
else() else()
@ -173,7 +184,7 @@ find_package(Threads REQUIRED)
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
find_package(OpenAL REQUIRED) find_package(OpenAL REQUIRED)
find_package(ALUT REQUIRED) find_package(ALUT REQUIRED)
find_package(OpenSceneGraph 2.8.1 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA) find_package(OpenSceneGraph 3.0.0 REQUIRED osgText osgSim osgDB osgParticle osgFX osgUtil osgViewer osgGA)
if(ENABLE_FGADMIN) if(ENABLE_FGADMIN)
find_package(FLTK) find_package(FLTK)
@ -304,7 +315,7 @@ set (INSTALL_DOCS
README.OSG README.OSG
README.SimGear) README.SimGear)
INSTALL(FILES ${INSTALL_DOCS} DESTINATION doc OPTIONAL) INSTALL(FILES ${INSTALL_DOCS} DESTINATION ${CMAKE_INSTALL_DOCDIR} OPTIONAL)
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
### uninstall target ### uninstall target

View file

@ -1,6 +1,8 @@
# Locate SimGear # Locate SimGear
# This module defines # This module defines
# SIMGEAR_LIBRARIES
# SIMGEAR_CORE_LIBRARIES, a list of the core static libraries
# SIMGEAR_LIBRARIES, a list of all the static libraries (core + scene)
# SIMGEAR_FOUND, if false, do not try to link to SimGear # SIMGEAR_FOUND, if false, do not try to link to SimGear
# SIMGEAR_INCLUDE_DIR, where to find the headers # SIMGEAR_INCLUDE_DIR, where to find the headers
# #
@ -23,19 +25,60 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
# Per my request, CMake should search for frameworks first in
# the following order:
# ~/Library/Frameworks/SimGear.framework/Headers
# /Library/Frameworks/SimGear.framework/Headers
# /System/Library/Frameworks/SimGear.framework/Headers
#
# On OS X, this will prefer the Framework version (if found) over others.
# People will have to manually change the cache values of
# SimGear_LIBRARIES to override this selection or set the CMake environment
# CMAKE_INCLUDE_PATH to modify the search paths.
include(SelectLibraryConfigurations) include(SelectLibraryConfigurations)
macro(find_sg_library libName varName libs)
set(libVarName "${varName}_LIBRARY")
FIND_LIBRARY(${libVarName}_DEBUG
NAMES ${libName}${CMAKE_DEBUG_POSTFIX}
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
/opt
)
FIND_LIBRARY(${libVarName}_RELEASE
NAMES ${libName}${CMAKE_RELEASE_POSTFIX}
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES ${CMAKE_INSTALL_LIBDIR} libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
/opt
)
# message(STATUS "before: Simgear ${${libVarName}_RELEASE} ")
# message(STATUS "before: Simgear ${${libVarName}_DEBUG} ")
select_library_configurations( ${varName} )
# message(STATUS "after:Simgear ${${libVarName}_RELEASE} ")
# message(STATUS "after:Simgear ${${libVarName}_DEBUG} ")
set(componentLibRelease ${${libVarName}_RELEASE})
# message(STATUS "Simgear ${libVarName}_RELEASE ${componentLibRelease}")
set(componentLibDebug ${${libVarName}_DEBUG})
# message(STATUS "Simgear ${libVarName}_DEBUG ${componentLibDebug}")
if (NOT ${libVarName}_DEBUG)
if (NOT ${libVarName}_RELEASE)
#message(STATUS "found ${componentLib}")
list(APPEND ${libs} ${componentLibRelease})
endif()
else()
list(APPEND ${libs} optimized ${componentLibRelease} debug ${componentLibDebug})
endif()
endmacro()
macro(find_sg_component comp libs)
set(compLib "sg${comp}")
string(TOUPPER "SIMGEAR_${comp}" libVar)
find_sg_library(${compLib} ${libVar} ${libs})
endmacro()
FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
HINTS $ENV{SIMGEAR_DIR} HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES include PATH_SUFFIXES include
@ -47,101 +90,63 @@ FIND_PATH(SIMGEAR_INCLUDE_DIR simgear/math/SGMath.hxx
/opt /opt
) )
message(STATUS ${SIMGEAR_INCLUDE_DIR}) # message(STATUS ${SIMGEAR_INCLUDE_DIR})
# check for dynamic framework/library
FIND_LIBRARY(SIMGEAR_LIBRARIES
NAMES simgear SimGear
HINTS
$ENV{SIMGEAR_DIR}
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/opt
)
# dependent packages # dependent packages
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
macro(find_sg_component comp libs) if(SIMGEAR_SHARED)
set(compLib "sg${comp}") message(STATUS "looking for shared Simgear libraries")
string(TOUPPER "SIMGEAR_${comp}" compLibBase)
set( compLibName ${compLibBase}_LIBRARY )
FIND_LIBRARY(${compLibName}_DEBUG find_sg_library(SimGearCore SIMGEAR_CORE SIMGEAR_CORE_LIBRARIES)
NAMES ${compLib}${CMAKE_DEBUG_POSTFIX} find_sg_library(SimGearScene SIMGEAR_SCENE SIMGEAR_LIBRARIES)
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
/opt
)
FIND_LIBRARY(${compLibName}_RELEASE
NAMES ${compLib}${CMAKE_RELEASE_POSTFIX}
HINTS $ENV{SIMGEAR_DIR}
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
PATHS
/usr/local
/usr
/opt
)
select_library_configurations( ${compLibBase} )
set(componentLibRelease ${${compLibName}_RELEASE})
#message(STATUS "Simgear ${compLibName}_RELEASE ${componentLibRelease}")
set(componentLibDebug ${${compLibName}_DEBUG})
#message(STATUS "Simgear ${compLibName}_DEBUG ${componentLibDebug}")
if (NOT ${compLibName}_DEBUG)
if (NOT ${compLibName}_RELEASE)
#message(STATUS "found ${componentLib}")
list(APPEND ${libs} ${componentLibRelease})
endif()
else()
list(APPEND ${libs} optimized ${componentLibRelease} debug ${componentLibDebug})
endif()
endmacro()
if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND") list(APPEND SIMGEAR_LIBRARIES ${SIMGEAR_CORE_LIBRARIES})
set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES "")
set(SIMGEAR_SCENE_LIBRARY_DEPENDENCIES "")
# message(STATUS "core lib ${SIMGEAR_CORE_LIBRARIES}")
# message(STATUS "all libs ${SIMGEAR_LIBRARIES}")
else(SIMGEAR_SHARED)
set(SIMGEAR_LIBRARIES "") # clear value set(SIMGEAR_LIBRARIES "") # clear value
set(SIMGEAR_CORE_LIBRARIES "") # clear value set(SIMGEAR_CORE_LIBRARIES "") # clear value
message(STATUS "looking for static Simgear libraries")
# note the order here affects the order Simgear libraries are # note the order here affects the order Simgear libraries are
# linked in, and hence ability to link when using a traditional # linked in, and hence ability to link when using a traditional
# linker such as GNU ld on Linux # linker such as GNU ld on Linux
set(comps set(comps
tsync
environment environment
nasal nasal
bucket bucket
bvh
util
route route
timing timing
io io
serial serial
sound math
structure
props props
structure
xml xml
misc misc
threads threads
debug debug
magvar magvar
math) )
set(scene_comps set(scene_comps
tsync
ephem ephem
sky sky
material material
tgdb tgdb
model model
screen) screen
bvh
util
sound)
foreach(component ${comps}) foreach(component ${comps})
find_sg_component(${component} SIMGEAR_CORE_LIBRARIES) find_sg_component(${component} SIMGEAR_CORE_LIBRARIES)
@ -151,13 +156,21 @@ if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
find_sg_component(${component} SIMGEAR_LIBRARIES) find_sg_component(${component} SIMGEAR_LIBRARIES)
endforeach() endforeach()
# again link order matters - scene libraires depend on core ones
# again link order matters - scene libraries depend on core ones
list(APPEND SIMGEAR_LIBRARIES ${SIMGEAR_CORE_LIBRARIES}) list(APPEND SIMGEAR_LIBRARIES ${SIMGEAR_CORE_LIBRARIES})
#message(STATUS "all libs ${SIMGEAR_LIBRARIES}")
set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES set(SIMGEAR_CORE_LIBRARY_DEPENDENCIES
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARY}) ${ZLIB_LIBRARY})
set(SIMGEAR_SCENE_LIBRARY_DEPENDENCIES
${ALUT_LIBRARY}
${OPENAL_LIBRARY}
${LIBSVN_LIBRARIES})
if(WIN32) if(WIN32)
list(APPEND SIMGEAR_CORE_LIBRARY_DEPENDENCIES ws2_32.lib) list(APPEND SIMGEAR_CORE_LIBRARY_DEPENDENCIES ws2_32.lib)
endif(WIN32) endif(WIN32)
@ -172,8 +185,7 @@ if(${SIMGEAR_LIBRARIES} STREQUAL "SIMGEAR_LIBRARIES-NOTFOUND")
endif(have_rt) endif(have_rt)
endif(NOT clock_gettime_in_libc) endif(NOT clock_gettime_in_libc)
endif(NOT MSVC) endif(NOT MSVC)
endif(SIMGEAR_SHARED)
endif()
# now we've found SimGear, check its version # now we've found SimGear, check its version

View file

@ -1,4 +1,10 @@
if(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
# use official include provided by latest CMake
include(GNUInstallDirs) include(GNUInstallDirs)
else(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
# backward compatibility: use our own module for older cmake versions
include(OldGNUInstallDirs)
endif(${CMAKE_VERSION} VERSION_GREATER 2.8.4)
set(MANPAGES set(MANPAGES
est-epsilon.1 est-epsilon.1

View file

@ -24,6 +24,8 @@
# include <config.h> # include <config.h>
#endif #endif
#include <string.h>
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <string> #include <string>
@ -36,6 +38,7 @@
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/scene/model/modellib.hxx> #include <simgear/scene/model/modellib.hxx>
#include <simgear/scene/util/SGNodeMasks.hxx> #include <simgear/scene/util/SGNodeMasks.hxx>
#include <simgear/sound/soundmgr_openal.hxx>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/props/props.hxx> #include <simgear/props/props.hxx>
@ -72,6 +75,8 @@ FGAIBase::FGAIBase(object_type ot, bool enableHot) :
_refID( _newAIModelID() ), _refID( _newAIModelID() ),
_otype(ot), _otype(ot),
_initialized(false), _initialized(false),
_aimodel(0),
_fxpath(""),
_fx(0) _fx(0)
{ {
@ -139,8 +144,11 @@ FGAIBase::~FGAIBase() {
if (parent) if (parent)
model_removed->setStringValue(props->getPath()); model_removed->setStringValue(props->getPath());
} }
delete _fx;
_fx = 0; if (_refID != 0 && _refID != 1) {
SGSoundMgr *smgr = globals->get_soundmgr();
smgr->remove("aifx:"+_refID);
}
delete fp; delete fp;
fp = 0; fp = 0;
@ -216,6 +224,20 @@ void FGAIBase::update(double dt) {
velocity = SGVec3d( speed_north_deg_sec, speed_east_deg_sec, pitch*speed ); velocity = SGVec3d( speed_north_deg_sec, speed_east_deg_sec, pitch*speed );
_fx->set_velocity( velocity ); _fx->set_velocity( velocity );
} }
else if (_aimodel)
{
string fxpath = _aimodel->get_sound_path();
if (fxpath != "")
{
_fxpath = fxpath;
props->setStringValue("sim/sound/path", _fxpath.c_str());
// initialize the sound configuration
SGSoundMgr *smgr = globals->get_soundmgr();
_fx = new FGFX(smgr, "aifx:"+_refID, props);
_fx->init();
}
}
} }
/** update LOD properties of the model */ /** update LOD properties of the model */
@ -285,7 +307,8 @@ bool FGAIBase::init(bool search_in_AI_path) {
else else
_installed = true; _installed = true;
osg::Node * mdl = SGModelLib::loadDeferredModel(f, props, new FGNasalModelData(props)); _aimodel = new FGAIModelData(props);
osg::Node * mdl = SGModelLib::loadDeferredModel(f, props, _aimodel);
if (_model.valid()) if (_model.valid())
{ {
@ -314,17 +337,6 @@ bool FGAIBase::init(bool search_in_AI_path) {
// Get the sound-path tag from the configuration file and store it // Get the sound-path tag from the configuration file and store it
// in the property tree. // in the property tree.
string fxpath = props->getStringValue("sim/sound/path");
if ( !fxpath.empty() )
{
props->setStringValue("sim/sound/path", fxpath.c_str());
// initialize the sound configuration
SGSoundMgr *smgr = globals->get_soundmgr();
_fx = new FGFX(smgr, "aifx:"+f, props);
_fx->init();
}
_initialized = true; _initialized = true;
} else if (!model_path.empty()) { } else if (!model_path.empty()) {
@ -884,3 +896,26 @@ int FGAIBase::_newAIModelID() {
return id; return id;
} }
FGAIModelData::FGAIModelData(SGPropertyNode *root)
: _nasal( new FGNasalModelData(root) ),
_path("")
{
}
FGAIModelData::~FGAIModelData()
{
delete _nasal;
}
void FGAIModelData::modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *n)
{
const char* fxpath = prop->getStringValue("sound/path");
if (fxpath) {
string sound_path = string(fxpath);
if (sound_path != "") {
_path = "/AI/"+sound_path;
}
}
_nasal->modelLoaded(path, prop, n);
}

View file

@ -26,6 +26,7 @@
#include <simgear/constants.h> #include <simgear/constants.h>
#include <simgear/math/SGMath.hxx> #include <simgear/math/SGMath.hxx>
#include <simgear/scene/model/placement.hxx> #include <simgear/scene/model/placement.hxx>
#include <simgear/scene/model/modellib.hxx>
#include <simgear/misc/sg_path.hxx> #include <simgear/misc/sg_path.hxx>
#include <simgear/structure/SGSharedPtr.hxx> #include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/structure/SGReferenced.hxx> #include <simgear/structure/SGReferenced.hxx>
@ -33,7 +34,6 @@
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <Main/fg_props.hxx> #include <Main/fg_props.hxx>
@ -44,6 +44,9 @@ class SGMaterial;
class FGAIManager; class FGAIManager;
class FGAIFlightPlan; class FGAIFlightPlan;
class FGFX; class FGFX;
class FGNasalModelData;
class FGAIModelData; // defined below
class FGAIBase : public SGReferenced { class FGAIBase : public SGReferenced {
@ -226,6 +229,10 @@ private:
object_type _otype; object_type _otype;
bool _initialized; bool _initialized;
osg::ref_ptr<osg::LOD> _model; //The 3D model LOD object osg::ref_ptr<osg::LOD> _model; //The 3D model LOD object
FGAIModelData* _aimodel;
string _fxpath;
SGSharedPtr<FGFX> _fx; SGSharedPtr<FGFX> _fx;
public: public:
@ -441,4 +448,17 @@ inline void FGAIBase::setMaxSpeed(double m) {
_max_speed = m; _max_speed = m;
} }
class FGAIModelData : public simgear::SGModelData {
public:
FGAIModelData(SGPropertyNode *root = 0);
~FGAIModelData();
void modelLoaded(const string& path, SGPropertyNode *prop, osg::Node *n);
inline string& get_sound_path() { return _path; };
private:
FGNasalModelData *_nasal;
string _path;
};
#endif // _FG_AIBASE_HXX #endif // _FG_AIBASE_HXX

View file

@ -55,16 +55,12 @@ public:
private: private:
FGClouds * _fgClouds; FGClouds * _fgClouds;
SGPropertyNode_ptr _shaderNode;
SGPropertyNode_ptr _enableNode; SGPropertyNode_ptr _enableNode;
}; };
FG3DCloudsListener::FG3DCloudsListener( FGClouds * fgClouds ) : FG3DCloudsListener::FG3DCloudsListener( FGClouds * fgClouds ) :
_fgClouds( fgClouds ) _fgClouds( fgClouds )
{ {
_shaderNode = fgGetNode( "/sim/rendering/shader-effects", true );
_shaderNode->addChangeListener( this );
_enableNode = fgGetNode( "/sim/rendering/clouds3d-enable", true ); _enableNode = fgGetNode( "/sim/rendering/clouds3d-enable", true );
_enableNode->addChangeListener( this ); _enableNode->addChangeListener( this );
@ -74,12 +70,11 @@ FG3DCloudsListener::FG3DCloudsListener( FGClouds * fgClouds ) :
FG3DCloudsListener::~FG3DCloudsListener() FG3DCloudsListener::~FG3DCloudsListener()
{ {
_enableNode->removeChangeListener( this ); _enableNode->removeChangeListener( this );
_shaderNode->removeChangeListener( this );
} }
void FG3DCloudsListener::valueChanged( SGPropertyNode * node ) void FG3DCloudsListener::valueChanged( SGPropertyNode * node )
{ {
_fgClouds->set_3dClouds( _enableNode->getBoolValue() && _shaderNode->getBoolValue() ); _fgClouds->set_3dClouds( _enableNode->getBoolValue() );
} }
FGEnvironmentMgr::FGEnvironmentMgr () : FGEnvironmentMgr::FGEnvironmentMgr () :

View file

@ -70,7 +70,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.118 2011/10/22 15:11:23 bcoconni Exp $"; static const char *IdSrc = "$Id: FGFDMExec.cpp,v 1.120 2011/11/10 12:06:13 jberndt Exp $";
static const char *IdHdr = ID_FDMEXEC; static const char *IdHdr = ID_FDMEXEC;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -82,10 +82,9 @@ CLASS IMPLEMENTATION
FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), FDMctr(fdmctr) FGFDMExec::FGFDMExec(FGPropertyManager* root, unsigned int* fdmctr) : Root(root), FDMctr(fdmctr)
{ {
Frame = 0; Frame = 0;
Error = 0; Error = 0;
GroundCallback = new FGDefaultGroundCallback(); SetGroundCallback(new FGDefaultGroundCallback());
IC = 0; IC = 0;
Trim = 0; Trim = 0;
Script = 0; Script = 0;
@ -186,9 +185,6 @@ FGFDMExec::~FGFDMExec()
if (FDMctr > 0) (*FDMctr)--; if (FDMctr > 0) (*FDMctr)--;
if(GroundCallback)
delete GroundCallback;
Debug(1); Debug(1);
} }
@ -213,7 +209,7 @@ bool FGFDMExec::Allocate(void)
Models[ePropulsion] = new FGPropulsion(this); Models[ePropulsion] = new FGPropulsion(this);
Models[eAerodynamics] = new FGAerodynamics (this); Models[eAerodynamics] = new FGAerodynamics (this);
GroundCallback->SetSeaLevelRadius(((FGInertial*)Models[eInertial])->GetRefRadius()); GetGroundCallback()->SetSeaLevelRadius(((FGInertial*)Models[eInertial])->GetRefRadius());
Models[eGroundReactions] = new FGGroundReactions(this); Models[eGroundReactions] = new FGGroundReactions(this);
Models[eExternalReactions] = new FGExternalReactions(this); Models[eExternalReactions] = new FGExternalReactions(this);
@ -616,14 +612,6 @@ string FGFDMExec::GetOutputFileName(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGFDMExec::SetGroundCallback(FGGroundCallback* p)
{
delete GroundCallback;
GroundCallback = p;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
vector <string> FGFDMExec::EnumerateFDMs(void) vector <string> FGFDMExec::EnumerateFDMs(void)
{ {
vector <string> FDMList; vector <string> FDMList;

View file

@ -47,7 +47,6 @@ INCLUDES
#include "initialization/FGTrim.h" #include "initialization/FGTrim.h"
#include "FGJSBBase.h" #include "FGJSBBase.h"
#include "input_output/FGPropertyManager.h" #include "input_output/FGPropertyManager.h"
#include "input_output/FGGroundCallback.h"
#include "input_output/FGXMLFileRead.h" #include "input_output/FGXMLFileRead.h"
#include "models/FGPropagate.h" #include "models/FGPropagate.h"
#include "math/FGColumnVector3.h" #include "math/FGColumnVector3.h"
@ -56,7 +55,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.72 2011/10/14 22:46:49 bcoconni Exp $" #define ID_FDMEXEC "$Id: FGFDMExec.h,v 1.74 2011/11/09 21:58:26 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -181,7 +180,7 @@ CLASS DOCUMENTATION
property actually maps toa function call of DoTrim(). property actually maps toa function call of DoTrim().
@author Jon S. Berndt @author Jon S. Berndt
@version $Revision: 1.72 $ @version $Revision: 1.74 $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -268,10 +267,14 @@ public:
@return true if successful */ @return true if successful */
bool RunIC(void); bool RunIC(void);
/** Sets the ground callback pointer. /** Sets the ground callback pointer. For optimal memory management, a shared
@param gc A pointer to a ground callback object. pointer is used internally that maintains a reference counter. The calling
application must therefore use FGGroundCallback_ptr 'smart pointers' to
manage their copy of the ground callback.
@param gc A pointer to a ground callback object
@see FGGroundCallback
*/ */
void SetGroundCallback(FGGroundCallback* gc); void SetGroundCallback(FGGroundCallback* gc) { FGLocation::SetGroundCallback(gc); }
/** Loads an aircraft model. /** Loads an aircraft model.
@param AircraftPath path to the aircraft/ directory. For instance: @param AircraftPath path to the aircraft/ directory. For instance:
@ -328,7 +331,7 @@ public:
bool SetSystemsPath(const string& path) { SystemsPath = RootDir + path; return true; } bool SetSystemsPath(const string& path) { SystemsPath = RootDir + path; return true; }
/// @name Top-level executive State and Model retrieval mechanism /// @name Top-level executive State and Model retrieval mechanism
//@{ ///@{
/// Returns the FGAtmosphere pointer. /// Returns the FGAtmosphere pointer.
FGAtmosphere* GetAtmosphere(void) {return (FGAtmosphere*)Models[eAtmosphere];} FGAtmosphere* GetAtmosphere(void) {return (FGAtmosphere*)Models[eAtmosphere];}
/// Returns the FGAccelerations pointer. /// Returns the FGAccelerations pointer.
@ -359,15 +362,19 @@ public:
FGAuxiliary* GetAuxiliary(void) {return (FGAuxiliary*)Models[eAuxiliary];} FGAuxiliary* GetAuxiliary(void) {return (FGAuxiliary*)Models[eAuxiliary];}
/// Returns the FGInput pointer. /// Returns the FGInput pointer.
FGInput* GetInput(void) {return (FGInput*)Models[eInput];} FGInput* GetInput(void) {return (FGInput*)Models[eInput];}
/// Returns the FGGroundCallback pointer. /** Get a pointer to the ground callback currently used. It is recommanded
FGGroundCallback* GetGroundCallback(void) {return GroundCallback;} to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
@return A pointer to the current ground callback object.
@see FGGroundCallback
*/
FGGroundCallback* GetGroundCallback(void) {return FGLocation::GetGroundCallback();}
/// Retrieves the script object /// Retrieves the script object
FGScript* GetScript(void) {return Script;} FGScript* GetScript(void) {return Script;}
// Returns a pointer to the FGInitialCondition object /// Returns a pointer to the FGInitialCondition object
FGInitialCondition* GetIC(void) {return IC;} FGInitialCondition* GetIC(void) {return IC;}
// Returns a pointer to the FGTrim object /// Returns a pointer to the FGTrim object
FGTrim* GetTrim(void); FGTrim* GetTrim(void);
//@} ///@}
/// Retrieves the engine path. /// Retrieves the engine path.
const string& GetEnginePath(void) {return EnginePath;} const string& GetEnginePath(void) {return EnginePath;}
@ -391,7 +398,7 @@ public:
} }
/// Returns the model name. /// Returns the model name.
const string& GetModelName(void) { return modelName; } const string& GetModelName(void) const { return modelName; }
/* /*
/// Returns the current time. /// Returns the current time.
double GetSimTime(void); double GetSimTime(void);
@ -404,9 +411,9 @@ public:
/// Returns a vector of strings representing the names of all loaded models (future) /// Returns a vector of strings representing the names of all loaded models (future)
vector <string> EnumerateFDMs(void); vector <string> EnumerateFDMs(void);
/// Gets the number of child FDMs. /// Gets the number of child FDMs.
int GetFDMCount(void) {return (int)ChildFDMList.size();} int GetFDMCount(void) const {return (int)ChildFDMList.size();}
/// Gets a particular child FDM. /// Gets a particular child FDM.
childData* GetChildFDM(int i) {return ChildFDMList[i];} childData* GetChildFDM(int i) const {return ChildFDMList[i];}
/// Marks this instance of the Exec object as a "child" object. /// Marks this instance of the Exec object as a "child" object.
void SetChild(bool ch) {IsChild = ch;} void SetChild(bool ch) {IsChild = ch;}
@ -503,7 +510,7 @@ public:
double GetSimTime(void) const { return sim_time; } double GetSimTime(void) const { return sim_time; }
/// Returns the simulation delta T. /// Returns the simulation delta T.
double GetDeltaT(void) {return dT;} double GetDeltaT(void) const {return dT;}
/// Suspends the simulation and sets the delta T to zero. /// Suspends the simulation and sets the delta T to zero.
void SuspendIntegration(void) {saved_dT = dT; dT = 0.0;} void SuspendIntegration(void) {saved_dT = dT; dT = 0.0;}
@ -513,7 +520,7 @@ public:
/** Returns the simulation suspension state. /** Returns the simulation suspension state.
@return true if suspended, false if executing */ @return true if suspended, false if executing */
bool IntegrationSuspended(void) {return dT == 0.0;} bool IntegrationSuspended(void) const {return dT == 0.0;}
/** Sets the current sim time. /** Sets the current sim time.
@param cur_time the current time @param cur_time the current time
@ -588,7 +595,6 @@ private:
bool trim_status; bool trim_status;
int ta_mode; int ta_mode;
FGGroundCallback* GroundCallback;
FGScript* Script; FGScript* Script;
FGInitialCondition* IC; FGInitialCondition* IC;
FGTrim* Trim; FGTrim* Trim;

View file

@ -63,7 +63,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.75 2011/10/23 15:05:32 bcoconni Exp $"; static const char *IdSrc = "$Id: FGInitialCondition.cpp,v 1.78 2011/11/09 21:57:51 bcoconni Exp $";
static const char *IdHdr = ID_INITIALCONDITION; static const char *IdHdr = ID_INITIALCONDITION;
//****************************************************************************** //******************************************************************************
@ -109,13 +109,16 @@ void FGInitialCondition::ResetIC(double u0, double v0, double w0,
vPQR_body = FGColumnVector3(p0, q0, r0); vPQR_body = FGColumnVector3(p0, q0, r0);
alpha = alpha0; beta = beta0; alpha = alpha0; beta = beta0;
position.SetPosition(lonRad0, latRad0, altAGLFt0 + terrain_elevation + sea_level_radius); position.SetLongitude(lonRad0);
position.SetLatitude(latRad0);
position.SetAltitudeAGL(altAGLFt0, fdmex->GetSimTime());
orientation = FGQuaternion(phi0, theta0, psi0); orientation = FGQuaternion(phi0, theta0, psi0);
const FGMatrix33& Tb2l = orientation.GetTInv(); const FGMatrix33& Tb2l = orientation.GetTInv();
vUVW_NED = Tb2l * FGColumnVector3(u0, v0, w0); vUVW_NED = Tb2l * FGColumnVector3(u0, v0, w0);
vt = vUVW_NED.Magnitude(); vt = vUVW_NED.Magnitude();
lastSpeedSet = setuvw;
Tw2b = FGMatrix33(calpha*cbeta, -calpha*sbeta, -salpha, Tw2b = FGMatrix33(calpha*cbeta, -calpha*sbeta, -salpha,
sbeta, cbeta, 0.0, sbeta, cbeta, 0.0,
@ -130,11 +133,12 @@ void FGInitialCondition::ResetIC(double u0, double v0, double w0,
void FGInitialCondition::InitializeIC(void) void FGInitialCondition::InitializeIC(void)
{ {
alpha=beta=0; alpha=beta=0;
terrain_elevation = 0;
sea_level_radius = fdmex->GetInertial()->GetRefRadius();
position.SetEllipse(fdmex->GetInertial()->GetSemimajor(), fdmex->GetInertial()->GetSemiminor()); position.SetEllipse(fdmex->GetInertial()->GetSemimajor(), fdmex->GetInertial()->GetSemiminor());
position.SetPosition(0., 0., sea_level_radius);
position.SetPositionGeodetic(0.0, 0.0, 0.0);
position.SetEarthPositionAngle(fdmex->GetPropagate()->GetEarthPositionAngle()); position.SetEarthPositionAngle(fdmex->GetPropagate()->GetEarthPositionAngle());
orientation = FGQuaternion(0.0, 0.0, 0.0); orientation = FGQuaternion(0.0, 0.0, 0.0);
vUVW_NED.InitMatrix(); vUVW_NED.InitMatrix();
vPQR_body.InitMatrix(); vPQR_body.InitMatrix();
@ -144,6 +148,9 @@ void FGInitialCondition::InitializeIC(void)
Tw2b.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.); Tw2b.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
Tb2w.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.); Tb2w.InitMatrix(1., 0., 0., 0., 1., 0., 0., 0., 1.);
lastSpeedSet = setvt;
lastAltitudeSet = setasl;
} }
//****************************************************************************** //******************************************************************************
@ -185,7 +192,7 @@ void FGInitialCondition::WriteStateFile(int num)
void FGInitialCondition::SetVequivalentKtsIC(double ve) void FGInitialCondition::SetVequivalentKtsIC(double ve)
{ {
double altitudeASL = position.GetRadius() - sea_level_radius; double altitudeASL = position.GetAltitudeASL();
double rho = Atmosphere->GetDensity(altitudeASL); double rho = Atmosphere->GetDensity(altitudeASL);
double rhoSL = Atmosphere->GetDensitySL(); double rhoSL = Atmosphere->GetDensitySL();
SetVtrueFpsIC(ve*ktstofps*sqrt(rhoSL/rho)); SetVtrueFpsIC(ve*ktstofps*sqrt(rhoSL/rho));
@ -196,7 +203,7 @@ void FGInitialCondition::SetVequivalentKtsIC(double ve)
void FGInitialCondition::SetMachIC(double mach) void FGInitialCondition::SetMachIC(double mach)
{ {
double altitudeASL = position.GetRadius() - sea_level_radius; double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL); double temperature = Atmosphere->GetTemperature(altitudeASL);
double soundSpeed = sqrt(SHRatio*Reng*temperature); double soundSpeed = sqrt(SHRatio*Reng*temperature);
SetVtrueFpsIC(mach*soundSpeed); SetVtrueFpsIC(mach*soundSpeed);
@ -207,7 +214,7 @@ void FGInitialCondition::SetMachIC(double mach)
void FGInitialCondition::SetVcalibratedKtsIC(double vcas) void FGInitialCondition::SetVcalibratedKtsIC(double vcas)
{ {
double altitudeASL = position.GetRadius() - sea_level_radius; double altitudeASL = position.GetAltitudeASL();
double pressure = Atmosphere->GetPressure(altitudeASL); double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL(); double pressureSL = Atmosphere->GetPressureSL();
double rhoSL = Atmosphere->GetDensitySL(); double rhoSL = Atmosphere->GetDensitySL();
@ -671,6 +678,49 @@ void FGInitialCondition::SetWindDirDegIC(double dir)
calcAeroAngles(_vt_NED); calcAeroAngles(_vt_NED);
} }
//******************************************************************************
void FGInitialCondition::SetSeaLevelRadiusFtIC(double slr)
{
fdmex->GetGroundCallback()->SetSeaLevelRadius(slr);
}
//******************************************************************************
void FGInitialCondition::SetTerrainElevationFtIC(double elev)
{
double agl = GetAltitudeAGLFtIC();
fdmex->GetGroundCallback()->SetTerrainGeoCentRadius(elev + position.GetSeaLevelRadius());
if (lastAltitudeSet == setagl)
SetAltitudeAGLFtIC(agl);
}
//******************************************************************************
double FGInitialCondition::GetAltitudeAGLFtIC(void) const
{
return position.GetAltitudeAGL(fdmex->GetSimTime());
}
//******************************************************************************
double FGInitialCondition::GetTerrainElevationFtIC(void) const
{
return position.GetTerrainRadius(fdmex->GetSimTime())
- position.GetSeaLevelRadius();
}
//******************************************************************************
void FGInitialCondition::SetAltitudeAGLFtIC(double agl)
{
double terrainElevation = position.GetTerrainRadius(fdmex->GetSimTime()) - position.GetSeaLevelRadius();
SetAltitudeASLFtIC(agl + terrainElevation);
lastAltitudeSet = setagl;
}
//****************************************************************************** //******************************************************************************
// Set the altitude SL. If the airspeed has been previously set with parameters // Set the altitude SL. If the airspeed has been previously set with parameters
// that are atmosphere dependent (Mach, VCAS, VEAS) then the true airspeed is // that are atmosphere dependent (Mach, VCAS, VEAS) then the true airspeed is
@ -678,7 +728,7 @@ void FGInitialCondition::SetWindDirDegIC(double dir)
void FGInitialCondition::SetAltitudeASLFtIC(double alt) void FGInitialCondition::SetAltitudeASLFtIC(double alt)
{ {
double altitudeASL = position.GetRadius() - sea_level_radius; double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL); double temperature = Atmosphere->GetTemperature(altitudeASL);
double pressure = Atmosphere->GetPressure(altitudeASL); double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL(); double pressureSL = Atmosphere->GetPressureSL();
@ -691,7 +741,7 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
double ve0 = vt * sqrt(rho/rhoSL); double ve0 = vt * sqrt(rho/rhoSL);
altitudeASL=alt; altitudeASL=alt;
position.SetRadius(alt + sea_level_radius); position.SetAltitudeASL(alt);
temperature = Atmosphere->GetTemperature(altitudeASL); temperature = Atmosphere->GetTemperature(altitudeASL);
soundSpeed = sqrt(SHRatio*Reng*temperature); soundSpeed = sqrt(SHRatio*Reng*temperature);
@ -712,6 +762,47 @@ void FGInitialCondition::SetAltitudeASLFtIC(double alt)
default: // Make the compiler stop complaining about missing enums default: // Make the compiler stop complaining about missing enums
break; break;
} }
lastAltitudeSet = setasl;
}
//******************************************************************************
void FGInitialCondition::SetLatitudeRadIC(double lat)
{
double altitude;
switch(lastAltitudeSet) {
case setagl:
altitude = GetAltitudeAGLFtIC();
position.SetLatitude(lat);
SetAltitudeAGLFtIC(altitude);
break;
default:
altitude = position.GetAltitudeASL();
position.SetLatitude(lat);
position.SetAltitudeASL(altitude);
}
}
//******************************************************************************
void FGInitialCondition::SetLongitudeRadIC(double lon)
{
double altitude;
switch(lastAltitudeSet) {
case setagl:
altitude = GetAltitudeAGLFtIC();
position.SetLongitude(lon);
SetAltitudeAGLFtIC(altitude);
break;
default:
altitude = position.GetAltitudeASL();
position.SetLongitude(lon);
position.SetAltitudeASL(altitude);
break;
}
} }
//****************************************************************************** //******************************************************************************
@ -764,7 +855,7 @@ double FGInitialCondition::GetBodyWindFpsIC(int idx) const
double FGInitialCondition::GetVcalibratedKtsIC(void) const double FGInitialCondition::GetVcalibratedKtsIC(void) const
{ {
double altitudeASL = position.GetRadius() - sea_level_radius; double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL); double temperature = Atmosphere->GetTemperature(altitudeASL);
double pressure = Atmosphere->GetPressure(altitudeASL); double pressure = Atmosphere->GetPressure(altitudeASL);
double pressureSL = Atmosphere->GetPressureSL(); double pressureSL = Atmosphere->GetPressureSL();
@ -778,7 +869,7 @@ double FGInitialCondition::GetVcalibratedKtsIC(void) const
double FGInitialCondition::GetVequivalentKtsIC(void) const double FGInitialCondition::GetVequivalentKtsIC(void) const
{ {
double altitudeASL = position.GetRadius() - sea_level_radius; double altitudeASL = position.GetAltitudeASL();
double rho = Atmosphere->GetDensity(altitudeASL); double rho = Atmosphere->GetDensity(altitudeASL);
double rhoSL = Atmosphere->GetDensitySL(); double rhoSL = Atmosphere->GetDensitySL();
return fpstokts * vt * sqrt(rho/rhoSL); return fpstokts * vt * sqrt(rho/rhoSL);
@ -788,7 +879,7 @@ double FGInitialCondition::GetVequivalentKtsIC(void) const
double FGInitialCondition::GetMachIC(void) const double FGInitialCondition::GetMachIC(void) const
{ {
double altitudeASL = position.GetRadius() - sea_level_radius; double altitudeASL = position.GetAltitudeASL();
double temperature = Atmosphere->GetTemperature(altitudeASL); double temperature = Atmosphere->GetTemperature(altitudeASL);
double soundSpeed = sqrt(SHRatio*Reng*temperature); double soundSpeed = sqrt(SHRatio*Reng*temperature);
return vt / soundSpeed; return vt / soundSpeed;
@ -868,18 +959,18 @@ bool FGInitialCondition::Load_v1(void)
bool result = true; bool result = true;
if (document->FindElement("latitude")) if (document->FindElement("latitude"))
position.SetLatitude(document->FindElementValueAsNumberConvertTo("latitude", "RAD")); SetLatitudeRadIC(document->FindElementValueAsNumberConvertTo("latitude", "RAD"));
if (document->FindElement("longitude")) if (document->FindElement("longitude"))
position.SetLongitude(document->FindElementValueAsNumberConvertTo("longitude", "RAD")); SetLongitudeRadIC(document->FindElementValueAsNumberConvertTo("longitude", "RAD"));
if (document->FindElement("elevation")) if (document->FindElement("elevation"))
terrain_elevation = document->FindElementValueAsNumberConvertTo("elevation", "FT"); SetTerrainElevationFtIC(document->FindElementValueAsNumberConvertTo("elevation", "FT"));
if (document->FindElement("altitude")) // This is feet above ground level if (document->FindElement("altitude")) // This is feet above ground level
position.SetRadius(document->FindElementValueAsNumberConvertTo("altitude", "FT") + terrain_elevation + sea_level_radius); SetAltitudeAGLFtIC(document->FindElementValueAsNumberConvertTo("altitude", "FT"));
else if (document->FindElement("altitudeAGL")) // This is feet above ground level else if (document->FindElement("altitudeAGL")) // This is feet above ground level
position.SetRadius(document->FindElementValueAsNumberConvertTo("altitudeAGL", "FT") + terrain_elevation + sea_level_radius); SetAltitudeAGLFtIC(document->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"));
else if (document->FindElement("altitudeMSL")) // This is feet above sea level else if (document->FindElement("altitudeMSL")) // This is feet above sea level
position.SetRadius(document->FindElementValueAsNumberConvertTo("altitudeMSL", "FT") + sea_level_radius); SetAltitudeASLFtIC(document->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
FGColumnVector3 vOrient = orientation.GetEuler(); FGColumnVector3 vOrient = orientation.GetEuler();
@ -957,9 +1048,6 @@ bool FGInitialCondition::Load_v2(void)
if (document->FindElement("earth_position_angle")) if (document->FindElement("earth_position_angle"))
position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("earth_position_angle", "RAD")); position.SetEarthPositionAngle(document->FindElementValueAsNumberConvertTo("earth_position_angle", "RAD"));
if (document->FindElement("elevation"))
terrain_elevation = document->FindElementValueAsNumberConvertTo("elevation", "FT");
// Initialize vehicle position // Initialize vehicle position
// //
// Allowable frames: // Allowable frames:
@ -974,20 +1062,25 @@ bool FGInitialCondition::Load_v2(void)
position = position.GetTi2ec() * position_el->FindElementTripletConvertTo("FT"); position = position.GetTi2ec() * position_el->FindElementTripletConvertTo("FT");
} else if (frame == "ecef") { } else if (frame == "ecef") {
if (!position_el->FindElement("x") && !position_el->FindElement("y") && !position_el->FindElement("z")) { if (!position_el->FindElement("x") && !position_el->FindElement("y") && !position_el->FindElement("z")) {
if (position_el->FindElement("longitude"))
position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD"));
if (position_el->FindElement("latitude"))
position.SetLatitude(position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"));
if (position_el->FindElement("radius")) { if (position_el->FindElement("radius")) {
position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT")); position.SetRadius(position_el->FindElementValueAsNumberConvertTo("radius", "FT"));
} else if (position_el->FindElement("altitudeAGL")) { } else if (position_el->FindElement("altitudeAGL")) {
position.SetRadius(sea_level_radius + terrain_elevation + position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT")); position.SetAltitudeAGL(position_el->FindElementValueAsNumberConvertTo("altitudeAGL", "FT"),
fdmex->GetSimTime());
} else if (position_el->FindElement("altitudeMSL")) { } else if (position_el->FindElement("altitudeMSL")) {
position.SetRadius(sea_level_radius + position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT")); position.SetAltitudeASL(position_el->FindElementValueAsNumberConvertTo("altitudeMSL", "FT"));
} else { } else {
cerr << endl << " No altitude or radius initial condition is given." << endl; cerr << endl << " No altitude or radius initial condition is given." << endl;
result = false; result = false;
} }
if (position_el->FindElement("longitude"))
position.SetLongitude(position_el->FindElementValueAsNumberConvertTo("longitude", "RAD"));
if (position_el->FindElement("latitude"))
position.SetLatitude(position_el->FindElementValueAsNumberConvertTo("latitude", "RAD"));
} else { } else {
position = position_el->FindElementTripletConvertTo("FT"); position = position_el->FindElementTripletConvertTo("FT");
} }
@ -1000,6 +1093,9 @@ bool FGInitialCondition::Load_v2(void)
result = false; result = false;
} }
if (document->FindElement("elevation"))
fdmex->GetGroundCallback()->SetTerrainGeoCentRadius(document->FindElementValueAsNumberConvertTo("elevation", "FT")+position.GetSeaLevelRadius());
// End of position initialization // End of position initialization
// Initialize vehicle orientation // Initialize vehicle orientation
@ -1101,8 +1197,10 @@ bool FGInitialCondition::Load_v2(void)
if (frame == "eci") { if (frame == "eci") {
FGColumnVector3 omega_cross_r = vOmegaEarth * (position.GetTec2i() * position); FGColumnVector3 omega_cross_r = vOmegaEarth * (position.GetTec2i() * position);
vUVW_NED = mTec2l * (vInitVelocity - omega_cross_r); vUVW_NED = mTec2l * (vInitVelocity - omega_cross_r);
lastSpeedSet = setned;
} else if (frame == "ecef") { } else if (frame == "ecef") {
vUVW_NED = mTec2l * vInitVelocity; vUVW_NED = mTec2l * vInitVelocity;
lastSpeedSet = setned;
} else if (frame == "local") { } else if (frame == "local") {
vUVW_NED = vInitVelocity; vUVW_NED = vInitVelocity;
lastSpeedSet = setned; lastSpeedSet = setned;

View file

@ -54,7 +54,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.31 2011/10/23 15:05:32 bcoconni Exp $" #define ID_INITIALCONDITION "$Id: FGInitialCondition.h,v 1.32 2011/11/06 18:14:51 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -68,6 +68,7 @@ class FGColumnVector3;
class FGAtmosphere; class FGAtmosphere;
typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset; typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
typedef enum { setasl, setagl} altitudeset;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION CLASS DOCUMENTATION
@ -214,7 +215,7 @@ CLASS DOCUMENTATION
@property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second @property ic/r-rad_sec (read/write) Yaw rate initial condition in radians/second
@author Tony Peden @author Tony Peden
@version "$Id: FGInitialCondition.h,v 1.31 2011/10/23 15:05:32 bcoconni Exp $" @version "$Id: FGInitialCondition.h,v 1.32 2011/11/06 18:14:51 bcoconni Exp $"
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -291,24 +292,23 @@ public:
/** Sets the initial Altitude above ground level. /** Sets the initial Altitude above ground level.
@param agl Altitude above ground level in feet */ @param agl Altitude above ground level in feet */
void SetAltitudeAGLFtIC(double agl) void SetAltitudeAGLFtIC(double agl);
{ SetAltitudeASLFtIC(terrain_elevation + agl); }
/** Sets the initial sea level radius from planet center /** Sets the initial sea level radius from planet center
@param sl_rad sea level radius in feet */ @param sl_rad sea level radius in feet */
void SetSeaLevelRadiusFtIC(double sl_rad) { sea_level_radius = sl_rad; } void SetSeaLevelRadiusFtIC(double slr);
/** Sets the initial terrain elevation. /** Sets the initial terrain elevation.
@param elev Initial terrain elevation in feet */ @param elev Initial terrain elevation in feet */
void SetTerrainElevationFtIC(double elev) { terrain_elevation = elev; } void SetTerrainElevationFtIC(double elev);
/** Sets the initial latitude. /** Sets the initial latitude.
@param lat Initial latitude in degrees */ @param lat Initial latitude in degrees */
void SetLatitudeDegIC(double lat) { position.SetLatitude(lat*degtorad); } void SetLatitudeDegIC(double lat) { SetLatitudeRadIC(lat*degtorad); }
/** Sets the initial longitude. /** Sets the initial longitude.
@param lon Initial longitude in degrees */ @param lon Initial longitude in degrees */
void SetLongitudeDegIC(double lon) { position.SetLongitude(lon*degtorad); } void SetLongitudeDegIC(double lon) { SetLongitudeRadIC(lon*degtorad); }
/** Gets the initial calibrated airspeed. /** Gets the initial calibrated airspeed.
@return Initial calibrated airspeed in knots */ @return Initial calibrated airspeed in knots */
@ -370,15 +370,15 @@ public:
/** Gets the initial altitude above sea level. /** Gets the initial altitude above sea level.
@return Initial altitude in feet. */ @return Initial altitude in feet. */
double GetAltitudeASLFtIC(void) const { return position.GetRadius() - sea_level_radius; } double GetAltitudeASLFtIC(void) const { return position.GetAltitudeASL(); }
/** Gets the initial altitude above ground level. /** Gets the initial altitude above ground level.
@return Initial altitude AGL in feet */ @return Initial altitude AGL in feet */
double GetAltitudeAGLFtIC(void) const { return position.GetRadius() - sea_level_radius - terrain_elevation; } double GetAltitudeAGLFtIC(void) const;
/** Gets the initial terrain elevation. /** Gets the initial terrain elevation.
@return Initial terrain elevation in feet */ @return Initial terrain elevation in feet */
double GetTerrainElevationFtIC(void) const { return terrain_elevation; } double GetTerrainElevationFtIC(void) const;
/** Sets the initial ground speed. /** Sets the initial ground speed.
@param vg Initial ground speed in feet/second */ @param vg Initial ground speed in feet/second */
@ -585,11 +585,11 @@ public:
/** Sets the initial latitude. /** Sets the initial latitude.
@param lat Initial latitude in radians */ @param lat Initial latitude in radians */
void SetLatitudeRadIC(double lat) { position.SetLatitude(lat); } void SetLatitudeRadIC(double lat);
/** Sets the initial longitude. /** Sets the initial longitude.
@param lon Initial longitude in radians */ @param lon Initial longitude in radians */
void SetLongitudeRadIC(double lon) { position.SetLongitude(lon); } void SetLongitudeRadIC(double lon);
/** Sets the target normal load factor. /** Sets the target normal load factor.
@param nlf Normal load factor*/ @param nlf Normal load factor*/
@ -665,14 +665,14 @@ private:
FGLocation position; FGLocation position;
FGQuaternion orientation; FGQuaternion orientation;
double vt; double vt;
double sea_level_radius;
double terrain_elevation;
double targetNlfIC; double targetNlfIC;
FGMatrix33 Tw2b, Tb2w; FGMatrix33 Tw2b, Tb2w;
double alpha, beta; double alpha, beta;
speedset lastSpeedSet; speedset lastSpeedSet;
altitudeset lastAltitudeSet;
FGFDMExec *fdmex; FGFDMExec *fdmex;
FGPropertyManager *PropertyManager; FGPropertyManager *PropertyManager;

View file

@ -54,7 +54,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGTrim.cpp,v 1.15 2011/02/19 16:29:29 bcoconni Exp $"; static const char *IdSrc = "$Id: FGTrim.cpp,v 1.16 2011/11/10 12:06:13 jberndt Exp $";
static const char *IdHdr = ID_TRIM; static const char *IdHdr = ID_TRIM;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -38,17 +38,21 @@ SENTRY
INCLUDES INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "math/FGColumnVector3.h" #include "FGJSBBase.h"
#include "math/FGLocation.h" #include "simgear/structure/SGReferenced.hxx"
#include "simgear/structure/SGSharedPtr.hxx"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $" #define ID_GROUNDCALLBACK "$Id: FGGroundCallback.h,v 1.15 2011/11/19 14:14:57 bcoconni Exp $"
namespace JSBSim { namespace JSBSim {
class FGLocation;
class FGColumnVector3;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@ -59,14 +63,14 @@ CLASS DOCUMENTATION
ball formed earth with an adjustable terrain elevation. ball formed earth with an adjustable terrain elevation.
@author Mathias Froehlich @author Mathias Froehlich
@version $Id: FGGroundCallback.h,v 1.12 2011/10/14 22:46:49 bcoconni Exp $ @version $Id: FGGroundCallback.h,v 1.15 2011/11/19 14:14:57 bcoconni Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGGroundCallback : public FGJSBBase class FGGroundCallback : public FGJSBBase, public SGReferenced
{ {
public: public:
@ -119,6 +123,8 @@ public:
}; };
typedef SGSharedPtr<FGGroundCallback> FGGroundCallback_ptr;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// The default sphere earth implementation: // The default sphere earth implementation:
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

2
src/FDM/JSBSim/input_output/FGScript.cpp Normal file → Executable file
View file

@ -55,7 +55,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGScript.cpp,v 1.48 2011/09/07 02:36:04 jberndt Exp $"; static const char *IdSrc = "$Id: FGScript.cpp,v 1.49 2011/11/10 12:06:14 jberndt Exp $";
static const char *IdHdr = ID_FGSCRIPT; static const char *IdHdr = ID_FGSCRIPT;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -45,7 +45,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGCondition.cpp,v 1.14 2011/04/05 20:20:21 andgi Exp $"; static const char *IdSrc = "$Id: FGCondition.cpp,v 1.16 2011/11/10 12:06:14 jberndt Exp $";
static const char *IdHdr = ID_CONDITION; static const char *IdHdr = ID_CONDITION;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -7,6 +7,7 @@
------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------------ ------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------------
------- (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) ---- ------- (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) ----
------- (C) 2011 Ola Røer Thorsen (ola@silentwings.no) -----------
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU Lesser General Public License as published by the Free Software
@ -33,6 +34,8 @@ It has vector properties, so you can add multiply ....
HISTORY HISTORY
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
04/04/2004 MF Created 04/04/2004 MF Created
11/01/2011 ORT Encapsulated ground callback code in FGLocation and removed
it from FGFDMExec.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES INCLUDES
@ -45,10 +48,14 @@ INCLUDES
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGLocation.cpp,v 1.25 2011/10/16 00:19:56 bcoconni Exp $"; static const char *IdSrc = "$Id: FGLocation.cpp,v 1.26 2011/11/06 18:14:51 bcoconni Exp $";
static const char *IdHdr = ID_LOCATION; static const char *IdHdr = ID_LOCATION;
using std::cerr; using std::cerr;
using std::endl; using std::endl;
// Set up the default ground callback object.
FGGroundCallback_ptr FGLocation::GroundCallback = NULL;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/

View file

@ -6,6 +6,7 @@
------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------------ ------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) ------------------
------- (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) ---- ------- (C) 2004 Mathias Froehlich (Mathias.Froehlich@web.de) ----
------- (C) 2011 Ola Røer Thorsen (ola@silentwings.no) -----------
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU Lesser General Public License as published by the Free Software
@ -27,6 +28,8 @@
HISTORY HISTORY
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
04/04/2004 MF Created from code previously in the old positions class. 04/04/2004 MF Created from code previously in the old positions class.
11/01/2011 ORT Encapsulated ground callback code in FGLocation and removed
it from FGFDMExec.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY SENTRY
@ -43,12 +46,13 @@ INCLUDES
#include "input_output/FGPropertyManager.h" #include "input_output/FGPropertyManager.h"
#include "FGColumnVector3.h" #include "FGColumnVector3.h"
#include "FGMatrix33.h" #include "FGMatrix33.h"
#include "input_output/FGGroundCallback.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_LOCATION "$Id: FGLocation.h,v 1.28 2011/08/04 12:46:32 jberndt Exp $" #define ID_LOCATION "$Id: FGLocation.h,v 1.29 2011/11/06 18:14:51 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -142,7 +146,7 @@ CLASS DOCUMENTATION
@see W. C. Durham "Aircraft Dynamics & Control", section 2.2 @see W. C. Durham "Aircraft Dynamics & Control", section 2.2
@author Mathias Froehlich @author Mathias Froehlich
@version $Id: FGLocation.h,v 1.28 2011/08/04 12:46:32 jberndt Exp $ @version $Id: FGLocation.h,v 1.29 2011/11/06 18:14:51 bcoconni Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -306,6 +310,70 @@ public:
//double GetRadius() const { return mECLoc.Magnitude(); } // may not work with FlightGear //double GetRadius() const { return mECLoc.Magnitude(); } // may not work with FlightGear
double GetRadius() const { ComputeDerived(); return mRadius; } double GetRadius() const { ComputeDerived(); return mRadius; }
/// @name Functions that need the ground callback to be set
///@{
/** Set the altitude above sea level.
@param altitudeASL altitude above Sea Level in feet. */
void SetAltitudeASL(double altitudeASL)
{ SetRadius(GroundCallback->GetSeaLevelRadius(*this) + altitudeASL); }
/** Set the altitude above ground level.
@param altitudeAGL altitude above Ground Level in feet. */
void SetAltitudeAGL(double altitudeAGL, double time)
{ SetRadius(GroundCallback->GetTerrainGeoCentRadius(time, *this) + altitudeAGL); }
/** Get the local sea level radius
@return the sea level radius at the location in feet. */
double GetSeaLevelRadius(void) const
{ ComputeDerived(); return GroundCallback->GetSeaLevelRadius(*this); }
/** Get the local terrain radius
@return the terrain level radius at the location in feet. */
double GetTerrainRadius(double time) const
{ ComputeDerived(); return GroundCallback->GetTerrainGeoCentRadius(time, *this); }
/** Get the altitude above sea level.
@return the altitude ASL in feet. */
double GetAltitudeASL() const
{ ComputeDerived(); return GroundCallback->GetAltitude(*this); }
/** Get the altitude above ground level.
@return the altitude AGL in feet. */
double GetAltitudeAGL(double time) const {
FGLocation c;
FGColumnVector3 n,v,w;
return GetContactPoint(time,c,n,v,w);
}
/** Get terrain contact point information below the current location.
@param time Simulation time
@param contact Contact point location
@param normal Terrain normal vector in contact point (ECEF frame)
@param v Terrain linear velocity in contact point (ECEF frame)
@param w Terrain angular velocity in contact point (ECEF frame)
@return Location altitude above contact point (AGL) in feet. */
double GetContactPoint(double time,
FGLocation& contact, FGColumnVector3& normal,
FGColumnVector3& v, FGColumnVector3& w) const
{ ComputeDerived(); return GroundCallback->GetAGLevel(time, *this, contact, normal, v, w); }
/** Sets the ground callback pointer. For optimal memory management, a shared
pointer is used internally that maintains a reference counter. The calling
application must therefore use FGGroundCallback_ptr 'smart pointers' to
manage their copy of the ground callback.
@param gc A pointer to a ground callback object
@see FGGroundCallback
*/
static void SetGroundCallback(FGGroundCallback* gc) { GroundCallback = gc; }
/** Get a pointer to the ground callback currently used. It is recommanded
to store the returned pointer in a 'smart pointer' FGGroundCallback_ptr.
@return A pointer to the current ground callback object.
@see FGGroundCallback
*/
static FGGroundCallback* GetGroundCallback(void) { return GroundCallback; }
///@}
/** Transform matrix from local horizontal to earth centered frame. /** Transform matrix from local horizontal to earth centered frame.
Returns a const reference to the rotation matrix of the transform from Returns a const reference to the rotation matrix of the transform from
the local horizontal frame to the earth centered frame. */ the local horizontal frame to the earth centered frame. */
@ -520,6 +588,9 @@ private:
The C++ keyword "mutable" tells the compiler that the data member is The C++ keyword "mutable" tells the compiler that the data member is
allowed to change during a const member function. */ allowed to change during a const member function. */
mutable bool mCacheValid; mutable bool mCacheValid;
/** The ground callback object pointer */
static FGGroundCallback_ptr GroundCallback;
}; };
/** Scalar multiplication. /** Scalar multiplication.

View file

@ -57,7 +57,7 @@ using std::endl;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.19 2010/12/07 12:57:14 jberndt Exp $"; static const char *IdSrc = "$Id: FGQuaternion.cpp,v 1.20 2011/10/31 14:54:40 bcoconni Exp $";
static const char *IdHdr = ID_QUATERNION; static const char *IdHdr = ID_QUATERNION;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -157,7 +157,7 @@ FGQuaternion::FGQuaternion(const FGMatrix33& m) : mCacheValid(false)
Equation 1.3-36. Equation 1.3-36.
Also see Jack Kuipers, "Quaternions and Rotation Sequences", Equation 11.12. Also see Jack Kuipers, "Quaternions and Rotation Sequences", Equation 11.12.
*/ */
FGQuaternion FGQuaternion::GetQDot(const FGColumnVector3& PQR) FGQuaternion FGQuaternion::GetQDot(const FGColumnVector3& PQR) const
{ {
return FGQuaternion( return FGQuaternion(
-0.5*( data[1]*PQR(eP) + data[2]*PQR(eQ) + data[3]*PQR(eR)), -0.5*( data[1]*PQR(eP) + data[2]*PQR(eQ) + data[3]*PQR(eR)),

View file

@ -47,7 +47,7 @@ SENTRY
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_QUATERNION "$Id: FGQuaternion.h,v 1.22 2010/12/07 12:57:14 jberndt Exp $" #define ID_QUATERNION "$Id: FGQuaternion.h,v 1.23 2011/10/31 14:54:40 bcoconni Exp $"
namespace JSBSim { namespace JSBSim {
@ -164,7 +164,7 @@ public:
@return the quaternion derivative @return the quaternion derivative
@see Stevens and Lewis, "Aircraft Control and Simulation", Second Edition, @see Stevens and Lewis, "Aircraft Control and Simulation", Second Edition,
Equation 1.3-36. */ Equation 1.3-36. */
FGQuaternion GetQDot(const FGColumnVector3& PQR); FGQuaternion GetQDot(const FGColumnVector3& PQR) const;
/** Transformation matrix. /** Transformation matrix.
@return a reference to the transformation/rotation matrix @return a reference to the transformation/rotation matrix
@ -527,7 +527,4 @@ inline FGQuaternion operator*(double scalar, const FGQuaternion& q) {
std::ostream& operator<<(std::ostream& os, const FGQuaternion& q); std::ostream& operator<<(std::ostream& os, const FGQuaternion& q);
} // namespace JSBSim } // namespace JSBSim
#include "FGMatrix33.h"
#endif #endif

View file

@ -50,7 +50,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.7 2011/08/21 15:46:48 bcoconni Exp $" #define ID_ACCELERATIONS "$Id: FGAccelerations.h,v 1.8 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -70,7 +70,7 @@ CLASS DOCUMENTATION
-Calculate the translational velocity -Calculate the translational velocity
@author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
@version $Id: FGAccelerations.h,v 1.7 2011/08/21 15:46:48 bcoconni Exp $ @version $Id: FGAccelerations.h,v 1.8 2011/10/31 14:54:41 bcoconni Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -151,7 +151,7 @@ public:
*/ */
double GetUVWdot(int idx) const { return vUVWdot(idx); } double GetUVWdot(int idx) const { return vUVWdot(idx); }
FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; } const FGColumnVector3& GetBodyAccel(void) const { return vBodyAccel; }
double GetBodyAccel(int idx) const { return vBodyAccel(idx); } double GetBodyAccel(int idx) const { return vBodyAccel(idx); }

View file

@ -50,7 +50,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.18 2011/07/10 20:18:14 jberndt Exp $" #define ID_AIRCRAFT "$Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -91,7 +91,7 @@ CLASS DOCUMENTATION
@endcode @endcode
@author Jon S. Berndt @author Jon S. Berndt
@version $Id: FGAircraft.h,v 1.18 2011/07/10 20:18:14 jberndt Exp $ @version $Id: FGAircraft.h,v 1.19 2011/11/10 12:06:14 jberndt Exp $
@see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
School, January 1994 School, January 1994

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

@ -50,7 +50,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.53 2011/08/17 23:56:01 jberndt Exp $"; static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.55 2011/11/12 18:59:11 bcoconni Exp $";
static const char *IdHdr = ID_AUXILIARY; static const char *IdHdr = ID_AUXILIARY;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -180,6 +180,8 @@ bool FGAuxiliary::Run(bool Holding)
} }
} }
UpdateWindMatrices();
Re = Vt * in.Wingchord / in.KinematicViscosity; Re = Vt * in.Wingchord / in.KinematicViscosity;
double densityD2 = 0.5*in.Density; double densityD2 = 0.5*in.Density;
@ -278,7 +280,7 @@ bool FGAuxiliary::Run(bool Holding)
// sin(B) cos(B) 0 // sin(B) cos(B) 0
// sin(a)*cos(B) -sin(a)*sin(B) cos(a) // sin(a)*cos(B) -sin(a)*sin(B) cos(a)
FGMatrix33& FGAuxiliary::GetTw2b(void) void FGAuxiliary::UpdateWindMatrices(void)
{ {
double ca, cb, sa, sb; double ca, cb, sa, sb;
@ -297,31 +299,7 @@ FGMatrix33& FGAuxiliary::GetTw2b(void)
mTw2b(3,2) = -sa*sb; mTw2b(3,2) = -sa*sb;
mTw2b(3,3) = ca; mTw2b(3,3) = ca;
return mTw2b; mTb2w = mTw2b.Transposed();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGMatrix33& FGAuxiliary::GetTb2w(void)
{
double ca, cb, sa, sb;
ca = cos(alpha);
sa = sin(alpha);
cb = cos(beta);
sb = sin(beta);
mTb2w(1,1) = ca*cb;
mTb2w(1,2) = sb;
mTb2w(1,3) = sa*cb;
mTb2w(2,1) = -ca*sb;
mTb2w(2,2) = cb;
mTb2w(2,3) = -sa*sb;
mTb2w(3,1) = -sa;
mTb2w(3,2) = 0.0;
mTb2w(3,3) = ca;
return mTb2w;
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -48,7 +48,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_AUXILIARY "$Id: FGAuxiliary.h,v 1.23 2011/08/17 23:56:01 jberndt Exp $" #define ID_AUXILIARY "$Id: FGAuxiliary.h,v 1.25 2011/11/12 18:59:11 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -99,7 +99,7 @@ CLASS DOCUMENTATION
to the JSBSim vPQRdot vector, and the w parameter is equivalent to vPQR. to the JSBSim vPQRdot vector, and the w parameter is equivalent to vPQR.
@author Tony Peden, Jon Berndt @author Tony Peden, Jon Berndt
@version $Id: FGAuxiliary.h,v 1.23 2011/08/17 23:56:01 jberndt Exp $ @version $Id: FGAuxiliary.h,v 1.25 2011/11/12 18:59:11 bcoconni Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -195,12 +195,12 @@ public:
/** Calculates and returns the wind-to-body axis transformation matrix. /** Calculates and returns the wind-to-body axis transformation matrix.
@return a reference to the wind-to-body transformation matrix. @return a reference to the wind-to-body transformation matrix.
*/ */
FGMatrix33& GetTw2b(void); const FGMatrix33& GetTw2b(void) { return mTw2b; }
/** Calculates and returns the body-to-wind axis transformation matrix. /** Calculates and returns the body-to-wind axis transformation matrix.
@return a reference to the wind-to-body transformation matrix. @return a reference to the wind-to-body transformation matrix.
*/ */
FGMatrix33& GetTb2w(void); const FGMatrix33& GetTb2w(void) { return mTb2w; }
double Getqbar (void) const { return qbar; } double Getqbar (void) const { return qbar; }
double GetqbarUW (void) const { return qbarUW; } double GetqbarUW (void) const { return qbarUW; }
@ -225,7 +225,7 @@ public:
/** The vertical acceleration in g's of the aircraft center of gravity. */ /** The vertical acceleration in g's of the aircraft center of gravity. */
double GetNz (void) const { return Nz; } double GetNz (void) const { return Nz; }
FGColumnVector3& GetNwcg(void) { return vNwcg; } const FGColumnVector3& GetNwcg(void) const { return vNwcg; }
double GetHOverBCG(void) const { return hoverbcg; } double GetHOverBCG(void) const { return hoverbcg; }
double GetHOverBMAC(void) const { return hoverbmac; } double GetHOverBMAC(void) const { return hoverbmac; }
@ -248,7 +248,7 @@ public:
double GetLatitudeRelativePosition (void) const { return lat_relative_position; } double GetLatitudeRelativePosition (void) const { return lat_relative_position; }
double GetDistanceRelativePosition (void) const { return relative_position; } double GetDistanceRelativePosition (void) const { return relative_position; }
void SetAeroPQR(FGColumnVector3 tt) { vAeroPQR = tt; } void SetAeroPQR(const FGColumnVector3& tt) { vAeroPQR = tt; }
struct Inputs { struct Inputs {
double Pressure; double Pressure;
@ -329,6 +329,8 @@ private:
double lat_relative_position; double lat_relative_position;
double relative_position; double relative_position;
void UpdateWindMatrices(void);
void CalculateRelativePosition(void); void CalculateRelativePosition(void);
void bind(void); void bind(void);

View file

@ -45,7 +45,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.20 2011/08/06 13:47:59 jberndt Exp $"; static const char *IdSrc = "$Id: FGBuoyantForces.cpp,v 1.21 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_BUOYANTFORCES; static const char *IdHdr = ID_BUOYANTFORCES;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -146,7 +146,7 @@ bool FGBuoyantForces::Load(Element *element)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGBuoyantForces::GetGasMass(void) double FGBuoyantForces::GetGasMass(void) const
{ {
double Gw = 0.0; double Gw = 0.0;
@ -187,7 +187,7 @@ const FGMatrix33& FGBuoyantForces::GetGasMassInertia(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGBuoyantForces::GetBuoyancyStrings(string delimeter) string FGBuoyantForces::GetBuoyancyStrings(const string& delimeter)
{ {
string CoeffStrings = ""; string CoeffStrings = "";
/* /*
@ -217,7 +217,7 @@ string FGBuoyantForces::GetBuoyancyStrings(string delimeter)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGBuoyantForces::GetBuoyancyValues(string delimeter) string FGBuoyantForces::GetBuoyancyValues(const string& delimeter)
{ {
string SDValues = ""; string SDValues = "";
/* /*

View file

@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.15 2011/08/14 20:15:56 jberndt Exp $" #define ID_BUOYANTFORCES "$Id: FGBuoyantForces.h,v 1.16 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -96,7 +96,7 @@ CLASS DOCUMENTATION
See FGGasCell for the full configuration file format for gas cells. See FGGasCell for the full configuration file format for gas cells.
@author Anders Gidenstam, Jon S. Berndt @author Anders Gidenstam, Jon S. Berndt
@version $Id: FGBuoyantForces.h,v 1.15 2011/08/14 20:15:56 jberndt Exp $ @version $Id: FGBuoyantForces.h,v 1.16 2011/10/31 14:54:41 bcoconni Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -150,7 +150,7 @@ public:
/** Gets the total gas mass. The gas mass is part of the aircraft's /** Gets the total gas mass. The gas mass is part of the aircraft's
inertia. inertia.
@return mass in slugs. */ @return mass in slugs. */
double GetGasMass(void); double GetGasMass(void) const;
/** Gets the total moment from the gas mass. /** Gets the total moment from the gas mass.
@return a moment vector in the structural frame in lbs in. */ @return a moment vector in the structural frame in lbs in. */
@ -164,13 +164,13 @@ public:
/** Gets the strings for the current set of gas cells. /** Gets the strings for the current set of gas cells.
@param delimeter either a tab or comma string depending on output type @param delimeter either a tab or comma string depending on output type
@return a string containing the descriptive names for all parameters */ @return a string containing the descriptive names for all parameters */
string GetBuoyancyStrings(string delimeter); string GetBuoyancyStrings(const string& delimeter);
/** Gets the coefficient values. /** Gets the coefficient values.
@param delimeter either a tab or comma string depending on output type @param delimeter either a tab or comma string depending on output type
@return a string containing the numeric values for the current set of @return a string containing the numeric values for the current set of
parameters */ parameters */
string GetBuoyancyValues(string delimeter); string GetBuoyancyValues(const string& delimeter);
FGGasCell::Inputs in; FGGasCell::Inputs in;

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

@ -60,7 +60,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.10 2009/10/24 22:59:30 jberndt Exp $"; static const char *IdSrc = "$Id: FGExternalForce.cpp,v 1.11 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_EXTERNALFORCE; static const char *IdHdr = ID_EXTERNALFORCE;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -168,7 +168,7 @@ void FGExternalForce::SetMagnitude(double mag)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3& FGExternalForce::GetBodyForces(void) const FGColumnVector3& FGExternalForce::GetBodyForces(void)
{ {
if (Magnitude_Function) { if (Magnitude_Function) {
double mag = Magnitude_Function->GetValue(); double mag = Magnitude_Function->GetValue();

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

@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.9 2010/11/18 12:38:06 jberndt Exp $" #define ID_EXTERNALFORCE "$Id: FGExternalForce.h,v 1.10 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -154,7 +154,7 @@ public:
void SetMagnitude(double mag); void SetMagnitude(double mag);
void SetAzimuth(double az) {azimuth = az;} void SetAzimuth(double az) {azimuth = az;}
FGColumnVector3& GetBodyForces(void); const FGColumnVector3& GetBodyForces(void);
double GetMagnitude(void) const {return magnitude;} double GetMagnitude(void) const {return magnitude;}
double GetAzimuth(void) const {return azimuth;} double GetAzimuth(void) const {return azimuth;}
double GetX(void) const {return vDirection(eX);} double GetX(void) const {return vDirection(eX);}

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

@ -48,7 +48,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.13 2011/07/20 12:16:34 jberndt Exp $" #define ID_EXTERNALREACTIONS "$Id: FGExternalReactions.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -153,13 +153,13 @@ public:
/** Retrieves the total forces defined in the external reactions. /** Retrieves the total forces defined in the external reactions.
@return the total force in pounds. @return the total force in pounds.
*/ */
FGColumnVector3 GetForces(void) const {return vTotalForces;} const FGColumnVector3& GetForces(void) const {return vTotalForces;}
double GetForces(int idx) const {return vTotalForces(idx);} double GetForces(int idx) const {return vTotalForces(idx);}
/** Retrieves the total moment resulting from the forces defined in the external reactions. /** Retrieves the total moment resulting from the forces defined in the external reactions.
@return the total moment in foot-pounds. @return the total moment in foot-pounds.
*/ */
FGColumnVector3 GetMoments(void) const {return vTotalMoments;} const FGColumnVector3& GetMoments(void) const {return vTotalMoments;}
double GetMoments(int idx) const {return vTotalMoments(idx);} double GetMoments(int idx) const {return vTotalMoments(idx);}
private: private:

View file

@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FCS "$Id: FGFCS.h,v 1.39 2011/08/14 20:15:56 jberndt Exp $" #define ID_FCS "$Id: FGFCS.h,v 1.40 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -168,7 +168,7 @@ CLASS DOCUMENTATION
@property gear/tailhook-pos-norm @property gear/tailhook-pos-norm
@author Jon S. Berndt @author Jon S. Berndt
@version $Revision: 1.39 $ @version $Revision: 1.40 $
@see FGActuator @see FGActuator
@see FGDeadBand @see FGDeadBand
@see FGFCSFunction @see FGFCSFunction
@ -243,14 +243,14 @@ public:
@return throttle command in range from 0 - 1.0 for the given engine */ @return throttle command in range from 0 - 1.0 for the given engine */
double GetThrottleCmd(int engine) const; double GetThrottleCmd(int engine) const;
vector <double> GetThrottleCmd() const {return ThrottleCmd;} const vector<double>& GetThrottleCmd() const {return ThrottleCmd;}
/** Gets the mixture command. /** Gets the mixture command.
@param engine engine ID number @param engine engine ID number
@return mixture command in range from 0 - 1.0 for the given engine */ @return mixture command in range from 0 - 1.0 for the given engine */
double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; } double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
vector <double> GetMixtureCmd() const {return MixtureCmd;} const vector<double>& GetMixtureCmd() const {return MixtureCmd;}
/** Gets the prop pitch command. /** Gets the prop pitch command.
@param engine engine ID number @param engine engine ID number
@ -322,20 +322,20 @@ public:
@return throttle position for the given engine in range from 0 - 1.0 */ @return throttle position for the given engine in range from 0 - 1.0 */
double GetThrottlePos(int engine) const; double GetThrottlePos(int engine) const;
vector <double> GetThrottlePos() const {return ThrottlePos;} const vector<double>& GetThrottlePos() const {return ThrottlePos;}
/** Gets the mixture position. /** Gets the mixture position.
@param engine engine ID number @param engine engine ID number
@return mixture position for the given engine in range from 0 - 1.0 */ @return mixture position for the given engine in range from 0 - 1.0 */
double GetMixturePos(int engine) const { return MixturePos[engine]; } double GetMixturePos(int engine) const { return MixturePos[engine]; }
vector <double> GetMixturePos() const {return MixturePos;} const vector<double>& GetMixturePos() const {return MixturePos;}
/** Gets the steering position. /** Gets the steering position.
@return steering position in degrees */ @return steering position in degrees */
double GetSteerPosDeg(int gear) const { return SteerPosDeg[gear]; } double GetSteerPosDeg(int gear) const { return SteerPosDeg[gear]; }
vector <double> GetSteerPosDeg() const {return SteerPosDeg;} const vector<double>& GetSteerPosDeg() const {return SteerPosDeg;}
/** Gets the gear position (0 up, 1 down), defaults to down /** Gets the gear position (0 up, 1 down), defaults to down
@return gear position (0 up, 1 down) */ @return gear position (0 up, 1 down) */
@ -354,14 +354,14 @@ public:
@return prop pitch position for the given engine in range from 0 - 1.0 */ @return prop pitch position for the given engine in range from 0 - 1.0 */
double GetPropAdvance(int engine) const { return PropAdvance[engine]; } double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
vector <double> GetPropAdvance() const { return PropAdvance; } const vector<double>& GetPropAdvance() const { return PropAdvance; }
/** Gets the prop feather position. /** Gets the prop feather position.
@param engine engine ID number @param engine engine ID number
@return prop fether for the given engine (on / off)*/ @return prop fether for the given engine (on / off)*/
bool GetPropFeather(int engine) const { return PropFeather[engine]; } bool GetPropFeather(int engine) const { return PropFeather[engine]; }
vector <bool> GetPropFeather() const { return PropFeather; } const vector<bool>& GetPropFeather() const { return PropFeather; }
//@} //@}
/** Retrieves all component names for inclusion in output stream /** Retrieves all component names for inclusion in output stream
@ -528,7 +528,7 @@ public:
@return the brake setting for the supplied brake group argument */ @return the brake setting for the supplied brake group argument */
double GetBrake(FGLGear::BrakeGroup bg); double GetBrake(FGLGear::BrakeGroup bg);
vector <double> GetBrakePos() const {return BrakePos;} const vector<double>& GetBrakePos() const {return BrakePos;}
/** Gets the left brake. /** Gets the left brake.
@return the left brake setting. */ @return the left brake setting. */

View file

@ -43,7 +43,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGInertial.cpp,v 1.24 2011/08/04 12:46:32 jberndt Exp $"; static const char *IdSrc = "$Id: FGInertial.cpp,v 1.25 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_INERTIAL; static const char *IdHdr = ID_INERTIAL;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -130,7 +130,7 @@ double FGInertial::GetGAccel(double r) const
// and therefore may need to be expressed (transformed) in another frame, // and therefore may need to be expressed (transformed) in another frame,
// depending on how it is used. See Stevens and Lewis eqn. 1.4-16. // depending on how it is used. See Stevens and Lewis eqn. 1.4-16.
FGColumnVector3 FGInertial::GetGravityJ2(FGColumnVector3 position) const FGColumnVector3 FGInertial::GetGravityJ2(const FGColumnVector3& position) const
{ {
FGColumnVector3 J2Gravity; FGColumnVector3 J2Gravity;

View file

@ -47,7 +47,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_INERTIAL "$Id: FGInertial.h,v 1.19 2011/08/04 12:46:32 jberndt Exp $" #define ID_INERTIAL "$Id: FGInertial.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -86,9 +86,9 @@ public:
double SLgravity(void) const {return gAccelReference;} double SLgravity(void) const {return gAccelReference;}
double gravity(void) const {return gAccel;} double gravity(void) const {return gAccel;}
double omega(void) const {return RotationRate;} double omega(void) const {return RotationRate;}
FGColumnVector3 GetOmegaPlanet() const {return vOmegaPlanet;} const FGColumnVector3& GetOmegaPlanet() const {return vOmegaPlanet;}
double GetGAccel(double r) const; double GetGAccel(double r) const;
FGColumnVector3 GetGravityJ2(FGColumnVector3 position) const; FGColumnVector3 GetGravityJ2(const FGColumnVector3& position) const;
double GetRefRadius(void) const {return RadiusReference;} double GetRefRadius(void) const {return RadiusReference;}
double GetSemimajor(void) const {return a;} double GetSemimajor(void) const {return a;}
double GetSemiminor(void) const {return b;} double GetSemiminor(void) const {return b;}

View file

@ -60,7 +60,7 @@ DEFINITIONS
GLOBAL DATA GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
static const char *IdSrc = "$Id: FGLGear.cpp,v 1.89 2011/09/11 11:36:04 bcoconni Exp $"; static const char *IdSrc = "$Id: FGLGear.cpp,v 1.92 2011/11/10 12:06:14 jberndt Exp $";
static const char *IdHdr = ID_LGEAR; static const char *IdHdr = ID_LGEAR;
// Body To Structural (body frame is rotated 180 deg about Y and lengths are given in // Body To Structural (body frame is rotated 180 deg about Y and lengths are given in
@ -274,7 +274,7 @@ FGLGear::~FGLGear()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3& FGLGear::GetBodyForces(void) const FGColumnVector3& FGLGear::GetBodyForces(void)
{ {
double t = fdmex->GetSimTime(); double t = fdmex->GetSimTime();
@ -290,7 +290,7 @@ FGColumnVector3& FGLGear::GetBodyForces(void)
gearLoc = in.Location.LocalToLocation(vLocalGear); gearLoc = in.Location.LocalToLocation(vLocalGear);
// Compute the height of the theoretical location of the wheel (if strut is // Compute the height of the theoretical location of the wheel (if strut is
// not compressed) with respect to the ground level // not compressed) with respect to the ground level
double height = fdmex->GetGroundCallback()->GetAGLevel(t, gearLoc, contact, normal, terrainVel, dummy); double height = gearLoc.GetContactPoint(t, contact, normal, terrainVel, dummy);
vGroundNormal = in.Tec2b * normal; vGroundNormal = in.Tec2b * normal;
// The height returned above is the AGL and is expressed in the Z direction // The height returned above is the AGL and is expressed in the Z direction
@ -342,8 +342,7 @@ FGColumnVector3& FGLGear::GetBodyForces(void)
compressSpeed = 0.0; // Steady state is sought during trimming compressSpeed = 0.0; // Steady state is sought during trimming
else { else {
compressSpeed = -vLocalWhlVel(eX); compressSpeed = -vLocalWhlVel(eX);
if (eContactType == ctBOGEY) if (eContactType == ctBOGEY) compressSpeed /= LGearProj;
compressSpeed /= LGearProj;
} }
ComputeVerticalStrutForce(); ComputeVerticalStrutForce();

View file

@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_LGEAR "$Id: FGLGear.h,v 1.47 2011/08/30 21:05:56 bcoconni Exp $" #define ID_LGEAR "$Id: FGLGear.h,v 1.48 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -178,7 +178,7 @@ CLASS DOCUMENTATION
</contact> </contact>
@endcode @endcode
@author Jon S. Berndt @author Jon S. Berndt
@version $Id: FGLGear.h,v 1.47 2011/08/30 21:05:56 bcoconni Exp $ @version $Id: FGLGear.h,v 1.48 2011/10/31 14:54:41 bcoconni Exp $
@see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
NASA-Ames", NASA CR-2497, January 1975 NASA-Ames", NASA CR-2497, January 1975
@see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics", @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
@ -238,17 +238,17 @@ public:
~FGLGear(); ~FGLGear();
/// The Force vector for this gear /// The Force vector for this gear
FGColumnVector3& GetBodyForces(void); const FGColumnVector3& GetBodyForces(void);
/// Gets the location of the gear in Body axes /// Gets the location of the gear in Body axes
FGColumnVector3 GetBodyLocation(void) const { return in.vWhlBodyVec[GearNumber]; } const FGColumnVector3& GetBodyLocation(void) const { return in.vWhlBodyVec[GearNumber]; }
double GetBodyLocation(int idx) const { return in.vWhlBodyVec[GearNumber](idx); } double GetBodyLocation(int idx) const { return in.vWhlBodyVec[GearNumber](idx); }
FGColumnVector3& GetLocalGear(void) { return vLocalGear; } const FGColumnVector3& GetLocalGear(void) const { return vLocalGear; }
double GetLocalGear(int idx) const { return vLocalGear(idx); } double GetLocalGear(int idx) const { return vLocalGear(idx); }
/// Gets the name of the gear /// Gets the name of the gear
string GetName(void) const {return name; } const string& GetName(void) const {return name; }
/// Gets the Weight On Wheels flag value /// Gets the Weight On Wheels flag value
bool GetWOW(void) const {return WOW; } bool GetWOW(void) const {return WOW; }
/// Gets the current compressed length of the gear in feet /// Gets the current compressed length of the gear in feet

View file

@ -49,7 +49,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.37 2011/07/12 01:52:49 jberndt Exp $"; static const char *IdSrc = "$Id: FGMassBalance.cpp,v 1.39 2011/11/09 21:58:26 bcoconni Exp $";
static const char *IdHdr = ID_MASSBALANCE; static const char *IdHdr = ID_MASSBALANCE;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -291,7 +291,7 @@ void FGMassBalance::AddPointMass(Element* el)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGMassBalance::GetTotalPointMassWeight(void) double FGMassBalance::GetTotalPointMassWeight(void) const
{ {
double PM_total_weight = 0.0; double PM_total_weight = 0.0;
@ -303,7 +303,7 @@ double FGMassBalance::GetTotalPointMassWeight(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3& FGMassBalance::GetPointMassMoment(void) const FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
{ {
PointMassCG.InitMatrix(); PointMassCG.InitMatrix();
@ -315,7 +315,7 @@ FGColumnVector3& FGMassBalance::GetPointMassMoment(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGMatrix33& FGMassBalance::CalculatePMInertias(void) const FGMatrix33& FGMassBalance::CalculatePMInertias(void)
{ {
unsigned int size; unsigned int size;

View file

@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.25 2011/07/28 12:48:19 jberndt Exp $" #define ID_MASSBALANCE "$Id: FGMassBalance.h,v 1.27 2011/11/09 21:58:26 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONSS FORWARD DECLARATIONSS
@ -171,12 +171,12 @@ public:
void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = vXYZcg = CG;} void SetBaseCG(const FGColumnVector3& CG) {vbaseXYZcg = vXYZcg = CG;}
void AddPointMass(Element* el); void AddPointMass(Element* el);
double GetTotalPointMassWeight(void); double GetTotalPointMassWeight(void) const;
FGColumnVector3& GetPointMassMoment(void); const FGColumnVector3& GetPointMassMoment(void);
const FGMatrix33& GetJ(void) const {return mJ;} const FGMatrix33& GetJ(void) const {return mJ;}
const FGMatrix33& GetJinv(void) const {return mJinv;} const FGMatrix33& GetJinv(void) const {return mJinv;}
void SetAircraftBaseInertias(FGMatrix33 BaseJ) {baseJ = BaseJ;} void SetAircraftBaseInertias(const FGMatrix33& BaseJ) {baseJ = BaseJ;}
void GetMassPropertiesReport(void) const; void GetMassPropertiesReport(void) const;
struct Inputs { struct Inputs {
@ -204,7 +204,7 @@ private:
FGColumnVector3 vbaseXYZcg; FGColumnVector3 vbaseXYZcg;
FGColumnVector3 vPMxyz; FGColumnVector3 vPMxyz;
FGColumnVector3 PointMassCG; FGColumnVector3 PointMassCG;
FGMatrix33& CalculatePMInertias(void); const FGMatrix33& CalculatePMInertias(void);
/** The PointMass structure encapsulates a point mass object, moments of inertia /** The PointMass structure encapsulates a point mass object, moments of inertia
@ -255,9 +255,9 @@ private:
double GetPointMassLocation(int axis) const {return Location(axis);} double GetPointMassLocation(int axis) const {return Location(axis);}
double GetPointMassWeight(void) const {return Weight;} double GetPointMassWeight(void) const {return Weight;}
esShape GetShapeType(void) {return eShapeType;} esShape GetShapeType(void) {return eShapeType;}
FGColumnVector3 GetLocation(void) {return Location;} const FGColumnVector3& GetLocation(void) {return Location;}
FGMatrix33 GetPointMassInertia(void) {return mPMInertia;} const FGMatrix33& GetPointMassInertia(void) {return mPMInertia;}
string GetName(void) {return Name;} const string& GetName(void) {return Name;}
void SetPointMassLocation(int axis, double value) {Location(axis) = value;} void SetPointMassLocation(int axis, double value) {Location(axis) = value;}
void SetPointMassWeight(double wt) {Weight = wt;} void SetPointMassWeight(double wt) {Weight = wt;}

View file

@ -51,7 +51,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_OUTPUT "$Id: FGOutput.h,v 1.23 2011/05/20 03:18:36 jberndt Exp $" #define ID_OUTPUT "$Id: FGOutput.h,v 1.24 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -124,7 +124,7 @@ CLASS DOCUMENTATION
propulsion ON|OFF propulsion ON|OFF
</pre> </pre>
NOTE that Time is always output with the data. NOTE that Time is always output with the data.
@version $Id: FGOutput.h,v 1.23 2011/05/20 03:18:36 jberndt Exp $ @version $Id: FGOutput.h,v 1.24 2011/11/10 12:06:14 jberndt Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -68,7 +68,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.98 2011/10/22 15:11:24 bcoconni Exp $"; static const char *IdSrc = "$Id: FGPropagate.cpp,v 1.100 2011/11/06 18:14:51 bcoconni Exp $";
static const char *IdHdr = ID_PROPAGATE; static const char *IdHdr = ID_PROPAGATE;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -113,10 +113,8 @@ FGPropagate::~FGPropagate(void)
bool FGPropagate::InitModel(void) bool FGPropagate::InitModel(void)
{ {
// For initialization ONLY: // For initialization ONLY:
VState.vLocation.SetRadius( FDMExec->GetGroundCallback()->
GetTerrainGeoCentRadius(0.0,VState.vLocation) + 4.0 );
VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor); VState.vLocation.SetEllipse(in.SemiMajor, in.SemiMinor);
VState.vLocation.SetAltitudeAGL(4.0, FDMExec->GetSimTime());
vInertialVelocity.InitMatrix(); vInertialVelocity.InitMatrix();
@ -137,8 +135,6 @@ bool FGPropagate::InitModel(void)
void FGPropagate::SetInitialState(const FGInitialCondition *FGIC) void FGPropagate::SetInitialState(const FGInitialCondition *FGIC)
{ {
SetTerrainElevation(FGIC->GetTerrainElevationFtIC());
// Initialize the State Vector elements and the transformation matrices // Initialize the State Vector elements and the transformation matrices
// Set the position lat/lon/radius // Set the position lat/lon/radius
@ -371,7 +367,7 @@ void FGPropagate::UpdateBodyMatrices(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetInertialOrientation(FGQuaternion Qi) { void FGPropagate::SetInertialOrientation(const FGQuaternion& Qi) {
VState.qAttitudeECI = Qi; VState.qAttitudeECI = Qi;
VState.qAttitudeECI.Normalize(); VState.qAttitudeECI.Normalize();
UpdateBodyMatrices(); UpdateBodyMatrices();
@ -380,7 +376,7 @@ void FGPropagate::SetInertialOrientation(FGQuaternion Qi) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetInertialVelocity(FGColumnVector3 Vi) { void FGPropagate::SetInertialVelocity(const FGColumnVector3& Vi) {
VState.vInertialVelocity = Vi; VState.vInertialVelocity = Vi;
CalculateUVW(); CalculateUVW();
vVel = Tb2l * VState.vUVW; vVel = Tb2l * VState.vUVW;
@ -388,7 +384,7 @@ void FGPropagate::SetInertialVelocity(FGColumnVector3 Vi) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetInertialRates(FGColumnVector3 vRates) { void FGPropagate::SetInertialRates(const FGColumnVector3& vRates) {
VState.vPQRi = Ti2b * vRates; VState.vPQRi = Ti2b * vRates;
VState.vPQR = VState.vPQRi - Ti2b * in.vOmegaPlanet; VState.vPQR = VState.vPQRi - Ti2b * in.vOmegaPlanet;
} }
@ -399,21 +395,19 @@ void FGPropagate::RecomputeLocalTerrainVelocity()
{ {
FGLocation contact; FGLocation contact;
FGColumnVector3 normal; FGColumnVector3 normal;
FDMExec->GetGroundCallback()->GetAGLevel(FDMExec->GetSimTime(), VState.vLocation.GetContactPoint(FDMExec->GetSimTime(), contact, normal,
VState.vLocation, LocalTerrainVelocity, LocalTerrainAngularVelocity);
contact, normal,
LocalTerrainVelocity,
LocalTerrainAngularVelocity);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetTerrainElevation(double terrainElev) void FGPropagate::SetTerrainElevation(double terrainElev)
{ {
double radius = terrainElev + FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation); double radius = terrainElev + VState.vLocation.GetSeaLevelRadius();
FDMExec->GetGroundCallback()->SetTerrainGeoCentRadius(radius); FDMExec->GetGroundCallback()->SetTerrainGeoCentRadius(radius);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetSeaLevelRadius(double tt) void FGPropagate::SetSeaLevelRadius(double tt)
@ -425,49 +419,22 @@ void FGPropagate::SetSeaLevelRadius(double tt)
double FGPropagate::GetLocalTerrainRadius(void) const double FGPropagate::GetLocalTerrainRadius(void) const
{ {
return FDMExec->GetGroundCallback()->GetTerrainGeoCentRadius(FDMExec->GetSimTime(), return VState.vLocation.GetTerrainRadius(FDMExec->GetSimTime());
VState.vLocation);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetTerrainElevation(void) const
{
return GetLocalTerrainRadius()
- FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetDistanceAGL(void) const double FGPropagate::GetDistanceAGL(void) const
{ {
FGColumnVector3 dummy; return VState.vLocation.GetAltitudeAGL(FDMExec->GetSimTime());
FGLocation dummyloc;
double t = FDMExec->GetSimTime();
return FDMExec->GetGroundCallback()->GetAGLevel(t, VState.vLocation, dummyloc,
dummy, dummy, dummy);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetAltitudeASL(double altASL)
{
SetRadius(altASL + FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation));
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropagate::GetAltitudeASL(void) const
{
return VState.vLocation.GetRadius()
- FDMExec->GetGroundCallback()->GetSeaLevelRadius(VState.vLocation);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropagate::SetDistanceAGL(double tt) void FGPropagate::SetDistanceAGL(double tt)
{ {
SetAltitudeASL(tt + GetTerrainElevation()); VState.vLocation.SetAltitudeAGL(tt, FDMExec->GetSimTime());
UpdateVehicleState();
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -508,7 +475,6 @@ void FGPropagate::UpdateVehicleState(void)
void FGPropagate::SetLocation(const FGLocation& l) void FGPropagate::SetLocation(const FGLocation& l)
{ {
VState.vLocation = l; VState.vLocation = l;
VState.vLocation.SetEarthPositionAngle(l.GetEPA());
Ti2ec = VState.vLocation.GetTi2ec(); // useless ? Ti2ec = VState.vLocation.GetTi2ec(); // useless ?
Tec2i = Ti2ec.Transposed(); Tec2i = Ti2ec.Transposed();
UpdateVehicleState(); UpdateVehicleState();

View file

@ -49,7 +49,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PROPAGATE "$Id: FGPropagate.h,v 1.64 2011/10/14 22:46:49 bcoconni Exp $" #define ID_PROPAGATE "$Id: FGPropagate.h,v 1.67 2011/11/09 22:07:17 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -93,7 +93,7 @@ CLASS DOCUMENTATION
@endcode @endcode
@author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier @author Jon S. Berndt, Mathias Froehlich, Bertrand Coconnier
@version $Id: FGPropagate.h,v 1.64 2011/10/14 22:46:49 bcoconni Exp $ @version $Id: FGPropagate.h,v 1.67 2011/11/09 22:07:17 bcoconni Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -286,14 +286,14 @@ public:
/** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame. /** Calculates and retrieves the velocity vector relative to the earth centered earth fixed (ECEF) frame.
*/ */
const FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; } FGColumnVector3 GetECEFVelocity(void) const {return Tb2ec * VState.vUVW; }
/** Returns the current altitude above sea level. /** Returns the current altitude above sea level.
This function returns the altitude above sea level. This function returns the altitude above sea level.
units ft units ft
@return The current altitude above sea level in feet. @return The current altitude above sea level in feet.
*/ */
double GetAltitudeASL(void) const; double GetAltitudeASL(void) const { return VState.vLocation.GetAltitudeASL(); }
/** Returns the current altitude above sea level. /** Returns the current altitude above sea level.
This function returns the altitude above sea level. This function returns the altitude above sea level.
@ -387,7 +387,7 @@ public:
const FGColumnVector3& GetTerrainAngularVelocity(void) const { return LocalTerrainAngularVelocity; } const FGColumnVector3& GetTerrainAngularVelocity(void) const { return LocalTerrainAngularVelocity; }
void RecomputeLocalTerrainVelocity(); void RecomputeLocalTerrainVelocity();
double GetTerrainElevation(void) const; double GetTerrainElevation(void) const { return GetLocalTerrainRadius() - VState.vLocation.GetSeaLevelRadius(); }
double GetDistanceAGL(void) const; double GetDistanceAGL(void) const;
double GetRadius(void) const { double GetRadius(void) const {
if (VState.vLocation.GetRadius() == 0) return 1.0; if (VState.vLocation.GetRadius() == 0) return 1.0;
@ -467,21 +467,21 @@ public:
void SetEarthPositionAngle(double epa) {VState.vLocation.SetEarthPositionAngle(epa);} void SetEarthPositionAngle(double epa) {VState.vLocation.SetEarthPositionAngle(epa);}
void SetInertialOrientation(FGQuaternion Qi); void SetInertialOrientation(const FGQuaternion& Qi);
void SetInertialVelocity(FGColumnVector3 Vi); void SetInertialVelocity(const FGColumnVector3& Vi);
void SetInertialRates(FGColumnVector3 vRates); void SetInertialRates(const FGColumnVector3& vRates);
const FGQuaternion GetQuaternion(void) const { return VState.qAttitudeLocal; } const FGQuaternion GetQuaternion(void) const { return VState.qAttitudeLocal; }
const FGQuaternion GetQuaternionECI(void) const { return VState.qAttitudeECI; } const FGQuaternion GetQuaternionECI(void) const { return VState.qAttitudeECI; }
void SetPQR(unsigned int i, double val) { void SetPQR(unsigned int i, double val) {
if ((i>=1) && (i<=3) )
VState.vPQR(i) = val; VState.vPQR(i) = val;
VState.vPQRi = VState.vPQR + Ti2b * in.vOmegaPlanet;
} }
void SetUVW(unsigned int i, double val) { void SetUVW(unsigned int i, double val) {
if ((i>=1) && (i<=3) )
VState.vUVW(i) = val; VState.vUVW(i) = val;
CalculateInertialVelocity();
} }
// SET functions // SET functions
@ -505,7 +505,11 @@ public:
VState.vInertialPosition = Tec2i * VState.vLocation; VState.vInertialPosition = Tec2i * VState.vLocation;
} }
void SetAltitudeASL(double altASL); void SetAltitudeASL(double altASL)
{
VState.vLocation.SetAltitudeASL(altASL);
UpdateVehicleState();
}
void SetAltitudeASLmeters(double altASL) { SetAltitudeASL(altASL/fttom); } void SetAltitudeASLmeters(double altASL) { SetAltitudeASL(altASL/fttom); }
void SetSeaLevelRadius(double tt); void SetSeaLevelRadius(double tt);
@ -525,7 +529,7 @@ public:
SetLocation(l); SetLocation(l);
} }
void NudgeBodyLocation(FGColumnVector3 deltaLoc) { void NudgeBodyLocation(const FGColumnVector3& deltaLoc) {
VState.vInertialPosition -= Tb2i*deltaLoc; VState.vInertialPosition -= Tb2i*deltaLoc;
VState.vLocation -= Tb2ec*deltaLoc; VState.vLocation -= Tb2ec*deltaLoc;
} }

View file

@ -66,7 +66,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.51 2011/09/11 11:36:04 bcoconni Exp $"; static const char *IdSrc = "$Id: FGPropulsion.cpp,v 1.52 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_PROPULSION; static const char *IdHdr = ID_PROPULSION;
extern short debug_lvl; extern short debug_lvl;
@ -584,7 +584,7 @@ string FGPropulsion::GetPropulsionTankReport()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3& FGPropulsion::GetTanksMoment(void) const FGColumnVector3& FGPropulsion::GetTanksMoment(void)
{ {
vXYZtank_arm.InitMatrix(); vXYZtank_arm.InitMatrix();
for (unsigned int i=0; i<Tanks.size(); i++) { for (unsigned int i=0; i<Tanks.size(); i++) {
@ -597,7 +597,7 @@ FGColumnVector3& FGPropulsion::GetTanksMoment(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGPropulsion::GetTanksWeight(void) double FGPropulsion::GetTanksWeight(void) const
{ {
double Tw = 0.0; double Tw = 0.0;
@ -608,7 +608,7 @@ double FGPropulsion::GetTanksWeight(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGMatrix33& FGPropulsion::CalculateTankInertias(void) const FGMatrix33& FGPropulsion::CalculateTankInertias(void)
{ {
unsigned int size; unsigned int size;

View file

@ -50,7 +50,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PROPULSION "$Id: FGPropulsion.h,v 1.30 2011/08/03 03:21:06 jberndt Exp $" #define ID_PROPULSION "$Id: FGPropulsion.h,v 1.31 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -92,7 +92,7 @@ CLASS DOCUMENTATION
@endcode @endcode
@author Jon S. Berndt @author Jon S. Berndt
@version $Id: FGPropulsion.h,v 1.30 2011/08/03 03:21:06 jberndt Exp $ @version $Id: FGPropulsion.h,v 1.31 2011/10/31 14:54:41 bcoconni Exp $
@see @see
FGEngine FGEngine
FGTank FGTank
@ -180,13 +180,13 @@ public:
void DoRefuel(double time_slice); void DoRefuel(double time_slice);
void DumpFuel(double time_slice); void DumpFuel(double time_slice);
FGColumnVector3& GetTanksMoment(void); const FGColumnVector3& GetTanksMoment(void);
double GetTanksWeight(void); double GetTanksWeight(void) const;
std::ifstream* FindEngineFile(const std::string& filename); std::ifstream* FindEngineFile(const std::string& filename);
std::string FindEngineFullPathname(const std::string& engine_filename); std::string FindEngineFullPathname(const std::string& engine_filename);
inline int GetActiveEngine(void) const {return ActiveEngine;} inline int GetActiveEngine(void) const {return ActiveEngine;}
inline bool GetFuelFreeze(void) {return FuelFreeze;} inline bool GetFuelFreeze(void) const {return FuelFreeze;}
double GetTotalFuelQuantity(void) const {return TotalFuelQuantity;} double GetTotalFuelQuantity(void) const {return TotalFuelQuantity;}
void SetMagnetos(int setting); void SetMagnetos(int setting);
@ -194,7 +194,7 @@ public:
void SetCutoff(int setting=0); void SetCutoff(int setting=0);
void SetActiveEngine(int engine); void SetActiveEngine(int engine);
void SetFuelFreeze(bool f); void SetFuelFreeze(bool f);
FGMatrix33& CalculateTankInertias(void); const FGMatrix33& CalculateTankInertias(void);
struct FGEngine::Inputs in; struct FGEngine::Inputs in;

View file

@ -51,7 +51,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGWinds.cpp,v 1.5 2011/09/11 11:36:04 bcoconni Exp $"; static const char *IdSrc = "$Id: FGWinds.cpp,v 1.6 2011/11/10 12:02:34 jberndt Exp $";
static const char *IdHdr = ID_WINDS; static const char *IdHdr = ID_WINDS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -435,6 +435,46 @@ void FGWinds::CosineGust()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGWinds::NumberOfUpDownburstCells(int num)
{
for (unsigned int i=0; i<UpDownBurstCells.size();i++) delete UpDownBurstCells[i];
UpDownBurstCells.clear();
if (num >= 0) {
for (unsigned int i=0; i<num; i++) UpDownBurstCells.push_back(new struct UpDownBurst);
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// Calculates the distance between a specified point (where presumably the
// Up/Downburst is centered) and the current vehicle location. The distance
// here is calculated from the Haversine formula.
double FGWinds::DistanceFromRingCenter(double lat, double lon)
{
double deltaLat = in.latitude - lat;
double deltaLong = in.longitude - lon;
double dLat2 = deltaLat/2.0;
double dLong2 = deltaLong/2.0;
double a = sin(dLat2)*sin(dLat2)
+ cos(lat)*cos(in.latitude)*sin(dLong2)*sin(dLong2);
double c = 2.0*atan2(sqrt(a), sqrt(1.0 - a));
double d = in.planetRadius*c;
return d;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGWinds::UpDownBurst()
{
for (unsigned int i=0; i<UpDownBurstCells.size(); i++) {
double d = DistanceFromRingCenter(UpDownBurstCells[i]->ringLatitude, UpDownBurstCells[i]->ringLongitude);
}
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGWinds::bind(void) void FGWinds::bind(void)
{ {
typedef double (FGWinds::*PMF)(int) const; typedef double (FGWinds::*PMF)(int) const;
@ -473,6 +513,16 @@ void FGWinds::bind(void)
PropertyManager->Tie("atmosphere/cosine-gust/Z-velocity-ft_sec", this, (Ptr)0L, &FGWinds::GustZComponent); PropertyManager->Tie("atmosphere/cosine-gust/Z-velocity-ft_sec", this, (Ptr)0L, &FGWinds::GustZComponent);
PropertyManager->Tie("atmosphere/cosine-gust/start", this, (PMFt)0L, (PMFi)&FGWinds::StartGust); PropertyManager->Tie("atmosphere/cosine-gust/start", this, (PMFt)0L, (PMFi)&FGWinds::StartGust);
// User-specified Up- Down-burst parameters
PropertyManager->Tie("atmosphere/updownburst/number-of-cells", this, (PMFt)0L, &FGWinds::NumberOfUpDownburstCells);
// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
// PropertyManager->Tie("atmosphere/updownburst/", this, (Ptr)0L, &FGWinds::);
// User-specified turbulence (local navigational/geographic frame: N-E-D) // User-specified turbulence (local navigational/geographic frame: N-E-D)
PropertyManager->Tie("atmosphere/turb-north-fps", this, eNorth, (PMF)&FGWinds::GetTurbNED, PropertyManager->Tie("atmosphere/turb-north-fps", this, eNorth, (PMF)&FGWinds::GetTurbNED,
(PMFd)&FGWinds::SetTurbNED); (PMFd)&FGWinds::SetTurbNED);

View file

@ -47,7 +47,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_WINDS "$Id: FGWinds.h,v 1.6 2011/10/22 15:11:24 bcoconni Exp $" #define ID_WINDS "$Id: FGWinds.h,v 1.9 2011/11/19 14:14:57 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -154,7 +154,7 @@ public:
virtual void SetWindNED(const FGColumnVector3& wind) { vWindNED=wind; } virtual void SetWindNED(const FGColumnVector3& wind) { vWindNED=wind; }
/// Retrieves the wind components in NED frame. /// Retrieves the wind components in NED frame.
virtual FGColumnVector3& GetWindNED(void) { return vWindNED; } virtual const FGColumnVector3& GetWindNED(void) const { return vWindNED; }
/// Retrieves a wind component in NED frame. /// Retrieves a wind component in NED frame.
virtual double GetWindNED(int idx) const {return vWindNED(idx);} virtual double GetWindNED(int idx) const {return vWindNED(idx);}
@ -194,7 +194,7 @@ public:
virtual double GetTurbNED(int idx) const {return vTurbulenceNED(idx);} virtual double GetTurbNED(int idx) const {return vTurbulenceNED(idx);}
/// Retrieves the gust components in NED frame. /// Retrieves the gust components in NED frame.
virtual FGColumnVector3& GetGustNED(void) {return vGustNED;} virtual const FGColumnVector3& GetGustNED(void) const {return vGustNED;}
/** Turbulence models available: ttNone, ttStandard, ttBerndt, ttCulp, ttMilspec, ttTustin */ /** Turbulence models available: ttNone, ttStandard, ttBerndt, ttCulp, ttMilspec, ttTustin */
virtual void SetTurbType(tType tt) {turbType = tt;} virtual void SetTurbType(tType tt) {turbType = tt;}
@ -264,7 +264,14 @@ public:
double ringRadius; ///<- The radius of the ring (feet). double ringRadius; ///<- The radius of the ring (feet).
double ringCoreRadius; ///<- The cross-section "core" radius of the ring (feet). double ringCoreRadius; ///<- The cross-section "core" radius of the ring (feet).
double circulation; ///<- The circulation (gamma) (feet-squared per second). double circulation; ///<- The circulation (gamma) (feet-squared per second).
struct OneMinusCosineProfile oneMCosineProfile; struct OneMinusCosineProfile oneMCosineProfile;///<- A gust profile structure.
UpDownBurst() { ///<- Constructor
ringLatitude = ringLongitude = 0.0;
ringAltitude = 1000.0;
ringRadius = 2000.0;
ringCoreRadius = 100.0;
circulation = 100000.0;
}
}; };
// 1 - Cosine gust setters // 1 - Cosine gust setters
@ -293,11 +300,17 @@ public:
/// Specifies the Z component of velocity in the specified gust frame (ft/sec). /// Specifies the Z component of velocity in the specified gust frame (ft/sec).
virtual void GustZComponent(double z) {oneMinusCosineGust.vWind(eZ) = z;} virtual void GustZComponent(double z) {oneMinusCosineGust.vWind(eZ) = z;}
// Up- Down-burst functions
void NumberOfUpDownburstCells(int num);
struct Inputs { struct Inputs {
double V; double V;
double wingspan; double wingspan;
double DistanceAGL; double DistanceAGL;
double AltitudeASL; double AltitudeASL;
double longitude;
double latitude;
double planetRadius;
FGMatrix33 Tl2b; FGMatrix33 Tl2b;
FGMatrix33 Tw2b; FGMatrix33 Tw2b;
double totalDeltaT; double totalDeltaT;
@ -320,6 +333,7 @@ private:
FGColumnVector3 vTurbPQR; FGColumnVector3 vTurbPQR;
struct OneMinusCosineGust oneMinusCosineGust; struct OneMinusCosineGust oneMinusCosineGust;
std::vector <struct UpDownBurst*> UpDownBurstCells;
// Dryden turbulence model // Dryden turbulence model
double windspeed_at_20ft; ///< in ft/s double windspeed_at_20ft; ///< in ft/s
@ -334,12 +348,13 @@ private:
FGColumnVector3 vBurstGust; FGColumnVector3 vBurstGust;
FGColumnVector3 vTurbulenceNED; FGColumnVector3 vTurbulenceNED;
/// Get T, P and rho for a standard atmosphere at the given altitude.
void Turbulence(double h); void Turbulence(double h);
void UpDownBurst();
void CosineGust(); void CosineGust();
double CosineGustProfile( double startDuration, double steadyDuration, double CosineGustProfile( double startDuration, double steadyDuration,
double endDuration, double elapsedTime); double endDuration, double elapsedTime);
double DistanceFromRingCenter(double lat, double lon);
virtual void bind(void); virtual void bind(void);
void Debug(int from); void Debug(int from);

4
src/FDM/JSBSim/models/flight_control/FGFCSFunction.h Normal file → Executable file
View file

@ -45,7 +45,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FCSFUNCTION "$Id: FGFCSFunction.h,v 1.7 2009/10/02 10:30:09 jberndt Exp $" #define ID_FCSFUNCTION "$Id: FGFCSFunction.h,v 1.8 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -105,7 +105,7 @@ a function (from an aero specification):
</function> </function>
@endcode @endcode
@version $Id: FGFCSFunction.h,v 1.7 2009/10/02 10:30:09 jberndt Exp $ @version $Id: FGFCSFunction.h,v 1.8 2011/11/10 12:06:14 jberndt Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View file

@ -53,7 +53,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGEngine.cpp,v 1.47 2011/09/11 11:36:04 bcoconni Exp $"; static const char *IdSrc = "$Id: FGEngine.cpp,v 1.48 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_ENGINE; static const char *IdHdr = ID_ENGINE;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -183,7 +183,8 @@ unsigned int FGEngine::GetSourceTank(unsigned int i) const
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGEngine::SetPlacement(FGColumnVector3& location, FGColumnVector3& orientation) void FGEngine::SetPlacement(const FGColumnVector3& location,
const FGColumnVector3& orientation)
{ {
X = location(eX); X = location(eX);
Y = location(eY); Y = location(eY);
@ -201,14 +202,14 @@ double FGEngine::GetThrust(void) const
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3& FGEngine::GetBodyForces(void) const FGColumnVector3& FGEngine::GetBodyForces(void)
{ {
return Thruster->GetBodyForces(); return Thruster->GetBodyForces();
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3& FGEngine::GetMoments(void) const FGColumnVector3& FGEngine::GetMoments(void)
{ {
return Thruster->GetMoments(); return Thruster->GetMoments();
} }

View file

@ -55,7 +55,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_ENGINE "$Id: FGEngine.h,v 1.27 2011/08/17 23:56:01 jberndt Exp $" #define ID_ENGINE "$Id: FGEngine.h,v 1.29 2011/11/10 12:06:14 jberndt Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -113,7 +113,7 @@ CLASS DOCUMENTATION
documentation for engine and thruster classes. documentation for engine and thruster classes.
</pre> </pre>
@author Jon S. Berndt @author Jon S. Berndt
@version $Id: FGEngine.h,v 1.27 2011/08/17 23:56:01 jberndt Exp $ @version $Id: FGEngine.h,v 1.29 2011/11/10 12:06:14 jberndt Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -157,28 +157,28 @@ public:
enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etTurboprop, etElectric}; enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etTurboprop, etElectric};
EngineType GetType(void) { return Type; } EngineType GetType(void) const { return Type; }
virtual string GetName(void) { return Name; } virtual const string& GetName(void) const { return Name; }
// Engine controls // Engine controls
virtual double GetThrottleMin(void) { return MinThrottle; } virtual double GetThrottleMin(void) const { return MinThrottle; }
virtual double GetThrottleMax(void) { return MaxThrottle; } virtual double GetThrottleMax(void) const { return MaxThrottle; }
virtual bool GetStarter(void) { return Starter; } virtual bool GetStarter(void) const { return Starter; }
virtual double getFuelFlow_gph () const {return FuelFlow_gph;} virtual double getFuelFlow_gph () const {return FuelFlow_gph;}
virtual double getFuelFlow_pph () const {return FuelFlow_pph;} virtual double getFuelFlow_pph () const {return FuelFlow_pph;}
virtual double GetFuelFlowRate(void) const {return FuelFlowRate;} virtual double GetFuelFlowRate(void) const {return FuelFlowRate;}
virtual double GetFuelFlowRateGPH(void) const {return FuelFlowRate*3600/6.02;} virtual double GetFuelFlowRateGPH(void) const {return FuelFlowRate*3600/6.02;}
virtual double GetFuelUsedLbs(void) const {return FuelUsedLbs;} virtual double GetFuelUsedLbs(void) const {return FuelUsedLbs;}
virtual bool GetStarved(void) { return Starved; } virtual bool GetStarved(void) const { return Starved; }
virtual bool GetRunning(void) const { return Running; } virtual bool GetRunning(void) const { return Running; }
virtual bool GetCranking(void) { return Cranking; } virtual bool GetCranking(void) const { return Cranking; }
virtual void SetStarved(bool tt) { Starved = tt; } virtual void SetStarved(bool tt) { Starved = tt; }
virtual void SetStarved(void) { Starved = true; } virtual void SetStarved(void) { Starved = true; }
virtual void SetRunning(bool bb) { Running=bb; } virtual void SetRunning(bool bb) { Running=bb; }
virtual void SetName(string name) { Name = name; } virtual void SetName(const string& name) { Name = name; }
virtual void SetFuelFreeze(bool f) { FuelFreeze = f; } virtual void SetFuelFreeze(bool f) { FuelFreeze = f; }
virtual void SetStarter(bool s) { Starter = s; } virtual void SetStarter(bool s) { Starter = s; }
@ -194,7 +194,7 @@ public:
virtual double GetThrust(void) const; virtual double GetThrust(void) const;
/// Sets engine placement information /// Sets engine placement information
virtual void SetPlacement(FGColumnVector3& location, FGColumnVector3& orientation); virtual void SetPlacement(const FGColumnVector3& location, const FGColumnVector3& orientation);
/** The fuel need is calculated based on power levels and flow rate for that /** The fuel need is calculated based on power levels and flow rate for that
power level. It is also turned from a rate into an actual amount (pounds) power level. It is also turned from a rate into an actual amount (pounds)
@ -206,11 +206,11 @@ public:
virtual double GetPowerAvailable(void) {return 0.0;}; virtual double GetPowerAvailable(void) {return 0.0;};
virtual FGColumnVector3& GetBodyForces(void); virtual const FGColumnVector3& GetBodyForces(void);
virtual FGColumnVector3& GetMoments(void); virtual const FGColumnVector3& GetMoments(void);
bool LoadThruster(Element *el); bool LoadThruster(Element *el);
FGThruster* GetThruster(void) {return Thruster;} FGThruster* GetThruster(void) const {return Thruster;}
unsigned int GetSourceTank(unsigned int i) const; unsigned int GetSourceTank(unsigned int i) const;
unsigned int GetNumSourceTanks() const {return SourceTanks.size();} unsigned int GetNumSourceTanks() const {return SourceTanks.size();}

View file

@ -53,7 +53,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGForce.cpp,v 1.16 2011/08/04 12:46:32 jberndt Exp $"; static const char *IdSrc = "$Id: FGForce.cpp,v 1.17 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_FORCE; static const char *IdHdr = ID_FORCE;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -89,7 +89,7 @@ FGForce::~FGForce()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3& FGForce::GetBodyForces(void) const FGColumnVector3& FGForce::GetBodyForces(void)
{ {
vFb = Transform()*vFn; vFb = Transform()*vFn;
@ -106,7 +106,7 @@ FGColumnVector3& FGForce::GetBodyForces(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGMatrix33 FGForce::Transform(void) const FGMatrix33& FGForce::Transform(void) const
{ {
switch(ttype) { switch(ttype) {
case tWindBody: case tWindBody:

View file

@ -66,7 +66,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FORCE "$Id: FGForce.h,v 1.13 2009/10/05 04:48:03 jberndt Exp $" #define ID_FORCE "$Id: FGForce.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -215,7 +215,7 @@ and vMn, the moments, can be made directly. Otherwise, the usage is similar.<br>
<br><br></p> <br><br></p>
@author Tony Peden @author Tony Peden
@version $Id: FGForce.h,v 1.13 2009/10/05 04:48:03 jberndt Exp $ @version $Id: FGForce.h,v 1.14 2011/10/31 14:54:41 bcoconni Exp $
*/ */
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -238,12 +238,12 @@ public:
enum TransformType { tNone, tWindBody, tLocalBody, tCustom }; enum TransformType { tNone, tWindBody, tLocalBody, tCustom };
virtual FGColumnVector3& GetBodyForces(void); virtual const FGColumnVector3& GetBodyForces(void);
inline double GetBodyXForce(void) const { return vFb(eX); } inline double GetBodyXForce(void) const { return vFb(eX); }
inline double GetBodyYForce(void) const { return vFb(eY); } inline double GetBodyYForce(void) const { return vFb(eY); }
inline double GetBodyZForce(void) const { return vFb(eZ); } inline double GetBodyZForce(void) const { return vFb(eZ); }
inline FGColumnVector3& GetMoments(void) { return vM; } inline const FGColumnVector3& GetMoments(void) const { return vM; }
// Normal point of application, JSBsim structural coords // Normal point of application, JSBsim structural coords
// (inches, x +back, y +right, z +up) // (inches, x +back, y +right, z +up)
@ -273,8 +273,8 @@ public:
inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;} inline double SetActingLocationX(double x) {vActingXYZn(eX) = x; return x;}
inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;} inline double SetActingLocationY(double y) {vActingXYZn(eY) = y; return y;}
inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;} inline double SetActingLocationZ(double z) {vActingXYZn(eZ) = z; return z;}
inline void SetLocation(FGColumnVector3 vv) { vXYZn = vv; SetActingLocation(vv);} inline void SetLocation(const FGColumnVector3& vv) { vXYZn = vv; SetActingLocation(vv);}
inline void SetActingLocation(FGColumnVector3 vv) { vActingXYZn = vv; } inline void SetActingLocation(const FGColumnVector3& vv) { vActingXYZn = vv; }
inline double GetLocationX( void ) const { return vXYZn(eX);} inline double GetLocationX( void ) const { return vXYZn(eX);}
inline double GetLocationY( void ) const { return vXYZn(eY);} inline double GetLocationY( void ) const { return vXYZn(eY);}
@ -282,8 +282,8 @@ public:
inline double GetActingLocationX( void ) const { return vActingXYZn(eX);} inline double GetActingLocationX( void ) const { return vActingXYZn(eX);}
inline double GetActingLocationY( void ) const { return vActingXYZn(eY);} inline double GetActingLocationY( void ) const { return vActingXYZn(eY);}
inline double GetActingLocationZ( void ) const { return vActingXYZn(eZ);} inline double GetActingLocationZ( void ) const { return vActingXYZn(eZ);}
FGColumnVector3& GetLocation(void) { return vXYZn; } const FGColumnVector3& GetLocation(void) const { return vXYZn; }
FGColumnVector3& GetActingLocation(void) { return vActingXYZn; } const FGColumnVector3& GetActingLocation(void) const { return vActingXYZn; }
//these angles are relative to body axes, not earth!!!!! //these angles are relative to body axes, not earth!!!!!
//I'm using these because pitch, roll, and yaw are easy to visualize, //I'm using these because pitch, roll, and yaw are easy to visualize,
@ -293,7 +293,7 @@ public:
//They are in radians. //They are in radians.
void SetAnglesToBody(double broll, double bpitch, double byaw); void SetAnglesToBody(double broll, double bpitch, double byaw);
inline void SetAnglesToBody(FGColumnVector3 vv) { inline void SetAnglesToBody(const FGColumnVector3& vv) {
SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw)); SetAnglesToBody(vv(eRoll), vv(ePitch), vv(eYaw));
} }
@ -304,13 +304,13 @@ public:
double GetPitch(void) const {return vOrient(ePitch);} double GetPitch(void) const {return vOrient(ePitch);}
double GetYaw(void) const {return vOrient(eYaw);} double GetYaw(void) const {return vOrient(eYaw);}
inline FGColumnVector3& GetAnglesToBody(void) {return vOrient;} inline const FGColumnVector3& GetAnglesToBody(void) const {return vOrient;}
inline double GetAnglesToBody(int axis) const {return vOrient(axis);} inline double GetAnglesToBody(int axis) const {return vOrient(axis);}
inline void SetTransformType(TransformType ii) { ttype=ii; } inline void SetTransformType(TransformType ii) { ttype=ii; }
inline TransformType GetTransformType(void) const { return ttype; } inline TransformType GetTransformType(void) const { return ttype; }
FGMatrix33 Transform(void); const FGMatrix33& Transform(void) const;
protected: protected:
FGFDMExec *fdmex; FGFDMExec *fdmex;

View file

@ -45,7 +45,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.39 2011/10/15 13:00:57 bcoconni Exp $"; static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.41 2011/11/17 21:07:30 jentron Exp $";
static const char *IdHdr = ID_PROPELLER; static const char *IdHdr = ID_PROPELLER;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -223,6 +223,10 @@ double FGPropeller::Calculate(double EnginePower)
if (CtMach) ThrustCoeff *= CtMach->GetValue(HelicalTipMach); if (CtMach) ThrustCoeff *= CtMach->GetValue(HelicalTipMach);
if (P_Factor > 0.0001) { if (P_Factor > 0.0001) {
// alpha = sin(fdmex->GetAuxiliary()->Getalpha() + FGThruster::GetPitch());
// beta = sin(fdmex->GetAuxiliary()->Getbeta() + FGThruster::GetYaw());
// SetActingLocationY( GetLocationY() + P_Factor*alpha*Sense);
// SetActingLocationZ( GetLocationZ() + P_Factor*beta*Sense);
SetActingLocationY( GetLocationY() + P_Factor*in.Alpha*Sense); SetActingLocationY( GetLocationY() + P_Factor*in.Alpha*Sense);
SetActingLocationZ( GetLocationZ() + P_Factor*in.Beta*Sense); SetActingLocationZ( GetLocationZ() + P_Factor*in.Beta*Sense);
} }
@ -334,8 +338,8 @@ double FGPropeller::GetPowerRequired(void)
double CL = (90.0 - Pitch) / 20.0; double CL = (90.0 - Pitch) / 20.0;
if (CL > 1.5) CL = 1.5; if (CL > 1.5) CL = 1.5;
double BladeArea = Diameter * Diameter / 32.0 * numBlades; double BladeArea = Diameter * Diameter / 32.0 * numBlades;
vTorque(eX) = -Sense*BladeArea*Diameter*Vel*Vel*rho*0.19*CL; vTorque(eX) = -Sense*BladeArea*Diameter*fabs(Vel)*Vel*rho*0.19*CL;
PowerRequired = fabs(vTorque(eX))*0.2*M_PI; PowerRequired = Sense*(vTorque(eX))*0.2*M_PI;
} }
return PowerRequired; return PowerRequired;
@ -343,7 +347,7 @@ double FGPropeller::GetPowerRequired(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGColumnVector3 FGPropeller::GetPFactor() FGColumnVector3 FGPropeller::GetPFactor() const
{ {
double px=0.0, py, pz; double px=0.0, py, pz;
@ -355,7 +359,7 @@ FGColumnVector3 FGPropeller::GetPFactor()
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGPropeller::GetThrusterLabels(int id, string delimeter) string FGPropeller::GetThrusterLabels(int id, const string& delimeter)
{ {
std::ostringstream buf; std::ostringstream buf;
@ -372,7 +376,7 @@ string FGPropeller::GetThrusterLabels(int id, string delimeter)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGPropeller::GetThrusterValues(int id, string delimeter) string FGPropeller::GetThrusterValues(int id, const string& delimeter)
{ {
std::ostringstream buf; std::ostringstream buf;

View file

@ -45,7 +45,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_PROPELLER "$Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $" #define ID_PROPELLER "$Id: FGPropeller.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -142,7 +142,7 @@ CLASS DOCUMENTATION
<li>Various NACA Technical Notes and Reports</li> <li>Various NACA Technical Notes and Reports</li>
</ul> </ul>
@author Jon S. Berndt @author Jon S. Berndt
@version $Id: FGPropeller.h,v 1.19 2011/09/24 14:26:46 jentron Exp $ @version $Id: FGPropeller.h,v 1.20 2011/10/31 14:54:41 bcoconni Exp $
@see FGEngine @see FGEngine
@see FGThruster @see FGThruster
*/ */
@ -175,7 +175,7 @@ public:
void SetEngineRPM(double rpm) {RPM = rpm/GearRatio;} void SetEngineRPM(double rpm) {RPM = rpm/GearRatio;}
/// Returns true of this propeller is variable pitch /// Returns true of this propeller is variable pitch
bool IsVPitch(void) {return MaxPitch != MinPitch;} bool IsVPitch(void) const {return MaxPitch != MinPitch;}
/** This commands the pitch of the blade to change to the value supplied. /** This commands the pitch of the blade to change to the value supplied.
This call is meant to be issued either from the cockpit or by the flight This call is meant to be issued either from the cockpit or by the flight
@ -207,7 +207,7 @@ public:
void SetSense(double s) { Sense = s;} void SetSense(double s) { Sense = s;}
/// Retrieves the pitch of the propeller in degrees. /// Retrieves the pitch of the propeller in degrees.
double GetPitch(void) { return Pitch; } double GetPitch(void) const { return Pitch; }
/// Retrieves the RPMs of the propeller /// Retrieves the RPMs of the propeller
double GetRPM(void) const { return RPM; } double GetRPM(void) const { return RPM; }
@ -216,16 +216,16 @@ public:
double GetEngineRPM(void) const { return RPM * GearRatio; } double GetEngineRPM(void) const { return RPM * GearRatio; }
/// Retrieves the propeller moment of inertia /// Retrieves the propeller moment of inertia
double GetIxx(void) { return Ixx; } double GetIxx(void) const { return Ixx; }
/// Retrieves the coefficient of thrust multiplier /// Retrieves the coefficient of thrust multiplier
double GetCtFactor(void) { return CtFactor; } double GetCtFactor(void) const { return CtFactor; }
/// Retrieves the coefficient of power multiplier /// Retrieves the coefficient of power multiplier
double GetCpFactor(void) { return CpFactor; } double GetCpFactor(void) const { return CpFactor; }
/// Retrieves the propeller diameter /// Retrieves the propeller diameter
double GetDiameter(void) { return Diameter; } double GetDiameter(void) const { return Diameter; }
/// Retrieves propeller thrust table /// Retrieves propeller thrust table
FGTable* GetCThrustTable(void) const { return cThrust;} FGTable* GetCThrustTable(void) const { return cThrust;}
@ -238,7 +238,7 @@ public:
FGTable* GetCpMachTable(void) const { return CpMach; } FGTable* GetCpMachTable(void) const { return CpMach; }
/// Retrieves the Torque in foot-pounds (Don't you love the English system?) /// Retrieves the Torque in foot-pounds (Don't you love the English system?)
double GetTorque(void) { return vTorque(eX); } double GetTorque(void) const { return vTorque(eX); }
/** Retrieves the power required (or "absorbed") by the propeller - /** Retrieves the power required (or "absorbed") by the propeller -
i.e. the power required to keep spinning the propeller at the current i.e. the power required to keep spinning the propeller at the current
@ -255,16 +255,16 @@ public:
would be slowed. would be slowed.
@return the thrust in pounds */ @return the thrust in pounds */
double Calculate(double EnginePower); double Calculate(double EnginePower);
FGColumnVector3 GetPFactor(void); FGColumnVector3 GetPFactor(void) const;
string GetThrusterLabels(int id, string delimeter); string GetThrusterLabels(int id, const string& delimeter);
string GetThrusterValues(int id, string delimeter); string GetThrusterValues(int id, const string& delimeter);
void SetReverseCoef (double c) { Reverse_coef = c; } void SetReverseCoef (double c) { Reverse_coef = c; }
double GetReverseCoef (void) { return Reverse_coef; } double GetReverseCoef (void) const { return Reverse_coef; }
void SetReverse (bool r) { Reversed = r; } void SetReverse (bool r) { Reversed = r; }
bool GetReverse (void) { return Reversed; } bool GetReverse (void) const { return Reversed; }
void SetFeather (bool f) { Feathered = f; } void SetFeather (bool f) { Feathered = f; }
bool GetFeather (void) { return Feathered; } bool GetFeather (void) const { return Feathered; }
double GetThrustCoefficient(void) const {return ThrustCoeff;} double GetThrustCoefficient(void) const {return ThrustCoeff;}
double GetHelicalTipMach(void) const {return HelicalTipMach;} double GetHelicalTipMach(void) const {return HelicalTipMach;}
int GetConstantSpeed(void) const {return ConstantSpeed;} int GetConstantSpeed(void) const {return ConstantSpeed;}

View file

@ -47,7 +47,7 @@ using namespace std;
namespace JSBSim { namespace JSBSim {
static const char *IdSrc = "$Id: FGTank.cpp,v 1.32 2011/09/18 13:04:34 bcoconni Exp $"; static const char *IdSrc = "$Id: FGTank.cpp,v 1.33 2011/10/31 14:54:41 bcoconni Exp $";
static const char *IdHdr = ID_TANK; static const char *IdHdr = ID_TANK;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@ -197,14 +197,14 @@ void FGTank::ResetToIC(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
const FGColumnVector3 FGTank::GetXYZ(void) FGColumnVector3 FGTank::GetXYZ(void) const
{ {
return vXYZ_drain + (Contents/Capacity)*(vXYZ - vXYZ_drain); return vXYZ_drain + (Contents/Capacity)*(vXYZ - vXYZ_drain);
} }
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGTank::GetXYZ(int idx) double FGTank::GetXYZ(int idx) const
{ {
return vXYZ_drain(idx) + (Contents/Capacity)*(vXYZ(idx)-vXYZ_drain(idx)); return vXYZ_drain(idx) + (Contents/Capacity)*(vXYZ(idx)-vXYZ_drain(idx));
} }
@ -331,7 +331,7 @@ void FGTank::CalculateInertias(void)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGTank::ProcessFuelName(std::string const& name) double FGTank::ProcessFuelName(const std::string& name)
{ {
if (name == "AVGAS") return 6.02; if (name == "AVGAS") return 6.02;
else if (name == "JET-A") return 6.74; else if (name == "JET-A") return 6.74;

View file

@ -52,7 +52,7 @@ INCLUDES
DEFINITIONS DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_TANK "$Id: FGTank.h,v 1.25 2011/09/18 13:04:34 bcoconni Exp $" #define ID_TANK "$Id: FGTank.h,v 1.26 2011/10/31 14:54:41 bcoconni Exp $"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS FORWARD DECLARATIONS
@ -226,26 +226,26 @@ public:
/** Retrieves the type of tank: Fuel or Oxidizer. /** Retrieves the type of tank: Fuel or Oxidizer.
@return the tank type, 0 for undefined, 1 for fuel, and 2 for oxidizer. @return the tank type, 0 for undefined, 1 for fuel, and 2 for oxidizer.
*/ */
int GetType(void) {return Type;} int GetType(void) const {return Type;}
/** Resets the tank parameters to the initial conditions */ /** Resets the tank parameters to the initial conditions */
void ResetToIC(void); void ResetToIC(void);
/** If the tank is set to supply fuel, this function returns true. /** If the tank is set to supply fuel, this function returns true.
@return true if this tank is set to a non-zero priority.*/ @return true if this tank is set to a non-zero priority.*/
bool GetSelected(void) {return Selected;} bool GetSelected(void) const {return Selected;}
/** Gets the tank fill level. /** Gets the tank fill level.
@return the fill level in percent, from 0 to 100.*/ @return the fill level in percent, from 0 to 100.*/
double GetPctFull(void) {return PctFull;} double GetPctFull(void) const {return PctFull;}
/** Gets the capacity of the tank. /** Gets the capacity of the tank.
@return the capacity of the tank in pounds. */ @return the capacity of the tank in pounds. */
double GetCapacity(void) {return Capacity;} double GetCapacity(void) const {return Capacity;}
/** Gets the capacity of the tank. /** Gets the capacity of the tank.
@return the capacity of the tank in gallons. */ @return the capacity of the tank in gallons. */
double GetCapacityGallons(void) {return Capacity/Density;} double GetCapacityGallons(void) const {return Capacity/Density;}
/** Gets the contents of the tank. /** Gets the contents of the tank.
@return the contents of the tank in pounds. */ @return the contents of the tank in pounds. */
@ -260,24 +260,24 @@ public:
given in the configuration file. given in the configuration file.
@return the temperature of the fuel in degrees C IF an initial temperature @return the temperature of the fuel in degrees C IF an initial temperature
is given, otherwise 0.0 C is returned. */ is given, otherwise 0.0 C is returned. */
double GetTemperature_degC(void) {return Temperature;} double GetTemperature_degC(void) const {return Temperature;}
/** Gets the temperature of the fuel. /** Gets the temperature of the fuel.
The temperature of the fuel is calculated if an initial tempearture is The temperature of the fuel is calculated if an initial tempearture is
given in the configuration file. given in the configuration file.
@return the temperature of the fuel in degrees F IF an initial temperature @return the temperature of the fuel in degrees F IF an initial temperature
is given, otherwise 32 degrees F is returned. */ is given, otherwise 32 degrees F is returned. */
double GetTemperature(void) {return CelsiusToFahrenheit(Temperature);} double GetTemperature(void) const {return CelsiusToFahrenheit(Temperature);}
/** Returns the density of a named fuel type. /** Returns the density of a named fuel type.
@return the density, in lbs/gal, or 6.6 if name cannot be resolved. */ @return the density, in lbs/gal, or 6.6 if name cannot be resolved. */
double ProcessFuelName(std::string const& name); double ProcessFuelName(const std::string& name);
double GetIxx(void) {return Ixx;} double GetIxx(void) const {return Ixx;}
double GetIyy(void) {return Iyy;} double GetIyy(void) const {return Iyy;}
double GetIzz(void) {return Izz;} double GetIzz(void) const {return Izz;}
double GetStandpipe(void) {return Standpipe;} double GetStandpipe(void) const {return Standpipe;}
int GetPriority(void) const {return Priority;} int GetPriority(void) const {return Priority;}
void SetPriority(int p) { Priority = p; Selected = p>0 ? true:false; } void SetPriority(int p) { Priority = p; Selected = p>0 ? true:false; }
@ -288,10 +288,10 @@ public:
double GetExternalFlow(void) const {return ExternalFlow;} double GetExternalFlow(void) const {return ExternalFlow;}
void SetExternalFlow(double f) { ExternalFlow = f; } void SetExternalFlow(double f) { ExternalFlow = f; }
const FGColumnVector3 GetXYZ(void); FGColumnVector3 GetXYZ(void) const;
double GetXYZ(int idx); double GetXYZ(int idx) const;
const GrainType GetGrainType(void) {return grainType;} const GrainType GetGrainType(void) const {return grainType;}
double Fill(double amount); double Fill(double amount);
void SetContents(double amount); void SetContents(double amount);

View file

@ -25,7 +25,7 @@
#include <simgear/compiler.h> #include <simgear/compiler.h>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/project.hxx> #include <simgear/scene/util/project.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Scenery/scenery.hxx> #include <Scenery/scenery.hxx>

View file

@ -73,14 +73,12 @@ target_link_libraries(fgfs
${FG_LIBS} ${FG_LIBS}
${SIMGEAR_LIBRARIES} ${SIMGEAR_LIBRARIES}
${OPENSCENEGRAPH_LIBRARIES} ${OPENSCENEGRAPH_LIBRARIES}
${ALUT_LIBRARY}
${OPENAL_LIBRARY}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${PLIB_LIBRARIES} ${PLIB_LIBRARIES}
${JPEG_LIBRARY} ${JPEG_LIBRARY}
${LIBSVN_LIBRARIES}
${HLA_LIBRARIES} ${HLA_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
${PLATFORM_LIBS} ${PLATFORM_LIBS}
) )
@ -90,6 +88,7 @@ add_executable(metar metar_main.cxx)
target_link_libraries(metar target_link_libraries(metar
${SIMGEAR_LIBRARIES} ${SIMGEAR_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
${PLATFORM_LIBS} ${PLATFORM_LIBS}
) )

View file

@ -79,7 +79,7 @@ FGFX::init()
string path_str = node->getStringValue("path"); string path_str = node->getStringValue("path");
if (path_str.empty()) { if (path_str.empty()) {
SG_LOG(SG_SOUND, SG_ALERT, "No path in /sim/sound/path"); SG_LOG(SG_SOUND, SG_ALERT, "No path in sim/sound/path");
return; return;
} }

View file

@ -13,6 +13,7 @@ target_link_libraries(GPSsmooth
${PLIB_SG_LIBRARY} ${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY} ${PLIB_UL_LIBRARY}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
${ZLIB_LIBRARY}
${WINMM_LIBRARY} ${WINMM_LIBRARY}
) )
@ -21,6 +22,7 @@ target_link_libraries(MIDGsmooth
${PLIB_SG_LIBRARY} ${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY} ${PLIB_UL_LIBRARY}
${WINMM_LIBRARY} ${WINMM_LIBRARY}
${ZLIB_LIBRARY}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
) )
@ -29,6 +31,7 @@ target_link_libraries(UGsmooth
${PLIB_SG_LIBRARY} ${PLIB_SG_LIBRARY}
${PLIB_UL_LIBRARY} ${PLIB_UL_LIBRARY}
${WINMM_LIBRARY} ${WINMM_LIBRARY}
${ZLIB_LIBRARY}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
) )

View file

@ -6,7 +6,7 @@ add_executable(fgadmin fgadmin_funcs.cxx main.cxx untarka.c)
add_dependencies(fgadmin FGAdminUI) add_dependencies(fgadmin FGAdminUI)
target_link_libraries(fgadmin FGAdminUI target_link_libraries(fgadmin FGAdminUI
${SIMGEAR_LIBRARIES} ${SIMGEAR_CORE_LIBRARIES}
${PLIB_LIBRARIES} ${PLIB_LIBRARIES}
${FLTK_LIBRARIES} ${FLTK_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES} ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}

View file

@ -22,7 +22,8 @@ if(GLUT_FOUND)
panel.cxx panel.cxx
panel.hxx panel.hxx
panel_io.cxx panel_io.cxx
panel_io.hxx) panel_io.hxx
)
target_link_libraries(fgpanel target_link_libraries(fgpanel
${PNG_LIBRARIES} ${PNG_LIBRARIES}