#include "FGCoefficient.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_AERODYNAMICS;
}
}
+} // namespace JSBSim
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
class FGAerodynamics : public FGModel {
void Debug(int from);
};
+} // namespace JSBSim
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGOutput.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
}
}
+} // namespace JSBSim
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGAircraft : public FGModel {
public:
/** Constructor
void Debug(int from);
};
+} // namespace JSBSim
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGColumnVector4.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_ATMOSPHERE;
}
}
+} // namespace JSBSim
CLASS DECLARATION
*******************************************************************************/
+namespace JSBSim {
+
class FGAtmosphere : public FGModel {
public:
void Debug(int from);
};
+} // namespace JSBSim
+
/******************************************************************************/
#endif
#include "FGColumnVector4.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_AUXILIARY;
}
}
+} // namespace JSBSim
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGAuxiliary : public FGModel {
public:
/** Constructor
void Debug(int from);
};
+} // namespace JSBSim
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
# include STL_IOMANIP
#endif
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_COEFFICIENT;
}
}
+} // namespace JSBSim
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFDMExec;
class FGState;
class FGAtmosphere;
virtual void Debug(int from);
};
+} // using namespace JSBSim
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGColumnVector3.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_COLUMNVECTOR3;
}
}
+} // namespace JSBSim
DECLARATION: FGColumnVector3
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGColumnVector3 : public FGJSBBase
{
public:
int rowCtr;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGColumnVector4.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_COLUMNVECTOR4;
}
}
}
-
-
+}
DECLARATION: FGColumnVector4
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGColumnVector4 : public FGJSBBase
{
public:
int rowCtr;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include <stdlib.h>
#include <math.h>
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_CONFIGFILE;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGConfigFile : public FGJSBBase
{
public:
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGEngine.h"
#include "FGTank.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_ENGINE;
}
}
}
-
+}
#define ID_ENGINE "$Id$"
using std::string;
+using std::vector;
+
+namespace JSBSim {
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
class FGAuxiliary;
class FGOutput;
-using std::vector;
-
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
vector <int> SourceTanks;
virtual void Debug(int from);
};
-
+}
#include "FGState.h"
#include "FGFDMExec.h"
#include "FGAtmosphere.h"
#include "filtersjb/FGSummer.h"
#include "filtersjb/FGKinemat.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FCS;
}
}
+}
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf, NNorm } FcIdx;
typedef enum { ofRad=0, ofNorm, ofMag , NForms} OutputForm;
int ToNormalize[NNorm];
void Debug(int from);
};
-
+}
#endif
#include "FGInitialCondition.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FDMEXEC;
if (Error > 0) result = false;
IC = new FGInitialCondition(this);
- //Trim is allocated as needed by GetTrim()
-
// Schedule a model. The second arg (the integer) is the pass number. For
// instance, the atmosphere model gets executed every fifth pass it is called
// by the executive. Everything else here gets executed each pass.
+ // IC and Trim objects are NOT scheduled.
Schedule(Atmosphere, 1);
Schedule(FCS, 1);
Schedule(Position, 1);
Schedule(Auxiliary, 1);
Schedule(Output, 1);
- //IC and Trim are *not* scheduled objects
-
-
modelLoaded = false;
}
}
}
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFDMExec : public FGJSBBase
{
public:
bool DeAllocate(void);
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
# include STL_IOMANIP
#endif
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FACTORGROUP;
}
}
+}
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFDMExec;
class FGState;
class FGAtmosphere;
FGPropertyManager *node;
void Debug(int from);
};
-
+}
#endif
#include "FGColumnVector4.h"
#include "FGForce.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FORCE;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGForce : public FGJSBBase
{
public:
virtual void Debug(int from);
};
-
+}
#endif
#include "FGGroundReactions.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_GROUNDREACTIONS;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGGroundReactions : public FGModel
{
public:
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGPosition.h"
#include "FGMassBalance.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_INERTIAL;
}
}
}
-
+}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGInertial : public FGModel {
public:
double GM;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGConfigFile.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_INITIALCONDITION;
}
}
}
-
+}
#define ID_INITIALCONDITION "$Id$"
+namespace JSBSim {
+
typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
typedef enum { setwned, setwmd, setwhc } windset;
bool solve(double *y, double x);
void Debug(int from);
};
-
+}
#endif
#include "FGJSBBase.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_JSBBASE;
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.2";
+const string FGJSBBase::JSBSim_version = "0.9.4";
queue <FGJSBBase::Message*> FGJSBBase::Messages;
FGJSBBase::Message FGJSBBase::localMsg;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+} // namespace JSBSim
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGJSBBase {
public:
/// Constructor for FGJSBBase.
static const string needed_cfg_version;
static const string JSBSim_version;
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGLGear.h"
#include <algorithm>
+namespace JSBSim {
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
GLOBAL DATA
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_LGEAR;
WOW = lastWOW = true; // should the value be initialized to true?
ReportEnable = true;
FirstContact = false;
- Reported = false;
- DistanceTraveled = 0.0;
+ StartedGroundRun = false;
+ TakeoffReported = LandingReported = false;
+ LandingDistanceTraveled = TakeoffDistanceTraveled = TakeoffDistanceTraveled50ft = 0.0;
MaximumStrutForce = MaximumStrutTravel = 0.0;
SinkRate = GroundSpeed = 0.0;
lastWOW = lgear.lastWOW;
ReportEnable = lgear.ReportEnable;
FirstContact = lgear.FirstContact;
- DistanceTraveled = lgear.DistanceTraveled;
+ StartedGroundRun = lgear.StartedGroundRun;
+ LandingDistanceTraveled = lgear.LandingDistanceTraveled;
+ TakeoffDistanceTraveled = lgear.TakeoffDistanceTraveled;
+ TakeoffDistanceTraveled50ft = lgear.TakeoffDistanceTraveled50ft;
MaximumStrutForce = lgear.MaximumStrutForce;
MaximumStrutTravel = lgear.MaximumStrutTravel;
maxCompLen = lgear.maxCompLen;
SinkRate = lgear.SinkRate;
GroundSpeed = lgear.GroundSpeed;
- Reported = lgear.Reported;
+ LandingReported = lgear.LandingReported;
+ TakeoffReported = lgear.TakeoffReported;
name = lgear.name;
sSteerType = lgear.sSteerType;
sRetractable = lgear.sRetractable;
{
double SteerGain = 0;
double SinWheel, CosWheel;
+ double deltaT;
vForce.InitMatrix();
vMoment.InitMatrix();
FirstContact = true;
SinkRate = compressSpeed;
GroundSpeed = Position->GetVel().Magnitude();
+ TakeoffReported = false;
+ }
+
+// If the takeoff run is starting, initialize.
+
+ if ((Position->GetVel().Magnitude() > 0.1) &&
+ (FCS->GetBrake(bgLeft) == 0) &&
+ (FCS->GetBrake(bgRight) == 0) &&
+ (FCS->GetThrottlePos(0) == 1) && !StartedGroundRun)
+ {
+ TakeoffDistanceTraveled = 0;
+ TakeoffDistanceTraveled50ft = 0;
+ StartedGroundRun = true;
}
// The following needs work regarding friction coefficients and braking and
if (Position->GetDistanceAGL() > 200.0) {
FirstContact = false;
- Reported = false;
- DistanceTraveled = 0.0;
+ StartedGroundRun = false;
+ LandingReported = false;
+ LandingDistanceTraveled = 0.0;
MaximumStrutForce = MaximumStrutTravel = 0.0;
}
compressLength = 0.0; // reset compressLength to zero for data output validity
}
- if (FirstContact) {
- DistanceTraveled += Position->GetVel().Magnitude()*State->Getdt()*Aircraft->GetRate();
- }
+ deltaT = State->Getdt()*Aircraft->GetRate();
+
+ if (FirstContact) LandingDistanceTraveled += Position->GetVground()*deltaT;
- if (ReportEnable && Position->GetVel().Magnitude() <= 0.05 && !Reported) {
- if (debug_lvl > 0) Report();
+ if (StartedGroundRun) {
+ TakeoffDistanceTraveled50ft += Position->GetVground()*deltaT;
+ if (WOW) TakeoffDistanceTraveled += Position->GetVground()*deltaT;
+ }
+
+ if (ReportEnable && Position->GetVground() <= 0.05 && !LandingReported) {
+ if (debug_lvl > 0) Report(erLand);
+ }
+
+ if (ReportEnable && !TakeoffReported &&
+ (vLocalGear(eZ) - Position->GetDistanceAGL()) < -50.0)
+ {
+ if (debug_lvl > 0) Report(erTakeoff);
}
if (lastWOW != WOW) {
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGLGear::Report(void)
+void FGLGear::Report(ReportType repType)
{
- cout << endl << "Touchdown report for " << name << endl;
- cout << " Sink rate at contact: " << SinkRate << " fps, "
- << SinkRate*0.3408 << " mps" << endl;
- cout << " Contact ground speed: " << GroundSpeed*.5925 << " knots, "
- << GroundSpeed*0.3408 << " mps" << endl;
- cout << " Maximum contact force: " << MaximumStrutForce << " lbs, "
- << MaximumStrutForce*4.448 << " Newtons" << endl;
- cout << " Maximum strut travel: " << MaximumStrutTravel*12.0 << " inches, "
- << MaximumStrutTravel*30.48 << " cm" << endl;
- cout << " Distance traveled: " << DistanceTraveled << " ft, "
- << DistanceTraveled*0.3408 << " meters" << endl;
- Reported = true;
+ switch(repType) {
+ case erLand:
+ cout << endl << "Touchdown report for " << name << endl;
+ cout << " Sink rate at contact: " << SinkRate << " fps, "
+ << SinkRate*0.3408 << " mps" << endl;
+ cout << " Contact ground speed: " << GroundSpeed*.5925 << " knots, "
+ << GroundSpeed*0.3408 << " mps" << endl;
+ cout << " Maximum contact force: " << MaximumStrutForce << " lbs, "
+ << MaximumStrutForce*4.448 << " Newtons" << endl;
+ cout << " Maximum strut travel: " << MaximumStrutTravel*12.0 << " inches, "
+ << MaximumStrutTravel*30.48 << " cm" << endl;
+ cout << " Distance traveled: " << LandingDistanceTraveled << " ft, "
+ << LandingDistanceTraveled*0.3408 << " meters" << endl;
+ LandingReported = true;
+ break;
+ case erTakeoff:
+ cout << endl << "Takeoff report for " << name << endl;
+ cout << " Distance traveled: " << TakeoffDistanceTraveled
+ << " ft, " << TakeoffDistanceTraveled*0.3408 << " meters" << endl;
+ cout << " Distance traveled (over 50'): " << TakeoffDistanceTraveled50ft
+ << " ft, " << TakeoffDistanceTraveled50ft*0.3408 << " meters" << endl;
+ TakeoffReported = true;
+ break;
+ }
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
}
}
+} // namespace JSBSim
+
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGAircraft;
class FGPosition;
class FGRotation;
enum BrakeGroup {bgNone=0, bgLeft, bgRight, bgCenter, bgNose, bgTail };
/// Steering group membership enumerators
enum SteerType {stSteer, stFixed, stCaster};
+ /// Report type enumerators
+ enum ReportType {erNone=0, erTakeoff, erLand};
/** Constructor
@param Executive a pointer to the parent executive object
@param File a pointer to the config file instance */
double maxCompLen;
double SinkRate;
double GroundSpeed;
- double DistanceTraveled;
+ double TakeoffDistanceTraveled;
+ double TakeoffDistanceTraveled50ft;
+ double LandingDistanceTraveled;
double MaximumStrutForce;
double MaximumStrutTravel;
double SideWhlVel, RollingWhlVel;
bool WOW;
bool lastWOW;
bool FirstContact;
- bool Reported;
+ bool StartedGroundRun;
+ bool LandingReported;
+ bool TakeoffReported;
bool ReportEnable;
bool isRetractable;
bool GearUp, GearDown;
FGFCS* FCS;
FGMassBalance* MassBalance;
- void Report(void);
+ void Report(ReportType rt);
void Debug(int from);
};
-
+}
#include "FGAircraft.h"
#include "FGPosition.h"
#include "FGRotation.h"
#include "FGMassBalance.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_MASSBALANCE;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGMassBalance : public FGModel
{
FGColumnVector3 PointMassCG;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGMatrix33.h"
#include "FGColumnVector3.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_MATRIX33;
}
}
}
-
+}
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGColumnVector3;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
unsigned int rowCtr, colCtr;
void Debug(int from);
};
-
+}
#endif
#include "FGAuxiliary.h"
#include "FGOutput.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_MODEL;
}
}
}
-
+}
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFDMExec;
class FGState;
class FGAtmosphere;
FGOutput* Output;
FGPropertyManager* PropertyManager;
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGNozzle.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_NOZZLE;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGNozzle : public FGThruster {
public:
double Area2;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGPosition.h"
#include "FGAuxiliary.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_OUTPUT;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGOutput : public FGModel
{
public:
FGfdmSocket* socket;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGPiston.h"
#include "FGPropulsion.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_PISTON;
{
return FuelFlow_gph / 3600 * 6 * State->Getdt() * Propulsion->GetRate();
}
+
+} // namespace JSBSim
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGPiston : public FGEngine
{
public:
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_POSITION;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGPosition : public FGModel {
public:
/** Constructor
void GetState(void);
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGPropeller.h"
#include "FGFCS.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_PROPELLER;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGPropeller : public FGThruster {
public:
FGTable *cPower;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
+namespace JSBSim {
+
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
string FGPropertyManager::mkPropertyName(string name, bool lowercase) {
cout <<
"Failed to tie property " << name << " to a pointer" << endl;
}
+
+} // namespace JSBSim
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGPropertyManager : public SGPropertyNode {
public:
/// Constructor
"Failed to tie property " << name << " to indexed object methods" << endl;
}
};
-
+}
#endif // FGPROPERTYMANAGER_H
#include "FGPropulsion.h"
#include "FGPropertyManager.h"
-
-static const char *IdSrc = "$Id$";
-static const char *IdHdr = ID_PROPULSION;
-
-extern short debug_lvl;
-
#if defined (__APPLE__)
/* Not all systems have the gcvt function */
inline char* gcvt (double value, int ndigits, char *buf) {
}
#endif
+namespace JSBSim {
+
+static const char *IdSrc = "$Id$";
+static const char *IdHdr = ID_PROPULSION;
+
+extern short debug_lvl;
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS IMPLEMENTATION
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGPropulsion : public FGModel
{
public:
FGColumnVector3 vXYZtank;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGRocket.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_ROCKET;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGRocket : public FGEngine
{
public:
double PC;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_ROTATION;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGRotation : public FGModel
{
public:
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGRotor.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_ROTOR;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGRotor : public FGThruster {
public:
private:
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGScript.h"
#include "FGConfigFile.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FGSCRIPT;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGScript : public FGJSBBase
{
public:
FGPropertyManager* PropertyManager;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGState.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_STATE;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGState : public FGJSBBase
{
public:
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#include <iomanip>
#endif
+using namespace std;
+
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_TABLE;
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-using namespace std;
FGTable::FGTable(int NRows, int NCols) : nRows(NRows), nCols(NCols)
{
}
}
}
-
-
-
+}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGTable : public FGJSBBase
{
public:
double** Allocate(void);
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGTank.h"
+#if !defined ( sgi ) || defined( __GNUC__ )
+using std::cerr;
+using std::endl;
+using std::cout;
+#endif
+
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_TANK;
CLASS IMPLEMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
-#if !defined ( sgi ) || defined( __GNUC__ )
-using std::cerr;
-using std::endl;
-using std::cout;
-#endif
-
FGTank::FGTank(FGConfigFile* AC_cfg)
{
string token;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGTank : public FGJSBBase
{
public:
bool Selected;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGThruster.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_THRUSTER;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGThruster : public FGForce {
public:
double deltaT;
virtual void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGOutput.h"
#include "FGPropertyManager.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_TRANSLATION;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGTranslation : public FGModel {
public:
FGTranslation(FGFDMExec*);
~FGTranslation();
+ /** Bound Properties
+ GetUVW(1): velocities/u-fps
+ GetUVW(2): velocities/v-fps
+ GetUVW(3): velocities/w-fps
+ */
inline double GetUVW (int idx) const { return vUVW(idx); }
inline FGColumnVector3& GetUVW (void) { return vUVW; }
inline FGColumnVector3& GetUVWdot(void) { return vUVWdot; }
+ /** Bound Properties
+ GetUVWdot(1): accelerations/udot-fps
+ GetUVWdot(2): accelerations/vdot-fps
+ GetUVWdot(3): accelerations/wdot-fps
+ */
inline double GetUVWdot(int idx) const { return vUVWdot(idx); }
inline FGColumnVector3& GetAeroUVW (void) { return vAeroUVW; }
+ /** Bound Properties
+ GetAeroUVW(1): velocities/u-aero-fps
+ GetAeroUVW(2): velocities/v-aero-fps
+ GetAeroUVW(3): velocities/w-aero-fps
+ */
inline double GetAeroUVW (int idx) const { return vAeroUVW(idx); }
+ /** Bound Property: aero/alpha-rad
+ */
double Getalpha(void) const { return alpha; }
+ /** Bound Property: aero/beta-rad
+ */
double Getbeta (void) const { return beta; }
+ /** Bound Property: aero/mag-beta-rad
+ */
inline double GetMagBeta(void) const { return fabs(beta); }
+ /** Bound Property: aero/qbar-psf
+ */
double Getqbar (void) const { return qbar; }
+ /** Bound Property: aero/qbarUW-psf
+ */
double GetqbarUW (void) const { return qbarUW; }
+ /** Bound Property: aero/qbarUV-psf
+ */
double GetqbarUV (void) const { return qbarUV; }
+ /** Bound Property: velocities/vt-fps
+ */
inline double GetVt (void) const { return Vt; }
+ /** Bound Property: velocities/mach-norm
+ */
double GetMach (void) const { return Mach; }
+ /** Bound Property: aero/alphadot-rad_sec
+ */
double Getadot (void) const { return adot; }
+ /** Bound Property: aero/betadot-rad_sec
+ */
double Getbdot (void) const { return bdot; }
+ /** Bound Properties
+ SetUVW(1): velocities/u-fps
+ SetUVW(2): velocities/v-fps
+ SetUVW(3): velocities/w-fps
+ */
void SetUVW(FGColumnVector3 tt) { vUVW = tt; }
void SetAeroUVW(FGColumnVector3 tt) { vAeroUVW = tt; }
+ /** Bound Property: aero/alpha-rad
+ */
inline void Setalpha(double tt) { alpha = tt; }
+ /** Bound Property: aero/beta-rad
+ */
inline void Setbeta (double tt) { beta = tt; }
+ /** Bound Property: aero/qbar-psf
+ */
inline void Setqbar (double tt) { qbar = tt; }
+ /** Bound Property: aero/qbarUW-psf
+ */
inline void SetqbarUW (double tt) { qbarUW = tt; }
+ /** Bound Property: aero/qbarUV-psf
+ */
inline void SetqbarUV (double tt) { qbarUV = tt; }
+ /** Bound Property: velocities/vt-fps
+ */
inline void SetVt (double tt) { Vt = tt; }
+ /** Bound Property: velocities/mach-norm
+ */
inline void SetMach (double tt) { Mach=tt; }
+ /** Bound Property: aero/alphadot-rad_sec
+ */
inline void Setadot (double tt) { adot = tt; }
+ /** Bound Property: aero/betadot-rad_sec
+ */
inline void Setbdot (double tt) { bdot = tt; }
inline void SetAB(double t1, double t2) { alpha=t1; beta=t2; }
double adot,bdot;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#pragma warning (disable : 4786 4788)
#endif
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_TRIM;
current_axis=0;
}
//YOU WERE WARNED, BUT YOU DID IT ANYWAY.
-
+}
#define ID_TRIM "$Id$"
-typedef enum { tLongitudinal, tFull, tGround, tPullup,
- tCustom, tNone, tTurn
- } TrimMode;
-
#if defined(_WIN32) && !defined(__CYGWIN__)
#define snprintf _snprintf
#endif
+namespace JSBSim {
+
+typedef enum { tLongitudinal, tFull, tGround, tPullup,
+ tCustom, tNone, tTurn
+ } TrimMode;
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
inline double GetTargetNlf(void) { return targetNlf; }
};
-
+}
#endif
-
-
-
-
-
-
-
-
-
#include "FGAerodynamics.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_TRIMAXIS;
}
}
}
-
-
+}
#define DEFAULT_TOLERANCE 0.001
+namespace JSBSim {
+
const string StateNames[10]= { "all","udot","vdot","wdot","qdot","pdot","rdot",
"hmgt","nlf"
};
void Debug(int from);
};
-
+}
#endif
#include "FGTurbine.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_TURBINE;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGTurbine : public FGEngine
{
public:
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGState.h"
#include "FGFDMExec.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_UTILITY;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFDMExec;
class FGState;
FGFDMExec* FDMExec;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGfdmSocket.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FDMSOCKET;
}
}
}
-
+}
using std::string;
+namespace JSBSim {
+
class FGfdmSocket : public FGJSBBase
{
public:
bool connected;
void Debug(int from);
};
-
+}
#endif
fgic->SetClimbRateFpsIC( get_Climb_Rate() );
}
}
+
#include <FDM/JSBSim/FGFDMExec.h>
+namespace JSBSim {
class FGState;
class FGAtmosphere;
class FGFCS;
class FGAuxiliary;
class FGOutput;
class FGInitialCondition;
+}
+
+using namespace JSBSim;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
FGTranslation.cpp FGTranslation.h \
FGTrim.cpp FGTrim.h \
FGTrimAxis.cpp FGTrimAxis.h \
- FGTurboJet.cpp FGTurboJet.h \
- FGTurboProp.cpp FGTurboProp.h \
- FGTurboShaft.cpp FGTurboShaft.h \
+ FGTurbine.cpp FGTurbine.h \
FGUtility.cpp FGUtility.h \
FGEngine.cpp FGEngine.h \
FGTank.cpp FGTank.h \
#include "FGDeadBand.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_DEADBAND;
AC_cfg->GetNextConfigLine();
string token;
+ clipmax = clipmin = 0.0;
+ clip = false;
+ gain = 1.0;
+ width = 0.0;
+
while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
*AC_cfg >> token;
- if (token == "ID") {
- *AC_cfg >> ID;
- } else if (token == "INPUT") {
- *AC_cfg >> InputIdx;
- } else {
+ if (token == "INPUT") {
+ if (InputNodes.size() > 0) {
+ cerr << "Deadband can only accept one input" << endl;
+ } else {
+ *AC_cfg >> token;
+ InputNodes.push_back(resolveSymbol(token));
+ }
+ } else if (token == "WIDTH") {
+ *AC_cfg >> width;
+ } else if (token == "CLIPTO") {
+ *AC_cfg >> clipmin >> clipmax;
+ if (clipmax > clipmin) clip = true;
+ } else if (token == "GAIN") {
+ *AC_cfg >> gain;
+ } else if (token == "OUTPUT") {
*AC_cfg >> token;
+ OutputNode = PropertyManager->GetNode(token);
}
}
FGFCSComponent::bind();
{
FGFCSComponent::Run(); // call the base class for initialization of Input
+ Input = InputNodes[0]->getDoubleValue();
+
+ if (Input < -width/2.0) {
+ Output = (Input + width/2.0)*gain;
+ } else if (Input > width/2.0) {
+ Output = (Input - width/2.0)*gain;
+ } else {
+ Output = 0.0;
+ }
+
+ if (clip) {
+ if (Output > clipmax) Output = clipmax;
+ else if (Output < clipmin) Output = clipmin;
+ }
+
+ if (IsOutput) SetOutput();
+
return true;
}
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
-
+ cout << " INPUT: " << InputNodes[0]->getName() << endl;
+ cout << " DEADBAND WIDTH: " << width << endl;
+ cout << " GAIN: " << gain << endl;
+ if (clip) cout << " CLIPTO: " << clipmin
+ << ", " << clipmax << endl;
+ if (IsOutput) cout << " OUTPUT: " << OutputNode->getName() << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
}
}
}
-
+}
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFCS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
/** Models a deadband object.
Owned and Operated by the FGFCS class.
+
+ <COMPONENT NAME="Deadbeat1" TYPE="DEADBAND">
+ INPUT {input}
+ WIDTH {deadband width}
+ GAIN {optional deadband gain}
+ MIN {minimum value}
+ MAX {maximum value}
+ OUTPUT {optional output parameter to set}
+ </COMPONENT>
+
@author Jon S. Berndt
@see -
*/
private:
FGConfigFile* AC_cfg;
+ double width;
+ double clipmax, clipmin;
+ bool clip;
+ double gain;
void Debug(int from);
};
-
+}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#endif
#include "FGFCSComponent.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FCSCOMPONENT;
FGFCSComponent::FGFCSComponent(FGFCS* _fcs) : fcs(_fcs)
{
Type = "";
- ID = 0;
Input = 0.0;
Output = 0.0;
OutputNode = 0;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-FGPropertyManager* FGFCSComponent::resolveSymbol(string token) {
+FGPropertyManager* FGFCSComponent::resolveSymbol(string token)
+{
string prop;
- FGPropertyManager* tmp=PropertyManager->GetNode(token,false);
- if( !tmp ){
- if( token.find("/") == token.npos )
- prop = "model/" + token;
+ FGPropertyManager* tmp = PropertyManager->GetNode(token,false);
+ if (!tmp) {
+ if (token.find("/") == token.npos) prop = "model/" + token;
cerr << "Creating new property " << prop << endl;
- tmp=PropertyManager->GetNode(token,true);
+ tmp = PropertyManager->GetNode(token,true);
}
return tmp;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-void FGFCSComponent::bind(void) {
+void FGFCSComponent::bind(void)
+{
string tmp = "fcs/" + PropertyManager->mkPropertyName(Name, true);
FGPropertyManager *tmpn;
PropertyManager->Tie( tmp,this, &FGFCSComponent::GetOutput);
}
}
}
-
+}
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFCS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGPropertyManager* treenode;
string Type;
string Name;
- int ID;
- vector<FGPropertyManager*> InputNodes;
- int InputIdx;
+ vector <FGPropertyManager*> InputNodes;
double Input;
FGPropertyManager* OutputNode;
double Output;
bool IsOutput;
virtual void Debug(int from);
};
-
+}
#include "../FGFCS.h"
#endif
#include "FGFilter.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FILTER;
while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
*AC_cfg >> token;
- if (token == "ID") *AC_cfg >> ID;
- else if (token == "C1") *AC_cfg >> C1;
+ 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;
}
}
}
-
+}
<pre>
<COMPONENT NAME="Elevator Filter" TYPE="LAG_FILTER">
- ID 16
INPUT 15
C1 600
OUTPUT FG_ELEVATOR_POS
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGFilter : public FGFCSComponent
{
public:
FGConfigFile* AC_cfg;
void Debug(int from);
};
-
+}
#endif
#include "FGGain.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_GAIN;
while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
*AC_cfg >> token;
- if (token == "ID") {
- *AC_cfg >> ID;
- } else if (token == "INPUT") {
+ if (token == "INPUT") {
token = AC_cfg->GetValue("INPUT");
- if( InputNodes.size() > 0 ) {
+ if (InputNodes.size() > 0) {
cerr << "Gains can only accept one input" << endl;
} else {
*AC_cfg >> token;
Output = Gain * Input;
} else if (Type == "SCHEDULED_GAIN") {
LookupVal = ScheduledBy->getDoubleValue();
- SchedGain = Table->GetValue(LookupVal);
+ SchedGain = Table->GetValue(LookupVal);
Output = Gain * SchedGain * Input;
} else if (Type == "AEROSURFACE_SCALE") {
- if(!invert) {
+ if (!invert) {
OutputPct = Input;
if (Input >= 0.0) Output = Input * Max;
else Output = Input * -Min;
}
}
}
-
+}
#define ID_GAIN "$Id$"
+namespace JSBSim {
+
class FGFCS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
void Debug(int from);
};
-
+}
#endif
#include "FGGradient.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_GRADIENT;
}
}
}
-
+}
#define ID_GRADIENT "$Id$"
+namespace JSBSim {
+
class FGFCS;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FGConfigFile* AC_cfg;
void Debug(int from);
};
-
+}
#endif
#include "FGKinemat.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_FLAPS;
while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
*AC_cfg >> token;
- if (token == "ID") {
- *AC_cfg >> ID;
- } else if (token == "INPUT") {
+ if (token == "INPUT") {
token = AC_cfg->GetValue("INPUT");
if( InputNodes.size() > 0 ) {
cerr << "Kinemat can only accept one input" << endl;
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGKinemat : public FGFCSComponent {
public:
FGKinemat(FGFCS* fcs, FGConfigFile* AC_cfg);
void Debug(int from);
};
-
+}
#endif
#include "FGSummer.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_SUMMER;
while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
*AC_cfg >> token;
- if (token == "ID") {
- *AC_cfg >> ID;
- } else if (token == "INPUT") {
+ if (token == "INPUT") {
token = AC_cfg->GetValue("INPUT");
*AC_cfg >> token;
InputNodes.push_back( resolveSymbol(token) );
}
}
}
-
+}
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGSummer : public FGFCSComponent
{
public:
double Bias;
void Debug(int from);
};
-
+}
#endif
COMMENTS, REFERENCES, and NOTES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+The SWITCH component is defined as follows (see the API documentation for more
+information):
+
+<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>
+
+Also, see the header file (FGSwitch.h) for further details.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
INCLUDES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGSwitch.h"
+namespace JSBSim {
+
static const char *IdSrc = "$Id$";
static const char *IdHdr = ID_SWITCH;
FGSwitch::FGSwitch(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
AC_cfg(AC_cfg)
{
+ string token, value;
+ struct test *current_test;
+ struct FGCondition *current_condition;
+
Type = AC_cfg->GetValue("TYPE");
Name = AC_cfg->GetValue("NAME");
+ AC_cfg->GetNextConfigLine();
+ while ((token = AC_cfg->GetValue()) != string("/COMPONENT")) {
+
+ // See the above documentation, or the API docs, for information on what
+ // the SWITCH component is supposed to look like in the configuration file.
+ // Below, the switch component is read in.
+
+ if (token == "TEST") {
+ tests.push_back(*(new test));
+ current_test = &tests.back();
+
+ if (AC_cfg->GetValue("LOGIC") == "OR") {
+ current_test->Logic = eOR;
+ } else if (AC_cfg->GetValue("LOGIC") == "AND") {
+ current_test->Logic = eAND;
+ } else if (AC_cfg->GetValue("LOGIC") == "DEFAULT") {
+ current_test->Logic = eDefault;
+ } else { // error
+ cerr << "Unrecognized LOGIC token in switch component: " << Name << endl;
+ }
+
+ value = AC_cfg->GetValue("VALUE");
+ if (value.empty()) {
+ cerr << "No VALUE supplied for switch component: " << Name << endl;
+ } else {
+ if (value.find_first_not_of("-.0123456789eE") == string::npos) {
+ // if true (and execution falls into this block), "value" is a number.
+ current_test->OutputVal = atof(value.c_str());
+ } else {
+ // "value" must be a property if execution passes to here.
+ current_test->OutputProp = PropertyManager->GetNode(value);
+ }
+ }
+
+ AC_cfg->GetNextConfigLine();
+ while (AC_cfg->GetValue() != "/TEST") {
+ current_test->conditions.push_back(*(new FGCondition(AC_cfg, PropertyManager)));
+ }
+ }
+ AC_cfg->GetNextConfigLine();
+ }
+
FGFCSComponent::bind();
Debug(0);
bool FGSwitch::Run(void )
{
+ vector <test>::iterator iTests = tests.begin();
+ vector <FGCondition>::iterator iConditions;
+ bool pass = false;
+
FGFCSComponent::Run(); // call the base class for initialization of Input
+ while (iTests < tests.end()) {
+ iConditions = iTests->conditions.begin();
+
+ if (iTests->Logic == eDefault) {
+ Output = iTests->GetValue();
+ } else if (iTests->Logic == eAND) {
+ pass = true;
+ while (iConditions < iTests->conditions.end()) {
+ if (!iConditions->Evaluate()) pass = false;
+ *iConditions++;
+ }
+ } else if (iTests->Logic == eOR) {
+ pass = false;
+ while (iConditions < iTests->conditions.end()) {
+ if (iConditions->Evaluate()) pass = true;
+ *iConditions++;
+ }
+ } else {
+ cerr << "Invalid logic test" << endl;
+ }
+
+ if (pass) {
+ Output = iTests->GetValue();
+ break;
+ }
+ *iTests++;
+ }
+
return true;
}
void FGSwitch::Debug(int from)
{
+ vector <test>::iterator iTests = tests.begin();
+ vector <FGCondition>::iterator iConditions;
+ string comp, scratch;
+ string indent = " ";
+ bool first = false;
+
if (debug_lvl <= 0) return;
if (debug_lvl & 1) { // Standard console startup message output
if (from == 0) { // Constructor
+ while (iTests < tests.end()) {
+
+ scratch = " if ";
+
+ switch(iTests->Logic) {
+ case (elUndef):
+ comp = " UNSET ";
+ cerr << "Unset logic for test condition" << endl;
+ break;
+ case (eAND):
+ comp = " AND ";
+ break;
+ case (eOR):
+ comp=" OR ";
+ break;
+ case (eDefault):
+ scratch = " by default.";
+ break;
+ default:
+ comp = " UNKNOWN ";
+ cerr << "Unknown logic for test condition" << endl;
+ }
+ if (iTests->OutputProp != 0L)
+ cout << indent << "Switch VALUE is " << iTests->OutputProp->GetName() << scratch << endl;
+ else
+ cout << indent << "Switch VALUE is " << iTests->OutputVal << scratch << endl;
+
+ iConditions = iTests->conditions.begin();
+ first = true;
+ while (iConditions < iTests->conditions.end()) {
+ if (!first) cout << indent << comp << " ";
+ else cout << indent << " ";
+ first = false;
+ iConditions->PrintCondition();
+ cout << endl;
+ *iConditions++;
+ }
+ cout << endl;
+ *iTests++;
+ }
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
}
}
}
-
+}
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Header: FGSwitch.h
- Author:
- Date started:
+ Author: Jon S. Berndt
+ Date started: 12/23/2002
------------- Copyright (C) -------------
HISTORY
--------------------------------------------------------------------------------
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES, and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SENTRY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#include "FGFCSComponent.h"
#include "../FGConfigFile.h"
+#include "FGCondition.h"
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_SWITCH "$Id$"
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Encapsulates a switch for the flight control system.
+
+The SWITCH component models a switch - either on/off or a multi-choice rotary
+switch. The switch can represent a physical cockpit switch, or can represent a
+logical switch, where several conditions might need to be satisfied before a
+particular state is reached. The VALUE of the switch - the output value - is
+chosen depending on the state of the switch. Each switch is comprised of two or
+more TESTs. Each TEST has a VALUE associated with it. The first TEST that
+evaluates to TRUE will set the output value of the switch according to the VALUE
+parameter belonging to that TEST. Each TEST contains one or more CONDITIONS, which
+each must be logically related (if there are more than one) given the value of
+the LOGIC parameter, and which takes the form:
+
+ property conditional property|value
+
+e.g.
+
+ qbar GE 21.0
+
+or,
+
+ roll_rate < pitch_rate
+
+Within a TEST, a CONDITION_GROUP can be specified. A CONDITION_GROUP allows for
+complex groupings of logical comparisons. Each CONDITION_GROUP contains
+additional conditions, as well as possibly additional CONDITION_GROUPs.
+
+<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>
+*/
+
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+namespace JSBSim {
+
class FGSwitch : public FGFCSComponent
{
private:
FGFCS* fcs;
FGConfigFile* AC_cfg;
+
+ enum eLogic {elUndef=0, eAND, eOR, eDefault};
+ enum eComparison {ecUndef=0, eEQ, eNE, eGT, eGE, eLT, eLE};
+ map <const string, eComparison> mComparison;
+
+ struct test {
+ vector <FGCondition> conditions;
+ eLogic Logic;
+ double OutputVal;
+ FGPropertyManager *OutputProp;
+
+ double GetValue(void) {
+ if (OutputProp == 0L) return OutputVal;
+ else return OutputProp->getDoubleValue();
+ }
+
+ test(void) { // constructor for the test structure
+ Logic = elUndef;
+ OutputVal = 0.0;
+ OutputProp = 0L;
+ }
+
+ };
+
+ vector <test> tests;
+
void Debug(int from);
};
-
+}
#endif
FGGradient.cpp FGGradient.h \
FGKinemat.cpp FGKinemat.h \
FGSummer.cpp FGSummer.h \
- FGSwitch.cpp FGSwitch.h
+ FGSwitch.cpp FGSwitch.h \
+ FGCondition.cpp FGCondition.h
AM_CXXFLAGS = -DFGFS