Sync with most current JSBSim CVS.
if (!FGModel::Run()) {
twovel = 2*Translation->GetVt();
- if (twovel > 0) {
+ if (twovel != 0) {
bi2vel = Aircraft->GetWingSpan() / twovel;
ci2vel = Aircraft->Getcbar() / twovel;
}
This class owns and contains the list of coefficients that define the
aerodynamic properties of this aircraft. Here also, such unique phenomena
as ground effect and maximum lift curve tailoff are handled.
- @author Jon S. Berndt
- @author Tony Peden
- @version $Id$
+ @config
+ <pre>
+ \<AERODYNAMICS>
+ \<AXIS NAME="{LIFT|DRAG|SIDE|ROLL|PITCH|YAW}">
+ {Coefficient definitions}
+ \</AXIS>
+ {Additional axis definitions}
+ \</AERODYNAMICS> </pre>
+
+ @author Jon S. Berndt, Tony Peden
+ $Id$
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
} else if (parameter == "AC_AERORP") {
*AC_cfg >> vXYZrp(eX) >> vXYZrp(eY) >> vXYZrp(eZ);
if (debug_lvl > 0) cout << " Ref Pt (x, y, z): " << vXYZrp << endl;
+ } else if (parameter == "AC_VRP") {
+ *AC_cfg >> vXYZvrp(eX) >> vXYZvrp(eY) >> vXYZvrp(eZ);
+ if (debug_lvl > 0) cout << " Visual Ref Pt (x, y, z): " << vXYZvrp << endl;
+ Position->SetVRP(vXYZvrp);
} else if (parameter == "AC_POINTMASS") {
*AC_cfg >> pmWt >> pmX >> pmY >> pmZ;
MassBalance->AddPointMass(pmWt, pmX, pmY, pmZ);
(PMF)&FGAircraft::GetXYZep);
PropertyManager->Tie("metrics/eyepoint-z-ft", this,3,
(PMF)&FGAircraft::GetXYZep);
+ PropertyManager->Tie("metrics/visualrefpoint-x-in", this,1,
+ (PMF)&FGAircraft::GetXYZvrp);
+ PropertyManager->Tie("metrics/visualrefpoint-y-in", this,2,
+ (PMF)&FGAircraft::GetXYZvrp);
+ PropertyManager->Tie("metrics/visualrefpoint-z-in", this,3,
+ (PMF)&FGAircraft::GetXYZvrp);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PropertyManager->Untie("metrics/eyepoint-x-ft");
PropertyManager->Untie("metrics/eyepoint-y-ft");
PropertyManager->Untie("metrics/eyepoint-z-ft");
+ PropertyManager->Untie("metrics/visualrefpoint-x-in");
+ PropertyManager->Untie("metrics/visualrefpoint-y-in");
+ PropertyManager->Untie("metrics/visualrefpoint-z-in");
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
the Engines, Tanks, Propellers, Nozzles, Aerodynamic and Mass properties,
landing gear, etc. These constituent parts may actually run as separate
JSBSim models themselves, but the responsibility for initializing them and
- for retrieving their force and moment contributions falls to FGAircraft.<br>
-
+ for retrieving their force and moment contributions falls to FGAircraft.
@author Jon S. Berndt
@version $Id$
- @see
- <ol><li>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
- School, January 1994</li>
- <li>D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
- JSC 12960, July 1977</li>
- <li>Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
- NASA-Ames", NASA CR-2497, January 1975</li>
- <li>Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
- Wiley & Sons, 1979 ISBN 0-471-03032-5</li>
- <li>Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
- 1982 ISBN 0-471-08936-2</li></ol>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAircraft.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ School, January 1994
+ @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
+ JSC 12960, July 1977
+ @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
+ NASA-Ames", NASA CR-2497, January 1975
+ @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
+ Wiley & Sons, 1979 ISBN 0-471-03032-5
+ @see Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
+ 1982 ISBN 0-471-08936-2
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
inline FGColumnVector3& GetForces(void) { return vForces; }
inline double GetForces(int idx) const { return vForces(idx); }
inline FGColumnVector3& GetBodyAccel(void) { return vBodyAccel; }
+ inline double GetBodyAccel(int idx) { return vBodyAccel(idx); }
inline FGColumnVector3& GetNcg (void) { return vNcg; }
+ inline double GetNcg(int idx) { return vNcg(idx); }
inline FGColumnVector3& GetXYZrp(void) { return vXYZrp; }
+ inline FGColumnVector3& GetXYZvrp(void) { return vXYZvrp; }
inline FGColumnVector3& GetXYZep(void) { return vXYZep; }
inline double GetXYZrp(int idx) const { return vXYZrp(idx); }
+ inline double GetXYZvrp(int idx) const { return vXYZvrp(idx); }
inline double GetXYZep(int idx) const { return vXYZep(idx); }
inline void SetAircraftName(string name) {AircraftName = name;}
FGColumnVector3 vMoments;
FGColumnVector3 vForces;
FGColumnVector3 vXYZrp;
+ FGColumnVector3 vXYZvrp;
FGColumnVector3 vXYZep;
FGColumnVector3 vEuler;
FGColumnVector3 vDXYZcg;
Debug(2);
- return false;
+ return false;
} else { // skip Run() execution this time
- return true;
+ return true;
}
}
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGAtmosphere.h
Author: Jon Berndt
HISTORY
--------------------------------------------------------------------------------
11/24/98 JSB Created
-07/23/99 TP Added implementation of 1959 Standard Atmosphere
- Moved calculation of Mach number to FGTranslation
- Updated to '76 model
-
+07/23/99 TP Added implementation of 1959 Standard Atmosphere
+ Moved calculation of Mach number to FGTranslation
+ Updated to '76 model
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGAtmosphere_H
#define FGAtmosphere_H
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGModel.h"
#include "FGMatrix33.h"
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-[1] Anderson, John D. "Introduction to Flight, Third Edition", McGraw-Hill,
- 1989, ISBN 0-07-001641-0
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Models the standard atmosphere.
@author Tony Peden, Jon Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAtmosphere.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAtmosphere.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ @see Anderson, John D. "Introduction to Flight, Third Edition", McGraw-Hill,
+ 1989, ISBN 0-07-001641-0
*/
-/******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGAtmosphere : public FGModel {
public:
void unbind(void);
-private:
+protected:
double rho;
enum tType {ttStandard, ttBerndt, ttNone} turbType;
} // namespace JSBSim
-/******************************************************************************/
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
if (!FGModel::Run()) {
GetState();
- //caculate total temperature assuming isentropic flow
+ //calculate total temperature assuming isentropic flow
tat=sat*(1 + 0.2*mach*mach);
+ tatc=RankineToCelsius(tat);
if (mach < 1) { //calculate total pressure assuming isentropic flow
- pt=p*pow((1 + 0.2*mach*mach),3.5);
+ pt=p*pow((1 + 0.2*machU*machU),3.5);
} else {
// shock in front of pitot tube, we'll assume its normal and use
// the Rayleigh Pitot Tube Formula, i.e. the ratio of total
// pressure behind the shock to the static pressure in front
- B = 5.76*mach*mach/(5.6*mach*mach - 0.8);
+ B = 5.76*machU*machU/(5.6*machU*machU - 0.8);
// The denominator above is zero for Mach ~ 0.38, for which
// we'll never be here, so we're safe
- D = (2.8*mach*mach-0.4)*0.4167;
+ D = (2.8*machU*machU-0.4)*0.4167;
pt = p*pow(B,3.5)*D;
}
A = pow(((pt-p)/psl+1),0.28571);
- vcas = sqrt(7*psl/rhosl*(A-1));
- veas = sqrt(2*qbar/rhosl);
+ if (machU > 0.0) {
+ vcas = sqrt(7*psl/rhosl*(A-1));
+ veas = sqrt(2*qbar/rhosl);
+ } else {
+ vcas = veas = 0.0;
+ }
// Pilot sensed accelerations are calculated here. This is used
// for the coordinated turn ball instrument. Motion base platforms sometimes
&FGAuxiliary::GetVequivalentFPS);
PropertyManager->Tie("velocities/ve-kts", this,
&FGAuxiliary::GetVequivalentKTS);
+ PropertyManager->Tie("velocities/machU", this,
+ &FGAuxiliary::GetMachU);
PropertyManager->Tie("velocities/tat-r", this,
&FGAuxiliary::GetTotalTemperature);
+ PropertyManager->Tie("velocities/tat-c", this,
+ &FGAuxiliary::GetTAT_C);
PropertyManager->Tie("velocities/pt-lbs_sqft", this,
&FGAuxiliary::GetTotalPressure);
PropertyManager->Untie("velocities/vc-kts");
PropertyManager->Untie("velocities/ve-fps");
PropertyManager->Untie("velocities/ve-kts");
+ PropertyManager->Untie("velocities/machU");
+ PropertyManager->Untie("velocities/tat-r");
+ PropertyManager->Untie("velocities/tat-c");
PropertyManager->Untie("accelerations/a-pilot-x-ft_sec2");
PropertyManager->Untie("accelerations/a-pilot-y-ft_sec2");
PropertyManager->Untie("accelerations/a-pilot-z-ft_sec2");
{
qbar = Translation->Getqbar();
mach = Translation->GetMach();
+ machU= Translation->GetMachU();
p = Atmosphere->GetPressure();
rhosl = Atmosphere->GetDensitySL();
psl = Atmosphere->GetPressureSL();
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Encapsulates various uncategorized scheduled functions.
@author Tony Peden, Jon Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAuxiliary.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGAuxiliary.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
public:
/** Constructor
@param Executive a pointer to the parent executive object */
- FGAuxiliary(FGFDMExec*);
+ FGAuxiliary(FGFDMExec* Executive);
/// Destructor
~FGAuxiliary();
inline double GetVcalibratedKTS(void) const { return vcas*fpstokts; }
inline double GetVequivalentFPS(void) const { return veas; }
inline double GetVequivalentKTS(void) const { return veas*fpstokts; }
+ inline double GetMachU(void) const { return machU; }
inline double GetTotalTemperature(void) const { return tat; }
+ inline double GetTAT_C(void) const { return tatc; }
// total pressure above is freestream total pressure for subsonic only
// for supersonic it is the 1D total pressure behind a normal shock
double vcas;
double veas;
double mach;
- double qbar,rhosl,rho,p,psl,pt,tat,sat;
+ double machU;
+ double qbar,rhosl,rho,p,psl,pt,tat,sat,tatc;
// Don't add a getter for pt!
#include "FGPropertyManager.h"
#ifndef FGFS
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <iomanip.h>
# else
# include <iomanip>
class FGOutput;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-Note that the coefficients need not be calculated each delta-t. This is
-something that may be fixed someday.
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
is called and the coefficient values are calculated.
@author Jon S. Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGCoefficient.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGCoefficient.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/** Outputs coefficient information.
Non-dimensionalizing parameter descriptions are output
- for each aero coefficient defined.
- @param multipliers the list of multipliers for this coefficient.*/
+ for each aero coefficient defined. */
virtual void DisplayCoeffFactors(void);
/// Returns the name of the coefficient.
SG_USING_STD(endl);
#else
# include <string>
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <fstream.h>
-# include <math.h>
# include <iostream.h>
+# include <math.h>
# else
# include <fstream>
-# include <cmath>
# include <iostream>
+# if defined(sgi) && !defined(__GNUC__)
+# include <math.h>
+# else
+# include <cmath>
+# endif
using std::ostream;
using std::istream;
using std::cerr;
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DECLARATION: FGColumnVector3
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** This class implements a 3 dimensional vector.
+ @author Jon S. Berndt, Tony Peden, et. al.
+ @version $Id$
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGColumnVector3 : public FGJSBBase
SG_USING_STD(endl);
#else
# include <string>
-# if defined (sgi) && !defined(__GNUC__)
+# if defined (sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <fstream.h>
-# include <math.h>
# include <iostream.h>
+# include <math.h>
# else
# include <fstream>
+# if defined (sgi) && !defined(__GNUC__)
+# include <math.h>
+# else
# include <cmath>
+# endif
# include <iostream>
using std::ostream;
using std::istream;
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DECLARATION: FGColumnVector4
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** This class implements a 4 dimensional vector.
+ @author Jon S. Berndt, Tony Peden, et. al.
+ @version $Id$
+*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGColumnVector4 : public FGJSBBase
FGConfigFile::FGConfigFile(string cfgFileName)
{
-#if defined ( sgi ) && !defined( __GNUC__ )
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
cfgfile.open(cfgFileName.c_str(), ios::in );
#else
cfgfile.open(cfgFileName.c_str(), ios::in | ios::binary );
CommentsOn = false;
CurrentIndex = 0;
Opened = true;
-#if defined ( sgi ) && !defined( __GNUC__ )
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
if (!cfgfile.fail() && !cfgfile.eof()) GetNextConfigLine();
#else
if (cfgfile.is_open()) GetNextConfigLine();
}
} else {
if ((test = cfgfile.get()) != EOF) { // get *next* character
-#if defined ( sgi ) && !defined( __GNUC__ )
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
if (test >= 0x20 || test == 0x09) cfgfile.putback(test);
#else
if (test >= 0x20 || test == 0x09) cfgfile.unget();
SG_USING_STD(cout);
#else
# include <string>
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <fstream.h>
# include <iostream.h>
# else
# include <iostream>
using std::ostream;
using std::istream;
- using std::ifstream;
using std::ios;
using std::cerr;
- using std::endl;
using std::cout;
+ using std::ifstream;
+ using std::endl;
# endif
using std::string;
#endif
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
JSBSim config files are in XML format.
@author Jon S. Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGConfigFile.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGConfigFile.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string GetCurrentLine(void) { return CurrentLine; }
/** Returns the value of the tag supplied.
- @param
- @return */
- string GetValue(string);
+ @param tag the tag for the value that is desired.
+ @return tthe value of the tag supplied.*/
+ string GetValue(string tag);
+
string GetValue(void);
string GetCommentString(void) {return CommentString;}
string GetLineComment(void) {return LineComment;}
# include <fstream.h>
# endif
#else
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <fstream.h>
# else
# include <fstream>
FGEngine::FGEngine(FGFDMExec* exec)
- : Name(""),
- Type(etUnknown),
- X(0), Y(0), Z(0),
- EnginePitch(0), EngineYaw(0),
- SLFuelFlowMax(0), SLOxiFlowMax(0),
- MaxThrottle(1.0), MinThrottle(0.0),
- Thrust(0.0),
- Throttle(0.0),
- Mixture(1.0),
- Magnetos(0),
- Starter(false),
- FuelNeed(0.0), OxidizerNeed(0.0),
- Starved(false), Flameout(false), Running(false), Cranking(false),
- Augmentation(false), Injection(false), Ignition(false),
- Reversed(false), Cutoff(true), Nitrous(false),
- PctPower(0.0),
- EngineNumber(-1),
- TrimMode(false),
- FuelFlow_gph(0.0),
- ManifoldPressure_inHg(0.0),
- ExhaustGasTemp_degK(0.0),
- CylinderHeadTemp_degK(0.0),
- OilPressure_psi(0.0),
- OilTemp_degK(0.0),
- FuelFlow_pph(0.0),
- N1(0.0), N2(0.0), EGT_degC(0.0),
- InletPosition(0.0), NozzlePosition(0.0),
- FDMExec(exec),
- State(FDMExec->GetState()),
- Atmosphere(FDMExec->GetAtmosphere()),
- FCS(FDMExec->GetFCS()),
- Propulsion(FDMExec->GetPropulsion()),
- Aircraft(FDMExec->GetAircraft()),
- Translation(FDMExec->GetTranslation()),
- Rotation(FDMExec->GetRotation()),
- Position(FDMExec->GetPosition()),
- Auxiliary(FDMExec->GetAuxiliary()),
- Output(FDMExec->GetOutput())
{
+ Name.clear();
+ Type = etUnknown;
+ X = Y = Z = 0.0;
+ EnginePitch = EngineYaw = 0.0;
+ SLFuelFlowMax = SLOxiFlowMax = 0.0;
+ MaxThrottle = 1.0;
+ MinThrottle = 0.0;
+ Thrust = 0.0;
+ Throttle = 0.0;
+ Mixture = 1.0;
+ Starter = false;
+ FuelNeed = OxidizerNeed = 0.0;
+ Starved = Running = Cranking = false;
+ PctPower = 0.0;
+ EngineNumber = -1;
+ TrimMode = false;
+ FuelFlow_gph = 0.0;
+ FuelFlow_pph = 0.0;
+
+ FDMExec = exec;
+ State = FDMExec->GetState();
+ Atmosphere = FDMExec->GetAtmosphere();
+ FCS = FDMExec->GetFCS();
+ Propulsion = FDMExec->GetPropulsion();
+ Aircraft = FDMExec->GetAircraft();
+ Translation = FDMExec->GetTranslation();
+ Rotation = FDMExec->GetRotation();
+ Position = FDMExec->GetPosition();
+ Auxiliary = FDMExec->GetAuxiliary();
+ Output = FDMExec->GetOutput();
+
+ PropertyManager = FDMExec->GetPropertyManager();
+
Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGEngine::CalcFuelNeed(void) {
+double FGEngine::CalcFuelNeed(void)
+{
FuelNeed = SLFuelFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
return FuelNeed;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGEngine::CalcOxidizerNeed(void) {
+double FGEngine::CalcOxidizerNeed(void)
+{
OxidizerNeed = SLOxiFlowMax*PctPower*State->Getdt()*Propulsion->GetRate();
return OxidizerNeed;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGEngine::SetPlacement(double x, double y, double z, double pitch, double yaw) {
+void FGEngine::SetPlacement(double x, double y, double z, double pitch, double yaw)
+{
X = x;
Y = y;
Z = z;
#endif
#include "FGJSBBase.h"
+#include "FGPropertyManager.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
class FGAuxiliary;
class FGOutput;
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
enum EngineType {etUnknown, etRocket, etPiston, etTurbine, etSimTurbine};
+ EngineType GetType(void) { return Type; }
+ virtual string GetName(void) { return Name; }
+
+ // Engine controls
virtual double GetThrottleMin(void) { return MinThrottle; }
virtual double GetThrottleMax(void) { return MaxThrottle; }
virtual double GetThrottle(void) { return Throttle; }
virtual double GetMixture(void) { return Mixture; }
- virtual int GetMagnetos(void) { return Magnetos; }
virtual bool GetStarter(void) { return Starter; }
- virtual double GetThrust(void) { return Thrust; }
- virtual bool GetStarved(void) { return Starved; }
- virtual bool GetFlameout(void) { return Flameout; }
- virtual bool GetRunning(void) { return Running; }
- virtual bool GetCranking(void) { return Cranking; }
- virtual int GetType(void) { return Type; }
- virtual string GetName(void) { return Name; }
- virtual double GetN1(void) { return N1; }
- virtual double GetN2(void) { return N2; }
- virtual double GetEGT(void) { return EGT_degC; }
- virtual double GetEPR(void) { return EPR; }
- virtual double GetInlet(void) { return InletPosition; }
- virtual double GetNozzle(void) { return NozzlePosition; }
- virtual bool GetAugmentation(void) { return Augmentation; }
- virtual bool GetInjection(void) { return Injection; }
- virtual int GetIgnition(void) { return Ignition; }
- virtual bool GetReversed(void) { return Reversed; }
- virtual bool GetCutoff(void) { return Cutoff; }
- virtual bool GetNitrous(void) { return Nitrous; }
-
- virtual double getFuelFlow_gph () const {
- return FuelFlow_gph;
- }
-
- virtual double getManifoldPressure_inHg () const {
- return ManifoldPressure_inHg;
- }
- virtual double getExhaustGasTemp_degF () const {
- return (ExhaustGasTemp_degK - 273) * (9.0 / 5.0) + 32.0;
- }
- virtual double getCylinderHeadTemp_degF () const {
- return (CylinderHeadTemp_degK - 273) * (9.0 / 5.0) + 32.0;
- }
- virtual double getOilPressure_psi () const {
- return OilPressure_psi;
- }
- virtual double getOilTemp_degF () const {
- return (OilTemp_degK - 273.0) * (9.0 / 5.0) + 32.0;
- }
-
- virtual double getFuelFlow_pph () const {
- return FuelFlow_pph;
- }
+
+ virtual double getFuelFlow_gph () const {return FuelFlow_gph;}
+ virtual double getFuelFlow_pph () const {return FuelFlow_pph;}
+ virtual double GetThrust(void) { return Thrust; }
+ virtual bool GetStarved(void) { return Starved; }
+ virtual bool GetRunning(void) { return Running; }
+ virtual bool GetCranking(void) { return Cranking; }
virtual void SetStarved(bool tt) { Starved = tt; }
virtual void SetStarved(void) { Starved = true; }
virtual void SetName(string name) { Name = name; }
virtual void AddFeedTank(int tkID);
- virtual void SetMagnetos(int m) { Magnetos = m; }
virtual void SetStarter(bool s) { Starter = s; }
- virtual void SetAugmentation(bool a) { Augmentation = a; }
- virtual void SetInjection(bool i) { Injection = i; }
- virtual void SetIgnition(int ig) { Ignition = ig; }
- virtual void SetReverse(bool r) { Reversed = r; }
- virtual void SetCutoff(bool c) { Cutoff = c; }
- virtual void SetNitrous(bool n) { Nitrous = n; }
/** Calculates the thrust of the engine, and other engine functions.
@param PowerRequired this is the power required to run the thrusting device
virtual void SetTrimMode(bool state) {TrimMode = state;}
protected:
+ FGPropertyManager* PropertyManager;
string Name;
EngineType Type;
double X, Y, Z;
double Thrust;
double Throttle;
double Mixture;
- int Magnetos;
+ double FuelNeed;
+ double OxidizerNeed;
+ double PctPower;
+ int EngineNumber;
bool Starter;
- double FuelNeed, OxidizerNeed;
bool Starved;
- bool Flameout;
bool Running;
bool Cranking;
- double PctPower;
- int EngineNumber;
bool TrimMode;
double FuelFlow_gph;
- double ManifoldPressure_inHg;
- double ExhaustGasTemp_degK;
- double CylinderHeadTemp_degK;
- double OilPressure_psi;
- double OilTemp_degK;
-
double FuelFlow_pph;
- double N1;
- double N2;
- double EGT_degC;
- double EPR;
- double BleedDemand;
- double InletPosition;
- double NozzlePosition;
- bool Augmentation;
- bool Injection;
- int Ignition;
- bool Reversed;
- bool Cutoff;
- bool Nitrous;
FGFDMExec* FDMExec;
FGState* State;
FGOutput* Output;
vector <int> SourceTanks;
- virtual void Debug(int from);
+ void Debug(int from);
};
}
#include "FGState.h"
typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf, NNorm } FcIdx;
typedef enum { ofRad=0, ofNorm, ofMag , NForms} OutputForm;
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Encapsulates the Flight Control System (FCS) functionality.
- <ul><li>\URL[Source Code]{FGFCS.cpp.html}</li>
- <li>\URL[Header File]{FGFCS.h.html}</li></ul>
- This class owns and contains the list of \URL[components]{FGFCSComponent.html}
+ This class owns and contains the list of FGFCSComponents
that define the control system for this aircraft. The config file for the
aircraft contains a description of the control path that starts at an input
or command and ends at an effector, e.g. an aerosurface. The FCS components
@see FGGradient
@see FGFilter
@see FGDeadBand
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFCS.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFCS.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# include STL_IOSTREAM
# include STL_ITERATOR
#else
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <iostream.h>
# else
# include <iostream>
scratch = AC_cfg->GetValue("VERSION").c_str();
CFGVersion = AC_cfg->GetValue("VERSION");
+ Release = AC_cfg->GetValue("RELEASE");
if (debug_lvl > 0)
cout << " Version: " << highint << CFGVersion
cerr << " You have version: " << CFGVersion << endl << fgdef << endl;
return false;
}
+
+ if (Release == "ALPHA") {
+ system("banner ALPHA");
+ cout << endl << endl
+ << highint << "This aircraft model is an " << fgred << Release
+ << reset << highint << " release!!!" << endl << endl << reset
+ << "This aircraft model may not even properly load, and probably"
+ << " will not fly as expected." << endl << endl
+ << fgred << highint << "Use this model for development purposes ONLY!!!"
+ << normint << endl << endl;
+ } else if (Release == "BETA") {
+ system("banner BETA");
+ cout << endl << endl
+ << highint << "This aircraft model is a " << fgred << Release
+ << reset << highint << " release!!!" << endl << endl << reset
+ << "This aircraft model probably will not fly as expected." << endl << endl
+ << fgblue << highint << "Use this model for development purposes ONLY!!!"
+ << normint << reset << endl << endl;
+ }
return true;
}
#include "FGJSBBase.h"
#include "FGPropertyManager.h"
-
#include <vector>
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Encapsulates the JSBSim simulation executive.
- @author Jon S. Berndt
- @version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFDMExec.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFDMExec.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
-
- @doc This class is the interface class through which all other simulation classes
+ This class is the interface class through which all other simulation classes
are instantiated, initialized, and run. When integrated with FlightGear (or
other flight simulator) this class is typically instantiated by an interface
class on the simulator side.
a message is printed out when they go out of bounds</li>
</ol>
+ @author Jon S. Berndt
+ @version $Id$
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/** Sets the path to the engine config file directories.
- @param EnginePath path to the directory under which engine config
+ @param path path to the directory under which engine config
files are kept, for instance "engine"
*/
bool SetEnginePath(string path) { EnginePath = path; return true; }
/** Sets the path to the aircraft config file directories.
- @param AircraftPath path to the aircraft directory. For instance:
+ @param path path to the aircraft directory. For instance:
"aircraft". Under aircraft, then, would be directories for various
modeled aircraft such as C172/, x15/, etc.
*/
bool SetAircraftPath(string path) { AircraftPath = path; return true; }
/** Sets the path to the autopilot config file directories.
- @param ControlPath path to the control directory. For instance:
+ @param path path to the control directory. For instance:
"control".
*/
bool SetControlPath(string path) { ControlPath = path; return true; }
string ControlPath;
string CFGVersion;
+ string Release;
FGState* State;
FGAtmosphere* Atmosphere;
#include "FGFDMExec.h"
#ifndef FGFS
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <iomanip.h>
# else
# include <iomanip>
class FGOutput;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** This class encapsulates the functionality needed to manage a factor group
i.e. factor*(coeff1 + coeff2 + coeff3)
@author Tony Peden
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFactorGroup.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFactorGroup.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#define ID_FORCE "$Id$"
-
#include "FGFDMExec.h"
#include "FGJSBBase.h"
#include "FGMatrix33.h"
#include "FGColumnVector4.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FORWARD DECLARATIONS
+DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-namespace JSBSim {
+#define ID_FORCE "$Id$"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
--------------------------------------------------------------------------------
09/13/00 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_GROUNDREACTIONS "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Manages ground reactions modeling.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
string GetGroundReactionValues(void);
inline int GetNumGearUnits(void) const { return lGear.size(); }
+
/** Gets a gear instance
@param gear index of gear instance
@return a pointer to the FGLGear instance of the gear unit requested */
-
-
inline FGLGear* GetGearUnit(int gear) { return &(lGear[gear]); }
void bind(void);
--------------------------------------------------------------------------------
09/13/00 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGColumnVector3.h"
#include "FGColumnVector4.h"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#define ID_INERTIAL "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models inertial forces (e.g. centripetal and coriolis accelerations).
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGInitialCondition.h
Author: Tony Peden
the sim will most likely start in a very dynamic state (unless, of course,
you have chosen your IC's wisely) even after setting it up with this class.
-********************************************************************************
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#ifndef FGINITIALCONDITION_H
#define FGINITIALCONDITION_H
-/*******************************************************************************
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
-*******************************************************************************/
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGFDMExec.h"
#include "FGJSBBase.h"
#define ID_INITIALCONDITION "$Id$"
-namespace JSBSim {
-
-typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
-typedef enum { setwned, setwmd, setwhc } windset;
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
+typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
+typedef enum { setwned, setwmd, setwhc } windset;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
FGInitialCondition fgic=new FGInitialCondition(FDMExec);
fgic->SetVcalibratedKtsIC()
fgic->SetAltitudeFtIC();
- .
- .
- .
+
//to directly into Run
FDMExec->GetState()->Initialize(fgic)
delete fgic;
Speed:
- Since vc, ve, vt, and mach all represent speed, the remaining
- three are recalculated each time one of them is set (using the
- current altitude). The most recent speed set is remembered so
- that if and when altitude is reset, the last set speed is used
- to recalculate the remaining three. Setting any of the body
- components forces a recalculation of vt and vt then becomes the
- most recent speed set.
+ Since vc, ve, vt, and mach all represent speed, the remaining
+ three are recalculated each time one of them is set (using the
+ current altitude). The most recent speed set is remembered so
+ that if and when altitude is reset, the last set speed is used
+ to recalculate the remaining three. Setting any of the body
+ components forces a recalculation of vt and vt then becomes the
+ most recent speed set.
Alpha,Gamma, and Theta:
This class assumes that it will be used to set up the sim for a
- steady, zero pitch rate condition. Since any two of those angles
+ steady, zero pitch rate condition. Since any two of those angles
specifies the third gamma (flight path angle) is favored when setting
alpha and theta and alpha is favored when setting gamma. i.e.
- set alpha : recalculate theta using gamma as currently set
- set theta : recalculate alpha using gamma as currently set
- set gamma : recalculate theta using alpha as currently set
+ - set alpha : recalculate theta using gamma as currently set
+ - set theta : recalculate alpha using gamma as currently set
+ - set gamma : recalculate theta using alpha as currently set
- The idea being that gamma is most interesting to pilots (since it
- is indicative of climb rate).
-
- Setting climb rate is, for the purpose of this discussion,
- considered equivalent to setting gamma.
- @author Anthony K. Peden
- @version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGInitialCondition.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGInitialCondition.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ The idea being that gamma is most interesting to pilots (since it
+ is indicative of climb rate).
+
+ Setting climb rate is, for the purpose of this discussion,
+ considered equivalent to setting gamma.
+ @author Tony Peden
+ @version "$Id$"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
const double FGJSBBase::Reng = 1716.0;
const double FGJSBBase::SHRatio = 1.40;
const string FGJSBBase::needed_cfg_version = "1.60";
-const string FGJSBBase::JSBSim_version = "0.9.4";
+const string FGJSBBase::JSBSim_version = "0.9.5";
std::queue <FGJSBBase::Message*> FGJSBBase::Messages;
FGJSBBase::Message FGJSBBase::localMsg;
static char *gcvt(double number, size_t ndigit, char *buf)
{
- sprintf(buf, "%f", number);
- return buf;
+ sprintf(buf, "%f", number);
+ return buf;
}
#endif
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
void disableHighLighting(void);
static short debug_lvl;
+ double KelvinToFahrenheit (double kelvin) {
+ return 1.8*kelvin - 459.4;
+ }
+
+ double RankineToCelsius (double rankine) {
+ return (rankine - 491.67)/1.8;
+ }
protected:
static Message localMsg;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGLGear.h"
-#include <algorithm>
+//#include <algorithm>
namespace JSBSim {
{
double SteerGain = 0;
double SinWheel, CosWheel;
- double deltaT;
+ double deltaSlip;
+ double deltaT = State->Getdt()*Aircraft->GetRate();
+ double maxdeltaSlip = 0.5*deltaT;
vForce.InitMatrix();
vMoment.InitMatrix();
if (compressLength > 0.00) {
- WOW = true;// Weight-On-Wheels is true
+ WOW = true; // Weight-On-Wheels is true
// The next equation should really use the vector to the contact patch of the tire
// including the strut compression and not vWhlBodyVec. Will fix this later.
switch (eBrakeGrp) {
case bgLeft:
- SteerGain = 0.10;
- BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) +
+ BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgLeft)) +
staticFCoeff*FCS->GetBrake(bgLeft) );
break;
case bgRight:
- SteerGain = 0.10;
BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgRight)) +
staticFCoeff*FCS->GetBrake(bgRight) );
break;
case bgCenter:
- SteerGain = 0.10;
BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
staticFCoeff*FCS->GetBrake(bgCenter) );
break;
case bgNose:
- SteerGain = -0.50;
- BrakeFCoeff = rollingFCoeff;
+ BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
+ staticFCoeff*FCS->GetBrake(bgCenter) );
break;
case bgTail:
- SteerGain = -0.10;
- BrakeFCoeff = rollingFCoeff;
+ BrakeFCoeff = ( rollingFCoeff*(1.0 - FCS->GetBrake(bgCenter)) +
+ staticFCoeff*FCS->GetBrake(bgCenter) );
break;
case bgNone:
- SteerGain = 0.0;
BrakeFCoeff = rollingFCoeff;
break;
default:
switch (eSteerType) {
case stSteer:
- SteerAngle = SteerGain*FCS->GetDrCmd()*0.349; // 20 deg
+ SteerAngle = -maxSteerAngle * FCS->GetDrCmd() * 0.01745;
break;
case stFixed:
SteerAngle = 0.0;
if (RollingWhlVel == 0.0 && SideWhlVel == 0.0) {
WheelSlip = 0.0;
- } else if (fabs(RollingWhlVel) < 0.10) {
+ } else if (fabs(RollingWhlVel) < 1.0) {
WheelSlip = 0.05*radtodeg*atan2(SideWhlVel, RollingWhlVel) + 0.95*WheelSlip;
} else {
WheelSlip = radtodeg*atan2(SideWhlVel, RollingWhlVel);
}
+/*
+ if (RollingWhlVel == 0.0 && SideWhlVel == 0.0) {
+ WheelSlip = 0.0;
+ } else if (RollingWhlVel < 1.0) {
+ WheelSlip = radtodeg*atan2(SideWhlVel, RollingWhlVel);
+ deltaSlip = WheelSlip - lastWheelSlip;
+ if (fabs(deltaSlip) > maxdeltaSlip) {
+ if (WheelSlip > lastWheelSlip) {
+ WheelSlip = lastWheelSlip + maxdeltaSlip;
+ } else if (WheelSlip < lastWheelSlip) {
+ WheelSlip = lastWheelSlip - maxdeltaSlip;
+ }
+ }
+ } else {
+ WheelSlip = radtodeg*atan2(SideWhlVel, RollingWhlVel);
+ }
if ((WheelSlip < 0.0 && lastWheelSlip > 0.0) ||
(WheelSlip > 0.0 && lastWheelSlip < 0.0))
{
WheelSlip = 0.0;
}
-
+*/
lastWheelSlip = WheelSlip;
// Compute the sideforce coefficients using similar assumptions to LaRCSim for now.
vForce = State->GetTl2b() * vLocalForce;
vMoment = vWhlBodyVec * vForce;
- } else {
+ } else { // Gear is NOT compressed
WOW = false;
compressLength = 0.0; // reset compressLength to zero for data output validity
}
- deltaT = State->Getdt()*Aircraft->GetRate();
-
if (FirstContact) LandingDistanceTraveled += Position->GetVground()*deltaT;
if (StartedGroundRun) {
class FGMassBalance;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
Wiley & Sons, 1979 ISBN 0-471-03032-5
@see W. A. Ragsdale, "A Generic Landing Gear Dynamics Model for LASRS++",
AIAA-2000-4303
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGLGear.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGLGear.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--------------------------------------------------------------------------------
09/12/2000 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGPropulsion.h"
#include <vector>
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#define ID_MASSBALANCE "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONSS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models weight and balance information.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
SG_USING_STD(endl);
#else
# include <string>
-# if defined(sgi) && !defined(__GNUC__)
-# include <fstream.h>
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
+ include <fstream.h>
+ include <iostream.h>
# include <math.h>
-# include <iostream.h>
# else
# include <fstream>
-# include <cmath>
+# include <iostream>
+# if defined(sgi) && !defined(__GNUC__)
+# include <math.h>
+# else
+# include <cmath>
+# endif
# include <iostream>
using std::ostream;
using std::istream;
class FGColumnVector3;
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Exception convenience class.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: MatrixException
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
string Message;
};
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Handles matrix math operations.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DECLARATION: FGMatrix33
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
# include <iostream.h>
# endif
#else
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <iostream.h>
# else
# include <iostream>
#include <string>
-#define ID_MODEL "$Id$"
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+#define ID_MODEL "$Id$"
+
using namespace std;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
class FGOutput;
class FGConfigFile;
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Base class for all scheduled JSBSim models
@author Jon S. Berndt
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGModel.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGModel.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
Thrust = 0;
+ ReverserAngle = 0.0;
Type = ttNozzle;
Area2 = (Diameter*Diameter/4.0)*M_PI;
AreaT = Area2/ExpR;
{
double pAtm = fdmex->GetAtmosphere()->GetPressure();
Thrust = max((double)0.0, (CfPc * AreaT + (PE - pAtm)*Area2) * nzlEff);
- vFn(1) = Thrust;
+ vFn(1) = Thrust * cos(ReverserAngle);
return Thrust;
}
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Models a rocket nozzle.
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGNozzle.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGNozzle.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ @author Jon S. Berndt
+ @version $Id$
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double GetPowerRequired(void);
private:
+ double ReverserAngle;
double PE;
double ExpR;
double nzlEff;
# include STL_IOSTREAM
# include STL_FSTREAM
#else
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <iostream.h>
# include <fstream.h>
# else
#include "FGfdmSocket.h"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#define ID_OUTPUT "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Handles simulation output.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
{
string token;
- MinManifoldPressure_inHg = 6.5;
- MaxManifoldPressure_inHg = 28.5;
- Displacement = 360;
- MaxHP = 200;
- Cycles = 2;
- IdleRPM = 600;
-
Name = Eng_cfg->GetValue("NAME");
Eng_cfg->GetNextConfigLine();
while (Eng_cfg->GetValue() != string("/FG_PISTON")) {
crank_counter = 0;
EngineNumber = 0;
OilTemp_degK = 298;
+ MinManifoldPressure_inHg = 6.5;
+ MaxManifoldPressure_inHg = 28.5;
ManifoldPressure_inHg = Atmosphere->GetPressure() * psftoinhg; // psf to in Hg
+ CylinderHeadTemp_degK = 0.0;
+ Displacement = 360;
+ MaxHP = 200;
+ Cycles = 2;
+ IdleRPM = 600;
+ Magnetos = 0;
+ ExhaustGasTemp_degK = 0.0;
+ EGT_degC = 0.0;
dt = State->Getdt();
p_amb_sea_level = Atmosphere->GetPressureSL() * 48;
T_amb = Atmosphere->GetTemperature() * (5.0 / 9.0); // convert from Rankine to Kelvin
- RPM = Propulsion->GetThruster(EngineNumber)->GetRPM();
+ RPM = Propulsion->GetThruster(EngineNumber)->GetRPM() *
+ Propulsion->GetThruster(EngineNumber)->GetGearRatio();
IAS = Auxiliary->GetVcalibratedKTS();
void FGPiston::doEnginePower(void)
{
ManifoldPressure_inHg *= p_amb / p_amb_sea_level;
+
if (Running) {
double ManXRPM = ManifoldPressure_inHg * RPM;
- // FIXME: this needs to be generalized
+ double T_amb_degF = KelvinToFahrenheit(T_amb);
+ double T_amb_sea_lev_degF = KelvinToFahrenheit(288);
+
+ // FIXME: this needs to be generalized
Percentage_Power = (6e-9 * ManXRPM * ManXRPM) + (8e-4 * ManXRPM) - 1.0;
- double T_amb_degF = (T_amb * 1.8) - 459.67;
- double T_amb_sea_lev_degF = (288 * 1.8) - 459.67;
- Percentage_Power =
- Percentage_Power + ((T_amb_sea_lev_degF - T_amb_degF) * 7 /120);
+ Percentage_Power += ((T_amb_sea_lev_degF - T_amb_degF) * 7 /120);
+
double Percentage_of_best_power_mixture_power =
Power_Mixture_Correlation->GetValue(14.7 / equivalence_ratio);
- Percentage_Power =
- Percentage_Power * Percentage_of_best_power_mixture_power / 100.0;
- if (Percentage_Power < 0.0)
- Percentage_Power = 0.0;
- else if (Percentage_Power > 100.0)
- Percentage_Power = 100.0;
+
+ Percentage_Power *= Percentage_of_best_power_mixture_power / 100.0;
+
+ if (Percentage_Power < 0.0) Percentage_Power = 0.0;
+ else if (Percentage_Power > 100.0) Percentage_Power = 100.0;
+
HP = Percentage_Power * MaxHP / 100.0;
- } else {
+
+ } else {
+
// Power output when the engine is not running
if (Cranking) {
if (RPM < 10) {
- HP = 3.0; // This is a hack to prevent overshooting the idle rpm in the first time step
- // It may possibly need to be changed if the prop model is changed.
+ HP = 3.0; // This is a hack to prevent overshooting the idle rpm in
+ // the first time step. It may possibly need to be changed
+ // if the prop model is changed.
} else if (RPM < 480) {
HP = 3.0 + ((480 - RPM) / 10.0);
// This is a guess - would be nice to find a proper starter moter torque curve
09/12/2000 JSB Created
10/01/2001 DPM Modified to use equations from Dave Luff's piston model.
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DOCUMENTATION
+CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Models Dave Luff's engine model as ported into JSBSim by David Megginson.
@author Jon S. Berndt (Engine framework code and framework-related mods)
@author Dave Luff (engine operational code)
@author David Megginson (porting and additional code)
- @version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPiston.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPiston.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ @version "$Id$"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double GetPowerAvailable(void) {return PowerAvailable;}
double CalcFuelNeed(void);
+ void SetMagnetos(int magnetos) {Magnetos = magnetos;}
+
+ double GetEGT(void) { return EGT_degC; }
+ int GetMagnetos(void) {return Magnetos;}
+
+ double getExhaustGasTemp_degF(void) {return KelvinToFahrenheit(ExhaustGasTemp_degK);}
+ double getManifoldPressure_inHg(void) const {return ManifoldPressure_inHg;}
+ double getCylinderHeadTemp_degF(void) {return KelvinToFahrenheit(CylinderHeadTemp_degK);}
+ double getOilPressure_psi(void) const {return OilPressure_psi;}
+ double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
+ double getRPM(void) {return RPM;}
+
private:
int crank_counter;
double T_amb; // degrees Kelvin
double RPM; // revolutions per minute
double IAS; // knots
+ bool Magneto_Left;
+ bool Magneto_Right;
+ int Magnetos;
//
// Outputs (in addition to those in FGEngine).
//
- bool Magneto_Left;
- bool Magneto_Right;
double rho_air;
double volumetric_efficiency;
double m_dot_air;
double Percentage_Power;
double HP;
double combustion_efficiency;
+ double ExhaustGasTemp_degK;
+ double EGT_degC;
+ double ManifoldPressure_inHg;
+ double CylinderHeadTemp_degK;
+ double OilPressure_psi;
+ double OilTemp_degK;
void Debug(int from);
};
#else
# if defined(sgi) && !defined(__GNUC__)
# include <math.h>
-# include <iomanip.h>
+# if (_COMPILER_VERSION < 740)
+# include <iomanip.h>
+# else
+# include <iomanip>
+# endif
# else
# include <cmath>
# include <iomanip>
Name = "FGPosition";
LongitudeDot = LatitudeDot = RadiusDot = 0.0;
- for (int i=0;i<3;i++) {
+ for (int i=0;i<4;i++) {
LatitudeDot_prev[i] = 0.0;
LongitudeDot_prev[i] = 0.0;
RadiusDot_prev[i] = 0.0;
}
-
+
+ vVRPoffset.InitMatrix();
+
Longitude = Latitude = 0.0;
+ LongitudeVRP = LatitudeVRP = 0.0;
gamma = Vt = Vground = 0.0;
hoverbmac = hoverbcg = 0.0;
psigt = 0.0;
{
double cosLat;
double hdot_Vt;
- FGColumnVector3 vMac;
if (!FGModel::Run()) {
GetState();
h = Radius - SeaLevelRadius; // Geocentric
+ vVRPoffset = State->GetTb2l() * (vVRP - MassBalance->GetXYZcg());
+ vVRPoffset /= 12.0; // converted to feet
+
+ // vVRP - the vector to the Visual Reference Point - now contains the
+ // offset from the CG to the VRP, in units of feet, in the Local coordinate
+ // frame, where X points north, Y points East, and Z points down. This needs
+ // to be converted to Lat/Lon/Alt, now.
+
+ if (cosLat != 0)
+ LongitudeVRP = vVRPoffset(eEast) / (Radius * cosLat) + Longitude;
+
+ LatitudeVRP = vVRPoffset(eNorth) / Radius + Latitude;
+ hVRP = vVRPoffset(eDown) + h;
+/*
+cout << "Lat/Lon/Alt : " << Latitude << " / " << Longitude << " / " << h << endl;
+cout << "Lat/Lon/Alt VRP: " << LatitudeVRP << " / " << LongitudeVRP << " / " << hVRP << endl << endl;
+*/
DistanceAGL = Radius - RunwayRadius; // Geocentric
hoverbcg = DistanceAGL/b;
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DOCUMENTATION
+CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Models the lateral and longitudinal translational EOM.
@author Jon S. Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPosition.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
public:
/** Constructor
@param Executive a pointer to the parent executive object */
- FGPosition(FGFDMExec*);
+ FGPosition(FGFDMExec* Executive);
/// Destructor
~FGPosition();
inline double GetVground(void) const { return Vground; }
inline double GetGroundTrack(void) const { return psigt; }
inline double Geth(void) const { return h; }
+ inline double GethVRP(void) const { return hVRP; }
inline double Gethdot(void) const { return RadiusDot; }
inline double GetLatitude(void) const { return Latitude; }
+ inline double GetLatitudeVRP(void) const { return LatitudeVRP; }
inline double GetLatitudeDot(void) const { return LatitudeDot; }
inline double GetLongitude(void) const { return Longitude; }
+ inline double GetLongitudeVRP(void) const { return LongitudeVRP; }
inline double GetLongitudeDot(void) const { return LongitudeDot; }
inline double GetRunwayRadius(void) const { return RunwayRadius; }
inline double GetDistanceAGL(void) const { return DistanceAGL; }
inline void SetRunwayNormal(double fgx, double fgy, double fgz ) {
vRunwayNormal << fgx << fgy << fgz;
}
+ void SetVRP(FGColumnVector3& vrp) {vVRP = vrp;}
void bind(void);
void unbind(void);
FGColumnVector3 vVel;
FGColumnVector3 vVelDot;
FGColumnVector3 vRunwayNormal;
+ FGColumnVector3 vVRP;
+ FGColumnVector3 vVRPoffset;
+ FGColumnVector3 vMac;
- double Radius, h;
+ double Radius, h, hVRP;
double LatitudeDot, LongitudeDot, RadiusDot;
- double LatitudeDot_prev[3], LongitudeDot_prev[3], RadiusDot_prev[3];
+ double LatitudeDot_prev[4], LongitudeDot_prev[4], RadiusDot_prev[4];
double Longitude, Latitude;
+ double LongitudeVRP, LatitudeVRP;
double dt;
double RunwayRadius;
double DistanceAGL;
int rows, cols;
MaxPitch = MinPitch = P_Factor = Sense = Pitch = 0.0;
+ GearRatio = 1.0;
Name = Prop_cfg->GetValue("NAME");
Prop_cfg->GetNextConfigLine();
Diameter /= 12.0;
} else if (token == "NUMBLADES") {
*Prop_cfg >> numBlades;
+ } else if (token == "GEARRATIO") {
+ *Prop_cfg >> GearRatio;
} else if (token == "MINPITCH") {
*Prop_cfg >> MinPitch;
} else if (token == "MAXPITCH") {
if (omega <= 5) omega = 1.0;
- ExcessTorque = PowerAvailable / omega;
+ ExcessTorque = PowerAvailable / omega * GearRatio;
RPM = (RPS + ((ExcessTorque / Ixx) / (2.0 * M_PI)) * deltaT) * 60.0;
// The friction from the engine should
else if (Pitch > MaxPitch) Pitch = MaxPitch;
} else {
- Pitch = MaxPitch - (MaxPitch - MinPitch) * advance;
+ Pitch = MinPitch + (MaxPitch - MinPitch) * advance;
}
cPReq = cPower->GetValue(J, Pitch);
}
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@see FGEngine
@see FGThruster
@see FGTable
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropeller.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropeller.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
fqname+= stack[0];
return fqname;
-
+
}
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Class wrapper for property handling.
@author David Megginson, Tony Peden
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropertyManager.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropertyManager.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Untie (const string &name);
- // Templates cause ambiguity here
+ // Templates cause ambiguity here
/**
* Tie a property to an external bool variable.
bool useDefault = true)
{
if (!tie(name.c_str(), SGRawValueFunctions<V>(getter, setter),
- useDefault))
+ useDefault))
+ {
cout <<
- "Failed to tie property " << name << " to functions" << endl;
+ "Failed to tie property " << name << " to functions" << endl;
+ }
}
void (*setter)(int, V) = 0, bool useDefault = true)
{
if (!tie(name.c_str(),
- SGRawValueFunctionsIndexed<V>(index,
- getter,
- setter),
- useDefault))
+ SGRawValueFunctionsIndexed<V>(index, getter, setter), useDefault))
+ {
cout <<
- "Failed to tie property " << name << " to indexed functions" << endl;
+ "Failed to tie property " << name << " to indexed functions" << endl;
+ }
}
void (T::*setter)(V) = 0, bool useDefault = true)
{
if (!tie(name.c_str(),
- SGRawValueMethods<T,V>(*obj, getter, setter),
- useDefault))
+ SGRawValueMethods<T,V>(*obj, getter, setter), useDefault))
+ {
cout <<
- "Failed to tie property " << name << " to object methods" << endl;
+ "Failed to tie property " << name << " to object methods" << endl;
+ }
}
/**
bool useDefault = true)
{
if (!tie(name.c_str(),
- SGRawValueMethodsIndexed<T,V>(*obj,
- index,
- getter,
- setter),
- useDefault))
+ SGRawValueMethodsIndexed<T,V>(*obj, index, getter, setter), useDefault))
+ {
cout <<
- "Failed to tie property " << name << " to indexed object methods" << endl;
+ "Failed to tie property " << name << " to indexed object methods" << endl;
+ }
}
};
}
FGPropulsion::FGPropulsion(FGFDMExec* exec) : FGModel(exec)
{
Name = "FGPropulsion";
+
numSelectedFuelTanks = numSelectedOxiTanks = 0;
numTanks = numEngines = numThrusters = 0;
numOxiTanks = numFuelTanks = 0;
dt = 0.0;
ActiveEngine = -1; // -1: ALL, 0: Engine 1, 1: Engine 2 ...
+
bind();
+
Debug(0);
}
case FGEngine::etTurbine:
break;
case FGEngine::etSimTurbine:
+ PropulsionStrings += (Engines[i]->GetName() + "_N1[" + buffer + "], ");
+ PropulsionStrings += (Engines[i]->GetName() + "_N2[" + buffer + "]");
break;
default:
PropulsionStrings += "INVALID ENGINE TYPE";
PropulsionStrings += (Thrusters[i]->GetName() + "_Pitch[" + buffer + "], ");
PropulsionStrings += (Thrusters[i]->GetName() + "_RPM[" + buffer + "]");
break;
+ case FGThruster::ttDirect:
+ PropulsionStrings += (Thrusters[i]->GetName() + "_Thrust[" + buffer + "]");
+ break;
default:
PropulsionStrings += "INVALID THRUSTER TYPE";
break;
case FGEngine::etTurbine:
break;
case FGEngine::etSimTurbine:
+ PropulsionValues += (string(gcvt(((FGSimTurbine*)Engines[i])->GetN1(), 10, buff))) + ", ";
+ PropulsionValues += (string(gcvt(((FGSimTurbine*)Engines[i])->GetN2(), 10, buff)));
break;
}
break;
case FGThruster::ttRotor:
break;
+ case FGThruster::ttDirect:
+ PropulsionValues += (string(gcvt(((FGThruster*)Thrusters[i])->GetThrust(), 10, buff)));
+ break;
case FGThruster::ttPropeller:
FGPropeller* Propeller = (FGPropeller*)Thrusters[i];
FGColumnVector3 vPFactor = Propeller->GetPFactor();
void FGPropulsion::SetMagnetos(int setting)
{
- if (ActiveEngine == -1) {
+ if (ActiveEngine < 0) {
for (unsigned i=0; i<Engines.size(); i++) {
- Engines[i]->SetMagnetos(setting);
+ ((FGPiston*)Engines[i])->SetMagnetos(setting);
}
} else {
- Engines[ActiveEngine]->SetMagnetos(setting);
+ ((FGPiston*)Engines[ActiveEngine])->SetMagnetos(setting);
}
}
void FGPropulsion::SetStarter(int setting)
{
- if (ActiveEngine == -1) {
+ if (ActiveEngine < 0) {
for (unsigned i=0; i<Engines.size(); i++) {
- Engines[i]->SetStarter(setting);
+ if (setting == 0)
+ Engines[i]->SetStarter(false);
+ else
+ Engines[i]->SetStarter(true);
}
} else {
if (setting == 0)
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+void FGPropulsion::SetCutoff(int setting)
+{
+ if (ActiveEngine < 0) {
+ for (unsigned i=0; i<Engines.size(); i++) {
+ if (setting == 0)
+ ((FGSimTurbine*)Engines[i])->SetCutoff(false);
+ else
+ ((FGSimTurbine*)Engines[i])->SetCutoff(true);
+ }
+ } else {
+ if (setting == 0)
+ ((FGSimTurbine*)Engines[ActiveEngine])->SetCutoff(false);
+ else
+ ((FGSimTurbine*)Engines[ActiveEngine])->SetCutoff(true);
+ }
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
void FGPropulsion::SetActiveEngine(int engine)
{
- if ( unsigned(engine) > Engines.size())
+ if (engine >= Engines.size() || engine < 0)
ActiveEngine = -1;
else
ActiveEngine = engine;
{
typedef double (FGPropulsion::*PMF)(int) const;
typedef int (FGPropulsion::*iPMF)(void) const;
- /* PropertyManager->Tie("propulsion/num-engines", this,
- &FGPropulsion::GetNumEngines);
- PropertyManager->Tie("propulsion/num-tanks", this,
- &FGPropulsion::GetNumTanks); */
PropertyManager->Tie("propulsion/magneto_cmd", this,
- (iPMF)0,
- &FGPropulsion::SetMagnetos,
- true);
+ (iPMF)0, &FGPropulsion::SetMagnetos, true);
PropertyManager->Tie("propulsion/starter_cmd", this,
- (iPMF)0,
- &FGPropulsion::SetStarter,
- true);
- PropertyManager->Tie("propulsion/active_engine", this,
- (iPMF)0,
- &FGPropulsion::SetActiveEngine,
- true);
-
- PropertyManager->Tie("propulsion/num-sel-fuel-tanks", this,
- &FGPropulsion::GetnumSelectedFuelTanks);
- PropertyManager->Tie("propulsion/num-sel-ox-tanks", this,
- &FGPropulsion::GetnumSelectedOxiTanks);
+ (iPMF)0, &FGPropulsion::SetStarter, true);
+ PropertyManager->Tie("propulsion/cutoff_cmd", this,
+ (iPMF)0, &FGPropulsion::SetCutoff, true);
+
PropertyManager->Tie("forces/fbx-prop-lbs", this,1,
(PMF)&FGPropulsion::GetForces);
PropertyManager->Tie("forces/fby-prop-lbs", this,2,
(PMF)&FGPropulsion::GetMoments);
PropertyManager->Tie("moments/n-prop-lbsft", this,3,
(PMF)&FGPropulsion::GetMoments);
- //PropertyManager->Tie("propulsion/tanks-weight-lbs", this,
- // &FGPropulsion::GetTanksWeight);
+
+ PropertyManager->Tie("propulsion/active_engine", this,
+ &FGPropulsion::GetActiveEngine, &FGPropulsion::SetActiveEngine, true);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGPropulsion::unbind(void)
{
- /* PropertyManager->Untie("propulsion/num-engines");
- PropertyManager->Untie("propulsion/num-tanks"); */
- PropertyManager->Untie("propulsion/num-sel-fuel-tanks");
- PropertyManager->Untie("propulsion/num-sel-ox-tanks");
PropertyManager->Untie("propulsion/magneto_cmd");
PropertyManager->Untie("propulsion/starter_cmd");
+ PropertyManager->Untie("propulsion/cutoff_cmd");
PropertyManager->Untie("propulsion/active_engine");
PropertyManager->Untie("forces/fbx-prop-lbs");
PropertyManager->Untie("forces/fby-prop-lbs");
PropertyManager->Untie("moments/l-prop-lbsft");
PropertyManager->Untie("moments/m-prop-lbsft");
PropertyManager->Untie("moments/n-prop-lbsft");
- //PropertyManager->Untie("propulsion/tanks-weight-lbs");
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Propulsion management class.
- FGPropulsion manages all aspects of propulsive force generation, including
- containment of engines, tanks, and thruster class instances in STL vectors,
- and the interaction and communication between them.
+ The Propulsion class is the container for the entire propulsion system, which is
+ comprised of engines, tanks, and "thrusters" (the device that transforms the
+ engine power into a force that acts on the aircraft, such as a nozzle or
+ propeller). Once the Propulsion class gets the config file, it reads in
+ information which is specific to a type of engine. Then:
+
+ -# The appropriate engine type instance is created
+ -# A thruster object is instantiated, and is linked to the engine
+ -# At least one tank object is created, and is linked to an engine.
+
+ At Run time each engines Calculate() method is called to return the excess power
+ generated during that iteration. The drag from the previous iteration is sub-
+ tracted to give the excess power available for thrust this pass. That quantity
+ is passed to the thrusters associated with a particular engine - perhaps with a
+ scaling mechanism (gearing?) to allow the engine to give its associated thrust-
+ ers specific distributed portions of the excess power.
@author Jon S. Berndt
@version $Id$
- @see FGEngine
- @see FGTank
- @see FGThruster
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropulsion.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGPropulsion.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ @see
+ FGEngine
+ FGTank
+ FGThruster
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (index <= Engines.size()-1) return Engines[index];
else return 0L; }
- // Retrieves the number of tanks defined for the aircraft.
+ /// Retrieves the number of tanks defined for the aircraft.
inline unsigned int GetNumTanks(void) const {return Tanks.size();}
/** Retrieves a tank object pointer from the list of tanks.
double GetTanksIzz(const FGColumnVector3& vXYZcg);
double GetTanksIxz(const FGColumnVector3& vXYZcg);
double GetTanksIxy(const FGColumnVector3& vXYZcg);
-
+
+ inline int GetActiveEngine(void) const
+ {
+ return ActiveEngine;
+ }
+
+ inline int GetActiveEngine(void);
+
void SetMagnetos(int setting);
void SetStarter(int setting);
+ void SetCutoff(int setting=0);
void SetActiveEngine(int engine);
void bind();
EngineNumber = 0;
Type = etRocket;
+ Flameout = false;
PC = 0.0;
kFactor = (2.0*SHR*SHR/(SHR-1.0))*pow(2.0/(SHR+1), (SHR+1)/(SHR-1));
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGRocket::~FGRocket()
+FGRocket::~FGRocket(void)
{
Debug(1);
}
{
double Cf=0;
- ConsumeFuel();
+ if (!Flameout && !Starved) ConsumeFuel();
Throttle = FCS->GetThrottlePos(EngineNumber);
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
<li>Variance (in percent, from 0 to 1.0, nominally 0.05)</li>
</ul>
Additionally, the following control inputs, operating characteristics, and
- location are required, as with all other engine types:</font>
+ location are required, as with all other engine types:
<ul>
- <li>Throttle setting (in percent, from 0 to 1.0)</font></li>
+ <li>Throttle setting (in percent, from 0 to 1.0)</li>
<li>Maximum allowable throttle setting</li>
<li>Minimum working throttle setting</li>
<li>Sea level fuel flow at maximum thrust</li>
determined.
@author Jon S. Berndt
- @version $Id$
- @see FGNozzle
- @see FGThruster
- @see FGForce
- @see FGEngine
- @see FGPropulsion
- @see FGTank
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGRocket.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGRocket.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ $Id$
+ @see FGNozzle,
+ FGThruster,
+ FGForce,
+ FGEngine,
+ FGPropulsion,
+ FGTank
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGRocket(FGFDMExec* exec, FGConfigFile* Eng_cfg);
/** Destructor */
- ~FGRocket();
+ ~FGRocket(void);
/** Determines the thrust coefficient.
This routine takes the nozzle exit pressure and calculates the thrust
@return chamber pressure in psf. */
double GetChamberPressure(void) {return PC;}
+ /** Gets the flame-out status.
+ The engine will "flame out" if the throttle is set below the minimum
+ sustainable setting.
+ @return true if engine has flamed out. */
+ bool GetFlameout(void) {return Flameout;}
+
private:
double SHR;
double maxPC;
double kFactor;
double Variance;
double PC;
+ bool Flameout;
+
void Debug(int from);
};
}
vPQRdot_prev[0].InitMatrix();
vPQRdot_prev[1].InitMatrix();
vPQRdot_prev[2].InitMatrix();
+ vPQRdot_prev[3].InitMatrix();
bind();
--------------------------------------------------------------------------------
12/02/98 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-[1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
- Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
- School, January 1994
-[2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
- JSC 12960, July 1977
-[3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
- NASA-Ames", NASA CR-2497, January 1975
-[4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
- Wiley & Sons, 1979 ISBN 0-471-03032-5
-[5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
- 1982 ISBN 0-471-08936-2
-
- The order of rotations used in this class corresponds to a 3-2-1 sequence,
- or Y-P-R, or Z-Y-X, if you prefer.
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGColumnVector3.h"
#include "FGColumnVector4.h"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#define ID_ROTATION "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models the rotational portion of the Equations of Motion.
+ Note: The order of rotations used in this class corresponds to a 3-2-1 sequence,
+ or Y-P-R, or Z-Y-X, if you prefer.
+ @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
+ Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
+ School, January 1994
+ @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
+ JSC 12960, July 1977
+ @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
+ NASA-Ames", NASA CR-2497, January 1975
+ @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
+ Wiley & Sons, 1979 ISBN 0-471-03032-5
+ @see Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
+ 1982 ISBN 0-471-08936-2
+*/
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGColumnVector3 vPQR;
FGColumnVector3 vAeroPQR;
FGColumnVector3 vPQRdot;
- FGColumnVector3 vPQRdot_prev[3];
+ FGColumnVector3 vPQRdot_prev[4];
FGColumnVector3 vMoments;
FGColumnVector3 vEuler;
FGColumnVector3 vEulerRates;
--------------------------------------------------------------------------------
08/24/00 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGThruster.h"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#define ID_ROTOR "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models a rotor (such as for a helicopter); NOT YET IMPLEMENTED.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
# include STL_IOSTREAM
# include STL_ITERATOR
#else
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <iostream.h>
# else
# include <iostream>
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Encapsulates the JSBSim scripting capability.
- @author Jon S. Berndt
- @version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGScript.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGScript.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
-
<h4>Scripting support provided via FGScript.</h4>
<p>There is simple scripting support provided in the FGScript
- class. Commands are specified using the <u>Simple Scripting
- Directives for JSBSim</u> (SSDJ). The script file is in XML
+ class. Commands are specified using the <em>Simple Scripting
+ Directives for JSBSim</em> (SSDJ). The script file is in XML
format. A test condition (or conditions) can be set up in the
script and when the condition evaluates to true, the specified
action[s] is/are taken. A test condition can be <em>persistent</em>,
to be used are specified in the "use" lines. Next,
comes the "run" section, where the conditions are
described in "when" clauses.</p>
+ @author Jon S. Berndt
+ @version "$Id$"
*/
FGSimTurbine::FGSimTurbine(FGFDMExec* exec, FGConfigFile* cfg) : FGEngine(exec)
{
SetDefaults();
- FGEngine::Type=etSimTurbine;
+
Load(cfg);
Debug(0);
}
phase = tpRun;
N2 = IdleN2;
N1 = IdleN1;
- OilTemp_degK = TAT + 10;
+ OilTemp_degK = 366.0;
Cutoff = false;
}
else {
double FGSimTurbine::Off(void)
{
- double qbar = Translation->Getqbar();
- Running = false;
- FuelFlow_pph = Seek(&FuelFlow_pph, 0, 1000.0, 10000.0);
- N1 = Seek(&N1, qbar/10.0, N1/2.0, N1/2.0);
- N2 = Seek(&N2, qbar/15.0, N2/2.0, N2/2.0);
- EGT_degC = Seek(&EGT_degC, TAT, 11.7, 7.3);
- OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0.2, 0.2);
- OilPressure_psi = N2 * 0.62;
- NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
- EPR = Seek(&EPR, 1.0, 0.2, 0.2);
- return 0.0;
+ double qbar = Translation->Getqbar();
+ Running = false;
+ FuelFlow_pph = Seek(&FuelFlow_pph, 0, 1000.0, 10000.0);
+ N1 = Seek(&N1, qbar/10.0, N1/2.0, N1/2.0);
+ N2 = Seek(&N2, qbar/15.0, N2/2.0, N2/2.0);
+ EGT_degC = Seek(&EGT_degC, TAT, 11.7, 7.3);
+ OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0.2, 0.2);
+ OilPressure_psi = N2 * 0.62;
+ NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
+ EPR = Seek(&EPR, 1.0, 0.2, 0.2);
+ return 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGSimTurbine::Run(void)
{
- double idlethrust, milthrust, thrust;
- double N2norm; // 0.0 = idle N2, 1.0 = maximum N2
- idlethrust = MilThrust * ThrustTables[0]->TotalValue();
- milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
+ double idlethrust, milthrust, thrust;
+ double N2norm; // 0.0 = idle N2, 1.0 = maximum N2
+ idlethrust = MilThrust * ThrustTables[0]->TotalValue();
+ milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
+
+ Running = true;
+ Starter = false;
- Running = true;
- Starter = false;
-
- N2 = Seek(&N2, IdleN2 + ThrottleCmd * N2_factor, delay, delay * 3.0);
- N1 = Seek(&N1, IdleN1 + ThrottleCmd * N1_factor, delay, delay * 2.4);
- N2norm = (N2 - IdleN2) / N2_factor;
- thrust = idlethrust + (milthrust * N2norm * N2norm);
- thrust = thrust * (1.0 - BleedDemand);
- EGT_degC = TAT + 363.1 + ThrottleCmd * 357.1;
- OilPressure_psi = N2 * 0.62;
- OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
- EPR = 1.0 + thrust/MilThrust;
- if (!Augmentation) {
- FuelFlow_pph = Seek(&FuelFlow_pph, thrust * TSFC, 1000.0, 100000);
- if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
- NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
- }
- if (Reversed) thrust = thrust * -0.2;
+ N2 = Seek(&N2, IdleN2 + ThrottleCmd * N2_factor, delay, delay * 3.0);
+ N1 = Seek(&N1, IdleN1 + ThrottleCmd * N1_factor, delay, delay * 2.4);
+ N2norm = (N2 - IdleN2) / N2_factor;
+ thrust = idlethrust + (milthrust * N2norm * N2norm);
+ thrust = thrust * (1.0 - BleedDemand);
+ EGT_degC = TAT + 363.1 + ThrottleCmd * 357.1;
+ OilPressure_psi = N2 * 0.62;
+ OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
+ EPR = 1.0 + thrust/MilThrust;
+
+ if (!Augmentation) {
+ FuelFlow_pph = Seek(&FuelFlow_pph, thrust * TSFC, 1000.0, 100000);
+ if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
+ NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
+ }
- if (AugMethod == 1) {
- if ((ThrottleCmd > 0.99) && (N2 > 97.0)) {Augmentation = true;}
- else {Augmentation = false;}
- }
+ if (AugMethod == 1) {
+ if ((ThrottleCmd > 0.99) && (N2 > 97.0)) {Augmentation = true;}
+ else {Augmentation = false;}
+ }
- if ((Augmented == 1) && Augmentation) {
- thrust = MaxThrust * ThrustTables[2]->TotalValue();
- FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
- NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
- }
+ if ((Augmented == 1) && Augmentation) {
+ thrust = MaxThrust * ThrustTables[2]->TotalValue();
+ FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
+ NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
+ }
+
+ if ((Injected == 1) && Injection)
+ thrust = thrust * ThrustTables[3]->TotalValue();
- if ((Injected == 1) && Injection)
- thrust = thrust * ThrustTables[3]->TotalValue();
+ ConsumeFuel();
+ if (Cutoff) phase = tpOff;
+ if (Starved) phase = tpOff;
- ConsumeFuel();
- if (Cutoff) phase = tpOff;
- if (Starved) phase = tpOff;
- return thrust;
+ return thrust;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGSimTurbine::SpinUp(void)
{
- Running = false;
- FuelFlow_pph = 0.0;
- N2 = Seek(&N2, 25.18, 3.0, N2/2.0);
- N1 = Seek(&N1, 5.21, 1.0, N1/2.0);
- EGT_degC = Seek(&EGT_degC, TAT, 11.7, 7.3);
- OilPressure_psi = N2 * 0.62;
- OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0.2, 0.2);
- EPR = 1.0;
- NozzlePosition = 1.0;
- return 0.0;
+ Running = false;
+ FuelFlow_pph = 0.0;
+ N2 = Seek(&N2, 25.18, 3.0, N2/2.0);
+ N1 = Seek(&N1, 5.21, 1.0, N1/2.0);
+ EGT_degC = Seek(&EGT_degC, TAT, 11.7, 7.3);
+ OilPressure_psi = N2 * 0.62;
+ OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0.2, 0.2);
+ EPR = 1.0;
+ NozzlePosition = 1.0;
+
+ return 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGSimTurbine::Start(void)
{
- if ((N2 > 15.0) && !Starved) { // minimum 15% N2 needed for start
- Cranking = true; // provided for sound effects signal
- if (N2 < IdleN2) {
- N2 = Seek(&N2, IdleN2, 2.0, N2/2.0);
- N1 = Seek(&N1, IdleN1, 1.4, N1/2.0);
- EGT_degC = Seek(&EGT_degC, TAT + 363.1, 21.3, 7.3);
- FuelFlow_pph = Seek(&FuelFlow_pph, IdleFF, 103.7, 103.7);
- OilPressure_psi = N2 * 0.62;
- }
- else {
- phase = tpRun;
- Running = true;
- Starter = false;
- Cranking = false;
- }
+ if ((N2 > 15.0) && !Starved) { // minimum 15% N2 needed for start
+ Cranking = true; // provided for sound effects signal
+ if (N2 < IdleN2) {
+ N2 = Seek(&N2, IdleN2, 2.0, N2/2.0);
+ N1 = Seek(&N1, IdleN1, 1.4, N1/2.0);
+ EGT_degC = Seek(&EGT_degC, TAT + 363.1, 21.3, 7.3);
+ FuelFlow_pph = Seek(&FuelFlow_pph, IdleFF, 103.7, 103.7);
+ OilPressure_psi = N2 * 0.62;
}
- else { // no start if N2 < 15%
- phase = tpOff;
+ else {
+ phase = tpRun;
+ Running = true;
Starter = false;
- }
- return 0.0;
+ Cranking = false;
+ }
+ }
+ else { // no start if N2 < 15%
+ phase = tpOff;
+ Starter = false;
+ }
+
+ return 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double FGSimTurbine::Stall(void)
{
- double qbar = Translation->Getqbar();
- EGT_degC = TAT + 903.14;
- FuelFlow_pph = IdleFF;
- N1 = Seek(&N1, qbar/10.0, 0, N1/10.0);
- N2 = Seek(&N2, qbar/15.0, 0, N2/10.0);
- if (ThrottleCmd == 0) phase = tpRun; // clear the stall with throttle
- return 0.0;
+ double qbar = Translation->Getqbar();
+ EGT_degC = TAT + 903.14;
+ FuelFlow_pph = IdleFF;
+ N1 = Seek(&N1, qbar/10.0, 0, N1/10.0);
+ N2 = Seek(&N2, qbar/15.0, 0, N2/10.0);
+ if (ThrottleCmd == 0) phase = tpRun; // clear the stall with throttle
+
+ return 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void FGSimTurbine::SetDefaults(void)
{
- Name = "None_Defined";
+ Name = "Not defined";
+ Type = etSimTurbine;
MilThrust = 10000.0;
MaxThrust = 10000.0;
BypassRatio = 0.0;
Augmentation = false;
Injection = false;
Reversed = false;
+ Cutoff = true;
phase = tpOff;
Stalled = false;
Seized = false;
Overtemp = false;
Fire = false;
+ EGT_degC = 0.0;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bool FGSimTurbine::Load(FGConfigFile *Eng_cfg)
{
- int i;
string token;
+
Name = Eng_cfg->GetValue("NAME");
- cout << Name << endl;
Eng_cfg->GetNextConfigLine();
- *Eng_cfg >> token >> MilThrust;
- *Eng_cfg >> token >> MaxThrust;
- *Eng_cfg >> token >> BypassRatio;
- *Eng_cfg >> token >> TSFC;
- *Eng_cfg >> token >> ATSFC;
- *Eng_cfg >> token >> IdleN1;
- *Eng_cfg >> token >> IdleN2;
- *Eng_cfg >> token >> MaxN1;
- *Eng_cfg >> token >> MaxN2;
- *Eng_cfg >> token >> Augmented;
- *Eng_cfg >> token >> AugMethod;
- *Eng_cfg >> token >> Injected;
- i=0;
- while( Eng_cfg->GetValue() != string("/FG_SIMTURBINE") && i < 10){
- ThrustTables.push_back( new FGCoefficient(FDMExec) );
- ThrustTables.back()->Load(Eng_cfg);
- i++;
+ int counter=0;
+
+ while (Eng_cfg->GetValue() != string("/FG_SIMTURBINE")) {
+ *Eng_cfg >> token;
+
+ if (token[0] == '<') token.erase(0,1); // Tables are read "<TABLE"
+
+ if (token == "MILTHRUST") *Eng_cfg >> MilThrust;
+ else if (token == "MAXTHRUST") *Eng_cfg >> MaxThrust;
+ else if (token == "BYPASSRATIO") *Eng_cfg >> BypassRatio;
+ else if (token == "TSFC") *Eng_cfg >> TSFC;
+ else if (token == "ATSFC") *Eng_cfg >> ATSFC;
+ else if (token == "IDLEN1") *Eng_cfg >> IdleN1;
+ else if (token == "IDLEN2") *Eng_cfg >> IdleN2;
+ else if (token == "MAXN1") *Eng_cfg >> MaxN1;
+ else if (token == "MAXN2") *Eng_cfg >> MaxN2;
+ else if (token == "AUGMENTED") *Eng_cfg >> Augmented;
+ else if (token == "AUGMETHOD") *Eng_cfg >> AugMethod;
+ else if (token == "INJECTED") *Eng_cfg >> Injected;
+ else if (token == "MINTHROTTLE") *Eng_cfg >> MinThrottle;
+ else if (token == "TABLE") {
+ if (counter++ == 0) Debug(2); // print engine specs prior to table read
+ ThrustTables.push_back( new FGCoefficient(FDMExec) );
+ ThrustTables.back()->Load(Eng_cfg);
+ }
+ else cerr << "Unhandled token in Engine config file: " << token << endl;
}
-
- // pre-calculations and initializations
- delay= 60.0 / (BypassRatio + 3.0);
+
+ // Pre-calculations and initializations
+
+ delay = 60.0 / (BypassRatio + 3.0);
N1_factor = MaxN1 - IdleN1;
N2_factor = MaxN2 - IdleN2;
OilTemp_degK = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556 + 273.0;
IdleFF = pow(MilThrust, 0.2) * 107.0; // just an estimate
+
return true;
}
if (from == 0) { // Constructor
}
+ if (from == 2) { // called from Load()
+ cout << "\n Engine Name: " << Name << endl;
+ cout << " MilThrust: " << MilThrust << endl;
+ cout << " MaxThrust: " << MaxThrust << endl;
+ cout << " BypassRatio: " << BypassRatio << endl;
+ cout << " TSFC: " << TSFC << endl;
+ cout << " ATSFC: " << ATSFC << endl;
+ cout << " IdleN1: " << IdleN1 << endl;
+ cout << " IdleN2: " << IdleN2 << endl;
+ cout << " MaxN1: " << MaxN1 << endl;
+ cout << " MaxN2: " << MaxN2 << endl;
+ cout << " Augmented: " << Augmented << endl;
+ cout << " AugMethod: " << AugMethod << endl;
+ cout << " Injected: " << Injected << endl;
+ cout << " MinThrottle: " << MinThrottle << endl;
+
+ cout << endl;
+ }
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
if (from == 0) cout << "Instantiated: FGSimTurbine" << endl;
09/22/2003 DPC Added starting, stopping, new framework
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
case the engine will go to the Run phase. Once an engine is in the Off phase
the full starting procedure (or airstart) must be used to get it running.
<P>
- -STARTING (on ground):
- -# Set the control FGEngine::Starter to true. The engine will spin up to
- a maximum of about %25 N2 (%5.2 N1). This simulates the action of a
- pneumatic starter.
- -# After reaching %15 N2 set the control FGEngine::Cutoff to false. If fuel
- is available the engine will now accelerate to idle. The starter will
- automatically be set to false after the start cycle.
+ - STARTING (on ground):
+ -# Set the control FGEngine::Starter to true. The engine will spin up to
+ a maximum of about %25 N2 (%5.2 N1). This simulates the action of a
+ pneumatic starter.
+ -# After reaching %15 N2 set the control FGEngine::Cutoff to false. If fuel
+ is available the engine will now accelerate to idle. The starter will
+ automatically be set to false after the start cycle.
<P>
- -STARTING (in air):
- -# Increase speed to obtain a minimum of %15 N2. If this is not possible,
- the starter may be used to assist.
- -# Place the control FGEngine::Cutoff to false.
+ - STARTING (in air):
+ -# Increase speed to obtain a minimum of %15 N2. If this is not possible,
+ the starter may be used to assist.
+ -# Place the control FGEngine::Cutoff to false.
<P>
Ignition is assumed to be on anytime the Cutoff control is set to false,
therefore a seperate ignition system is not modeled.
+Configuration File Format
+<pre>
+\<FG_SIMTURBINE NAME="<name>">
+ MILTHRUST \<thrust>
+ MAXTHRUST \<thrust>
+ BYPASSRATIO \<bypass ratio>
+ TSFC \<thrust specific fuel consumption>
+ ATSFC \<afterburning thrust specific fuel consumption>
+ IDLEN1 \<idle N1>
+ IDLEN2 \<idle N2>
+ MAXN1 \<max N1>
+ MAXN2 \<max N2>
+ AUGMENTED \<0|1>
+ AUGMETHOD \<0|1>
+ INJECTED \<0|1>
+ ...
+\</FG_SIMTURBINE>
+</pre>
+Definition of the turbine engine configuration file parameters:
+<pre>
+<b>MILTHRUST</b> - Maximum thrust, static, at sea level, lbf.
+<b>MAXTHRUST</b> - Afterburning thrust, static, at sea level, lbf
+[this value will be ignored when AUGMENTED is zero (false)].
+<b>BYPASSRATIO</b> - Ratio of bypass air flow to core air flow.
+<b>TSFC</b> - Thrust-specific fuel consumption, lbm/hr/lbf
+[i.e. fuel flow divided by thrust].
+<b>ATSFC</b> - Afterburning TSFC, lbm/hr/lbf
+[this value will be ignored when AUGMENTED is zero (false)]
+<b>IDLEN1</b> - Fan rotor rpm (% of max) at idle
+<b>IDLEN2</b> - Core rotor rpm (% of max) at idle
+<b>MAXN1</b> - Fan rotor rpm (% of max) at full throttle [not always 100!]
+<b>MAXN2</b> - Core rotor rpm (% of max) at full throttle [not always 100!]
+<b>AUGMENTED</b>
+ 0 == afterburner not installed
+ 1 == afterburner installed
+<b>AUGMETHOD</b>
+ 0 == afterburner activated by property /engines/engine[n]/augmentation
+ 1 == afterburner activated by pushing throttle above 99% position
+ [this item will be ignored when AUGMENTED == 0]
+<b>INJECTED</b>
+ 0 == Water injection not installed
+ 1 == Water injection installed
+</pre>
@author David P. Culp
- @version $Id$
+ @version "$Id$"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
public:
/** Constructor
- @param exec pointer to executive structure
- @param Eng_Cfg pointer to engine config file instance */
- FGSimTurbine(FGFDMExec* exec, FGConfigFile* Eng_cfg);
+ @param Executive pointer to executive structure
+ @param Eng_cfg pointer to engine config file instance */
+ FGSimTurbine(FGFDMExec* Executive, FGConfigFile* Eng_cfg);
/// Destructor
~FGSimTurbine();
enum phaseType { tpOff, tpRun, tpSpinUp, tpStart, tpStall, tpSeize, tpTrim };
- double Calculate(double);
+ double Calculate(double PowerRequired);
double CalcFuelNeed(void);
double GetPowerAvailable(void);
double Seek(double* var, double target, double accel, double decel);
- virtual phaseType GetPhase(void) { return phase; }
- virtual void SetPhase( phaseType p ) { phase = p; }
+ phaseType GetPhase(void) { return phase; }
+
+ bool GetOvertemp(void) {return Overtemp; }
+ bool GetInjection(void) {return Injection;}
+ bool GetFire(void) { return Fire; }
+ bool GetAugmentation(void) {return Augmentation;}
+ bool GetReversed(void) { return Reversed; }
+ bool GetCutoff(void) { return Cutoff; }
+ int GetIgnition(void) {return Ignition;}
+
+ double GetInlet(void) { return InletPosition; }
+ double GetNozzle(void) { return NozzlePosition; }
+ double GetBleedDemand(void) {return BleedDemand;}
+ double GetN1(void) {return N1;}
+ double GetN2(void) {return N2;}
+ double GetEPR(void) {return EPR;}
+ double GetEGT(void) {return EGT_degC;}
+
+ double getOilPressure_psi () const {return OilPressure_psi;}
+ double getOilTemp_degF (void) {return KelvinToFahrenheit(OilTemp_degK);}
+
+ void SetInjection(bool injection) {Injection = injection;}
+ void SetIgnition(int ignition) {Ignition = ignition;}
+ void SetAugmentation(bool augmentation) {Augmentation = augmentation;}
+ void SetPhase( phaseType p ) { phase = p; }
+ void SetEPR(double epr) {EPR = epr;}
+ void SetBleedDemand(double bleedDemand) {BleedDemand = bleedDemand;}
+ void SetReverse(bool reversed) { Reversed = reversed; }
+ void SetCutoff(bool cutoff) { Cutoff = cutoff; }
- virtual bool GetOvertemp(void) { return Overtemp; }
- virtual bool GetFire(void) { return Fire; }
-
private:
typedef vector<FGCoefficient*> CoeffArray;
double ATSFC; ///< Augmented TSFC (lbm/hr/lbf)
double IdleN1; ///< Idle N1
double IdleN2; ///< Idle N2
+ double N1; ///< N1
+ double N2; ///< N2
double MaxN1; ///< N1 at 100% throttle
double MaxN2; ///< N2 at 100% throttle
double IdleFF; ///< Idle Fuel Flow (lbm/hr)
bool Seized; ///< true if inner spool is seized
bool Overtemp; ///< true if EGT exceeds limits
bool Fire; ///< true if engine fire detected
- int Augmented; ///< = 1 if augmentation installed
+ bool Injection;
+ bool Augmentation;
+ bool Reversed;
+ bool Cutoff;
int Injected; ///< = 1 if water injection installed
+ int Ignition;
+ int Augmented; ///< = 1 if augmentation installed
int AugMethod; ///< = 0 if using property /engine[n]/augmentation
///< = 1 if using last 1% of throttle movement
+ double EGT_degC;
+ double EPR;
+ double OilPressure_psi;
+ double OilTemp_degK;
+ double BleedDemand;
+ double InletPosition;
+ double NozzlePosition;
double Off(void);
double Run(void);
Propulsion = FDMExec->GetPropulsion();
PropertyManager = FDMExec->GetPropertyManager();
- for(int i=0;i<3;i++) vQdot_prev[i].InitMatrix();
+ for(int i=0;i<4;i++) vQdot_prev[i].InitMatrix();
bind();
#include "FGGroundReactions.h"
#include "FGPropulsion.h"
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Encapsulates the calculation of aircraft state.
@author Jon S. Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGState.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGState.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// ======================================= General Purpose INTEGRATOR
- enum iType {AB4, AB3, AB2, AM3, EULER, TRAPZ};
+ enum iType {AB4, AB3, AB2, AM3, AM4, EULER, TRAPZ};
/** Multi-method integrator.
@param type Type of intergation scheme to use. Can be one of:
<li>AB3 - Adams-Bashforth, third order</li>
<li>AB2 - Adams-Bashforth, second order</li>
<li>AM3 - Adams Moulton, third order</li>
+ <li>AM4 - Adams Moulton, fourth order</li>
<li>EULER - Euler</li>
<li>TRAPZ - Trapezoidal</li>
</ul>
switch (type) {
case AB4:
- vResult = (delta_t/24.0)*( 55.0 * vTDeriv
- - 59.0 * vLastArray[0]
- + 37.0 * vLastArray[1]
- - 9.0 * vLastArray[2] );
+ vResult = (delta_t/24.0)*( 55.0 * vLastArray[0]
+ - 59.0 * vLastArray[1]
+ + 37.0 * vLastArray[2]
+ - 9.0 * vLastArray[3] );
+ vLastArray[3] = vLastArray[2];
vLastArray[2] = vLastArray[1];
vLastArray[1] = vLastArray[0];
vLastArray[0] = vTDeriv;
break;
case AB3:
- vResult = (delta_t/12.0)*( 23.0 * vTDeriv
- - 16.0 * vLastArray[0]
- + 5.0 * vLastArray[1] );
+ vResult = (delta_t/12.0)*( 23.0 * vLastArray[0]
+ - 16.0 * vLastArray[1]
+ + 5.0 * vLastArray[2] );
+ vLastArray[2] = vLastArray[1];
vLastArray[1] = vLastArray[0];
vLastArray[0] = vTDeriv;
break;
case AB2:
- vResult = (delta_t/2.0)*( 3.0 * vTDeriv - vLastArray[0] );
+ vResult = (delta_t/2.0)*( 3.0 * vLastArray[0] - vLastArray[1] );
+ vLastArray[1] = vLastArray[0];
+ vLastArray[0] = vTDeriv;
+ break;
+ case AM4:
+ vResult = (delta_t/24.0)*( 9.0 * vTDeriv
+ + 19.0 * vLastArray[0]
+ - 5.0 * vLastArray[1]
+ + 1.0 * vLastArray[2] );
+ vLastArray[2] = vLastArray[1];
+ vLastArray[1] = vLastArray[0];
vLastArray[0] = vTDeriv;
break;
case AM3:
FGMatrix33 mTs2b;
FGMatrix33 mTb2s;
FGColumnVector4 vQtrn;
- FGColumnVector4 vQdot_prev[3];
+ FGColumnVector4 vQdot_prev[4];
FGColumnVector4 vQdot;
FGColumnVector3 vUVW;
FGColumnVector3 vLocalVelNED;
#include "FGTable.h"
-#if defined ( sgi ) && !defined( __GNUC__ )
+#if defined ( sgi ) && !defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
#include <iomanip.h>
#else
#include <iomanip>
if (Type == tt1D) startRow = 1;
else startRow = 0;
-#if defined (sgi) && !defined(__GNUC__)
+#if defined (sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
unsigned long flags = cout.setf(ios::fixed);
#else
ios::fmtflags flags = cout.setf(ios::fixed); // set up output stream
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@version $Id$
@see FGCoefficient
@see FGPropeller
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTable.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTable.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#include "FGTank.h"
-#if !defined ( sgi ) || defined( __GNUC__ )
+#if !defined ( sgi ) || defined( __GNUC__ ) && (_COMPILER_VERSION < 740)
using std::cerr;
using std::endl;
using std::cout;
#else
# include <string>
using std::string;
-# if !defined(sgi) || defined(__GNUC__)
+# if !defined(sgi) || defined(__GNUC__) || (_COMPILER_VERSION >= 740)
using std::cerr;
using std::endl;
using std::cout;
#endif
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_TANK "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models a fuel tank.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
FGThruster::FGThruster(FGFDMExec *FDMExec) : FGForce(FDMExec),
ThrusterNumber(0)
{
+ Type = ttDirect;
SetTransformType(FGForce::tCustom);
Debug(0);
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGThruster::FGThruster(FGFDMExec *FDMExec,
- FGConfigFile *Eng_cfg ): FGForce(FDMExec) {
- ThrusterNumber=0;
- SetTransformType(FGForce::tCustom);
- Name=Eng_cfg->GetValue();
- Debug(0);
+FGThruster::FGThruster(FGFDMExec *FDMExec,
+ FGConfigFile *Eng_cfg ): FGForce(FDMExec)
+{
+ ThrusterNumber = 0;
+ Type = ttDirect;
+ SetTransformType(FGForce::tCustom);
+ Name = Eng_cfg->GetValue();
+ GearRatio = 1.0;
+ Debug(0);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--------------------------------------------------------------------------------
08/24/00 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGForce.h"
#include "FGConfigFile.h"
-#define ID_THRUSTER "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-namespace JSBSim {
+#define ID_THRUSTER "$Id$"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/// Destructor
virtual ~FGThruster();
- enum eType {ttNozzle, ttRotor, ttPropeller};
+ enum eType {ttNozzle, ttRotor, ttPropeller, ttDirect};
- virtual double Calculate(double Thrust) { vFn(1)=Thrust; return 0.0; }
+ virtual double Calculate(double tt) { Thrust = tt; vFn(1) = Thrust; return 0.0; }
void SetName(string name) {Name = name;}
void SetThrusterNumber(int nn) {ThrusterNumber = nn;}
virtual void SetRPM(double rpm) {};
string GetName(void) {return Name;}
int GetThrusterNumber(void) {return ThrusterNumber;}
virtual double GetRPM(void) { return 0.0; };
+ double GetGearRatio(void) {return GearRatio; }
protected:
eType Type;
double Thrust;
double PowerRequired;
double deltaT;
+ double GearRatio;
virtual void Debug(int from);
};
}
vUVWdot_prev[0].InitMatrix();
vUVWdot_prev[1].InitMatrix();
vUVWdot_prev[2].InitMatrix();
+ vUVWdot_prev[3].InitMatrix();
bind();
Debug(0);
qbarUW = 0.5*Atmosphere->GetDensity()*(vAeroUVW(eU)*vAeroUVW(eU) + vAeroUVW(eW)*vAeroUVW(eW));
qbarUV = 0.5*Atmosphere->GetDensity()*(vAeroUVW(eU)*vAeroUVW(eU) + vAeroUVW(eV)*vAeroUVW(eV));
Mach = Vt / State->Geta();
+ vMachUVW(eU) = vAeroUVW(eU) / State->Geta();
+ vMachUVW(eV) = vAeroUVW(eV) / State->Geta();
+ vMachUVW(eW) = vAeroUVW(eW) / State->Geta();
if (debug_lvl > 1) Debug(1);
--------------------------------------------------------------------------------
12/02/98 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-[1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
- Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
- School, January 1994
-[2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
- JSC 12960, July 1977
-[3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
- NASA-Ames", NASA CR-2497, January 1975
-[4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
- Wiley & Sons, 1979 ISBN 0-471-03032-5
-[5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
- 1982 ISBN 0-471-08936-2
-
- The order of rotations used in this class corresponds to a 3-2-1 sequence,
- or Y-P-R, or Z-Y-X, if you prefer.
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGColumnVector3.h"
#include "FGColumnVector4.h"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#define ID_TRANSLATION "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models the translation aspects of the EOM.
+ Note: The order of rotations used in this class corresponds to a 3-2-1 sequence,
+ or Y-P-R, or Z-Y-X, if you prefer.
+ @see Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
+ Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420 Naval Postgraduate
+ School, January 1994
+ @see D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
+ JSC 12960, July 1977
+ @see Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
+ NASA-Ames", NASA CR-2497, January 1975
+ @see Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
+ Wiley & Sons, 1979 ISBN 0-471-03032-5
+ @see Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
+ 1982 ISBN 0-471-08936-2
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
double GetqbarUV (void) const { return qbarUV; }
inline double GetVt (void) const { return Vt; }
double GetMach (void) const { return Mach; }
+ double GetMachU(void) const { return vMachUVW(eU); }
double Getadot (void) const { return adot; }
double Getbdot (void) const { return bdot; }
private:
FGColumnVector3 vUVW;
FGColumnVector3 vUVWdot;
- FGColumnVector3 vUVWdot_prev[3];
+ FGColumnVector3 vUVWdot_prev[4];
FGMatrix33 mVel;
FGColumnVector3 vAeroUVW;
+ FGColumnVector3 vMachUVW;
double Vt, Mach;
double qbar, qbarUW, qbarUV;
#define snprintf _snprintf
#endif
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
typedef enum { tLongitudinal, tFull, tGround, tPullup,
tCustom, tNone, tTurn
} TrimMode;
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FORWARD DECLARATIONS
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
last three are used for on-ground trimming. The state-control pairs used in
a given trim are completely user configurable and several pre-defined modes
are provided as well. They are:
- <ul>
- <li> tLongitudinal: Trim wdot with alpha, udot with thrust, qdot with elevator</li>
- <li> tFull: tLongitudinal + vdot with phi, pdot with aileron, rdot with rudder
- and heading minus ground track (hmgt) with beta</li>
- <li> tPullup: tLongitudinal but adjust alpha to achieve load factor input
- with SetTargetNlf()
-
- <li> tGround: wdot with altitude, qdot with theta, and pdot with phi</li>
+ - tLongitudinal: Trim wdot with alpha, udot with thrust, qdot with elevator
+ - tFull: tLongitudinal + vdot with phi, pdot with aileron, rdot with rudder
+ and heading minus ground track (hmgt) with beta
+ - tPullup: tLongitudinal but adjust alpha to achieve load factor input
+ with SetTargetNlf()
+ - tGround: wdot with altitude, qdot with theta, and pdot with phi
The remaining modes include <b>tCustom</b>, which is completely user defined and
<b>tNone</b>.
- </ul>
-
+
Note that trims can (and do) fail for reasons that are completely outside
the control of the trimming routine itself. The most common problem is the
initial conditions: is the model capable of steady state flight
at those conditions? Check the speed, altitude, configuration (flaps,
gear, etc.), weight, cg, and anything else that may be relevant.
- Example usage:
+ Example usage:<pre>
FGFDMExec* FDMExec = new FGFDMExec();
- .
- .
- .
+
FGInitialCondition* fgic = new FGInitialCondition(FDMExec);
FGTrim *fgt(FDMExec,fgic,tFull);
fgic->SetVcaibratedKtsIC(100);
if( !fgt->DoTrim() ) {
cout << "Trim Failed" << endl;
}
- fgt->ReportState();
+ fgt->ReportState(); </pre>
@author Tony Peden
- @version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTrim.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGTrim.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
+ @version "$Id$"
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
public:
/** Initializes the trimming class
@param FDMExec pointer to a JSBSim executive object.
- @param FGIC pointer to a FGInitialCondition object
+ @param tm trim mode
*/
- FGTrim(FGFDMExec *FDMExec, TrimMode tt=tGround );
+ FGTrim(FGFDMExec *FDMExec, TrimMode tm=tGround );
- ~FGTrim(void);
+ ~FGTrim(void);
/** Execute the trim
*/
void TrimStats();
/** Clear all state-control pairs and set a predefined trim mode
- @param TrimMode the set of axes to trim. Can be:
+ @param tm the set of axes to trim. Can be:
tLongitudinal, tFull, tGround, tCustom, or tNone
*/
- void SetMode(TrimMode tt);
+ void SetMode(TrimMode tm);
/** Clear all state-control pairs from the current configuration.
The trimming routine must have at least one state-control pair
/** Change the control used to zero a state previously configured
@param state the accel or other condition to zero
- @param control the control used to zero the state
+ @param new_control the control used to zero the state
*/
bool EditState( State state, Control new_control );
/** automatically switch to trimming longitudinal acceleration with
flight path angle (gamma) once it becomes apparent that there
is not enough/too much thrust.
- @param gamma_fallback true to enable fallback
+ @param bb true to enable fallback
*/
inline void SetGammaFallback(bool bb) { gamma_fallback=bb; }
#include "FGJSBBase.h"
#include "FGInitialCondition.h"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+DEFINITIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
#define ID_TRIMAXIS "$Id$"
#define DEFAULT_TOLERANCE 0.001
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
const string StateNames[10]= { "all","udot","vdot","wdot","qdot","pdot","rdot",
class FGInitialCondition;
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models an aircraft axis for purposes of trimming.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
--------------------------------------------------------------------------------
08/23/2002 JSB Created
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_TURBINE "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#define ID_UTILITY "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
size = 0;
connected = false;
-#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
+ #if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
WSADATA wsaData;
int wsaReturnCode;
wsaReturnCode = WSAStartup(MAKEWORD(1,1), &wsaData);
#ifndef FGfdmSocket_H
#define FGfdmSocket_H
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
SG_USING_STD(endl);
#else
# include <string>
-# if defined(sgi) && !defined(__GNUC__)
+# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
# include <iostream.h>
# include <fstream.h>
# else
#define ID_FDMSOCKET "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates a socket object.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include <simgear/compiler.h>
+#include <stdio.h> // size_t
#ifdef SG_MATH_EXCEPTION_CLASH
# include <math.h>
#endif
#include <FDM/JSBSim/FGAerodynamics.h>
#include <FDM/JSBSim/FGLGear.h>
#include <FDM/JSBSim/FGPropertyManager.h>
+#include <FDM/JSBSim/FGEngine.h>
+#include <FDM/JSBSim/FGRotor.h>
#include "JSBSim.hxx"
static inline double
init_gear();
- // Set initial fuel levels if provided.
+ // Set initial fuel levels if provided.
for (unsigned int i = 0; i < Propulsion->GetNumTanks(); i++) {
SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
- if (node->getChild("level-gal_us", 0, false) != 0)
- Propulsion->GetTank(i)
- ->SetContents(node->getDoubleValue("level-gal_us") * 6.6);
+ if (node->getChild("level-gal_us", 0, false) != 0) {
+ Propulsion->GetTank(i)->SetContents(node->getDoubleValue("level-gal_us") * 6.6);
+ } else {
+ node->setDoubleValue("level-lb", Propulsion->GetTank(i)->GetContents());
+ node->setDoubleValue("level-gal_us", Propulsion->GetTank(i)->GetContents() / 6.6);
+ }
}
fgSetDouble("/fdm/trim/pitch-trim", FCS->GetPitchTrimCmd());
=fgGetNode("/surface-positions/speedbrake-pos-norm",true);
spoilers_pos_pct=fgGetNode("/surface-positions/spoilers-pos-norm",true);
-
elevator_pos_pct->setDoubleValue(0);
left_aileron_pos_pct->setDoubleValue(0);
right_aileron_pos_pct->setDoubleValue(0);
wind_from_north= fgGetNode("/environment/wind-from-north-fps",true);
wind_from_east = fgGetNode("/environment/wind-from-east-fps" ,true);
wind_from_down = fgGetNode("/environment/wind-from-down-fps" ,true);
-
+ for (unsigned int i = 0; i < Propulsion->GetNumEngines(); i++) {
+ SGPropertyNode * node = fgGetNode("engines/engine", i, true);
+ Propulsion->GetThruster(i)->SetRPM(node->getDoubleValue("rpm") /
+ Propulsion->GetThruster(i)->GetGearRatio());
+ }
}
+
/******************************************************************************/
-FGJSBsim::~FGJSBsim(void) {
- delete fdmex;
+FGJSBsim::~FGJSBsim(void)
+{
+ delete fdmex;
}
/******************************************************************************/
// Initialize the JSBsim flight model, dt is the time increment for
// each subsequent iteration through the EOM
-void FGJSBsim::init() {
-
+void FGJSBsim::init()
+{
double tmp;
SG_LOG( SG_FLIGHT, SG_INFO, "Starting and initializing JSBsim" );
<< ", " << fdmex->GetAtmosphere()->GetDensity() );
common_init();
- copy_to_JSBsim();
-
- fdmex->RunIC(); //loop JSBSim once w/o integrating
+ copy_to_JSBsim();
+ fdmex->RunIC(); //loop JSBSim once w/o integrating
copy_from_JSBsim(); //update the bus
SG_LOG( SG_FLIGHT, SG_INFO, " Initialized JSBSim with:" );
SG_LOG( SG_FLIGHT, SG_INFO, "FGControls::get_gear_down()= " <<
globals->get_controls()->get_gear_down() );
-
-
-
}
/******************************************************************************/
// Run an iteration of the EOM (equations of motion)
-void
-FGJSBsim::update( double dt ) {
-
+void FGJSBsim::update( double dt )
+{
if (is_suspended())
return;
}
for ( i=0; i < multiloop; i++ ) {
- fdmex->Run();
+ fdmex->Run();
}
FGJSBBase::Message* msg;
// Convert from the FGInterface struct to the JSBsim generic_ struct
-bool FGJSBsim::copy_to_JSBsim() {
+bool FGJSBsim::copy_to_JSBsim()
+{
double tmp;
unsigned int i;
FCS->SetDsbCmd( globals->get_controls()->get_speedbrake() );
FCS->SetDspCmd( globals->get_controls()->get_spoilers() );
- // Parking brake sets minimum braking
- // level for mains.
+ // Parking brake sets minimum braking
+ // level for mains.
double parking_brake = globals->get_controls()->get_brake_parking();
FCS->SetLBrake(FMAX(globals->get_controls()->get_brake_left(), parking_brake));
FCS->SetRBrake(FMAX(globals->get_controls()->get_brake_right(), parking_brake));
FCS->SetCBrake( 0.0 );
+ // FCS->SetCBrake( globals->get_controls()->get_brake(2) );
FCS->SetGearCmd( globals->get_controls()->get_gear_down());
for (i = 0; i < Propulsion->GetNumEngines(); i++) {
- FGEngine * eng = Propulsion->GetEngine(i);
SGPropertyNode * node = fgGetNode("engines/engine", i, true);
+
FCS->SetThrottleCmd(i, globals->get_controls()->get_throttle(i));
FCS->SetMixtureCmd(i, globals->get_controls()->get_mixture(i));
FCS->SetPropAdvanceCmd(i, globals->get_controls()->get_prop_advance(i));
- Propulsion->GetThruster(i)->SetRPM(node->getDoubleValue("rpm"));
- eng->SetMagnetos( globals->get_controls()->get_magnetos(i) );
+
+ switch (Propulsion->GetEngine(i)->GetType()) {
+ case FGEngine::etPiston:
+ { // FGPiston code block
+ FGPiston* eng = (FGPiston*)Propulsion->GetEngine(i);
+ eng->SetMagnetos( globals->get_controls()->get_magnetos(i) );
+ break;
+ } // end FGPiston code block
+ case FGEngine::etSimTurbine:
+ { // FGSimTurbine code block
+ FGSimTurbine* eng = (FGSimTurbine*)Propulsion->GetEngine(i);
+ eng->SetAugmentation( globals->get_controls()->get_augmentation(i) );
+ eng->SetReverse( globals->get_controls()->get_reverser(i) );
+ eng->SetInjection( globals->get_controls()->get_water_injection(i) );
+ eng->SetCutoff( globals->get_controls()->get_cutoff(i) );
+ eng->SetIgnition( globals->get_controls()->get_ignition(i) );
+ break;
+ } // end FGSimTurbine code block
+ case FGEngine::etRocket:
+ { // FGRocket code block
+ FGRocket* eng = (FGRocket*)Propulsion->GetEngine(i);
+ break;
+ } // end FGRocket code block
+ }
+
+ { // FGEngine code block
+ FGEngine* eng = Propulsion->GetEngine(i);
+
eng->SetStarter( globals->get_controls()->get_starter(i) );
- eng->SetAugmentation( globals->get_controls()->get_augmentation(i) );
- eng->SetReverse( globals->get_controls()->get_reverser(i) );
- eng->SetInjection( globals->get_controls()->get_water_injection(i) );
- eng->SetIgnition( globals->get_controls()->get_ignition(i) );
- eng->SetCutoff( globals->get_controls()->get_cutoff(i) );
- eng->SetNitrous( globals->get_controls()->get_nitrous_injection(i) );
eng->SetRunning( node->getBoolValue("running") );
+ } // end FGEngine code block
}
_set_Runway_altitude( cur_fdm_state->get_Runway_altitude() );
// Convert from the JSBsim generic_ struct to the FGInterface struct
-bool FGJSBsim::copy_from_JSBsim() {
+bool FGJSBsim::copy_from_JSBsim()
+{
unsigned int i, j;
_set_Inertias( MassBalance->GetMass(),
MassBalance->GetXYZcg(2),
MassBalance->GetXYZcg(3) );
- _set_Accels_Body( Aircraft->GetBodyAccel()(1),
- Aircraft->GetBodyAccel()(2),
- Aircraft->GetBodyAccel()(3) );
-
- //_set_Accels_CG_Body( Aircraft->GetBodyAccel()(1),
- // Aircraft->GetBodyAccel()(2),
- // Aircraft->GetBodyAccel()(3) );
- //
- _set_Accels_CG_Body_N ( Aircraft->GetNcg()(1),
- Aircraft->GetNcg()(2),
- Aircraft->GetNcg()(3) );
-
- _set_Accels_Pilot_Body( Auxiliary->GetPilotAccel()(1),
- Auxiliary->GetPilotAccel()(2),
- Auxiliary->GetPilotAccel()(3) );
+ _set_Accels_Body( Aircraft->GetBodyAccel(1),
+ Aircraft->GetBodyAccel(2),
+ Aircraft->GetBodyAccel(3) );
- // _set_Accels_Pilot_Body_N( Auxiliary->GetPilotAccel()(1)/32.1739,
- // Auxiliary->GetNpilot(2)/32.1739,
- // Auxiliary->GetNpilot(3)/32.1739 );
+ _set_Accels_CG_Body_N ( Aircraft->GetNcg(1),
+ Aircraft->GetNcg(2),
+ Aircraft->GetNcg(3) );
+
+ _set_Accels_Pilot_Body( Auxiliary->GetPilotAccel(1),
+ Auxiliary->GetPilotAccel(2),
+ Auxiliary->GetPilotAccel(3) );
_set_Nlf( Aircraft->GetNlf() );
_set_V_equiv_kts( Auxiliary->GetVequivalentKTS() );
- // _set_V_calibrated( Auxiliary->GetVcalibratedFPS() );
-
_set_V_calibrated_kts( Auxiliary->GetVcalibratedKTS() );
_set_V_ground_speed( Position->GetVground() );
// Positions
_updateGeocentricPosition( Position->GetLatitude(),
- Position->GetLongitude(),
- Position->Geth() );
-
+ Position->GetLongitude(),
+ Position->Geth() );
+
+ // Positions of Visual Reference Point
+/*
+ _updateGeocentricPosition( Position->GetLatitudeVRP(),
+ Position->GetLongitudeVRP(),
+ Position->GethVRP() );
+*/
_set_Altitude_AGL( Position->GetDistanceAGL() );
_set_Euler_Angles( Rotation->Getphi(),
_set_Gamma_vert_rad( Position->GetGamma() );
- // set_Gamma_horiz_rad( Gamma_horiz_rad );
_set_Earth_position_angle( Auxiliary->GetEarthPositionAngle() );
}
}
- // Copy the engine values from JSBSim.
- for( i=0; i < Propulsion->GetNumEngines(); i++ ) {
+ // Copy the engine values from JSBSim.
+ for ( i=0; i < Propulsion->GetNumEngines(); i++ ) {
SGPropertyNode * node = fgGetNode("engines/engine", i, true);
- FGEngine * eng = Propulsion->GetEngine(i);
- FGThruster * thrust = Propulsion->GetThruster(i);
+ char buf[30];
+ sprintf(buf, "engines/engine[%d]/thruster", i);
+ SGPropertyNode * tnode = fgGetNode(buf, true);
+ FGThruster * thruster = Propulsion->GetThruster(i);
+
+ switch (Propulsion->GetEngine(i)->GetType()) {
+ case FGEngine::etPiston:
+ { // FGPiston code block
+ FGPiston* eng = (FGPiston*)Propulsion->GetEngine(i);
+ node->setDoubleValue("egt-degf", eng->getExhaustGasTemp_degF());
+ node->setDoubleValue("oil-temperature-degf", eng->getOilTemp_degF());
+ node->setDoubleValue("oil-pressure-psi", eng->getOilPressure_psi());
+ node->setDoubleValue("mp-osi", eng->getManifoldPressure_inHg());
+ node->setDoubleValue("cht-degf", eng->getCylinderHeadTemp_degF());
+ node->setDoubleValue("rpm", eng->getRPM());
+ } // end FGPiston code block
+ break;
+ case FGEngine::etRocket:
+ { // FGRocket code block
+ FGRocket* eng = (FGRocket*)Propulsion->GetEngine(i);
+ } // end FGRocket code block
+ break;
+ case FGEngine::etSimTurbine:
+ { // FGSimTurbine code block
+ FGSimTurbine* eng = (FGSimTurbine*)Propulsion->GetEngine(i);
+ node->setDoubleValue("N1", eng->GetN1());
+ node->setDoubleValue("N2", eng->GetN2());
+ node->setDoubleValue("EGT_degC", eng->GetEGT());
+ node->setBoolValue("augmentation", eng->GetAugmentation());
+ node->setBoolValue("water-injection", eng->GetInjection());
+ node->setBoolValue("ignition", eng->GetIgnition());
+ node->setDoubleValue("nozzle-pos-norm", eng->GetNozzle());
+ node->setDoubleValue("inlet-pos-norm", eng->GetInlet());
+ node->setBoolValue("reversed", eng->GetReversed());
+ node->setBoolValue("cutoff", eng->GetCutoff());
+ globals->get_controls()->set_reverser(i, eng->GetReversed() );
+ globals->get_controls()->set_cutoff(i, eng->GetCutoff() );
+ globals->get_controls()->set_water_injection(i, eng->GetInjection() );
+ globals->get_controls()->set_augmentation(i, eng->GetAugmentation() );
+ } // end FGSimTurbine code block
+ break;
+ }
- node->setDoubleValue("mp-osi", eng->getManifoldPressure_inHg());
- node->setDoubleValue("rpm", thrust->GetRPM());
- node->setDoubleValue("egt-degf", eng->getExhaustGasTemp_degF());
+ { // FGEngine code block
+ FGEngine* eng = Propulsion->GetEngine(i);
node->setDoubleValue("fuel-flow-gph", eng->getFuelFlow_gph());
- node->setDoubleValue("cht-degf", eng->getCylinderHeadTemp_degF());
- node->setDoubleValue("oil-temperature-degf", eng->getOilTemp_degF());
- node->setDoubleValue("oil-pressure-psi", eng->getOilPressure_psi());
- node->setDoubleValue("thrust_lb", eng->GetThrust());
- node->setDoubleValue("N1", eng->GetN1());
- node->setDoubleValue("N2", eng->GetN2());
- node->setDoubleValue("EGT_degC", eng->GetEGT());
+ node->setDoubleValue("thrust_lb", thruster->GetThrust());
node->setDoubleValue("fuel-flow_pph", eng->getFuelFlow_pph());
- node->setDoubleValue("nozzle-pos-norm", eng->GetNozzle());
- node->setDoubleValue("inlet-pos-norm", eng->GetInlet());
node->setBoolValue("running", eng->GetRunning());
node->setBoolValue("starter", eng->GetStarter());
node->setBoolValue("cranking", eng->GetCranking());
- node->setBoolValue("ignition", eng->GetIgnition());
- node->setBoolValue("augmentation", eng->GetAugmentation());
- node->setBoolValue("water-injection", eng->GetInjection());
- node->setBoolValue("reversed", eng->GetReversed());
- node->setBoolValue("cutoff", eng->GetCutoff());
- node->setBoolValue("nitrous", eng->GetNitrous());
globals->get_controls()->set_starter(i, eng->GetStarter() );
- globals->get_controls()->set_cutoff(i, eng->GetCutoff() );
- globals->get_controls()->set_augmentation(i, eng->GetAugmentation() );
- globals->get_controls()->set_reverser(i, eng->GetReversed() );
- globals->get_controls()->set_water_injection(i, eng->GetInjection() );
+ } // end FGEngine code block
+
+ switch (thruster->GetType()) {
+ case FGThruster::ttNozzle:
+ { // FGNozzle code block
+ FGNozzle* noz = (FGNozzle*)thruster;
+ } // end FGNozzle code block
+ break;
+ case FGThruster::ttPropeller:
+ { // FGPropeller code block
+ FGPropeller* prop = (FGPropeller*)thruster;
+ tnode->setDoubleValue("rpm", thruster->GetRPM());
+ tnode->setDoubleValue("pitch", prop->GetPitch());
+ tnode->setDoubleValue("torque", prop->GetTorque());
+ } // end FGPropeller code block
+ break;
+ case FGThruster::ttRotor:
+ { // FGRotor code block
+ FGRotor* rotor = (FGRotor*)thruster;
+ } // end FGRotor code block
+ break;
+ case FGThruster::ttDirect:
+ { // Direct code block
+ } // end Direct code block
+ break;
+ }
+
}
- static const SGPropertyNode *fuel_freeze
- = fgGetNode("/sim/freeze/fuel");
+ static const SGPropertyNode *fuel_freeze = fgGetNode("/sim/freeze/fuel");
- // Copy the fuel levels from JSBSim if fuel
- // freeze not enabled.
+ // Copy the fuel levels from JSBSim if fuel
+ // freeze not enabled.
if ( ! fuel_freeze->getBoolValue() ) {
- for (i = 0; i < Propulsion->GetNumTanks(); i++) {
- SGPropertyNode * node
- = fgGetNode("/consumables/fuel/tank", i, true);
- double contents = Propulsion->GetTank(i)->GetContents();
- node->setDoubleValue("level-gal_us", contents/6.6);
- node->setDoubleValue("level-lb", contents);
- // node->setDoubleValue("temperature_degC",
- }
+ for (i = 0; i < Propulsion->GetNumTanks(); i++) {
+ SGPropertyNode * node = fgGetNode("/consumables/fuel/tank", i, true);
+ double contents = Propulsion->GetTank(i)->GetContents();
+ node->setDoubleValue("level-gal_us", contents/6.6);
+ node->setDoubleValue("level-lb", contents);
+ // node->setDoubleValue("temperature_degC",
+ }
}
update_gear();
stall_warning->setDoubleValue( Aerodynamics->GetStallWarn() );
- /* elevator_pos_deg->setDoubleValue( FCS->GetDePos()*SG_RADIANS_TO_DEGREES );
- left_aileron_pos_deg->setDoubleValue( FCS->GetDaLPos()*SG_RADIANS_TO_DEGREES );
- right_aileron_pos_deg->setDoubleValue( FCS->GetDaRPos()*SG_RADIANS_TO_DEGREES );
- rudder_pos_deg->setDoubleValue( -1*FCS->GetDrPos()*SG_RADIANS_TO_DEGREES );
- flap_pos_deg->setDoubleValue( FCS->GetDfPos() ); */
-
-
elevator_pos_pct->setDoubleValue( FCS->GetDePos(ofNorm) );
left_aileron_pos_pct->setDoubleValue( FCS->GetDaLPos(ofNorm) );
right_aileron_pos_pct->setDoubleValue( -1*FCS->GetDaLPos(ofNorm) );
flap_pos_pct->setDoubleValue( FCS->GetDfPos(ofNorm) );
speedbrake_pos_pct->setDoubleValue( FCS->GetDsbPos(ofNorm) );
spoilers_pos_pct->setDoubleValue( FCS->GetDspPos(ofNorm) );
-
return true;
}
-bool FGJSBsim::ToggleDataLogging(void) {
+
+bool FGJSBsim::ToggleDataLogging(void)
+{
return fdmex->GetOutput()->Toggle();
}
-bool FGJSBsim::ToggleDataLogging(bool state) {
+bool FGJSBsim::ToggleDataLogging(bool state)
+{
if (state) {
fdmex->GetOutput()->Enable();
return true;
//Positions
-void FGJSBsim::set_Latitude(double lat) {
+void FGJSBsim::set_Latitude(double lat)
+{
static const SGPropertyNode *altitude = fgGetNode("/position/altitude-ft");
double alt;
double sea_level_radius_meters, lat_geoc;
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Latitude(lat);
if ( altitude->getDoubleValue() > -9990 ) {
needTrim=true;
}
-void FGJSBsim::set_Longitude(double lon) {
+void FGJSBsim::set_Longitude(double lon)
+{
SG_LOG(SG_FLIGHT,SG_INFO,"FGJSBsim::set_Longitude: " << lon );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Longitude(lon);
update_ic();
needTrim=true;
}
-void FGJSBsim::set_Altitude(double alt) {
+void FGJSBsim::set_Altitude(double alt)
+{
static const SGPropertyNode *latitude = fgGetNode("/position/latitude-deg");
double sea_level_radius_meters,lat_geoc;
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Altitude: " << alt );
SG_LOG(SG_FLIGHT,SG_INFO, " lat (deg) = " << latitude->getDoubleValue() );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Altitude(alt);
update_ic();
needTrim=true;
}
-void FGJSBsim::set_V_calibrated_kts(double vc) {
+void FGJSBsim::set_V_calibrated_kts(double vc)
+{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_V_calibrated_kts: " << vc );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_V_calibrated_kts(vc);
update_ic();
needTrim=true;
}
-void FGJSBsim::set_Mach_number(double mach) {
+void FGJSBsim::set_Mach_number(double mach)
+{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Mach_number: " << mach );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Mach_number(mach);
update_ic();
needTrim=true;
}
-void FGJSBsim::set_Velocities_Local( double north, double east, double down ){
+void FGJSBsim::set_Velocities_Local( double north, double east, double down )
+{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Velocities_Local: "
<< north << ", " << east << ", " << down );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Velocities_Local(north, east, down);
update_ic();
needTrim=true;
}
-void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w){
+void FGJSBsim::set_Velocities_Wind_Body( double u, double v, double w)
+{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Velocities_Wind_Body: "
<< u << ", " << v << ", " << w );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Velocities_Wind_Body(u, v, w);
update_ic();
}
//Euler angles
-void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi ) {
+void FGJSBsim::set_Euler_Angles( double phi, double theta, double psi )
+{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Euler_Angles: "
<< phi << ", " << theta << ", " << psi );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Euler_Angles(phi, theta, psi);
update_ic();
}
//Flight Path
-void FGJSBsim::set_Climb_Rate( double roc) {
+void FGJSBsim::set_Climb_Rate( double roc)
+{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Climb_Rate: " << roc );
- // In case we're not trimming
+ // In case we're not trimming
FGInterface::set_Climb_Rate(roc);
update_ic();
needTrim=true;
}
-void FGJSBsim::set_Gamma_vert_rad( double gamma) {
+void FGJSBsim::set_Gamma_vert_rad( double gamma)
+{
SG_LOG(SG_FLIGHT,SG_INFO, "FGJSBsim::set_Gamma_vert_rad: " << gamma );
update_ic();
needTrim=true;
}
-void FGJSBsim::init_gear(void ) {
-
+void FGJSBsim::init_gear(void )
+{
FGGroundReactions* gr=fdmex->GetGroundReactions();
int Ngear=GroundReactions->GetNumGearUnits();
for (int i=0;i<Ngear;i++) {
SGPropertyNode * node = fgGetNode("gear/gear", i, true);
node->setDoubleValue("xoffset-in",
- gr->GetGearUnit(i)->GetBodyLocation()(1));
+ gr->GetGearUnit(i)->GetBodyLocation()(1));
node->setDoubleValue("yoffset-in",
- gr->GetGearUnit(i)->GetBodyLocation()(2));
+ gr->GetGearUnit(i)->GetBodyLocation()(2));
node->setDoubleValue("zoffset-in",
- gr->GetGearUnit(i)->GetBodyLocation()(3));
+ gr->GetGearUnit(i)->GetBodyLocation()(3));
node->setBoolValue("wow", gr->GetGearUnit(i)->GetWOW());
node->setBoolValue("has-brake", gr->GetGearUnit(i)->GetBrakeGroup() > 0);
node->setDoubleValue("position-norm", FCS->GetGearPos());
}
}
-void FGJSBsim::update_gear(void) {
-
+void FGJSBsim::update_gear(void)
+{
FGGroundReactions* gr=fdmex->GetGroundReactions();
int Ngear=GroundReactions->GetNumGearUnits();
for (int i=0;i<Ngear;i++) {
SGPropertyNode * node = fgGetNode("gear/gear", i, true);
- node->getChild("wow", 0, true)
- ->setBoolValue(gr->GetGearUnit(i)->GetWOW());
- node->getChild("position-norm", 0, true)
- ->setDoubleValue(FCS->GetGearPos());
+ node->getChild("wow", 0, true)->setBoolValue(gr->GetGearUnit(i)->GetWOW());
+ node->getChild("position-norm", 0, true)->setDoubleValue(FCS->GetGearPos());
gr->GetGearUnit(i)->SetTirePressure(node->getDoubleValue("tire-pressure-norm"));
}
}
-void FGJSBsim::do_trim(void) {
-
- FGTrim *fgtrim;
- if( fgGetBool("/sim/presets/onground") ) {
- fgic->SetVcalibratedKtsIC(0.0);
- fgtrim=new FGTrim(fdmex,tGround);
- } else {
- fgtrim=new FGTrim(fdmex,tLongitudinal);
- }
- if( !fgtrim->DoTrim() ) {
- fgtrim->Report();
- fgtrim->TrimStats();
- } else {
- trimmed->setBoolValue(true);
- }
- if (FGJSBBase::debug_lvl > 0)
- State->ReportState();
- delete fgtrim;
- pitch_trim->setDoubleValue( FCS->GetPitchTrimCmd() );
- throttle_trim->setDoubleValue( FCS->GetThrottleCmd(0) );
- aileron_trim->setDoubleValue( FCS->GetDaCmd() );
- rudder_trim->setDoubleValue( FCS->GetDrCmd() );
-
- globals->get_controls()->set_elevator_trim(FCS->GetPitchTrimCmd());
- globals->get_controls()->set_elevator(FCS->GetDeCmd());
- globals->get_controls()->set_throttle(FGControls::ALL_ENGINES,
- FCS->GetThrottleCmd(0));
-
- globals->get_controls()->set_aileron(FCS->GetDaCmd());
- globals->get_controls()->set_rudder( FCS->GetDrCmd());
-
- SG_LOG( SG_FLIGHT, SG_INFO, " Trim complete" );
+void FGJSBsim::do_trim(void)
+{
+ FGTrim *fgtrim;
+
+ if ( fgGetBool("/sim/presets/onground") )
+ {
+ fgic->SetVcalibratedKtsIC(0.0);
+ fgtrim = new FGTrim(fdmex,tGround);
+ } else {
+ fgtrim = new FGTrim(fdmex,tLongitudinal);
+ }
+
+ if ( !fgtrim->DoTrim() ) {
+ fgtrim->Report();
+ fgtrim->TrimStats();
+ } else {
+ trimmed->setBoolValue(true);
+ }
+ if (FGJSBBase::debug_lvl > 0)
+ State->ReportState();
+
+ delete fgtrim;
+
+ pitch_trim->setDoubleValue( FCS->GetPitchTrimCmd() );
+ throttle_trim->setDoubleValue( FCS->GetThrottleCmd(0) );
+ aileron_trim->setDoubleValue( FCS->GetDaCmd() );
+ rudder_trim->setDoubleValue( FCS->GetDrCmd() );
+
+ globals->get_controls()->set_elevator_trim(FCS->GetPitchTrimCmd());
+ globals->get_controls()->set_elevator(FCS->GetDeCmd());
+ globals->get_controls()->set_throttle(FGControls::ALL_ENGINES,
+ FCS->GetThrottleCmd(0));
+
+ globals->get_controls()->set_aileron(FCS->GetDaCmd());
+ globals->get_controls()->set_rudder( FCS->GetDrCmd());
+
+ SG_LOG( SG_FLIGHT, SG_INFO, " Trim complete" );
}
-void FGJSBsim::update_ic(void) {
- if( !needTrim ) {
+void FGJSBsim::update_ic(void)
+{
+ if ( !needTrim ) {
fgic->SetLatitudeRadIC(get_Lat_geocentric() );
fgic->SetLongitudeRadIC( get_Longitude() );
fgic->SetAltitudeFtIC( get_Altitude() );
#define ID_CONDITION "$Id$"
-namespace JSBSim {
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGFCS;
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "../FGJSBBase.h"
#include "../FGPropertyManager.h"
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGFCS;
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
The Flight Control System (FCS) for JSBSim consists of the FCS container
class (see \URL[FGFCS]{FGFCS.html}), the FGFCSComponent base class, and the
component classes from which can be constructed a string, or channel. See:
- <ul>
- <li>\URL[Switch Component]{FGSwitch.html}</li>
- <li>\URL[Gain Component]{FGGain.html}</li>
- <li>\URL[Flaps Component]{FGFlaps.html}</li>
- <li>\URL[Filter Component]{FGFilter.html}</li>
- <li>\URL[Deadband Component]{FGDeadBand.html}</li>
- <li>\URL[Summer Component]{FGSummer.html}</li>
- <li>\URL[Gradient Component]{FGGradient.html}</li>
- </ul>
+
+ - FGSwitch
+ - FGGain
+ - FGKinemat
+ - FGFilter
+ - FGDeadBand
+ - FGSummer
+ - FGGradient
+
@author Jon S. Berndt
@version $Id$
@see Documentation for the FGFCS class, and for the configuration file class
Name = AC_cfg->GetValue("NAME");
AC_cfg->GetNextConfigLine();
dt = fcs->GetState()->Getdt();
+ Trigger = 0;
C1 = C2 = C3 = C4 = C5 = C6 = 0.0;
while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
*AC_cfg >> token;
- if (token == "C1") *AC_cfg >> C1;
- else if (token == "C2") *AC_cfg >> C2;
- else if (token == "C3") *AC_cfg >> C3;
- else if (token == "C4") *AC_cfg >> C4;
- else if (token == "C5") *AC_cfg >> C5;
- else if (token == "C6") *AC_cfg >> C6;
+ if (token == "C1") *AC_cfg >> C1;
+ else if (token == "C2") *AC_cfg >> C2;
+ else if (token == "C3") *AC_cfg >> C3;
+ else if (token == "C4") *AC_cfg >> C4;
+ else if (token == "C5") *AC_cfg >> C5;
+ else if (token == "C6") *AC_cfg >> C6;
+ else if (token == "TRIGGER")
+ {
+ token = AC_cfg->GetValue("TRIGGER");
+ *AC_cfg >> token;
+ Trigger = resolveSymbol(token);
+ }
else if (token == "INPUT")
{
token = AC_cfg->GetValue("INPUT");
bool FGFilter::Run(void)
{
+ int test = 0;
+
FGFCSComponent::Run(); // call the base class for initialization of Input
if (Initialize) {
PreviousOutput1 = PreviousInput1 = Output = Input;
Initialize = false;
+ } else if (Trigger != 0) {
+ test = Trigger->getIntValue();
+ if (test < 0) {
+ Output = PreviousOutput1 = PreviousOutput2 = 0.0;
+ Input = PreviousInput1 = PreviousInput2 = 0.0;
+ } else {
+ Output = PreviousOutput1 = PreviousOutput2 = 0.0;
+ }
+
} else {
Input = InputNodes[0]->getDoubleValue();
switch (FilterType) {
namespace JSBSim {
-/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Encapsulates a filter for the flight control system.
- Filters are modeled using the Tustin Substitution method. These types of
- filters can currently be modeled:
-
- - Lag
- - Lead-Lag
- - Washout
- - Integrator
- - Second order
-
- The filter is specified in the config file like this:
- <pre>
- \<COMPONENT NAME="{name}" TYPE="{LAG_FILTER}"\><BR>
- INPUT 15<BR>
- C1 600<BR>
- OUTPUT fcs/elevator-pos-rad<BR>
- \</COMPONENT\>
- </pre>
+The filter component can simulate any filter up to second order. The
+Tustin substitution is used to take filter definitions from LaPlace space to the
+time domain. The general format for a filter specification is:
+
+<pre>
+\<COMPONENT NAME="name" TYPE="type">
+ INPUT \<property>
+ C1 \<value>
+ [C2 \<value>]
+ [C3 \<value>]
+ [C4 \<value>]
+ [C5 \<value>]
+ [C6 \<value>]
+ [OUTPUT \<property>]
+\</COMPONENT>
+</pre>
+
+For a lag filter of the form,
+<pre>
+ C1
+------
+s + C1
+</pre>
+the corresponding filter definition is:
+<pre>
+\<COMPONENT NAME="name" TYPE="LAG_FILTER">
+ INPUT \<property>
+ C1 \<value>
+ [OUTPUT \<property>]
+\</COMPONENT>
+</pre>
+As an example, for the specific filter:
+<pre>
+ 600
+------
+s + 600
+</pre>
+the corresponding filter definition could be:
+<pre>
+\<COMPONENT NAME="LAG_1" TYPE="LAG_FILTER">
+ INPUT aileron_cmd
+ C1 600
+\</COMPONENT>
+</pre>
+For a lead-lag filter of the form:
+<pre>
+C1*s + C2
+---------
+C3*s + C4
+</pre>
+The corresponding filter definition is:
+<pre>
+\<COMPONENT NAME="name" TYPE="LEAD_LAG_FILTER">
+ INPUT \<property>
+ C1 \<value>
+ C2 \<value>
+ C3 \<value>
+ C4 \<value>
+ [OUTPUT \<property>]
+\</COMPONENT>
+</pre>
+For a washout filter of the form:
+<pre>
+ s
+------
+s + C1
+</pre>
+The corresponding filter definition is:
+<pre>
+\<COMPONENT NAME="name" TYPE="WASHOUT_FILTER">
+ INPUT \<property>
+ C1 \<value>
+ [OUTPUT \<property>]
+\</COMPONENT>
+</pre>
+For a second order filter of the form:
+<pre>
+C1*s^2 + C2*s + C3
+------------------
+C4*s^2 + C5*s + C6
+</pre>
+The corresponding filter definition is:
+<pre>
+\<COMPONENT NAME="name" TYPE="SECOND_ORDER_FILTER">
+ INPUT \<property>
+ C1 \<value>
+ C2 \<value>
+ C3 \<value>
+ C4 \<value>
+ C5 \<value>
+ C6 \<value>
+ [OUTPUT \<property>]
+\</COMPONENT>
+</pre>
+For an integrator of the form:
+<pre>
+ C1
+ ---
+ s
+</pre>
+The corresponding filter definition is:
+<pre>
+\<COMPONENT NAME="name" TYPE="INTEGRATOR">
+ INPUT \<property>
+ C1 \<value>
+ [OUTPUT \<property>]
+ [TRIGGER \<property>]
+\</COMPONENT>
+</pre>
+For the integrator, the TRIGGER features the following behavior, if the TRIGGER property value is:
+ - -1 (or simply less than zero), all previous inputs and outputs are set to 0.0
+ - 0, no action is taken - the output is calculated normally
+ - +1 (or simply greater than zero), all previous outputs (only) will be set to 0.0
+
@author Jon S. Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFilter.h?rev=HEAD">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFilter.cpp?rev=HEAD">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
double PreviousOutput1;
double PreviousOutput2;
FGConfigFile* AC_cfg;
+ FGPropertyManager* Trigger;
void Debug(int from);
};
}
while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
*AC_cfg >> token;
if (token == "INPUT") {
- token = AC_cfg->GetValue("INPUT");
+ *AC_cfg >> token;
if (token[0] == '-') {
invert = true;
token.erase(0,1);
- }
+ }
if (InputNodes.size() > 0) {
cerr << "Gains can only accept one input" << endl;
} else {
- *AC_cfg >> token;
InputNodes.push_back( resolveSymbol(token) );
- }
+ }
+
} else if (token == "GAIN") {
*AC_cfg >> Gain;
} else if (token == "MIN") {
*Table << *AC_cfg;
}
}
-
+
FGFCSComponent::bind();
if (Type == "AEROSURFACE_SCALE")
treenode->Tie( "output-norm", this, &FGGain::GetOutputPct );
if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl;
cout << " MIN: " << Min << endl;
cout << " MAX: " << Max << endl;
- if(invert) cout << " Invert mapping" << endl;
if (ScheduledBy != 0) {
cout << " Scheduled by parameter: " << ScheduledBy->getName() << endl;
Table->Print();
HISTORY
--------------------------------------------------------------------------------
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "../FGConfigFile.h"
#include "../FGTable.h"
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_GAIN "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
class FGFCS;
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates a gain component for the flight control system.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
HISTORY
--------------------------------------------------------------------------------
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "../FGConfigFile.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_GRADIENT "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
class FGFCS;
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates a gradient component for the flight control system.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
HISTORY
--------------------------------------------------------------------------------
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "../FGConfigFile.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_FLAPS "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
namespace JSBSim {
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates a kinematic component for the flight control system.
+ */
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
state variables, or even floating point numbers (e.g. for a bias).
@author Jon S. Berndt
@version $Id$
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGSummer.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Header File </a>
- @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGSummer.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
- Source File </a>
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#define ID_SWITCH "$Id$"
-namespace JSBSim {
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
additional conditions, as well as possibly additional CONDITION_GROUPs.
<pre>
-\<COMPONENT NAME="switch1" TYPE="SWITCH"\><BR>
- \<TEST LOGIC="{AND|OR|DEFAULT}" OUTPUT="{property|value}"\><BR>
- {property} {conditional} {property|value}<BR>
- \<CONDITION_GROUP LOGIC="{AND|OR}"\><BR>
- {property} {conditional} {property|value}<BR>
- ...<BR>
- \</CONDITION_GROUP\><BR>
- ...<BR>
- \</TEST><BR>
- \<TEST LOGIC="{AND|OR}" OUTPUT="{property|value}"\><BR>
- {property} {conditional} {property|value}<BR>
- ...<BR>
- \</TEST\><BR>
- ...<BR>
+\<COMPONENT NAME="switch1" TYPE="SWITCH"\>
+ \<TEST LOGIC="{AND|OR|DEFAULT}" OUTPUT="{property|value}"\>
+ {property} {conditional} {property|value}
+ \<CONDITION_GROUP LOGIC="{AND|OR}"\>
+ {property} {conditional} {property|value}
+ ...
+ \</CONDITION_GROUP\>
+ ...
+ \</TEST>
+ \<TEST LOGIC="{AND|OR}" OUTPUT="{property|value}"\>
+ {property} {conditional} {property|value}
+ ...
+ \</TEST\>
+ ...
\</COMPONENT\>
</pre>
*/