Latest jsbsim updates.
This commit is contained in:
parent
2aca8ca2cf
commit
94034c3081
15 changed files with 471 additions and 405 deletions
|
@ -225,8 +225,8 @@ bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string f
|
||||||
|
|
||||||
ReadPrologue(&AC_cfg);
|
ReadPrologue(&AC_cfg);
|
||||||
|
|
||||||
while ((AC_cfg.GetNextConfigLine() != "EOF") &&
|
while ((AC_cfg.GetNextConfigLine() != string("EOF")) &&
|
||||||
(token = AC_cfg.GetValue()) != "/FDM_CONFIG") {
|
(token = AC_cfg.GetValue()) != string("/FDM_CONFIG")) {
|
||||||
if (token == "METRICS") {
|
if (token == "METRICS") {
|
||||||
cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
|
cout << fgcyan << "\n Reading Metrics" << fgdef << endl;
|
||||||
ReadMetrics(&AC_cfg);
|
ReadMetrics(&AC_cfg);
|
||||||
|
@ -455,9 +455,9 @@ void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg) {
|
||||||
|
|
||||||
AC_cfg->GetNextConfigLine();
|
AC_cfg->GetNextConfigLine();
|
||||||
|
|
||||||
while ((token = AC_cfg->GetValue()) != "/METRICS") {
|
while ((token = AC_cfg->GetValue()) != string("/METRICS")) {
|
||||||
*AC_cfg >> parameter;
|
*AC_cfg >> parameter;
|
||||||
if (parameter == "AC_WINGAREA") {
|
if (parameter == string("AC_WINGAREA")) {
|
||||||
*AC_cfg >> WingArea;
|
*AC_cfg >> WingArea;
|
||||||
cout << " WingArea: " << WingArea << endl;
|
cout << " WingArea: " << WingArea << endl;
|
||||||
} else if (parameter == "AC_WINGSPAN") {
|
} else if (parameter == "AC_WINGSPAN") {
|
||||||
|
@ -522,12 +522,12 @@ void FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg) {
|
||||||
|
|
||||||
AC_cfg->GetNextConfigLine();
|
AC_cfg->GetNextConfigLine();
|
||||||
|
|
||||||
while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") {
|
while ((token = AC_cfg->GetValue()) != string("/AERODYNAMICS")) {
|
||||||
if (token == "AXIS") {
|
if (token == "AXIS") {
|
||||||
CoeffArray ca;
|
CoeffArray ca;
|
||||||
axis = AC_cfg->GetValue("NAME");
|
axis = AC_cfg->GetValue("NAME");
|
||||||
AC_cfg->GetNextConfigLine();
|
AC_cfg->GetNextConfigLine();
|
||||||
while ((token = AC_cfg->GetValue()) != "/AXIS") {
|
while ((token = AC_cfg->GetValue()) != string("/AXIS")) {
|
||||||
ca.push_back(new FGCoefficient(FDMExec, AC_cfg));
|
ca.push_back(new FGCoefficient(FDMExec, AC_cfg));
|
||||||
DisplayCoeffFactors(ca.back()->Getmultipliers());
|
DisplayCoeffFactors(ca.back()->Getmultipliers());
|
||||||
}
|
}
|
||||||
|
@ -544,7 +544,7 @@ void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg) {
|
||||||
|
|
||||||
AC_cfg->GetNextConfigLine();
|
AC_cfg->GetNextConfigLine();
|
||||||
|
|
||||||
while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") {
|
while ((token = AC_cfg->GetValue()) != string("/UNDERCARRIAGE")) {
|
||||||
lGear.push_back(FGLGear(AC_cfg, FDMExec));
|
lGear.push_back(FGLGear(AC_cfg, FDMExec));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -562,7 +562,7 @@ void FGAircraft::ReadOutput(FGConfigFile* AC_cfg) {
|
||||||
Output->SetType(token);
|
Output->SetType(token);
|
||||||
AC_cfg->GetNextConfigLine();
|
AC_cfg->GetNextConfigLine();
|
||||||
|
|
||||||
while ((token = AC_cfg->GetValue()) != "/OUTPUT") {
|
while ((token = AC_cfg->GetValue()) != string("/OUTPUT")) {
|
||||||
*AC_cfg >> parameter;
|
*AC_cfg >> parameter;
|
||||||
if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate;
|
if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate;
|
||||||
if (parameter == "SIMULATION") {
|
if (parameter == "SIMULATION") {
|
||||||
|
@ -634,7 +634,7 @@ void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg) {
|
||||||
CFGVersion = AC_cfg->GetValue("VERSION");
|
CFGVersion = AC_cfg->GetValue("VERSION");
|
||||||
cout << " Version: " << highint << CFGVersion
|
cout << " Version: " << highint << CFGVersion
|
||||||
<< normint << endl;
|
<< normint << endl;
|
||||||
if (CFGVersion != NEEDED_CFG_VERSION) {
|
if (CFGVersion != string(NEEDED_CFG_VERSION)) {
|
||||||
cout << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
|
cout << endl << fgred << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
|
||||||
" RESULTS WILL BE UNPREDICTABLE !!" << endl;
|
" RESULTS WILL BE UNPREDICTABLE !!" << endl;
|
||||||
cout << "Current version needed is: " << NEEDED_CFG_VERSION << endl;
|
cout << "Current version needed is: " << NEEDED_CFG_VERSION << endl;
|
||||||
|
|
|
@ -48,7 +48,11 @@ INCLUDES
|
||||||
#include "FGState.h"
|
#include "FGState.h"
|
||||||
#include "FGFDMExec.h"
|
#include "FGFDMExec.h"
|
||||||
|
|
||||||
#include <iomanip.h>
|
#ifndef FGFS
|
||||||
|
# include <iomanip.h>
|
||||||
|
#else
|
||||||
|
# include STL_IOMANIP
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *IdSrc = "$Id$";
|
static const char *IdSrc = "$Id$";
|
||||||
static const char *IdHdr = "ID_COEFFICIENT";
|
static const char *IdHdr = "ID_COEFFICIENT";
|
||||||
|
|
|
@ -53,8 +53,8 @@ FGControls::~FGControls() {
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
// Revision 1.22 2001/03/29 23:04:51 curt
|
// Revision 1.23 2001/04/02 01:12:38 curt
|
||||||
// Latest round of JSBSim updates.
|
// Latest jsbsim updates.
|
||||||
//
|
//
|
||||||
// Revision 1.7 2001/03/22 14:10:24 jberndt
|
// Revision 1.7 2001/03/22 14:10:24 jberndt
|
||||||
// Fixed ID comment
|
// Fixed ID comment
|
||||||
|
|
|
@ -178,8 +178,8 @@ extern FGControls controls;
|
||||||
|
|
||||||
|
|
||||||
// $Log$
|
// $Log$
|
||||||
// Revision 1.21 2001/03/29 23:04:51 curt
|
// Revision 1.22 2001/04/02 01:12:38 curt
|
||||||
// Latest round of JSBSim updates.
|
// Latest jsbsim updates.
|
||||||
//
|
//
|
||||||
// Revision 1.10 2001/03/22 14:10:24 jberndt
|
// Revision 1.10 2001/03/22 14:10:24 jberndt
|
||||||
// Fixed ID comment
|
// Fixed ID comment
|
||||||
|
|
|
@ -117,6 +117,7 @@ CLASS IMPLEMENTATION
|
||||||
|
|
||||||
FGFDMExec::FGFDMExec(void)
|
FGFDMExec::FGFDMExec(void)
|
||||||
{
|
{
|
||||||
|
Frame = 0;
|
||||||
FirstModel = 0;
|
FirstModel = 0;
|
||||||
Error = 0;
|
Error = 0;
|
||||||
State = 0;
|
State = 0;
|
||||||
|
@ -304,13 +305,16 @@ bool FGFDMExec::Run(void)
|
||||||
if (State->Getsim_time() >= EndTime) return false;
|
if (State->Getsim_time() >= EndTime) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug_lvl & 4) cout << "=========================" << endl;
|
if (debug_lvl & 4)
|
||||||
|
cout << "================== Frame: " << Frame << " Time: "
|
||||||
|
<< State->Getsim_time() << endl;
|
||||||
|
|
||||||
while (!model_iterator->Run()) {
|
while (!model_iterator->Run()) {
|
||||||
model_iterator = model_iterator->NextModel;
|
model_iterator = model_iterator->NextModel;
|
||||||
if (model_iterator == 0L) break;
|
if (model_iterator == 0L) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Frame++;
|
||||||
State->IncrTime();
|
State->IncrTime();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,331 +1,332 @@
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
Header: FGFDMExec.h
|
Header: FGFDMExec.h
|
||||||
Author: Jon Berndt
|
Author: Jon Berndt
|
||||||
Date started: 11/17/98
|
Date started: 11/17/98
|
||||||
|
|
||||||
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
||||||
|
|
||||||
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 General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
Foundation; either version 2 of the License, or (at your option) any later
|
Foundation; either version 2 of the License, or (at your option) any later
|
||||||
version.
|
version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
details.
|
details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
You should have received a copy of the GNU General Public License along with
|
||||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
Place - Suite 330, Boston, MA 02111-1307, USA.
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Further information about the GNU General Public License can also be found on
|
Further information about the GNU General Public License can also be found on
|
||||||
the world wide web at http://www.gnu.org.
|
the world wide web at http://www.gnu.org.
|
||||||
|
|
||||||
HISTORY
|
HISTORY
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
11/17/98 JSB Created
|
11/17/98 JSB Created
|
||||||
7/31/99 TP Added RunIC function that runs the sim so that every frame
|
7/31/99 TP Added RunIC function that runs the sim so that every frame
|
||||||
begins with the IC values from the given FGInitialCondition
|
begins with the IC values from the given FGInitialCondition
|
||||||
object and dt=0.
|
object and dt=0.
|
||||||
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
SENTRY
|
SENTRY
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#ifndef FGFDMEXEC_HEADER_H
|
#ifndef FGFDMEXEC_HEADER_H
|
||||||
#define FGFDMEXEC_HEADER_H
|
#define FGFDMEXEC_HEADER_H
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
INCLUDES
|
INCLUDES
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#ifdef FGFS
|
#ifdef FGFS
|
||||||
# include <simgear/compiler.h>
|
# include <simgear/compiler.h>
|
||||||
# ifdef FG_HAVE_STD_INCLUDES
|
# ifdef FG_HAVE_STD_INCLUDES
|
||||||
# include <vector>
|
# include <vector>
|
||||||
# else
|
# else
|
||||||
# include <vector.h>
|
# include <vector.h>
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# include <vector>
|
# include <vector>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "FGModel.h"
|
#include "FGModel.h"
|
||||||
#include "FGInitialCondition.h"
|
#include "FGInitialCondition.h"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
#define ID_FDMEXEC "$Id$"
|
#define ID_FDMEXEC "$Id$"
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
class FGState;
|
class FGState;
|
||||||
class FGAtmosphere;
|
class FGAtmosphere;
|
||||||
class FGFCS;
|
class FGFCS;
|
||||||
class FGPropulsion;
|
class FGPropulsion;
|
||||||
class FGAircraft;
|
class FGAircraft;
|
||||||
class FGTranslation;
|
class FGTranslation;
|
||||||
class FGRotation;
|
class FGRotation;
|
||||||
class FGPosition;
|
class FGPosition;
|
||||||
class FGAuxiliary;
|
class FGAuxiliary;
|
||||||
class FGOutput;
|
class FGOutput;
|
||||||
class FGInitialCondition;
|
class FGInitialCondition;
|
||||||
|
|
||||||
struct condition {
|
struct condition {
|
||||||
vector <eParam> TestParam;
|
vector <eParam> TestParam;
|
||||||
vector <eParam> SetParam;
|
vector <eParam> SetParam;
|
||||||
vector <float> TestValue;
|
vector <float> TestValue;
|
||||||
vector <float> SetValue;
|
vector <float> SetValue;
|
||||||
vector <string> Comparison;
|
vector <string> Comparison;
|
||||||
vector <float> TC;
|
vector <float> TC;
|
||||||
vector <bool> Persistent;
|
vector <bool> Persistent;
|
||||||
vector <eAction> Action;
|
vector <eAction> Action;
|
||||||
vector <eType> Type;
|
vector <eType> Type;
|
||||||
vector <bool> Triggered;
|
vector <bool> Triggered;
|
||||||
vector <float> newValue;
|
vector <float> newValue;
|
||||||
vector <float> OriginalValue;
|
vector <float> OriginalValue;
|
||||||
vector <float> StartTime;
|
vector <float> StartTime;
|
||||||
vector <float> EndTime;
|
vector <float> EndTime;
|
||||||
|
|
||||||
condition() {
|
condition() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS DOCUMENTATION
|
CLASS DOCUMENTATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
/** Encapsulates the JSBSim simulation executive.
|
/** Encapsulates the JSBSim simulation executive.
|
||||||
@author Jon S. Berndt
|
@author Jon S. Berndt
|
||||||
@version $Id$
|
@version $Id$
|
||||||
|
|
||||||
@doc This class is the interface class through which all other simulation classes
|
@doc This class is the interface class through which all other simulation classes
|
||||||
are instantiated, initialized, and run. When integrated with FlightGear (or
|
are instantiated, initialized, and run. When integrated with FlightGear (or
|
||||||
other flight simulator) this class is typically instantiated by an interface
|
other flight simulator) this class is typically instantiated by an interface
|
||||||
class on the simulator side.
|
class on the simulator side.
|
||||||
|
|
||||||
<h4>Scripting support provided in the Executive</h4>
|
<h4>Scripting support provided in the Executive</h4>
|
||||||
|
|
||||||
<p>There is simple scripting support provided in the FGFDMExec
|
<p>There is simple scripting support provided in the FGFDMExec
|
||||||
class. Commands are specified using the <u>Simple Scripting
|
class. Commands are specified using the <u>Simple Scripting
|
||||||
Directives for JSBSim</u> (SSDJ). The script file is in XML
|
Directives for JSBSim</u> (SSDJ). The script file is in XML
|
||||||
format. A test condition (or conditions) can be set up in the
|
format. A test condition (or conditions) can be set up in the
|
||||||
script and when the condition evaluates to true, the specified
|
script and when the condition evaluates to true, the specified
|
||||||
action[s] is/are taken. A test condition can be <em>persistent</em>,
|
action[s] is/are taken. A test condition can be <em>persistent</em>,
|
||||||
meaning that if a test condition evaluates to true, then passes
|
meaning that if a test condition evaluates to true, then passes
|
||||||
and evaluates to false, the condition is reset and may again be
|
and evaluates to false, the condition is reset and may again be
|
||||||
triggered. When the set of tests evaluates to true for a given
|
triggered. When the set of tests evaluates to true for a given
|
||||||
condition, an item may be set to another value. This value might
|
condition, an item may be set to another value. This value might
|
||||||
be a boolean, a value, or a delta value, and the change from the
|
be a boolean, a value, or a delta value, and the change from the
|
||||||
current value to the new value can be either via a step function,
|
current value to the new value can be either via a step function,
|
||||||
a ramp, or an exponential approach. The speed of a ramp or
|
a ramp, or an exponential approach. The speed of a ramp or
|
||||||
approach is specified via the time constant. Here is the format
|
approach is specified via the time constant. Here is the format
|
||||||
of the script file:</p>
|
of the script file:</p>
|
||||||
|
|
||||||
<pre><strong><?xml version="1.0"?>
|
<pre><strong><?xml version="1.0"?>
|
||||||
<runscript name="C172-01A">
|
<runscript name="C172-01A">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
This run is for testing C172 runs
|
This run is for testing C172 runs
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<use aircraft="c172">
|
<use aircraft="c172">
|
||||||
<use initialize="reset00">
|
<use initialize="reset00">
|
||||||
|
|
||||||
<run start="0.0" end="4.5" dt="0.05">
|
<run start="0.0" end="4.5" dt="0.05">
|
||||||
<when>
|
<when>
|
||||||
<parameter name="FG_TIME" comparison="ge" value="0.25">
|
<parameter name="FG_TIME" comparison="ge" value="0.25">
|
||||||
<parameter name="FG_TIME" comparison="le" value="0.50">
|
<parameter name="FG_TIME" comparison="le" value="0.50">
|
||||||
<set name="FG_AILERON_CMD" type="FG_VALUE" value="0.25"
|
<set name="FG_AILERON_CMD" type="FG_VALUE" value="0.25"
|
||||||
action="FG_STEP" persistent="false" tc ="0.25">
|
action="FG_STEP" persistent="false" tc ="0.25">
|
||||||
</when>
|
</when>
|
||||||
<when>
|
<when>
|
||||||
<parameter name="FG_TIME" comparison="ge" value="0.5">
|
<parameter name="FG_TIME" comparison="ge" value="0.5">
|
||||||
<parameter name="FG_TIME" comparison="le" value="1.5">
|
<parameter name="FG_TIME" comparison="le" value="1.5">
|
||||||
<set name="FG_AILERON_CMD" type="FG_DELTA" value="0.5"
|
<set name="FG_AILERON_CMD" type="FG_DELTA" value="0.5"
|
||||||
action="FG_EXP" persistent="false" tc ="0.5">
|
action="FG_EXP" persistent="false" tc ="0.5">
|
||||||
</when>
|
</when>
|
||||||
<when>
|
<when>
|
||||||
<parameter name="FG_TIME" comparison="ge" value="1.5">
|
<parameter name="FG_TIME" comparison="ge" value="1.5">
|
||||||
<parameter name="FG_TIME" comparison="le" value="2.5">
|
<parameter name="FG_TIME" comparison="le" value="2.5">
|
||||||
<set name="FG_RUDDER_CMD" type="FG_DELTA" value="0.5"
|
<set name="FG_RUDDER_CMD" type="FG_DELTA" value="0.5"
|
||||||
action="FG_RAMP" persistent="false" tc ="0.5">
|
action="FG_RAMP" persistent="false" tc ="0.5">
|
||||||
</when>
|
</when>
|
||||||
</run>
|
</run>
|
||||||
|
|
||||||
</runscript></strong></pre>
|
</runscript></strong></pre>
|
||||||
|
|
||||||
<p>The first line must always be present. The second line
|
<p>The first line must always be present. The second line
|
||||||
identifies this file as a script file, and gives a descriptive
|
identifies this file as a script file, and gives a descriptive
|
||||||
name to the script file. Comments are next, delineated by the
|
name to the script file. Comments are next, delineated by the
|
||||||
<!-- and --> symbols. The aircraft and initialization files
|
<!-- and --> symbols. The aircraft and initialization files
|
||||||
to be used are specified in the "use" lines. Next,
|
to be used are specified in the "use" lines. Next,
|
||||||
comes the "run" section, where the conditions are
|
comes the "run" section, where the conditions are
|
||||||
described in "when" clauses.</p>
|
described in "when" clauses.</p>
|
||||||
|
|
||||||
<h4>JSBSim Debugging Directives</h4>
|
<h4>JSBSim Debugging Directives</h4>
|
||||||
|
|
||||||
This describes to any interested entity the debug level
|
This describes to any interested entity the debug level
|
||||||
requested by setting the JSBSIM_DEBUG environment variable.
|
requested by setting the JSBSIM_DEBUG environment variable.
|
||||||
The bitmasked value choices are as follows:<ol>
|
The bitmasked value choices are as follows:<ol>
|
||||||
<li><b>unset</b>: In this case (the default) JSBSim would only print
|
<li><b>unset</b>: In this case (the default) JSBSim would only print
|
||||||
out the normally expected messages, essentially echoing
|
out the normally expected messages, essentially echoing
|
||||||
the config files as they are read. If the environment
|
the config files as they are read. If the environment
|
||||||
variable is not set, debug_lvl is set to 1 internally</li>
|
variable is not set, debug_lvl is set to 1 internally</li>
|
||||||
<li><b>0</b>: This requests JSBSim not to output any messages
|
<li><b>0</b>: This requests JSBSim not to output any messages
|
||||||
whatsoever.</li>
|
whatsoever.</li>
|
||||||
<li><b>1</b>: This value explicity requests the normal JSBSim
|
<li><b>1</b>: This value explicity requests the normal JSBSim
|
||||||
startup messages</li>
|
startup messages</li>
|
||||||
<li><b>2</b>: This value asks for a message to be printed out when
|
<li><b>2</b>: This value asks for a message to be printed out when
|
||||||
a class is instantiated</li>
|
a class is instantiated</li>
|
||||||
<li><b>4</b>: When this value is set, a message is displayed when a
|
<li><b>4</b>: When this value is set, a message is displayed when a
|
||||||
FGModel object executes its Run() method</li>
|
FGModel object executes its Run() method</li>
|
||||||
<li><b>8</b>: When this value is set, various runtime state variables
|
<li><b>8</b>: When this value is set, various runtime state variables
|
||||||
are printed out periodically</li>
|
are printed out periodically</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS DECLARATION
|
CLASS DECLARATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
||||||
class FGFDMExec
|
class FGFDMExec
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
FGFDMExec(void);
|
FGFDMExec(void);
|
||||||
|
|
||||||
/// Default destructor
|
/// Default destructor
|
||||||
~FGFDMExec();
|
~FGFDMExec();
|
||||||
|
|
||||||
/** This routine places a model into the runlist at the specified rate. The
|
/** This routine places a model into the runlist at the specified rate. The
|
||||||
"rate" is not really a clock rate. It represents how many calls to the
|
"rate" is not really a clock rate. It represents how many calls to the
|
||||||
FGFDMExec::Run() method must be made before the model is executed. A
|
FGFDMExec::Run() method must be made before the model is executed. A
|
||||||
value of 1 means that the model will be executed for each call to the
|
value of 1 means that the model will be executed for each call to the
|
||||||
exec's Run() method. A value of 5 means that the model will only be
|
exec's Run() method. A value of 5 means that the model will only be
|
||||||
executed every 5th call to the exec's Run() method.
|
executed every 5th call to the exec's Run() method.
|
||||||
@param model A pointer to the model being scheduled.
|
@param model A pointer to the model being scheduled.
|
||||||
@param rate The rate at which to execute the model as described above.
|
@param rate The rate at which to execute the model as described above.
|
||||||
@return Currently returns 0 always. */
|
@return Currently returns 0 always. */
|
||||||
int Schedule(FGModel* model, int rate);
|
int Schedule(FGModel* model, int rate);
|
||||||
|
|
||||||
/** This executes each scheduled model in succession, as well as running any
|
/** This executes each scheduled model in succession, as well as running any
|
||||||
scripts which are loaded.
|
scripts which are loaded.
|
||||||
@return true if successful, false if sim should be ended */
|
@return true if successful, false if sim should be ended */
|
||||||
bool Run(void);
|
bool Run(void);
|
||||||
|
|
||||||
/** Initializes the sim with a set of initial conditions.
|
/** Initializes the sim with a set of initial conditions.
|
||||||
@param fgic A pointer to a filled out initial conditions class which
|
@param fgic A pointer to a filled out initial conditions class which
|
||||||
describes the desired initial conditions.
|
describes the desired initial conditions.
|
||||||
@return true if successful
|
@return true if successful
|
||||||
*/
|
*/
|
||||||
bool RunIC(FGInitialCondition *fgic);
|
bool RunIC(FGInitialCondition *fgic);
|
||||||
|
|
||||||
/// Freezes the sim
|
/// Freezes the sim
|
||||||
void Freeze(void) {frozen = true;}
|
void Freeze(void) {frozen = true;}
|
||||||
|
|
||||||
/// Resumes the sim
|
/// Resumes the sim
|
||||||
void Resume(void) {frozen = false;}
|
void Resume(void) {frozen = false;}
|
||||||
|
|
||||||
/** 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:
|
||||||
"aircraft". Under aircraft, then, would be directories for various
|
"aircraft". Under aircraft, then, would be directories for various
|
||||||
modeled aircraft such as C172/, x15/, etc.
|
modeled aircraft such as C172/, x15/, etc.
|
||||||
@param EnginePath path to the directory under which engine config
|
@param EnginePath path to the directory under which engine config
|
||||||
files are kept, for instance "engine"
|
files are kept, for instance "engine"
|
||||||
@param model the name of the aircraft model itself. This file will
|
@param model the name of the aircraft model itself. This file will
|
||||||
be looked for in the directory specified in the AircraftPath variable,
|
be looked for in the directory specified in the AircraftPath variable,
|
||||||
and in turn under the directory with the same name as the model. For
|
and in turn under the directory with the same name as the model. For
|
||||||
instance: "aircraft/x15/x15.xml"
|
instance: "aircraft/x15/x15.xml"
|
||||||
@return true if successful*/
|
@return true if successful*/
|
||||||
bool LoadModel(string AircraftPath, string EnginePath, string model);
|
bool LoadModel(string AircraftPath, string EnginePath, string model);
|
||||||
|
|
||||||
/** Loads a script to drive JSBSim (usually in standalone mode).
|
/** Loads a script to drive JSBSim (usually in standalone mode).
|
||||||
The language is the Simple Script Directives for JSBSim (SSDJ).
|
The language is the Simple Script Directives for JSBSim (SSDJ).
|
||||||
@param script the filename (including path name, if any) for the script.
|
@param script the filename (including path name, if any) for the script.
|
||||||
@return true if successful */
|
@return true if successful */
|
||||||
bool LoadScript(string script);
|
bool LoadScript(string script);
|
||||||
|
|
||||||
/** This function is called each pass through the executive Run() method IF
|
/** This function is called each pass through the executive Run() method IF
|
||||||
scripting is enabled. */
|
scripting is enabled. */
|
||||||
void RunScript(void);
|
void RunScript(void);
|
||||||
|
|
||||||
bool SetEnginePath(string path) {EnginePath = path; return true;}
|
bool SetEnginePath(string path) {EnginePath = path; return true;}
|
||||||
bool SetAircraftPath(string path) {AircraftPath = path; return true;}
|
bool SetAircraftPath(string path) {AircraftPath = path; return true;}
|
||||||
bool SetScriptPath(string path) {ScriptPath = path; return true;}
|
bool SetScriptPath(string path) {ScriptPath = path; return true;}
|
||||||
|
|
||||||
/// @name Top-level executive State and Model retrieval mechanism
|
/// @name Top-level executive State and Model retrieval mechanism
|
||||||
//@{
|
//@{
|
||||||
/// Returns the FGState pointer.
|
/// Returns the FGState pointer.
|
||||||
inline FGState* GetState(void) {return State;}
|
inline FGState* GetState(void) {return State;}
|
||||||
/// Returns the FGAtmosphere pointer.
|
/// Returns the FGAtmosphere pointer.
|
||||||
inline FGAtmosphere* GetAtmosphere(void) {return Atmosphere;}
|
inline FGAtmosphere* GetAtmosphere(void) {return Atmosphere;}
|
||||||
/// Returns the FGFCS pointer.
|
/// Returns the FGFCS pointer.
|
||||||
inline FGFCS* GetFCS(void) {return FCS;}
|
inline FGFCS* GetFCS(void) {return FCS;}
|
||||||
/// Returns the FGPropulsion pointer.
|
/// Returns the FGPropulsion pointer.
|
||||||
inline FGPropulsion* GetPropulsion(void) {return Propulsion;}
|
inline FGPropulsion* GetPropulsion(void) {return Propulsion;}
|
||||||
/// Returns the FGAircraft pointer.
|
/// Returns the FGAircraft pointer.
|
||||||
inline FGAircraft* GetAircraft(void) {return Aircraft;}
|
inline FGAircraft* GetAircraft(void) {return Aircraft;}
|
||||||
/// Returns the FGTranslation pointer.
|
/// Returns the FGTranslation pointer.
|
||||||
inline FGTranslation* GetTranslation(void) {return Translation;}
|
inline FGTranslation* GetTranslation(void) {return Translation;}
|
||||||
/// Returns the FGRotation pointer.
|
/// Returns the FGRotation pointer.
|
||||||
inline FGRotation* GetRotation(void) {return Rotation;}
|
inline FGRotation* GetRotation(void) {return Rotation;}
|
||||||
/// Returns the FGPosition pointer.
|
/// Returns the FGPosition pointer.
|
||||||
inline FGPosition* GetPosition(void) {return Position;}
|
inline FGPosition* GetPosition(void) {return Position;}
|
||||||
/// Returns the FGAuxiliary pointer.
|
/// Returns the FGAuxiliary pointer.
|
||||||
inline FGAuxiliary* GetAuxiliary(void) {return Auxiliary;}
|
inline FGAuxiliary* GetAuxiliary(void) {return Auxiliary;}
|
||||||
/// Returns the FGOutput pointer.
|
/// Returns the FGOutput pointer.
|
||||||
inline FGOutput* GetOutput(void) {return Output;}
|
inline FGOutput* GetOutput(void) {return Output;}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Retrieves the engine path.
|
/// Retrieves the engine path.
|
||||||
inline string GetEnginePath(void) {return EnginePath;}
|
inline string GetEnginePath(void) {return EnginePath;}
|
||||||
/// Retrieves the aircraft path.
|
/// Retrieves the aircraft path.
|
||||||
inline string GetAircraftPath(void) {return AircraftPath;}
|
inline string GetAircraftPath(void) {return AircraftPath;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FGModel* FirstModel;
|
FGModel* FirstModel;
|
||||||
|
|
||||||
bool frozen;
|
bool frozen;
|
||||||
bool terminate;
|
bool terminate;
|
||||||
int Error;
|
int Error;
|
||||||
bool modelLoaded;
|
int Frame;
|
||||||
bool Scripted;
|
bool modelLoaded;
|
||||||
|
bool Scripted;
|
||||||
string AircraftPath;
|
|
||||||
string EnginePath;
|
string AircraftPath;
|
||||||
string ScriptPath;
|
string EnginePath;
|
||||||
string ScriptName;
|
string ScriptPath;
|
||||||
float StartTime;
|
string ScriptName;
|
||||||
float EndTime;
|
float StartTime;
|
||||||
vector <struct condition> Conditions;
|
float EndTime;
|
||||||
|
vector <struct condition> Conditions;
|
||||||
FGState* State;
|
|
||||||
FGAtmosphere* Atmosphere;
|
FGState* State;
|
||||||
FGFCS* FCS;
|
FGAtmosphere* Atmosphere;
|
||||||
FGPropulsion* Propulsion;
|
FGFCS* FCS;
|
||||||
FGAircraft* Aircraft;
|
FGPropulsion* Propulsion;
|
||||||
FGTranslation* Translation;
|
FGAircraft* Aircraft;
|
||||||
FGRotation* Rotation;
|
FGTranslation* Translation;
|
||||||
FGPosition* Position;
|
FGRotation* Rotation;
|
||||||
FGAuxiliary* Auxiliary;
|
FGPosition* Position;
|
||||||
FGOutput* Output;
|
FGAuxiliary* Auxiliary;
|
||||||
|
FGOutput* Output;
|
||||||
bool Allocate(void);
|
|
||||||
bool DeAllocate(void);
|
bool Allocate(void);
|
||||||
void Debug(void);
|
bool DeAllocate(void);
|
||||||
};
|
void Debug(void);
|
||||||
|
};
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
#endif
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ FGColumnVector FGLGear::Force(void)
|
||||||
FGColumnVector vLocalForce(3);
|
FGColumnVector vLocalForce(3);
|
||||||
//FGColumnVector vLocalGear(3); // Vector: CG to this wheel (Local)
|
//FGColumnVector vLocalGear(3); // Vector: CG to this wheel (Local)
|
||||||
FGColumnVector vWhlVelVec(3); // Velocity of this wheel (Local)
|
FGColumnVector vWhlVelVec(3); // Velocity of this wheel (Local)
|
||||||
|
|
||||||
vWhlBodyVec = (vXYZ - Aircraft->GetXYZcg()) / 12.0;
|
vWhlBodyVec = (vXYZ - Aircraft->GetXYZcg()) / 12.0;
|
||||||
vWhlBodyVec(eX) = -vWhlBodyVec(eX);
|
vWhlBodyVec(eX) = -vWhlBodyVec(eX);
|
||||||
vWhlBodyVec(eZ) = -vWhlBodyVec(eZ);
|
vWhlBodyVec(eZ) = -vWhlBodyVec(eZ);
|
||||||
|
@ -259,7 +259,7 @@ FGColumnVector FGLGear::Force(void)
|
||||||
|
|
||||||
switch (eSteerType) {
|
switch (eSteerType) {
|
||||||
case stSteer:
|
case stSteer:
|
||||||
SteerAngle = SteerGain*RudderPedal;
|
SteerAngle = SteerGain*FCS->GetDrCmd();
|
||||||
break;
|
break;
|
||||||
case stFixed:
|
case stFixed:
|
||||||
SteerAngle = 0.0;
|
SteerAngle = 0.0;
|
||||||
|
@ -322,7 +322,10 @@ FGColumnVector FGLGear::Force(void)
|
||||||
|
|
||||||
// Compute the forces in the wheel ground plane.
|
// Compute the forces in the wheel ground plane.
|
||||||
|
|
||||||
RollingForce = vLocalForce(eZ) * BrakeFCoeff * fabs(RollingWhlVel)/RollingWhlVel;
|
RollingForce = 0;
|
||||||
|
if(fabs(RollingWhlVel) > 1E-3) {
|
||||||
|
RollingForce = vLocalForce(eZ) * BrakeFCoeff * fabs(RollingWhlVel)/RollingWhlVel;
|
||||||
|
}
|
||||||
SideForce = vLocalForce(eZ) * FCoeff;
|
SideForce = vLocalForce(eZ) * FCoeff;
|
||||||
|
|
||||||
// Transform these forces back to the local reference frame.
|
// Transform these forces back to the local reference frame.
|
||||||
|
|
|
@ -23,6 +23,12 @@ INCLUDES
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef FGFS
|
#ifdef FGFS
|
||||||
# include <simgear/compiler.h>
|
# include <simgear/compiler.h>
|
||||||
|
# include STL_STRING
|
||||||
|
SG_USING_STD(string);
|
||||||
|
SG_USING_STD(ostream);
|
||||||
|
SG_USING_STD(istream);
|
||||||
|
SG_USING_STD(cerr);
|
||||||
|
SG_USING_STD(endl);
|
||||||
# ifdef FG_HAVE_STD_INCLUDES
|
# ifdef FG_HAVE_STD_INCLUDES
|
||||||
# include <fstream>
|
# include <fstream>
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
|
@ -36,9 +42,14 @@ INCLUDES
|
||||||
# include <fstream>
|
# include <fstream>
|
||||||
# include <cmath>
|
# include <cmath>
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
|
# include <string>
|
||||||
|
using std::string;
|
||||||
|
using std::ostream;
|
||||||
|
using std::istream;
|
||||||
|
using std::cerr;
|
||||||
|
using std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
DEFINITIONS
|
DEFINITIONS
|
||||||
|
@ -46,12 +57,6 @@ DEFINITIONS
|
||||||
|
|
||||||
#define ID_MATRIX "$Id$"
|
#define ID_MATRIX "$Id$"
|
||||||
|
|
||||||
using std::string;
|
|
||||||
using std::ostream;
|
|
||||||
using std::istream;
|
|
||||||
using std::cerr;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
FORWARD DECLARATIONS
|
FORWARD DECLARATIONS
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
@ -148,45 +153,12 @@ public:
|
||||||
friend FGColumnVector operator*(const FGMatrix& M, const FGColumnVector& V);
|
friend FGColumnVector operator*(const FGMatrix& M, const FGColumnVector& V);
|
||||||
|
|
||||||
double& operator()(int m) const;
|
double& operator()(int m) const;
|
||||||
|
|
||||||
FGColumnVector& multElementWise(const FGColumnVector& V);
|
FGColumnVector& multElementWise(const FGColumnVector& V);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Debug(void);
|
void Debug(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
DECLARATION: FGMatrix3x3
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
||||||
|
|
||||||
class FGMatrix3x3 : public FGMatrix
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FGMatrix3x3(void) {FGMatrix(3,3);}
|
|
||||||
// ~FGMatrix3x3(void) {~FGMatrix();}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
DECLARATION: FGColumnVector4
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
||||||
|
|
||||||
class FGColumnVector4 : public FGColumnVector
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FGColumnVector4(void) {FGColumnVector(4);}
|
|
||||||
// ~FGColumnVector4(void) {~FGColumnVector();}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
||||||
DECLARATION: FGColumnVector3
|
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
||||||
|
|
||||||
class FGColumnVector3 : public FGColumnVector
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FGColumnVector3(void) {FGColumnVector(3);}
|
|
||||||
// ~FGColumnVector3(void) {~FGColumnVector();}
|
|
||||||
};
|
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,6 +73,8 @@ FGNozzle::FGNozzle(FGFDMExec* FDMExec, FGConfigFile* Nzl_cfg) : FGThruster(FDMEx
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Thrust = 0;
|
||||||
|
|
||||||
if (debug_lvl & 2) cout << "Instantiated: FGNozzle" << endl;
|
if (debug_lvl & 2) cout << "Instantiated: FGNozzle" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +89,6 @@ FGNozzle::~FGNozzle()
|
||||||
|
|
||||||
float FGNozzle::Calculate(float CfPc)
|
float FGNozzle::Calculate(float CfPc)
|
||||||
{
|
{
|
||||||
float Thrust;
|
|
||||||
float pAtm = fdmex->GetAtmosphere()->GetPressure();
|
float pAtm = fdmex->GetAtmosphere()->GetPressure();
|
||||||
|
|
||||||
Thrust = (CfPc + (PE - pAtm)*ExpR) * (Diameter / ExpR) * nzlEff;
|
Thrust = (CfPc + (PE - pAtm)*ExpR) * (Diameter / ExpR) * nzlEff;
|
||||||
|
|
|
@ -52,8 +52,8 @@ FGPropeller::FGPropeller(FGFDMExec* exec, FGConfigFile* Prop_cfg) : FGThruster(e
|
||||||
string token;
|
string token;
|
||||||
int rows, cols;
|
int rows, cols;
|
||||||
|
|
||||||
PropName = Prop_cfg->GetValue("NAME");
|
Name = Prop_cfg->GetValue("NAME");
|
||||||
cout << "\n Propeller Name: " << PropName << endl;
|
cout << "\n Propeller Name: " << Name << endl;
|
||||||
Prop_cfg->GetNextConfigLine();
|
Prop_cfg->GetNextConfigLine();
|
||||||
while (Prop_cfg->GetValue() != "/FG_PROPELLER") {
|
while (Prop_cfg->GetValue() != "/FG_PROPELLER") {
|
||||||
*Prop_cfg >> token;
|
*Prop_cfg >> token;
|
||||||
|
|
|
@ -124,9 +124,6 @@ public:
|
||||||
/// Retrieves the propeller moment of inertia
|
/// Retrieves the propeller moment of inertia
|
||||||
float GetIxx(void) { return Ixx; }
|
float GetIxx(void) { return Ixx; }
|
||||||
|
|
||||||
/// Retrieves the Thrust in pounds
|
|
||||||
float GetThrust(void) { return Thrust; }
|
|
||||||
|
|
||||||
/// 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?)
|
||||||
float GetTorque(void) { return Torque; }
|
float GetTorque(void) { return Torque; }
|
||||||
|
|
||||||
|
@ -147,7 +144,6 @@ public:
|
||||||
float Calculate(float PowerAvailable);
|
float Calculate(float PowerAvailable);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
string PropName;
|
|
||||||
int numBlades;
|
int numBlades;
|
||||||
float RPM;
|
float RPM;
|
||||||
float Ixx;
|
float Ixx;
|
||||||
|
@ -155,7 +151,6 @@ private:
|
||||||
float MaxPitch;
|
float MaxPitch;
|
||||||
float MinPitch;
|
float MinPitch;
|
||||||
float Pitch;
|
float Pitch;
|
||||||
float Thrust;
|
|
||||||
float Torque;
|
float Torque;
|
||||||
FGTable *Efficiency;
|
FGTable *Efficiency;
|
||||||
FGTable *cThrust;
|
FGTable *cThrust;
|
||||||
|
|
|
@ -206,12 +206,12 @@ bool FGPropulsion::LoadPropulsion(FGConfigFile* AC_cfg)
|
||||||
} else cerr << "Unknown identifier: " << token << " in engine file: "
|
} else cerr << "Unknown identifier: " << token << " in engine file: "
|
||||||
<< engineFileName << endl;
|
<< engineFileName << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Engines[numEngines]->SetPlacement(xLoc, yLoc, zLoc, Pitch, Yaw);
|
Engines[numEngines]->SetPlacement(xLoc, yLoc, zLoc, Pitch, Yaw);
|
||||||
numEngines++;
|
numEngines++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
cerr << "Could not read engine config file: " << fullpath
|
cerr << "Could not read engine config file: " << fullpath
|
||||||
+ engineFileName + ".xml" << endl;
|
+ engineFileName + ".xml" << endl;
|
||||||
return false;
|
return false;
|
||||||
|
@ -231,7 +231,7 @@ bool FGPropulsion::LoadPropulsion(FGConfigFile* AC_cfg)
|
||||||
numOxiTanks++;
|
numOxiTanks++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
numTanks++;
|
numTanks++;
|
||||||
|
|
||||||
} else if (token == "AC_THRUSTER") { // ========== READING THRUSTERS
|
} else if (token == "AC_THRUSTER") { // ========== READING THRUSTERS
|
||||||
|
@ -285,6 +285,87 @@ bool FGPropulsion::LoadPropulsion(FGConfigFile* AC_cfg)
|
||||||
|
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
string FGPropulsion::GetPropulsionStrings(void)
|
||||||
|
{
|
||||||
|
string PropulsionStrings = "";
|
||||||
|
bool firstime = true;
|
||||||
|
|
||||||
|
for (unsigned int i=0;i<Engines.size();i++) {
|
||||||
|
if (!firstime) {
|
||||||
|
PropulsionStrings += ", ";
|
||||||
|
firstime = false;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
switch(Engines[i].GetType()) {
|
||||||
|
case etPiston:
|
||||||
|
PropulsionStrings += (Engines[i].GetName() + "_PwrAvail, ");
|
||||||
|
break;
|
||||||
|
case etRocket:
|
||||||
|
break;
|
||||||
|
case etTurboJet:
|
||||||
|
case etTurboProp:
|
||||||
|
case etTurboShaft:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(Thrusters[i].GetType()) {
|
||||||
|
case ttNozzle:
|
||||||
|
PropulsionStrings += (Thrusters[i].GetName() + "_Thrust, ");
|
||||||
|
break;
|
||||||
|
case ttRotor:
|
||||||
|
break;
|
||||||
|
case ttPropeller:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return PropulsionStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
string FGPropulsion::GetPropulsionValues(void)
|
||||||
|
{
|
||||||
|
char buff[20];
|
||||||
|
string PropulsionValues = "";
|
||||||
|
bool firstime = true;
|
||||||
|
|
||||||
|
for (unsigned int i=0;i<Engines.size();i++) {
|
||||||
|
if (!firstime) {
|
||||||
|
PropulsionValues += ", ";
|
||||||
|
firstime = false;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
switch(Engines[i].GetType()) {
|
||||||
|
case etPiston:
|
||||||
|
PropulsionValues += (string(gcvt(Thrusters[i].GetPowerAvailable(), 10, buff)) + ", ");
|
||||||
|
break;
|
||||||
|
case etRocket:
|
||||||
|
break;
|
||||||
|
case etTurboJet:
|
||||||
|
case etTurboProp:
|
||||||
|
case etTurboShaft:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(Thrusters[i].GetType()) {
|
||||||
|
case ttNozzle:
|
||||||
|
PropulsionValues += (string(gcvt(Thrusters[i].GetThrust(), 10, buff)) + ", ");
|
||||||
|
break;
|
||||||
|
case ttRotor:
|
||||||
|
break;
|
||||||
|
case ttPropeller:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return PropulsionValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
void FGPropulsion::Debug(void)
|
void FGPropulsion::Debug(void)
|
||||||
{
|
{
|
||||||
//TODO: Add your source code here
|
//TODO: Add your source code here
|
||||||
|
|
|
@ -157,6 +157,8 @@ public:
|
||||||
|
|
||||||
bool GetSteadyState(void);
|
bool GetSteadyState(void);
|
||||||
|
|
||||||
|
string GetPropulsionStrings(void);
|
||||||
|
string GetPropulsionValues(void);
|
||||||
|
|
||||||
inline FGColumnVector& GetForces(void) {return *Forces; }
|
inline FGColumnVector& GetForces(void) {return *Forces; }
|
||||||
inline FGColumnVector& GetMoments(void) {return *Moments;}
|
inline FGColumnVector& GetMoments(void) {return *Moments;}
|
||||||
|
|
|
@ -63,6 +63,7 @@ public:
|
||||||
void SetName(string name) {Name = name;}
|
void SetName(string name) {Name = name;}
|
||||||
virtual float GetPowerRequired(void) {return 0.0;}
|
virtual float GetPowerRequired(void) {return 0.0;}
|
||||||
virtual void SetdeltaT(float dt) {deltaT = dt;}
|
virtual void SetdeltaT(float dt) {deltaT = dt;}
|
||||||
|
float GetThrust(void) {return Thrust;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
string Name;
|
string Name;
|
||||||
|
|
|
@ -46,6 +46,9 @@ INCLUDES
|
||||||
|
|
||||||
#ifdef FGFS
|
#ifdef FGFS
|
||||||
# include <simgear/compiler.h>
|
# include <simgear/compiler.h>
|
||||||
|
# include STL_STRING
|
||||||
|
SG_USING_STD(cout);
|
||||||
|
SG_USING_STD(endl);
|
||||||
# ifdef FG_HAVE_STD_INCLUDES
|
# ifdef FG_HAVE_STD_INCLUDES
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <fstream>
|
# include <fstream>
|
||||||
|
@ -56,9 +59,11 @@ INCLUDES
|
||||||
#else
|
#else
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <fstream>
|
# include <fstream>
|
||||||
|
# include <string>
|
||||||
|
using std::cout;
|
||||||
|
using std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
#if defined(__BORLANDC__) || defined(_MSC_VER)
|
||||||
|
@ -76,9 +81,6 @@ DEFINITIONS
|
||||||
|
|
||||||
#define ID_FDMSOCKET "$Id$"
|
#define ID_FDMSOCKET "$Id$"
|
||||||
|
|
||||||
using std::cout;
|
|
||||||
using std::endl;
|
|
||||||
|
|
||||||
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
CLASS DECLARATION
|
CLASS DECLARATION
|
||||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue