2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
Header: FGCoefficient.h
|
|
|
|
Author: Jon Berndt
|
|
|
|
Date started: 12/28/98
|
|
|
|
|
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
12/28/98 JSB Created
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
SENTRY
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
|
|
|
#ifndef FGCOEFFICIENT_H
|
|
|
|
#define FGCOEFFICIENT_H
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
INCLUDES
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
Updates from the Jon and Tony show.
Tony submitted:
JSBsim:
Added trimming routine, it is longitudinal & in-air only at this point
Added support for taking wind & weather data from external source
Added support for flaps.
Added independently settable pitch trim
Added alphamin and max to config file, stall modeling and warning to
follow
c172.cfg:
Flaps!
Adjusted Cmo, model should be speed stable now
FG:
Hooked up Christian's weather code, should be using it soon.
Hooked up the trimming routine. Note that the X-15 will not trim.
This is not a model or trimming routine deficiency, just the
nature of the X-15
The trimming routine sets the pitch trim and and throttle at startup.
The throttle is set using Norman's code for the autothrottle so the
autothrottle is on by default. --notrim will turn it off.
Added --vc, --mach, and --notrim switches
(vc is airspeed in knots)
uBody, vBody, and wBody are still supported, last one entered
on the command line counts, i.e. you can set vc or mach or u,v,
and w but any combination will be ignored.
2000-05-16 21:35:11 +00:00
|
|
|
|
1999-02-26 22:09:10 +00:00
|
|
|
#ifdef FGFS
|
2000-02-15 03:30:01 +00:00
|
|
|
# include <simgear/compiler.h>
|
1999-02-26 22:09:10 +00:00
|
|
|
#endif
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
#include <vector>
|
Updates from the Jon and Tony show.
Tony submitted:
JSBsim:
Added trimming routine, it is longitudinal & in-air only at this point
Added support for taking wind & weather data from external source
Added support for flaps.
Added independently settable pitch trim
Added alphamin and max to config file, stall modeling and warning to
follow
c172.cfg:
Flaps!
Adjusted Cmo, model should be speed stable now
FG:
Hooked up Christian's weather code, should be using it soon.
Hooked up the trimming routine. Note that the X-15 will not trim.
This is not a model or trimming routine deficiency, just the
nature of the X-15
The trimming routine sets the pitch trim and and throttle at startup.
The throttle is set using Norman's code for the autothrottle so the
autothrottle is on by default. --notrim will turn it off.
Added --vc, --mach, and --notrim switches
(vc is airspeed in knots)
uBody, vBody, and wBody are still supported, last one entered
on the command line counts, i.e. you can set vc or mach or u,v,
and w but any combination will be ignored.
2000-05-16 21:35:11 +00:00
|
|
|
#include <string>
|
2000-04-24 23:49:06 +00:00
|
|
|
#include "FGConfigFile.h"
|
2001-03-30 01:04:50 +00:00
|
|
|
#include "FGTable.h"
|
2001-10-05 20:19:59 +00:00
|
|
|
#include "FGJSBBase.h"
|
2002-03-20 12:45:02 +00:00
|
|
|
#include "FGPropertyManager.h"
|
1999-06-21 05:01:31 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
DEFINITIONS
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-05-08 03:19:08 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
#define ID_COEFFICIENT "$Id$"
|
2000-10-14 02:10:10 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-03-02 01:02:51 +00:00
|
|
|
FORWARD DECLARATIONS
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2003-01-24 12:55:28 +00:00
|
|
|
namespace JSBSim {
|
|
|
|
|
1999-02-11 21:05:34 +00:00
|
|
|
class FGFDMExec;
|
|
|
|
class FGState;
|
|
|
|
class FGAtmosphere;
|
|
|
|
class FGFCS;
|
|
|
|
class FGAircraft;
|
|
|
|
class FGTranslation;
|
|
|
|
class FGRotation;
|
|
|
|
class FGPosition;
|
|
|
|
class FGAuxiliary;
|
|
|
|
class FGOutput;
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-06-21 05:01:31 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
Note that the coefficients need not be calculated each delta-t. This is
|
|
|
|
something that may be fixed someday.
|
1999-03-02 01:02:51 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DOCUMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-03-02 01:02:51 +00:00
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
/** This class models the aero coefficient and stability derivative coefficient
|
|
|
|
lookup table, value, vector, or equation (equation not modeled, yet).
|
2000-11-03 23:02:47 +00:00
|
|
|
Each coefficient for an axis is stored in that axes' vector of coefficients.
|
2002-06-08 03:14:03 +00:00
|
|
|
Each FDM execution frame the Run() method of the FGAerodynamics model
|
|
|
|
is called and the coefficient values are calculated.
|
2000-11-03 23:02:47 +00:00
|
|
|
@author Jon S. Berndt
|
|
|
|
@version $Id$
|
2002-04-06 16:03:16 +00:00
|
|
|
@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>
|
2000-11-03 23:02:47 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DECLARATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
class FGCoefficient : public FGJSBBase
|
1999-02-05 21:26:01 +00:00
|
|
|
{
|
2001-07-10 15:56:38 +00:00
|
|
|
public:
|
2002-06-08 03:14:03 +00:00
|
|
|
/** Constructor.
|
|
|
|
@param exec a pointer to the FGFDMExec instance. */
|
|
|
|
FGCoefficient(FGFDMExec* exec);
|
|
|
|
/// Destructor.
|
2001-10-05 20:19:59 +00:00
|
|
|
virtual ~FGCoefficient();
|
2001-07-23 20:31:59 +00:00
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
/** Loads the stability derivative/aero coefficient data from the config file
|
|
|
|
as directed by the FGAerodynamics instance.
|
|
|
|
@param AC_cfg a pointer to the current config file instance. */
|
2001-07-23 20:31:59 +00:00
|
|
|
virtual bool Load(FGConfigFile* AC_cfg);
|
|
|
|
|
2002-03-20 12:45:02 +00:00
|
|
|
typedef vector <FGPropertyManager*> MultVec;
|
2002-06-08 03:14:03 +00:00
|
|
|
|
|
|
|
enum Type {UNKNOWN, VALUE, VECTOR, TABLE, EQUATION};
|
|
|
|
|
|
|
|
/** Returns the value for this coefficient.
|
|
|
|
Each instance of FGCoefficient stores a value for the "type" of coefficient
|
|
|
|
it is, one of: VALUE, VECTOR, TABLE, or EQUATION. This TotalValue function
|
|
|
|
is called when the value for a coefficient needs to be known. When it is called,
|
|
|
|
depending on what type of coefficient is represented by the FGCoefficient
|
|
|
|
instance, TotalValue() directs the appropriate Value() function to be called.
|
|
|
|
The type of coefficient represented is determined when the config file is read.
|
|
|
|
The coefficient definition includes the "type" specifier.
|
|
|
|
@return the current value of the coefficient represented by this instance of
|
|
|
|
FGCoefficient. */
|
2001-11-20 22:34:24 +00:00
|
|
|
virtual double TotalValue(void);
|
2003-03-23 15:12:35 +00:00
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
/** Returns the value for this coefficient.
|
|
|
|
TotalValue is stored each time TotalValue() is called. This function returns
|
|
|
|
the stored value but does not calculate it anew. This is valuable for merely
|
|
|
|
printing out the value.
|
|
|
|
@return the most recently calculated and stored value of the coefficient
|
|
|
|
represented by this instance of FGCoefficient. */
|
2002-03-20 12:45:02 +00:00
|
|
|
virtual inline double GetValue(void) const { return totalValue; }
|
2003-03-23 15:12:35 +00:00
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
/// Returns the name of this coefficient.
|
2002-03-20 12:45:02 +00:00
|
|
|
virtual inline string Getname(void) const {return name;}
|
2003-03-23 15:12:35 +00:00
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
/// Returns the value of the coefficient only - before it is re-dimensionalized.
|
2002-03-20 12:45:02 +00:00
|
|
|
virtual inline double GetSD(void) const { return SD;}
|
2003-03-23 15:12:35 +00:00
|
|
|
|
2001-07-23 20:31:59 +00:00
|
|
|
/** Outputs coefficient information.
|
|
|
|
Non-dimensionalizing parameter descriptions are output
|
|
|
|
for each aero coefficient defined.
|
|
|
|
@param multipliers the list of multipliers for this coefficient.*/
|
|
|
|
virtual void DisplayCoeffFactors(void);
|
2003-03-23 15:12:35 +00:00
|
|
|
|
2002-06-08 03:14:03 +00:00
|
|
|
/// Returns the name of the coefficient.
|
|
|
|
virtual inline string GetCoefficientName(void) { return name; }
|
|
|
|
/// Returns the stability derivative or coefficient value as a string.
|
|
|
|
virtual string GetSDstring(void);
|
2003-03-23 15:12:35 +00:00
|
|
|
|
2001-12-17 15:36:20 +00:00
|
|
|
inline void setBias(double b) { bias=b; }
|
|
|
|
inline void setGain(double g) { gain=g; };
|
2002-03-20 12:45:02 +00:00
|
|
|
inline double getBias(void) const { return bias; }
|
|
|
|
inline double getGain(void) const { return gain; }
|
|
|
|
|
2002-03-23 00:29:21 +00:00
|
|
|
virtual void bind(FGPropertyManager *parent);
|
|
|
|
virtual void unbind(void);
|
2001-07-26 17:17:11 +00:00
|
|
|
|
2002-04-16 13:15:29 +00:00
|
|
|
protected:
|
|
|
|
FGFDMExec* FDMExec;
|
|
|
|
|
2001-07-10 15:56:38 +00:00
|
|
|
private:
|
2000-04-24 23:49:06 +00:00
|
|
|
int numInstances;
|
2002-04-30 13:42:26 +00:00
|
|
|
string description;
|
|
|
|
string name;
|
1999-02-26 22:09:10 +00:00
|
|
|
string filename;
|
|
|
|
string method;
|
2001-12-13 04:48:34 +00:00
|
|
|
string multparms;
|
|
|
|
string multparmsRow;
|
|
|
|
string multparmsCol;
|
2001-11-20 22:34:24 +00:00
|
|
|
double Value(double, double);
|
|
|
|
double Value(double);
|
|
|
|
double Value(void);
|
|
|
|
double StaticValue;
|
2002-03-20 12:45:02 +00:00
|
|
|
double totalValue;
|
2001-12-17 15:36:20 +00:00
|
|
|
double bias,gain;
|
2002-03-20 12:45:02 +00:00
|
|
|
FGPropertyManager *LookupR, *LookupC;
|
|
|
|
|
2002-04-30 13:42:26 +00:00
|
|
|
FGPropertyManager *node; // must be private!!
|
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
MultVec multipliers;
|
1999-02-05 21:26:01 +00:00
|
|
|
int rows, columns;
|
1999-03-02 01:02:51 +00:00
|
|
|
Type type;
|
2001-11-20 22:34:24 +00:00
|
|
|
double SD; // Actual stability derivative (or other coefficient) value
|
2001-03-30 01:04:50 +00:00
|
|
|
FGTable *Table;
|
1999-02-05 21:26:01 +00:00
|
|
|
|
1999-02-11 21:05:34 +00:00
|
|
|
FGState* State;
|
|
|
|
FGAtmosphere* Atmosphere;
|
|
|
|
FGFCS* FCS;
|
|
|
|
FGAircraft* Aircraft;
|
|
|
|
FGTranslation* Translation;
|
|
|
|
FGRotation* Rotation;
|
|
|
|
FGPosition* Position;
|
|
|
|
FGAuxiliary* Auxiliary;
|
|
|
|
FGOutput* Output;
|
2002-03-20 12:45:02 +00:00
|
|
|
FGPropertyManager* PropertyManager;
|
2002-09-24 12:54:43 +00:00
|
|
|
|
|
|
|
FGPropertyManager* resolveSymbol(string name);
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2001-12-13 04:48:34 +00:00
|
|
|
virtual void Debug(int from);
|
1999-02-05 21:26:01 +00:00
|
|
|
};
|
|
|
|
|
2003-01-24 12:55:28 +00:00
|
|
|
} // using namespace JSBSim
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
#endif
|
2001-03-30 01:04:50 +00:00
|
|
|
|