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-05 21:26:01 +00:00
|
|
|
Header: FGState.h
|
|
|
|
Author: Jon S. Berndt
|
|
|
|
Date started: 11/17/98
|
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-05 21:26:01 +00:00
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
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-05 21:26:01 +00:00
|
|
|
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.
|
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-05 21:26:01 +00:00
|
|
|
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.
|
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-05 21:26:01 +00:00
|
|
|
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.
|
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-05 21:26:01 +00:00
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
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-05 21:26:01 +00:00
|
|
|
FUNCTIONAL DESCRIPTION
|
|
|
|
--------------------------------------------------------------------------------
|
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-05 21:26:01 +00:00
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
11/17/98 JSB Created
|
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
|
|
|
|
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 FGSTATE_H
|
|
|
|
#define FGSTATE_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
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
1999-02-26 22:09:10 +00:00
|
|
|
#ifdef FGFS
|
2000-02-15 03:30:01 +00:00
|
|
|
# include <simgear/compiler.h>
|
2001-06-05 20:58:48 +00:00
|
|
|
# ifdef SG_HAVE_STD_INCLUDES
|
1999-02-26 22:09:10 +00:00
|
|
|
# include <fstream>
|
|
|
|
# else
|
|
|
|
# include <fstream.h>
|
|
|
|
# endif
|
|
|
|
#else
|
2001-10-05 20:19:59 +00:00
|
|
|
# if defined(sgi) && !defined(__GNUC__)
|
|
|
|
# include <fstream.h>
|
|
|
|
# else
|
|
|
|
# include <fstream>
|
|
|
|
# endif
|
1999-02-26 22:09:10 +00:00
|
|
|
#endif
|
|
|
|
|
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 <map>
|
1999-02-11 21:05:34 +00:00
|
|
|
#include "FGDefs.h"
|
2001-10-05 20:19:59 +00:00
|
|
|
#include "FGJSBBase.h"
|
1999-08-17 21:18:11 +00:00
|
|
|
#include "FGInitialCondition.h"
|
2001-10-05 20:19:59 +00:00
|
|
|
#include "FGMatrix33.h"
|
|
|
|
#include "FGColumnVector3.h"
|
|
|
|
#include "FGColumnVector4.h"
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2001-04-17 21:19:54 +00:00
|
|
|
DEFINITIONS
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
#define ID_STATE "$Id$"
|
2000-10-14 02:10:10 +00:00
|
|
|
|
2001-04-17 21:19:54 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
FORWARD DECLARATIONS
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
class FGAircraft;
|
|
|
|
class FGTranslation;
|
|
|
|
class FGRotation;
|
|
|
|
class FGAtmosphere;
|
|
|
|
class FGOutput;
|
|
|
|
class FGPosition;
|
2001-10-05 20:19:59 +00:00
|
|
|
class FGFDMExec;
|
2001-10-29 19:00:24 +00:00
|
|
|
class FGGroundReactions;
|
2001-10-30 02:51:13 +00:00
|
|
|
class FGPropulsion;
|
2001-04-17 21:19:54 +00:00
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DOCUMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/** Encapsulates the calculation of aircraft state.
|
|
|
|
@author Jon S. Berndt
|
|
|
|
@version $Id$
|
|
|
|
*/
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-02-05 21:26:01 +00:00
|
|
|
CLASS DECLARATION
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
class FGState : public FGJSBBase
|
|
|
|
{
|
1999-02-05 21:26:01 +00:00
|
|
|
public:
|
2001-10-05 20:19:59 +00:00
|
|
|
/** Constructor
|
|
|
|
@param Executive a pointer to the parent executive object */
|
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
|
|
|
FGState(FGFDMExec*);
|
2001-10-05 20:19:59 +00:00
|
|
|
/// Destructor
|
2001-03-30 01:04:50 +00:00
|
|
|
~FGState();
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/** Specifies the Reset file to use.
|
|
|
|
The reset file normally resides in the same directory as an aircraft config file.
|
|
|
|
it includes the following information:
|
|
|
|
<ul>
|
|
|
|
<li>U, the body X-Axis velocity</li>
|
|
|
|
<li>V, the body Y-Axis velocity</li>
|
|
|
|
<li>W, the body Z-Axis velocity</li>
|
|
|
|
<li>Latitude measured in radians from the equator, negative values are south.</li>
|
|
|
|
<li>Longitude, measured in radians from the Greenwich meridian, negative values are west.</li>
|
|
|
|
<li>Phi, the roll angle in radians.</li>
|
|
|
|
<li>Theta, the pitch attitude in radians.</li>
|
|
|
|
<li>Psi, the heading angle in radians.</li>
|
|
|
|
<li>H, the altitude in feet</li>
|
|
|
|
<li>Wind Direction, the direction the wind is coming <u>from</u>.</li>
|
|
|
|
<li>Wind magnitude, the wind speed in fps.</li>
|
|
|
|
</ul>
|
|
|
|
@param path the path string leading to the specific aircraft file, i.e. "aircraft".
|
|
|
|
@param aircraft the name of the aircraft, i.e. "c172".
|
|
|
|
@param filename the name of the reset file without an extension, i.e. "reset00".
|
|
|
|
@return true if successful, false if the file could not be opened.
|
|
|
|
*/
|
|
|
|
bool Reset(string path, string aircraft, string filename);
|
|
|
|
|
|
|
|
/** Initializes the simulation state based on the passed-in parameters.
|
|
|
|
@param U the body X-Axis velocity in fps.
|
|
|
|
@param V the body Y-Axis velocity in fps.
|
|
|
|
@param W the body Z-Axis velocity in fps.
|
|
|
|
@param lat latitude measured in radians from the equator, negative values are south.
|
|
|
|
@param lon longitude, measured in radians from the Greenwich meridian, negative values are west.
|
|
|
|
@param phi the roll angle in radians.
|
|
|
|
@param tht the pitch angle in radians.
|
|
|
|
@param psi the heading angle in radians measured clockwise from north.
|
|
|
|
@param h altitude in feet.
|
|
|
|
@param wnorth north velocity in feet per second
|
|
|
|
@param weast eastward velocity in feet per second
|
|
|
|
@param wdown downward velocity in feet per second
|
|
|
|
*/
|
|
|
|
void Initialize(float U,
|
|
|
|
float V,
|
|
|
|
float W,
|
|
|
|
float lat,
|
|
|
|
float lon,
|
|
|
|
float phi,
|
|
|
|
float tht,
|
|
|
|
float psi,
|
|
|
|
float h,
|
|
|
|
float wnorth,
|
|
|
|
float weast,
|
|
|
|
float wdown);
|
|
|
|
|
|
|
|
/** Initializes the simulation state based on parameters from an Initial Conditions object.
|
|
|
|
@param FGIC pointer to an initial conditions object.
|
|
|
|
@see FGInitialConditions.
|
|
|
|
*/
|
1999-08-17 21:18:11 +00:00
|
|
|
void Initialize(FGInitialCondition *FGIC);
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/** Stores state data in the supplied file name.
|
|
|
|
@param filename the file to store the data in.
|
|
|
|
@return true if successful.
|
|
|
|
*/
|
|
|
|
bool StoreData(string filename);
|
|
|
|
|
|
|
|
/// returns the speed of sound in feet per second.
|
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
|
|
|
inline float Geta(void) { return a; }
|
1999-02-11 21:05:34 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/// Returns the simulation time in seconds.
|
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
|
|
|
inline float Getsim_time(void) { return sim_time; }
|
2001-10-05 20:19:59 +00:00
|
|
|
/// Returns the simulation delta T.
|
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
|
|
|
inline float Getdt(void) { return dt; }
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/// Suspends the simulation and sets the delta T to zero.
|
2000-10-02 23:07:30 +00:00
|
|
|
inline void Suspend(void) {saved_dt = dt; dt = 0.0;}
|
2001-10-05 20:19:59 +00:00
|
|
|
/// Resumes the simulation by resetting delta T to the correct value.
|
2000-10-02 23:07:30 +00:00
|
|
|
inline void Resume(void) {dt = saved_dt;}
|
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/** Retrieves a parameter.
|
|
|
|
The parameters that can be retrieved are enumerated in FGDefs.h.
|
|
|
|
@param val_idx one of the enumerated JSBSim parameters.
|
|
|
|
@return the value of the parameter.
|
|
|
|
*/
|
2000-10-02 23:07:30 +00:00
|
|
|
float GetParameter(eParam val_idx);
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
/** Retrieves a parameter.
|
|
|
|
The parameters that can be retrieved are enumerated in FGDefs.h.
|
|
|
|
@param val_string a string representing one of the enumerated JSBSim parameters,
|
|
|
|
i.e. "FG_QBAR".
|
|
|
|
@return the value of the parameter.
|
|
|
|
*/
|
2000-04-24 23:49:06 +00:00
|
|
|
float GetParameter(string val_string);
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/** Retrieves the JSBSim parameter enumerated item given the text string.
|
|
|
|
@param val_string the parameter string, i.e. "FG_QBAR".
|
|
|
|
@return the JSBSim parameter index (an enumerated type) for the supplied string.
|
|
|
|
*/
|
|
|
|
eParam GetParameterIndex(string val_string);
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
/** Sets the speed of sound.
|
|
|
|
@param speed the speed of sound in feet per second.
|
|
|
|
*/
|
|
|
|
inline void Seta(float speed) { a = speed; }
|
|
|
|
|
|
|
|
/** Sets the current sim time.
|
|
|
|
@param cur_time the current time
|
|
|
|
@return the current time.
|
|
|
|
*/
|
|
|
|
inline float Setsim_time(float cur_time) {
|
|
|
|
sim_time = cur_time;
|
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
|
|
|
return sim_time;
|
|
|
|
}
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
/** Sets the integration time step for the simulation executive.
|
|
|
|
@param delta_t the time step in seconds.
|
|
|
|
*/
|
|
|
|
inline void Setdt(float delta_t) { dt = delta_t; }
|
|
|
|
|
|
|
|
/** Sets the JSBSim parameter to the supplied value.
|
|
|
|
@param prm the JSBSim parameter to set, i.e. FG_RUDDER_POS.
|
|
|
|
@param val the value to give the parameter.
|
|
|
|
*/
|
|
|
|
void SetParameter(eParam prm, float val);
|
|
|
|
|
|
|
|
/** Increments the simulation time.
|
|
|
|
@return the new simulation time.
|
|
|
|
*/
|
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
|
|
|
inline float IncrTime(void) {
|
|
|
|
sim_time+=dt;
|
|
|
|
return sim_time;
|
|
|
|
}
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
/** Initializes the transformation matrices.
|
|
|
|
@param phi the roll angle in radians.
|
|
|
|
@param tht the pitch angle in radians.
|
|
|
|
@param psi the heading angle in radians
|
|
|
|
*/
|
2000-04-24 23:49:06 +00:00
|
|
|
void InitMatrices(float phi, float tht, float psi);
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
/** Calculates the local-to-body and body-to-local conversion matrices.
|
|
|
|
*/
|
2000-04-24 23:49:06 +00:00
|
|
|
void CalcMatrices(void);
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
/** Integrates the quaternion.
|
|
|
|
Given the supplied rotational rate vector and integration rate, the quaternion
|
|
|
|
is integrated. The quaternion is later used to update the transformation
|
|
|
|
matrices.
|
|
|
|
@param vPQR the body rotational rate column vector.
|
|
|
|
@param rate the integration rate in seconds.
|
|
|
|
*/
|
|
|
|
void IntegrateQuat(FGColumnVector3 vPQR, int rate);
|
|
|
|
|
|
|
|
/** Calculates Euler angles from the local-to-body matrix.
|
|
|
|
@return a reference to the vEuler column vector.
|
|
|
|
*/
|
|
|
|
FGColumnVector3& CalcEuler(void);
|
|
|
|
|
|
|
|
/** Calculates and returns the stability-to-body axis transformation matrix.
|
|
|
|
@param alpha angle of attack in radians.
|
|
|
|
@param beta angle of sideslip in radians.
|
|
|
|
@return a reference to the stability-to-body transformation matrix.
|
|
|
|
*/
|
|
|
|
FGMatrix33& GetTs2b(float alpha, float beta);
|
|
|
|
|
|
|
|
/** Retrieves the local-to-body transformation matrix.
|
|
|
|
@return a reference to the local-to-body transformation matrix.
|
|
|
|
*/
|
|
|
|
FGMatrix33& GetTl2b(void) { return mTl2b; }
|
|
|
|
|
|
|
|
/** Retrieves a specific local-to-body matrix element.
|
|
|
|
@param r matrix row index.
|
|
|
|
@param c matrix column index.
|
|
|
|
@return the matrix element described by the row and column supplied.
|
|
|
|
*/
|
|
|
|
float GetTl2b(int r, int c) { return mTl2b(r,c);}
|
|
|
|
|
|
|
|
/** Retrieves the body-to-local transformation matrix.
|
|
|
|
@return a reference to the body-to-local matrix.
|
|
|
|
*/
|
|
|
|
FGMatrix33& GetTb2l(void) { return mTb2l; }
|
|
|
|
|
|
|
|
/** Retrieves a specific body-to-local matrix element.
|
|
|
|
@param r matrix row index.
|
|
|
|
@param c matrix column index.
|
|
|
|
@return the matrix element described by the row and column supplied.
|
|
|
|
*/
|
2001-04-17 21:19:54 +00:00
|
|
|
float GetTb2l(int i, int j) { return mTb2l(i,j);}
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
/** Prints a summary of simulator state (speed, altitude,
|
|
|
|
configuration, etc.)
|
|
|
|
*/
|
|
|
|
void ReportState(void);
|
|
|
|
|
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
typedef map<eParam, string> ParamMap;
|
|
|
|
ParamMap paramdef;
|
1999-12-20 20:24:49 +00:00
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
private:
|
2000-04-28 19:59:46 +00:00
|
|
|
float a; // speed of sound
|
1999-02-05 21:26:01 +00:00
|
|
|
float sim_time, dt;
|
2000-10-02 23:07:30 +00:00
|
|
|
float saved_dt;
|
1999-02-05 21:26:01 +00:00
|
|
|
|
1999-02-11 21:05:34 +00:00
|
|
|
FGFDMExec* FDMExec;
|
2001-10-05 20:19:59 +00:00
|
|
|
FGMatrix33 mTb2l;
|
|
|
|
FGMatrix33 mTl2b;
|
|
|
|
FGMatrix33 mTs2b;
|
|
|
|
FGColumnVector4 vQtrn;
|
|
|
|
FGColumnVector4 vlastQdot;
|
|
|
|
FGColumnVector3 vUVW;
|
|
|
|
FGColumnVector3 vLocalVelNED;
|
|
|
|
FGColumnVector3 vLocalEuler;
|
|
|
|
FGColumnVector4 vQdot;
|
|
|
|
FGColumnVector4 vTmp;
|
|
|
|
FGColumnVector3 vEuler;
|
1999-02-05 21:26:01 +00:00
|
|
|
|
2001-04-17 21:19:54 +00:00
|
|
|
FGAircraft* Aircraft;
|
|
|
|
FGPosition* Position;
|
|
|
|
FGTranslation* Translation;
|
|
|
|
FGRotation* Rotation;
|
|
|
|
FGOutput* Output;
|
|
|
|
FGAtmosphere* Atmosphere;
|
|
|
|
FGFCS* FCS;
|
2001-06-05 20:58:48 +00:00
|
|
|
FGAerodynamics* Aerodynamics;
|
2001-10-29 19:00:24 +00:00
|
|
|
FGGroundReactions* GroundReactions;
|
2001-10-30 02:51:13 +00:00
|
|
|
FGPropulsion* Propulsion;
|
2001-04-17 21:19:54 +00:00
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
typedef map<string, eParam> CoeffMap;
|
2000-04-24 23:49:06 +00:00
|
|
|
CoeffMap coeffdef;
|
2001-03-30 01:04:50 +00:00
|
|
|
void Debug(void);
|
|
|
|
int ActiveEngine;
|
1999-02-05 21:26:01 +00:00
|
|
|
};
|
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2001-04-17 21:19:54 +00:00
|
|
|
|
|
|
|
#include "FGFDMExec.h"
|
|
|
|
#include "FGAtmosphere.h"
|
|
|
|
#include "FGFCS.h"
|
|
|
|
#include "FGTranslation.h"
|
|
|
|
#include "FGRotation.h"
|
|
|
|
#include "FGPosition.h"
|
2001-06-05 20:58:48 +00:00
|
|
|
#include "FGAerodynamics.h"
|
2001-04-17 21:19:54 +00:00
|
|
|
#include "FGOutput.h"
|
|
|
|
#include "FGAircraft.h"
|
2001-10-29 19:00:24 +00:00
|
|
|
#include "FGGroundReactions.h"
|
2001-10-30 02:51:13 +00:00
|
|
|
#include "FGPropulsion.h"
|
2001-04-17 21:19:54 +00:00
|
|
|
|
1999-02-05 21:26:01 +00:00
|
|
|
#endif
|
2001-03-30 01:04:50 +00:00
|
|
|
|