1999-08-17 21:20:38 +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-08-17 21:20:38 +00:00
|
|
|
Header: FGInitialCondition.cpp
|
|
|
|
Author: Tony Peden
|
|
|
|
Date started: 7/1/99
|
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-08-17 21:20:38 +00:00
|
|
|
------------- Copyright (C) 1999 Anthony K. Peden (apeden@earthlink.net) -------------
|
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-08-17 21:20:38 +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-08-17 21:20:38 +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-08-17 21:20:38 +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-08-17 21:20:38 +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-08-17 21:20:38 +00:00
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
7/1/99 TP 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
|
|
|
|
|
|
|
|
1999-08-17 21:20:38 +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-08-17 21:20:38 +00:00
|
|
|
The purpose of this class is to take a set of initial conditions and provide
|
|
|
|
a kinematically consistent set of body axis velocity components, euler
|
|
|
|
angles, and altitude. This class does not attempt to trim the model i.e.
|
|
|
|
the sim will most likely start in a very dynamic state (unless, of course,
|
|
|
|
you have chosen your IC's wisely) even after setting it up with this class.
|
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-08-17 21:20:38 +00:00
|
|
|
********************************************************************************
|
|
|
|
INCLUDES
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
#include "FGInitialCondition.h"
|
|
|
|
#include "FGFDMExec.h"
|
|
|
|
#include "FGState.h"
|
|
|
|
#include "FGAtmosphere.h"
|
|
|
|
#include "FGFCS.h"
|
|
|
|
#include "FGAircraft.h"
|
|
|
|
#include "FGTranslation.h"
|
|
|
|
#include "FGRotation.h"
|
|
|
|
#include "FGPosition.h"
|
|
|
|
#include "FGAuxiliary.h"
|
|
|
|
#include "FGOutput.h"
|
2001-10-05 20:19:59 +00:00
|
|
|
#include "FGConfigFile.h"
|
2002-03-20 12:45:02 +00:00
|
|
|
#include "FGPropertyManager.h"
|
1999-08-17 21:20:38 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
static const char *IdSrc = "$Id$";
|
2000-10-14 02:10:10 +00:00
|
|
|
static const char *IdHdr = ID_INITIALCONDITION;
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-12 16:06:29 +00:00
|
|
|
FGInitialCondition::FGInitialCondition(FGFDMExec *FDMExec)
|
|
|
|
{
|
2001-03-30 01:04:50 +00:00
|
|
|
vt=vc=ve=vg=0;
|
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
|
|
|
mach=0;
|
|
|
|
alpha=beta=gamma=0;
|
|
|
|
theta=phi=psi=0;
|
|
|
|
altitude=hdot=0;
|
|
|
|
latitude=longitude=0;
|
2001-03-30 01:04:50 +00:00
|
|
|
u=v=w=0;
|
2001-10-05 20:19:59 +00:00
|
|
|
uw=vw=ww=0;
|
2000-10-09 21:16:21 +00:00
|
|
|
vnorth=veast=vdown=0;
|
2001-10-05 20:19:59 +00:00
|
|
|
wnorth=weast=wdown=0;
|
|
|
|
whead=wcross=0;
|
|
|
|
wdir=wmag=0;
|
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
|
|
|
lastSpeedSet=setvt;
|
2001-10-05 20:19:59 +00:00
|
|
|
lastWindSet=setwned;
|
2001-11-12 16:06:29 +00:00
|
|
|
sea_level_radius = FDMExec->GetInertial()->RefRadius();
|
|
|
|
radius_to_vehicle = FDMExec->GetInertial()->RefRadius();
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
terrain_altitude = 0;
|
2001-03-30 01:04:50 +00:00
|
|
|
|
|
|
|
salpha=sbeta=stheta=sphi=spsi=sgamma=0;
|
|
|
|
calpha=cbeta=ctheta=cphi=cpsi=cgamma=1;
|
|
|
|
|
2000-05-27 05:48:14 +00:00
|
|
|
if(FDMExec != NULL ) {
|
2000-05-02 18:25:30 +00:00
|
|
|
fdmex=FDMExec;
|
|
|
|
fdmex->GetPosition()->Seth(altitude);
|
|
|
|
fdmex->GetAtmosphere()->Run();
|
2002-03-20 12:45:02 +00:00
|
|
|
PropertyManager=fdmex->GetPropertyManager();
|
|
|
|
bind();
|
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
|
|
|
} else {
|
2000-10-09 21:16:21 +00:00
|
|
|
cout << "FGInitialCondition: This class requires a pointer to a valid FGFDMExec object" << endl;
|
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
|
|
|
}
|
2002-03-20 12:45:02 +00:00
|
|
|
|
2001-12-24 13:54:55 +00:00
|
|
|
Debug(0);
|
1999-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
1999-08-17 21:20:38 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
FGInitialCondition::~FGInitialCondition()
|
|
|
|
{
|
2002-03-20 12:45:02 +00:00
|
|
|
unbind();
|
2001-12-24 13:54:55 +00:00
|
|
|
Debug(1);
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
1999-08-17 21:20:38 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
1999-08-17 21:20:38 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVcalibratedKtsIC(double tt) {
|
1999-08-17 21:20:38 +00:00
|
|
|
|
2001-11-12 16:06:29 +00:00
|
|
|
if(getMachFromVcas(&mach,tt*ktstofps)) {
|
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
|
|
|
//cout << "Mach: " << mach << endl;
|
|
|
|
lastSpeedSet=setvc;
|
2001-11-12 16:06:29 +00:00
|
|
|
vc=tt*ktstofps;
|
2000-05-02 18:25:30 +00:00
|
|
|
vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
|
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
|
|
|
ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
|
2001-11-12 16:06:29 +00:00
|
|
|
//cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
|
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
|
|
|
}
|
|
|
|
else {
|
|
|
|
cout << "Failed to get Mach number for given Vc and altitude, Vc unchanged." << endl;
|
|
|
|
cout << "Please mail the set of initial conditions used to apeden@earthlink.net" << endl;
|
|
|
|
}
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
2000-04-24 23:49:06 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVequivalentKtsIC(double tt) {
|
2001-11-12 16:06:29 +00:00
|
|
|
ve=tt*ktstofps;
|
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
|
|
|
lastSpeedSet=setve;
|
|
|
|
vt=ve*1/sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
|
|
|
|
mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
|
|
|
|
vc=calcVcas(mach);
|
1999-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVgroundFpsIC(double tt) {
|
|
|
|
double ua,va,wa;
|
|
|
|
double vxz;
|
2001-03-30 01:04:50 +00:00
|
|
|
|
|
|
|
vg=tt;
|
|
|
|
lastSpeedSet=setvg;
|
|
|
|
vnorth = vg*cos(psi); veast = vg*sin(psi); vdown = 0;
|
|
|
|
calcUVWfromNED();
|
2001-10-05 20:19:59 +00:00
|
|
|
ua = u + uw; va = v + vw; wa = w + ww;
|
|
|
|
vt = sqrt( ua*ua + va*va + wa*wa );
|
2001-03-30 01:04:50 +00:00
|
|
|
alpha = beta = 0;
|
|
|
|
vxz = sqrt( u*u + w*w );
|
|
|
|
if( w != 0 ) alpha = atan2( w, u );
|
|
|
|
if( vxz != 0 ) beta = atan2( v, vxz );
|
|
|
|
mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
|
|
|
|
vc=calcVcas(mach);
|
|
|
|
ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVtrueFpsIC(double tt) {
|
2000-10-28 16:30:30 +00:00
|
|
|
vt=tt;
|
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
|
|
|
lastSpeedSet=setvt;
|
|
|
|
mach=vt/fdmex->GetAtmosphere()->GetSoundSpeed();
|
|
|
|
vc=calcVcas(mach);
|
|
|
|
ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
|
1999-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetMachIC(double tt) {
|
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
|
|
|
mach=tt;
|
|
|
|
lastSpeedSet=setmach;
|
|
|
|
vt=mach*fdmex->GetAtmosphere()->GetSoundSpeed();
|
|
|
|
vc=calcVcas(mach);
|
|
|
|
ve=vt*sqrt(fdmex->GetAtmosphere()->GetDensityRatio());
|
2001-11-12 16:06:29 +00:00
|
|
|
//cout << "Vt: " << vt*fpstokts << " Vc: " << vc*fpstokts << endl;
|
1999-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetClimbRateFpmIC(double tt) {
|
2000-10-09 21:16:21 +00:00
|
|
|
SetClimbRateFpsIC(tt/60.0);
|
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetClimbRateFpsIC(double tt) {
|
1999-08-17 21:20:38 +00:00
|
|
|
|
2000-05-27 05:48:14 +00:00
|
|
|
if(vt > 0.1) {
|
2000-10-09 21:16:21 +00:00
|
|
|
hdot=tt;
|
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
|
|
|
gamma=asin(hdot/vt);
|
2001-03-30 01:04:50 +00:00
|
|
|
sgamma=sin(gamma); cgamma=cos(gamma);
|
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-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetFlightPathAngleRadIC(double tt) {
|
2000-10-02 23:07:30 +00:00
|
|
|
gamma=tt;
|
2001-03-30 01:04:50 +00:00
|
|
|
sgamma=sin(gamma); cgamma=cos(gamma);
|
|
|
|
getTheta();
|
|
|
|
hdot=vt*sgamma;
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetAlphaRadIC(double tt) {
|
2001-03-30 01:04:50 +00:00
|
|
|
alpha=tt;
|
|
|
|
salpha=sin(alpha); calpha=cos(alpha);
|
|
|
|
getTheta();
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetPitchAngleRadIC(double tt) {
|
2001-03-30 01:04:50 +00:00
|
|
|
theta=tt;
|
|
|
|
stheta=sin(theta); ctheta=cos(theta);
|
|
|
|
getAlpha();
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetBetaRadIC(double tt) {
|
2001-03-30 01:04:50 +00:00
|
|
|
beta=tt;
|
|
|
|
sbeta=sin(beta); cbeta=cos(beta);
|
2000-10-02 23:07:30 +00:00
|
|
|
getTheta();
|
2001-10-05 20:19:59 +00:00
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetRollAngleRadIC(double tt) {
|
2001-03-30 01:04:50 +00:00
|
|
|
phi=tt;
|
|
|
|
sphi=sin(phi); cphi=cos(phi);
|
|
|
|
getTheta();
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetTrueHeadingRadIC(double tt) {
|
2001-03-30 01:04:50 +00:00
|
|
|
psi=tt;
|
|
|
|
spsi=sin(psi); cpsi=cos(psi);
|
|
|
|
calcWindUVW();
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetUBodyFpsIC(double tt) {
|
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
|
|
|
u=tt;
|
2001-03-30 01:04:50 +00:00
|
|
|
vt=sqrt(u*u + v*v + w*w);
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
lastSpeedSet=setuvw;
|
1999-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVBodyFpsIC(double tt) {
|
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
|
|
|
v=tt;
|
2001-03-30 01:04:50 +00:00
|
|
|
vt=sqrt(u*u + v*v + w*w);
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
lastSpeedSet=setuvw;
|
1999-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetWBodyFpsIC(double tt) {
|
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
|
|
|
w=tt;
|
2001-03-30 01:04:50 +00:00
|
|
|
vt=sqrt( u*u + v*v + w*w );
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
lastSpeedSet=setuvw;
|
1999-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGInitialCondition::GetUBodyFpsIC(void) {
|
2001-03-30 01:04:50 +00:00
|
|
|
if(lastSpeedSet == setvg )
|
|
|
|
return u;
|
|
|
|
else
|
2001-10-05 20:19:59 +00:00
|
|
|
return vt*calpha*cbeta - uw;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGInitialCondition::GetVBodyFpsIC(void) {
|
2001-03-30 01:04:50 +00:00
|
|
|
if( lastSpeedSet == setvg )
|
|
|
|
return v;
|
2001-10-05 20:19:59 +00:00
|
|
|
else {
|
|
|
|
return vt*sbeta - vw;
|
|
|
|
}
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGInitialCondition::GetWBodyFpsIC(void) {
|
2001-03-30 01:04:50 +00:00
|
|
|
if( lastSpeedSet == setvg )
|
|
|
|
return w;
|
2001-10-05 20:19:59 +00:00
|
|
|
else
|
|
|
|
return vt*salpha*cbeta -ww;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetWindNEDFpsIC(double wN, double wE, double wD ) {
|
2001-03-30 01:04:50 +00:00
|
|
|
wnorth = wN; weast = wE; wdown = wD;
|
2001-10-05 20:19:59 +00:00
|
|
|
lastWindSet = setwned;
|
|
|
|
calcWindUVW();
|
2001-03-30 01:04:50 +00:00
|
|
|
if(lastSpeedSet == setvg)
|
|
|
|
SetVgroundFpsIC(vg);
|
2001-10-05 20:19:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
|
|
|
// positive from left
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetHeadWindKtsIC(double head){
|
2001-11-12 16:06:29 +00:00
|
|
|
whead=head*ktstofps;
|
2001-10-05 20:19:59 +00:00
|
|
|
lastWindSet=setwhc;
|
|
|
|
calcWindUVW();
|
|
|
|
if(lastSpeedSet == setvg)
|
|
|
|
SetVgroundFpsIC(vg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetCrossWindKtsIC(double cross){
|
2001-11-12 16:06:29 +00:00
|
|
|
wcross=cross*ktstofps;
|
2001-10-05 20:19:59 +00:00
|
|
|
lastWindSet=setwhc;
|
|
|
|
calcWindUVW();
|
|
|
|
if(lastSpeedSet == setvg)
|
|
|
|
SetVgroundFpsIC(vg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetWindDownKtsIC(double wD) {
|
2001-10-05 20:19:59 +00:00
|
|
|
wdown=wD;
|
|
|
|
calcWindUVW();
|
|
|
|
if(lastSpeedSet == setvg)
|
|
|
|
SetVgroundFpsIC(vg);
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetWindMagKtsIC(double mag) {
|
2001-11-12 16:06:29 +00:00
|
|
|
wmag=mag*ktstofps;
|
2001-10-05 20:19:59 +00:00
|
|
|
lastWindSet=setwmd;
|
|
|
|
calcWindUVW();
|
|
|
|
if(lastSpeedSet == setvg)
|
|
|
|
SetVgroundFpsIC(vg);
|
|
|
|
}
|
2001-03-30 01:04:50 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
//******************************************************************************
|
2001-03-30 01:04:50 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetWindDirDegIC(double dir) {
|
2001-11-12 16:06:29 +00:00
|
|
|
wdir=dir*degtorad;
|
2001-10-05 20:19:59 +00:00
|
|
|
lastWindSet=setwmd;
|
|
|
|
calcWindUVW();
|
|
|
|
if(lastSpeedSet == setvg)
|
|
|
|
SetVgroundFpsIC(vg);
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
|
|
|
void FGInitialCondition::calcWindUVW(void) {
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
switch(lastWindSet) {
|
|
|
|
case setwmd:
|
|
|
|
wnorth=wmag*cos(wdir);
|
|
|
|
weast=wmag*sin(wdir);
|
|
|
|
break;
|
|
|
|
case setwhc:
|
|
|
|
wnorth=whead*cos(psi) + wcross*cos(psi+M_PI/2);
|
|
|
|
weast=whead*sin(psi) + wcross*sin(psi+M_PI/2);
|
|
|
|
break;
|
2001-12-13 04:48:34 +00:00
|
|
|
case setwned:
|
|
|
|
break;
|
2001-10-05 20:19:59 +00:00
|
|
|
}
|
2001-03-30 01:04:50 +00:00
|
|
|
uw=wnorth*ctheta*cpsi +
|
|
|
|
weast*ctheta*spsi -
|
|
|
|
wdown*stheta;
|
|
|
|
vw=wnorth*( sphi*stheta*cpsi - cphi*spsi ) +
|
|
|
|
weast*( sphi*stheta*spsi + cphi*cpsi ) +
|
|
|
|
wdown*sphi*ctheta;
|
|
|
|
ww=wnorth*(cphi*stheta*cpsi + sphi*spsi) +
|
|
|
|
weast*(cphi*stheta*spsi - sphi*cpsi) +
|
|
|
|
wdown*cphi*ctheta;
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
/* cout << "FGInitialCondition::calcWindUVW: wnorth, weast, wdown "
|
|
|
|
<< wnorth << ", " << weast << ", " << wdown << endl;
|
|
|
|
cout << "FGInitialCondition::calcWindUVW: theta, phi, psi "
|
|
|
|
<< theta << ", " << phi << ", " << psi << endl;
|
|
|
|
cout << "FGInitialCondition::calcWindUVW: uw, vw, ww "
|
|
|
|
<< uw << ", " << vw << ", " << ww << endl; */
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
1999-08-17 21:20:38 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetAltitudeFtIC(double tt) {
|
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
|
|
|
altitude=tt;
|
|
|
|
fdmex->GetPosition()->Seth(altitude);
|
|
|
|
fdmex->GetAtmosphere()->Run();
|
|
|
|
//lets try to make sure the user gets what they intended
|
2000-05-27 05:48:14 +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
|
|
|
switch(lastSpeedSet) {
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
case setned:
|
|
|
|
case setuvw:
|
2000-05-27 05:48:14 +00:00
|
|
|
case setvt:
|
2001-11-12 16:06:29 +00:00
|
|
|
SetVtrueKtsIC(vt*fpstokts);
|
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
|
|
|
break;
|
2000-05-27 05:48:14 +00:00
|
|
|
case setvc:
|
2001-11-12 16:06:29 +00:00
|
|
|
SetVcalibratedKtsIC(vc*fpstokts);
|
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
|
|
|
break;
|
2000-05-27 05:48:14 +00:00
|
|
|
case setve:
|
2001-11-12 16:06:29 +00:00
|
|
|
SetVequivalentKtsIC(ve*fpstokts);
|
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
|
|
|
break;
|
2000-05-27 05:48:14 +00:00
|
|
|
case setmach:
|
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
|
|
|
SetMachIC(mach);
|
|
|
|
break;
|
2001-03-30 01:04:50 +00:00
|
|
|
case setvg:
|
|
|
|
SetVgroundFpsIC(vg);
|
|
|
|
break;
|
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-08-17 21:20:38 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetAltitudeAGLFtIC(double tt) {
|
2000-10-02 23:07:30 +00:00
|
|
|
fdmex->GetPosition()->SetDistanceAGL(tt);
|
|
|
|
altitude=fdmex->GetPosition()->Geth();
|
|
|
|
SetAltitudeFtIC(altitude);
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
void FGInitialCondition::SetSeaLevelRadiusFtIC(double tt) {
|
|
|
|
sea_level_radius = tt;
|
|
|
|
}
|
2001-03-30 01:04:50 +00:00
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
void FGInitialCondition::SetTerrainAltitudeFtIC(double tt) {
|
|
|
|
terrain_altitude=tt;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
2000-10-09 21:16:21 +00:00
|
|
|
|
|
|
|
void FGInitialCondition::calcUVWfromNED(void) {
|
2001-03-30 01:04:50 +00:00
|
|
|
u=vnorth*ctheta*cpsi +
|
|
|
|
veast*ctheta*spsi -
|
|
|
|
vdown*stheta;
|
|
|
|
v=vnorth*( sphi*stheta*cpsi - cphi*spsi ) +
|
|
|
|
veast*( sphi*stheta*spsi + cphi*cpsi ) +
|
|
|
|
vdown*sphi*ctheta;
|
|
|
|
w=vnorth*( cphi*stheta*cpsi + sphi*spsi ) +
|
|
|
|
veast*( cphi*stheta*spsi - sphi*cpsi ) +
|
|
|
|
vdown*cphi*ctheta;
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVnorthFpsIC(double tt) {
|
2000-10-09 21:16:21 +00:00
|
|
|
vnorth=tt;
|
|
|
|
calcUVWfromNED();
|
|
|
|
vt=sqrt(u*u + v*v + w*w);
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
lastSpeedSet=setned;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVeastFpsIC(double tt) {
|
2000-10-09 21:16:21 +00:00
|
|
|
veast=tt;
|
|
|
|
calcUVWfromNED();
|
|
|
|
vt=sqrt(u*u + v*v + w*w);
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
lastSpeedSet=setned;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
2000-10-09 21:16:21 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
void FGInitialCondition::SetVdownFpsIC(double tt) {
|
2000-10-09 21:16:21 +00:00
|
|
|
vdown=tt;
|
|
|
|
calcUVWfromNED();
|
|
|
|
vt=sqrt(u*u + v*v + w*w);
|
|
|
|
SetClimbRateFpsIC(-1*vdown);
|
I tested:
LaRCsim c172 on-ground and in-air starts, reset: all work
UIUC Cessna172 on-ground and in-air starts work as expected, reset
results in an aircraft that is upside down but does not crash FG. I
don't know what it was like before, so it may well be no change.
JSBSim c172 and X15 in-air starts work fine, resets now work (and are
trimmed), on-ground starts do not -- the c172 ends up on its back. I
suspect this is no worse than before.
I did not test:
Balloon (the weather code returns nan's for the atmosphere data --this
is in the weather module and apparently is a linux only bug)
ADA (don't know how)
MagicCarpet (needs work yet)
External (don't know how)
known to be broken:
LaRCsim c172 on-ground starts with a negative terrain altitude (this
happens at KPAO when the scenery is not present). The FDM inits to
about 50 feet AGL and the model falls to the ground. It does stay
upright, however, and seems to be fine once it settles out, FWIW.
To do:
--implement set_Model on the bus
--bring Christian's weather data into JSBSim
-- add default method to bus for updating things like the sin and cos of
latitude (for Balloon, MagicCarpet)
-- lots of cleanup
The files:
src/FDM/flight.cxx
src/FDM/flight.hxx
-- all data members now declared protected instead of private.
-- eliminated all but a small set of 'setters', no change to getters.
-- that small set is declared virtual, the default implementation
provided preserves the old behavior
-- all of the vector data members are now initialized.
-- added busdump() method -- FG_LOG's all the bus data when called,
useful for diagnostics.
src/FDM/ADA.cxx
-- bus data members now directly assigned to
src/FDM/Balloon.cxx
-- bus data members now directly assigned to
-- changed V_equiv_kts to V_calibrated_kts
src/FDM/JSBSim.cxx
src/FDM/JSBSim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with JSBSim specific
logic
-- changed the static FDMExec to a dynamic fdmex (needed so that the
JSBSim object can be deleted when a model change is called for)
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- added logic to bring up FGEngInterface objects and set the RPM and
throttle values.
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim.hxx
-- bus data members now directly assigned to
-- implemented the FGInterface virtual setters with LaRCsim specific
logic, uses LaRCsimIC
-- implemented constructor and destructor, moved some of the logic
formerly in init() to constructor
-- moved default inertias to here from fg_init.cxx
-- eliminated the climb rate calculation. The equivalent, climb_rate =
-1*vdown, is now in copy_from_LaRCsim().
src/FDM/LaRCsimIC.cxx
src/FDM/LaRCsimIC.hxx
-- similar to FGInitialCondition, this class has all the logic needed to
turn data like Vc and Mach into the more fundamental quantities LaRCsim
needs to initialize.
-- put it in src/FDM since it is a class
src/FDM/MagicCarpet.cxx
-- bus data members now directly assigned to
src/FDM/Makefile.am
-- adds LaRCsimIC.hxx and cxx
src/FDM/JSBSim/FGAtmosphere.h
src/FDM/JSBSim/FGDefs.h
src/FDM/JSBSim/FGInitialCondition.cpp
src/FDM/JSBSim/FGInitialCondition.h
src/FDM/JSBSim/JSBSim.cpp
-- changes to accomodate the new bus
src/FDM/LaRCsim/atmos_62.h
src/FDM/LaRCsim/ls_geodesy.h
-- surrounded prototypes with #ifdef __cplusplus ... #endif , functions
here are needed in LaRCsimIC
src/FDM/LaRCsim/c172_main.c
src/FDM/LaRCsim/cherokee_aero.c
src/FDM/LaRCsim/ls_aux.c
src/FDM/LaRCsim/ls_constants.h
src/FDM/LaRCsim/ls_geodesy.c
src/FDM/LaRCsim/ls_geodesy.h
src/FDM/LaRCsim/ls_step.c
src/FDM/UIUCModel/uiuc_betaprobe.cpp
-- changed PI to LS_PI, eliminates preprocessor naming conflict with
weather module
src/FDM/LaRCsim/ls_interface.c
src/FDM/LaRCsim/ls_interface.h
-- added function ls_set_model_dt()
src/Main/bfi.cxx
-- eliminated calls that set the NED speeds to body components. They
are no longer needed and confuse the new bus.
src/Main/fg_init.cxx
-- eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). or set default values. The bus now handles the
defaults and updates itself when the setters are called (for LaRCsim and
JSBSim). A default method for doing this needs to be added to the bus.
-- added fgVelocityInit() to set the speed the user asked for. Both
JSBSim and LaRCsim can now be initialized using any of:
vc,mach, NED components, UVW components.
src/Main/main.cxx
--eliminated call to fgFDMSetGroundElevation, this data is now 'pulled'
onto the bus every update()
src/Main/options.cxx
src/Main/options.hxx
-- added enum to keep track of the speed requested by the user
-- eliminated calls to set NED velocity properties to body speeds, they
are no longer needed.
-- added options for the NED components.
src/Network/garmin.cxx
src/Network/nmea.cxx
--eliminated calls that just brought the bus data up-to-date (e.g.
set_sin_cos_latitude). The bus now updates itself when the setters are
called (for LaRCsim and JSBSim). A default method for doing this needs
to be added to the bus.
-- changed set_V_equiv_kts to set_V_calibrated_kts. set_V_equiv_kts no
longer exists ( get_V_equiv_kts still does, though)
src/WeatherCM/FGLocalWeatherDatabase.cpp
-- commented out the code to put the weather data on the bus, a
different scheme for this is needed.
2000-10-24 00:34:50 +00:00
|
|
|
lastSpeedSet=setned;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
bool FGInitialCondition::getMachFromVcas(double *Mach,double vcas) {
|
2001-03-30 01:04:50 +00:00
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
bool result=false;
|
2001-11-20 22:34:24 +00:00
|
|
|
double guess=1.5;
|
2000-10-02 23:07:30 +00:00
|
|
|
xlo=xhi=0;
|
|
|
|
xmin=0;xmax=50;
|
|
|
|
sfunc=&FGInitialCondition::calcVcas;
|
|
|
|
if(findInterval(vcas,guess)) {
|
|
|
|
if(solve(&mach,vcas))
|
|
|
|
result=true;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
2000-10-02 23:07:30 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
bool FGInitialCondition::getAlpha(void) {
|
|
|
|
bool result=false;
|
2001-11-20 22:34:24 +00:00
|
|
|
double guess=theta-gamma;
|
2002-01-24 15:51:26 +00:00
|
|
|
|
|
|
|
if(vt < 0.01) return 0;
|
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
xlo=xhi=0;
|
|
|
|
xmin=fdmex->GetAircraft()->GetAlphaCLMin();
|
|
|
|
xmax=fdmex->GetAircraft()->GetAlphaCLMax();
|
|
|
|
sfunc=&FGInitialCondition::GammaEqOfAlpha;
|
|
|
|
if(findInterval(0,guess)){
|
|
|
|
if(solve(&alpha,0)){
|
|
|
|
result=true;
|
2001-03-30 01:04:50 +00:00
|
|
|
salpha=sin(alpha);
|
|
|
|
calpha=cos(alpha);
|
2000-10-02 23:07:30 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-05 20:19:59 +00:00
|
|
|
calcWindUVW();
|
2000-10-02 23:07:30 +00:00
|
|
|
return result;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
bool FGInitialCondition::getTheta(void) {
|
|
|
|
bool result=false;
|
2001-11-20 22:34:24 +00:00
|
|
|
double guess=alpha+gamma;
|
2002-01-24 15:51:26 +00:00
|
|
|
|
|
|
|
if(vt < 0.01) return 0;
|
|
|
|
|
2000-10-02 23:07:30 +00:00
|
|
|
xlo=xhi=0;
|
|
|
|
xmin=-89;xmax=89;
|
|
|
|
sfunc=&FGInitialCondition::GammaEqOfTheta;
|
|
|
|
if(findInterval(0,guess)){
|
|
|
|
if(solve(&theta,0)){
|
|
|
|
result=true;
|
2001-03-30 01:04:50 +00:00
|
|
|
stheta=sin(theta);
|
|
|
|
ctheta=cos(theta);
|
2000-10-02 23:07:30 +00:00
|
|
|
}
|
|
|
|
}
|
2001-10-05 20:19:59 +00:00
|
|
|
calcWindUVW();
|
2000-10-02 23:07:30 +00:00
|
|
|
return result;
|
2001-03-30 01:04:50 +00:00
|
|
|
}
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
2000-10-02 23:07:30 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGInitialCondition::GammaEqOfTheta(double Theta) {
|
2001-12-03 22:24:40 +00:00
|
|
|
double a,b,c;
|
2001-11-20 22:34:24 +00:00
|
|
|
double sTheta,cTheta;
|
2001-03-30 01:04:50 +00:00
|
|
|
|
|
|
|
//theta=Theta; stheta=sin(theta); ctheta=cos(theta);
|
|
|
|
sTheta=sin(Theta); cTheta=cos(Theta);
|
|
|
|
calcWindUVW();
|
|
|
|
a=wdown + vt*calpha*cbeta + uw;
|
|
|
|
b=vt*sphi*sbeta + vw*sphi;
|
|
|
|
c=vt*cphi*salpha*cbeta + ww*cphi;
|
|
|
|
return vt*sgamma - ( a*sTheta - (b+c)*cTheta);
|
2000-10-02 23:07:30 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGInitialCondition::GammaEqOfAlpha(double Alpha) {
|
2001-12-03 22:24:40 +00:00
|
|
|
double a,b,c;
|
2001-11-20 22:34:24 +00:00
|
|
|
double sAlpha,cAlpha;
|
2001-03-30 01:04:50 +00:00
|
|
|
sAlpha=sin(Alpha); cAlpha=cos(Alpha);
|
|
|
|
a=wdown + vt*cAlpha*cbeta + uw;
|
|
|
|
b=vt*sphi*sbeta + vw*sphi;
|
|
|
|
c=vt*cphi*sAlpha*cbeta + ww*cphi;
|
|
|
|
|
|
|
|
return vt*sgamma - ( a*stheta - (b+c)*ctheta );
|
2000-10-02 23:07:30 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGInitialCondition::calcVcas(double Mach) {
|
2000-05-02 18:25:30 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double p=fdmex->GetAtmosphere()->GetPressure();
|
|
|
|
double psl=fdmex->GetAtmosphere()->GetPressureSL();
|
|
|
|
double rhosl=fdmex->GetAtmosphere()->GetDensitySL();
|
|
|
|
double pt,A,B,D,vcas;
|
2000-10-02 23:07:30 +00:00
|
|
|
if(Mach < 0) Mach=0;
|
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
|
|
|
if(Mach < 1) //calculate total pressure assuming isentropic flow
|
|
|
|
pt=p*pow((1 + 0.2*Mach*Mach),3.5);
|
|
|
|
else {
|
|
|
|
// shock in front of pitot tube, we'll assume its normal and use
|
|
|
|
// the Rayleigh Pitot Tube Formula, i.e. the ratio of total
|
|
|
|
// pressure behind the shock to the static pressure in front
|
|
|
|
|
|
|
|
|
|
|
|
//the normal shock assumption should not be a bad one -- most supersonic
|
|
|
|
//aircraft place the pitot probe out front so that it is the forward
|
|
|
|
//most point on the aircraft. The real shock would, of course, take
|
|
|
|
//on something like the shape of a rounded-off cone but, here again,
|
|
|
|
//the assumption should be good since the opening of the pitot probe
|
|
|
|
//is very small and, therefore, the effects of the shock curvature
|
|
|
|
//should be small as well. AFAIK, this approach is fairly well accepted
|
|
|
|
//within the aerospace community
|
|
|
|
|
|
|
|
B = 5.76*Mach*Mach/(5.6*Mach*Mach - 0.8);
|
|
|
|
|
|
|
|
// The denominator above is zero for Mach ~ 0.38, for which
|
|
|
|
// we'll never be here, so we're safe
|
|
|
|
|
|
|
|
D = (2.8*Mach*Mach-0.4)*0.4167;
|
|
|
|
pt = p*pow(B,3.5)*D;
|
|
|
|
}
|
|
|
|
|
|
|
|
A = pow(((pt-p)/psl+1),0.28571);
|
|
|
|
vcas = sqrt(7*psl/rhosl*(A-1));
|
2001-11-12 16:06:29 +00:00
|
|
|
//cout << "calcVcas: vcas= " << vcas*fpstokts << " mach= " << Mach << " pressure: " << pt << endl;
|
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 vcas;
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
bool FGInitialCondition::findInterval(double x,double guess) {
|
|
|
|
//void find_interval(inter_params &ip,eqfunc f,double y,double constant, int &flag){
|
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
|
|
|
|
|
|
|
int i=0;
|
|
|
|
bool found=false;
|
2001-11-20 22:34:24 +00:00
|
|
|
double flo,fhi,fguess;
|
|
|
|
double lo,hi,step;
|
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
|
|
|
step=0.1;
|
2000-10-02 23:07:30 +00:00
|
|
|
fguess=(this->*sfunc)(guess)-x;
|
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
|
|
|
lo=hi=guess;
|
|
|
|
do {
|
|
|
|
step=2*step;
|
|
|
|
lo-=step;
|
|
|
|
hi+=step;
|
2000-10-02 23:07:30 +00:00
|
|
|
if(lo < xmin) lo=xmin;
|
|
|
|
if(hi > xmax) hi=xmax;
|
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
|
|
|
i++;
|
2000-10-02 23:07:30 +00:00
|
|
|
flo=(this->*sfunc)(lo)-x;
|
|
|
|
fhi=(this->*sfunc)(hi)-x;
|
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
|
|
|
if(flo*fhi <=0) { //found interval with root
|
|
|
|
found=true;
|
|
|
|
if(flo*fguess <= 0) { //narrow interval down a bit
|
|
|
|
hi=lo+step; //to pass solver interval that is as
|
|
|
|
//small as possible
|
|
|
|
}
|
|
|
|
else if(fhi*fguess <= 0) {
|
|
|
|
lo=hi-step;
|
|
|
|
}
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
2000-10-02 23:07:30 +00:00
|
|
|
//cout << "findInterval: i=" << i << " Lo= " << lo << " Hi= " << hi << endl;
|
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
|
|
|
}
|
|
|
|
while((found == 0) && (i <= 100));
|
2000-10-02 23:07:30 +00:00
|
|
|
xlo=lo;
|
|
|
|
xhi=hi;
|
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 found;
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 01:04:50 +00:00
|
|
|
//******************************************************************************
|
2000-05-02 18:25:30 +00:00
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
bool FGInitialCondition::solve(double *y,double x)
|
2001-10-05 20:19:59 +00:00
|
|
|
{
|
2001-11-20 22:34:24 +00:00
|
|
|
double x1,x2,x3,f1,f2,f3,d,d0;
|
|
|
|
double eps=1E-5;
|
|
|
|
double const relax =0.9;
|
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
|
|
|
int i;
|
|
|
|
bool success=false;
|
2001-03-30 01:04:50 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
//initializations
|
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
|
|
|
d=1;
|
2001-12-03 22:24:40 +00:00
|
|
|
x2 = 0;
|
2001-10-05 20:19:59 +00:00
|
|
|
x1=xlo;x3=xhi;
|
|
|
|
f1=(this->*sfunc)(x1)-x;
|
|
|
|
f3=(this->*sfunc)(x3)-x;
|
|
|
|
d0=fabs(x3-x1);
|
|
|
|
|
|
|
|
//iterations
|
|
|
|
i=0;
|
|
|
|
while ((fabs(d) > eps) && (i < 100)) {
|
|
|
|
d=(x3-x1)/d0;
|
2001-11-27 03:32:24 +00:00
|
|
|
x2 = x1-d*d0*f1/(f3-f1);
|
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
f2=(this->*sfunc)(x2)-x;
|
|
|
|
//cout << "solve x1,x2,x3: " << x1 << "," << x2 << "," << x3 << endl;
|
|
|
|
//cout << " " << f1 << "," << f2 << "," << f3 << endl;
|
|
|
|
|
|
|
|
if(fabs(f2) <= 0.001) {
|
|
|
|
x1=x3=x2;
|
|
|
|
} else if(f1*f2 <= 0.0) {
|
|
|
|
x3=x2;
|
|
|
|
f3=f2;
|
|
|
|
f1=relax*f1;
|
|
|
|
} else if(f2*f3 <= 0) {
|
|
|
|
x1=x2;
|
|
|
|
f1=f2;
|
|
|
|
f3=relax*f3;
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
2001-10-05 20:19:59 +00:00
|
|
|
//cout << i << endl;
|
|
|
|
i++;
|
|
|
|
}//end while
|
|
|
|
if(i < 100) {
|
|
|
|
success=true;
|
|
|
|
*y=x2;
|
|
|
|
}
|
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
|
|
|
|
2001-11-12 16:06:29 +00:00
|
|
|
//cout << "Success= " << success << " Vcas: " << vcas*fpstokts << " Mach: " << x2 << endl;
|
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 success;
|
2000-05-02 18:25:30 +00:00
|
|
|
}
|
2001-03-30 01:04:50 +00:00
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double FGInitialCondition::GetWindDirDegIC(void) {
|
2001-10-05 20:19:59 +00:00
|
|
|
if(weast != 0.0)
|
2001-11-12 16:06:29 +00:00
|
|
|
return atan2(weast,wnorth)*radtodeg;
|
2001-10-05 20:19:59 +00:00
|
|
|
else if(wnorth > 0)
|
|
|
|
return 0.0;
|
|
|
|
else
|
|
|
|
return 180.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//******************************************************************************
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
bool FGInitialCondition::Load(string acpath, string acname, string rstfile)
|
2001-03-30 01:04:50 +00:00
|
|
|
{
|
2001-10-05 20:19:59 +00:00
|
|
|
string resetDef;
|
|
|
|
string token="";
|
|
|
|
|
2001-11-20 22:34:24 +00:00
|
|
|
double temp;
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
# ifndef macintosh
|
2001-11-20 22:34:24 +00:00
|
|
|
resetDef = acpath + "/" + acname + "/" + rstfile + ".xml";
|
2001-10-05 20:19:59 +00:00
|
|
|
# else
|
2001-11-20 22:34:24 +00:00
|
|
|
resetDef = acpath + ";" + acname + ";" + rstfile + ".xml";
|
2001-10-05 20:19:59 +00:00
|
|
|
# endif
|
|
|
|
|
|
|
|
FGConfigFile resetfile(resetDef);
|
2001-12-21 19:20:21 +00:00
|
|
|
if (!resetfile.IsOpen()) {
|
|
|
|
cerr << "Failed to open reset file: " << resetDef << endl;
|
|
|
|
return false;
|
|
|
|
}
|
2001-10-05 20:19:59 +00:00
|
|
|
|
|
|
|
resetfile.GetNextConfigLine();
|
|
|
|
token = resetfile.GetValue();
|
2001-11-20 22:34:24 +00:00
|
|
|
if (token != string("initialize")) {
|
2001-10-05 20:19:59 +00:00
|
|
|
cerr << "The reset file " << resetDef
|
|
|
|
<< " does not appear to be a reset file" << endl;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
resetfile.GetNextConfigLine();
|
|
|
|
resetfile >> token;
|
2001-11-20 22:34:24 +00:00
|
|
|
while (token != string("/initialize") && token != string("EOF")) {
|
2001-10-05 20:19:59 +00:00
|
|
|
if (token == "UBODY" ) { resetfile >> temp; SetUBodyFpsIC(temp); }
|
|
|
|
if (token == "VBODY" ) { resetfile >> temp; SetVBodyFpsIC(temp); }
|
|
|
|
if (token == "WBODY" ) { resetfile >> temp; SetWBodyFpsIC(temp); }
|
|
|
|
if (token == "LATITUDE" ) { resetfile >> temp; SetLatitudeDegIC(temp); }
|
|
|
|
if (token == "LONGITUDE" ) { resetfile >> temp; SetLongitudeDegIC(temp); }
|
|
|
|
if (token == "PHI" ) { resetfile >> temp; SetRollAngleDegIC(temp); }
|
|
|
|
if (token == "THETA" ) { resetfile >> temp; SetPitchAngleDegIC(temp); }
|
|
|
|
if (token == "PSI" ) { resetfile >> temp; SetTrueHeadingDegIC(temp); }
|
|
|
|
if (token == "ALPHA" ) { resetfile >> temp; SetAlphaDegIC(temp); }
|
|
|
|
if (token == "BETA" ) { resetfile >> temp; SetBetaDegIC(temp); }
|
|
|
|
if (token == "GAMMA" ) { resetfile >> temp; SetFlightPathAngleDegIC(temp); }
|
|
|
|
if (token == "ROC" ) { resetfile >> temp; SetClimbRateFpmIC(temp); }
|
|
|
|
if (token == "ALTITUDE" ) { resetfile >> temp; SetAltitudeFtIC(temp); }
|
|
|
|
if (token == "WINDDIR" ) { resetfile >> temp; SetWindDirDegIC(temp); }
|
|
|
|
if (token == "VWIND" ) { resetfile >> temp; SetWindMagKtsIC(temp); }
|
|
|
|
if (token == "HWIND" ) { resetfile >> temp; SetHeadWindKtsIC(temp); }
|
|
|
|
if (token == "XWIND" ) { resetfile >> temp; SetCrossWindKtsIC(temp); }
|
|
|
|
if (token == "VC" ) { resetfile >> temp; SetVcalibratedKtsIC(temp); }
|
|
|
|
if (token == "MACH" ) { resetfile >> temp; SetMachIC(temp); }
|
|
|
|
if (token == "VGROUND" ) { resetfile >> temp; SetVgroundKtsIC(temp); }
|
|
|
|
resetfile >> token;
|
|
|
|
}
|
2001-03-30 01:04:50 +00:00
|
|
|
|
2001-10-05 20:19:59 +00:00
|
|
|
fdmex->RunIC(this);
|
|
|
|
|
|
|
|
return true;
|
2001-12-24 13:54:55 +00:00
|
|
|
}
|
|
|
|
|
2002-03-23 00:29:21 +00:00
|
|
|
//******************************************************************************
|
2001-12-24 13:54:55 +00:00
|
|
|
|
2002-03-20 12:45:02 +00:00
|
|
|
void FGInitialCondition::bind(void){
|
|
|
|
PropertyManager->Tie("ic/vc-kts", this,
|
|
|
|
&FGInitialCondition::GetVcalibratedKtsIC,
|
|
|
|
&FGInitialCondition::SetVcalibratedKtsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/ve-kts", this,
|
|
|
|
&FGInitialCondition::GetVequivalentKtsIC,
|
|
|
|
&FGInitialCondition::SetVequivalentKtsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/vg-kts", this,
|
|
|
|
&FGInitialCondition::GetVgroundKtsIC,
|
|
|
|
&FGInitialCondition::SetVgroundKtsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/vt-kts", this,
|
|
|
|
&FGInitialCondition::GetVtrueKtsIC,
|
|
|
|
&FGInitialCondition::SetVtrueKtsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/mach-norm", this,
|
|
|
|
&FGInitialCondition::GetMachIC,
|
|
|
|
&FGInitialCondition::SetMachIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/roc-fpm", this,
|
|
|
|
&FGInitialCondition::GetClimbRateFpmIC,
|
|
|
|
&FGInitialCondition::SetClimbRateFpmIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/gamma-deg", this,
|
|
|
|
&FGInitialCondition::GetFlightPathAngleDegIC,
|
|
|
|
&FGInitialCondition::SetFlightPathAngleDegIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/alpha-deg", this,
|
|
|
|
&FGInitialCondition::GetAlphaDegIC,
|
|
|
|
&FGInitialCondition::SetAlphaDegIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/beta-deg", this,
|
|
|
|
&FGInitialCondition::GetBetaDegIC,
|
|
|
|
&FGInitialCondition::SetBetaDegIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/theta-deg", this,
|
|
|
|
&FGInitialCondition::GetPitchAngleDegIC,
|
|
|
|
&FGInitialCondition::SetPitchAngleDegIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/phi-deg", this,
|
|
|
|
&FGInitialCondition::GetRollAngleDegIC,
|
|
|
|
&FGInitialCondition::SetRollAngleDegIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/psi-true-deg", this,
|
|
|
|
&FGInitialCondition::GetHeadingDegIC );
|
|
|
|
PropertyManager->Tie("ic/lat-gc-deg", this,
|
|
|
|
&FGInitialCondition::GetLatitudeDegIC,
|
|
|
|
&FGInitialCondition::SetLatitudeDegIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/long-gc-deg", this,
|
|
|
|
&FGInitialCondition::GetLongitudeDegIC,
|
|
|
|
&FGInitialCondition::SetLongitudeDegIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/h-sl-ft", this,
|
|
|
|
&FGInitialCondition::GetAltitudeFtIC,
|
|
|
|
&FGInitialCondition::SetAltitudeFtIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/h-agl-ft", this,
|
|
|
|
&FGInitialCondition::GetAltitudeAGLFtIC,
|
|
|
|
&FGInitialCondition::SetAltitudeAGLFtIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/sea-level-radius-ft", this,
|
|
|
|
&FGInitialCondition::GetSeaLevelRadiusFtIC,
|
|
|
|
&FGInitialCondition::SetSeaLevelRadiusFtIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/terrain-altitude-ft", this,
|
|
|
|
&FGInitialCondition::GetTerrainAltitudeFtIC,
|
|
|
|
&FGInitialCondition::SetTerrainAltitudeFtIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/vg-fps", this,
|
|
|
|
&FGInitialCondition::GetVgroundFpsIC,
|
|
|
|
&FGInitialCondition::SetVgroundFpsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/vt-fps", this,
|
|
|
|
&FGInitialCondition::GetVtrueFpsIC,
|
|
|
|
&FGInitialCondition::SetVtrueFpsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/vw-bx-fps", this,
|
|
|
|
&FGInitialCondition::GetWindUFpsIC);
|
|
|
|
PropertyManager->Tie("ic/vw-by-fps", this,
|
|
|
|
&FGInitialCondition::GetWindVFpsIC);
|
|
|
|
PropertyManager->Tie("ic/vw-bz-fps", this,
|
|
|
|
&FGInitialCondition::GetWindWFpsIC);
|
|
|
|
PropertyManager->Tie("ic/vw-north-fps", this,
|
|
|
|
&FGInitialCondition::GetWindNFpsIC);
|
|
|
|
PropertyManager->Tie("ic/vw-east-fps", this,
|
|
|
|
&FGInitialCondition::GetWindEFpsIC);
|
|
|
|
PropertyManager->Tie("ic/vw-down-fps", this,
|
|
|
|
&FGInitialCondition::GetWindDFpsIC);
|
|
|
|
PropertyManager->Tie("ic/vw-mag-fps", this,
|
|
|
|
&FGInitialCondition::GetWindFpsIC);
|
|
|
|
/* PropertyManager->Tie("ic/vw-dir-deg", this,
|
|
|
|
&FGInitialCondition::GetWindDirDegIC,
|
|
|
|
&FGInitialCondition::SetWindDirDegIC,
|
|
|
|
true); */
|
|
|
|
|
|
|
|
PropertyManager->Tie("ic/roc-fps", this,
|
|
|
|
&FGInitialCondition::GetClimbRateFpsIC,
|
|
|
|
&FGInitialCondition::SetClimbRateFpsIC,
|
|
|
|
true);
|
|
|
|
/* PropertyManager->Tie("ic/u-fps", this,
|
|
|
|
&FGInitialCondition::GetUBodyFpsIC,
|
|
|
|
&FGInitialCondition::SetUBodyFpsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/v-fps", this,
|
|
|
|
&FGInitialCondition::GetVBodyFpsIC,
|
|
|
|
&FGInitialCondition::SetVBodyFpsIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/w-fps", this,
|
|
|
|
&FGInitialCondition::GetWBodyFpsIC,
|
|
|
|
&FGInitialCondition::SetWBodyFpsIC,
|
|
|
|
true); */
|
|
|
|
|
|
|
|
PropertyManager->Tie("ic/gamma-rad", this,
|
|
|
|
&FGInitialCondition::GetFlightPathAngleRadIC,
|
|
|
|
&FGInitialCondition::SetFlightPathAngleRadIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/alpha-rad", this,
|
|
|
|
&FGInitialCondition::GetAlphaRadIC,
|
|
|
|
&FGInitialCondition::SetAlphaRadIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/theta-rad", this,
|
|
|
|
&FGInitialCondition::GetPitchAngleRadIC,
|
|
|
|
&FGInitialCondition::SetPitchAngleRadIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/beta-rad", this,
|
|
|
|
&FGInitialCondition::GetBetaRadIC,
|
|
|
|
&FGInitialCondition::SetBetaRadIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/phi-rad", this,
|
|
|
|
&FGInitialCondition::GetRollAngleRadIC,
|
|
|
|
&FGInitialCondition::SetRollAngleRadIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/psi-true-rad", this,
|
|
|
|
&FGInitialCondition::GetHeadingRadIC);
|
|
|
|
PropertyManager->Tie("ic/lat-gc-rad", this,
|
|
|
|
&FGInitialCondition::GetLatitudeRadIC,
|
|
|
|
&FGInitialCondition::SetLatitudeRadIC,
|
|
|
|
true);
|
|
|
|
PropertyManager->Tie("ic/long-gc-rad", this,
|
|
|
|
&FGInitialCondition::GetLongitudeRadIC,
|
|
|
|
&FGInitialCondition::SetLongitudeRadIC,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
|
2002-03-23 00:29:21 +00:00
|
|
|
//******************************************************************************
|
|
|
|
|
2002-03-20 12:45:02 +00:00
|
|
|
void FGInitialCondition::unbind(void){
|
|
|
|
PropertyManager->Untie("ic/vc-kts");
|
|
|
|
PropertyManager->Untie("ic/ve-kts");
|
|
|
|
PropertyManager->Untie("ic/vg-kts");
|
|
|
|
PropertyManager->Untie("ic/vt-kts");
|
|
|
|
PropertyManager->Untie("ic/mach-norm");
|
|
|
|
PropertyManager->Untie("ic/roc-fpm");
|
|
|
|
PropertyManager->Untie("ic/gamma-deg");
|
|
|
|
PropertyManager->Untie("ic/alpha-deg");
|
|
|
|
PropertyManager->Untie("ic/beta-deg");
|
|
|
|
PropertyManager->Untie("ic/theta-deg");
|
|
|
|
PropertyManager->Untie("ic/phi-deg");
|
|
|
|
PropertyManager->Untie("ic/psi-true-deg");
|
|
|
|
PropertyManager->Untie("ic/lat-gc-deg");
|
|
|
|
PropertyManager->Untie("ic/long-gc-deg");
|
|
|
|
PropertyManager->Untie("ic/h-sl-ft");
|
|
|
|
PropertyManager->Untie("ic/h-agl-ft");
|
|
|
|
PropertyManager->Untie("ic/sea-level-radius-ft");
|
|
|
|
PropertyManager->Untie("ic/terrain-altitude-ft");
|
|
|
|
PropertyManager->Untie("ic/vg-fps");
|
|
|
|
PropertyManager->Untie("ic/vt-fps");
|
|
|
|
PropertyManager->Untie("ic/vw-bx-fps");
|
|
|
|
PropertyManager->Untie("ic/vw-by-fps");
|
|
|
|
PropertyManager->Untie("ic/vw-bz-fps");
|
|
|
|
PropertyManager->Untie("ic/vw-north-fps");
|
|
|
|
PropertyManager->Untie("ic/vw-east-fps");
|
|
|
|
PropertyManager->Untie("ic/vw-down-fps");
|
|
|
|
PropertyManager->Untie("ic/vw-mag-fps");
|
|
|
|
/* PropertyManager->Untie("ic/vw-dir-deg"); */
|
|
|
|
|
|
|
|
PropertyManager->Untie("ic/roc-fps");
|
|
|
|
|
|
|
|
/* PropertyManager->Untie("ic/u-fps");
|
|
|
|
PropertyManager->Untie("ic/v-fps");
|
|
|
|
PropertyManager->Untie("ic/w-fps"); */
|
|
|
|
|
|
|
|
PropertyManager->Untie("ic/gamma-rad");
|
|
|
|
PropertyManager->Untie("ic/alpha-rad");
|
|
|
|
PropertyManager->Untie("ic/theta-rad");
|
|
|
|
PropertyManager->Untie("ic/beta-rad");
|
|
|
|
PropertyManager->Untie("ic/phi-rad");
|
|
|
|
PropertyManager->Untie("ic/psi-true-rad");
|
|
|
|
PropertyManager->Untie("ic/lat-gc-rad");
|
|
|
|
PropertyManager->Untie("ic/long-gc-rad");
|
|
|
|
}
|
2002-03-23 00:29:21 +00:00
|
|
|
|
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
// The bitmasked value choices are as follows:
|
|
|
|
// unset: In this case (the default) JSBSim would only print
|
|
|
|
// out the normally expected messages, essentially echoing
|
|
|
|
// the config files as they are read. If the environment
|
|
|
|
// variable is not set, debug_lvl is set to 1 internally
|
|
|
|
// 0: This requests JSBSim not to output any messages
|
|
|
|
// whatsoever.
|
|
|
|
// 1: This value explicity requests the normal JSBSim
|
|
|
|
// startup messages
|
|
|
|
// 2: This value asks for a message to be printed out when
|
|
|
|
// a class is instantiated
|
|
|
|
// 4: When this value is set, a message is displayed when a
|
|
|
|
// FGModel object executes its Run() method
|
|
|
|
// 8: When this value is set, various runtime state variables
|
|
|
|
// are printed out periodically
|
|
|
|
// 16: When set various parameters are sanity checked and
|
|
|
|
// a message is printed out when they go out of bounds
|
|
|
|
|
|
|
|
void FGInitialCondition::Debug(int from)
|
|
|
|
{
|
|
|
|
if (debug_lvl <= 0) return;
|
|
|
|
|
|
|
|
if (debug_lvl & 1) { // Standard console startup message output
|
|
|
|
}
|
|
|
|
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
|
|
|
|
if (from == 0) cout << "Instantiated: FGInitialCondition" << endl;
|
|
|
|
if (from == 1) cout << "Destroyed: FGInitialCondition" << endl;
|
|
|
|
}
|
|
|
|
if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
|
|
|
|
}
|
|
|
|
if (debug_lvl & 8 ) { // Runtime state variables
|
|
|
|
}
|
|
|
|
if (debug_lvl & 16) { // Sanity checking
|
|
|
|
}
|
|
|
|
if (debug_lvl & 64) {
|
|
|
|
if (from == 0) { // Constructor
|
|
|
|
cout << IdSrc << endl;
|
|
|
|
cout << IdHdr << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|