1
0
Fork 0
flightgear/src/FDM/JSBSim/FGInitialCondition.h

297 lines
11 KiB
C
Raw Normal View History

1999-08-17 21:20:38 +00:00
/*******************************************************************************
1999-08-17 21:20:38 +00:00
Header: FGInitialCondition.h
Author: Tony Peden
Date started: 7/1/99
1999-08-17 21:20:38 +00:00
------------- Copyright (C) 1999 Anthony K. Peden (apeden@earthlink.net) -------------
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.
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.
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.
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.
1999-08-17 21:20:38 +00:00
HISTORY
--------------------------------------------------------------------------------
7/1/99 TP Created
1999-08-17 21:20:38 +00:00
FUNCTIONAL DESCRIPTION
--------------------------------------------------------------------------------
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.
1999-08-17 21:20:38 +00:00
********************************************************************************
SENTRY
*******************************************************************************/
#ifndef FGINITIALCONDITION_H
#define FGINITIALCONDITION_H
/*******************************************************************************
INCLUDES
*******************************************************************************/
#include "FGFDMExec.h"
#include "FGJSBBase.h"
1999-08-17 21:20:38 +00:00
#include "FGAtmosphere.h"
#include "FGMatrix33.h"
#include "FGColumnVector3.h"
#include "FGColumnVector4.h"
1999-08-17 21:20:38 +00:00
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DEFINITIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
#define ID_INITIALCONDITION "$Id$"
1999-08-17 21:20:38 +00:00
2001-03-30 01:04:50 +00:00
typedef enum { setvt, setvc, setve, setmach, setuvw, setned, setvg } speedset;
typedef enum { setwned, setwmd, setwhc } windset;
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
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
FORWARD DECLARATIONS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DOCUMENTATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/** Takes 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.
USAGE NOTES
2000-10-02 23:07:30 +00:00
With a valid object of FGFDMExec and an aircraft model loaded
FGInitialCondition fgic=new FGInitialCondition(FDMExec);
fgic->SetVcalibratedKtsIC()
fgic->SetAltitudeFtIC();
.
.
.
//to directly into Run
FDMExec->GetState()->Initialize(fgic)
delete fgic;
FDMExec->Run()
//or to loop the sim w/o integrating
FDMExec->RunIC(fgic)
Speed:
Since vc, ve, vt, and mach all represent speed, the remaining
three are recalculated each time one of them is set (using the
current altitude). The most recent speed set is remembered so
that if and when altitude is reset, the last set speed is used
to recalculate the remaining three. Setting any of the body
components forces a recalculation of vt and vt then becomes the
most recent speed set.
Alpha,Gamma, and Theta:
This class assumes that it will be used to set up the sim for a
steady, zero pitch rate condition. Since any two of those angles
specifies the third gamma (flight path angle) is favored when setting
alpha and theta and alpha is favored when setting gamma. i.e.
set alpha : recalculate theta using gamma as currently set
set theta : recalculate alpha using gamma as currently set
set gamma : recalculate theta using alpha as currently set
The idea being that gamma is most interesting to pilots (since it
is indicative of climb rate).
Setting climb rate is, for the purpose of this discussion,
considered equivalent to setting gamma.
@author Anthony K. Peden
@version $Id$
*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CLASS DECLARATION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
class FGInitialCondition : public FGJSBBase
{
public:
/// Constructor
FGInitialCondition(FGFDMExec *fdmex);
/// Destructor
2001-03-30 01:04:50 +00:00
~FGInitialCondition();
2001-11-20 22:34:24 +00:00
void SetVcalibratedKtsIC(double tt);
void SetVequivalentKtsIC(double tt);
inline void SetVtrueKtsIC(double tt) { SetVtrueFpsIC(tt*ktstofps); }
inline void SetVgroundKtsIC(double tt) { SetVgroundFpsIC(tt*ktstofps); }
void SetMachIC(double tt);
2001-11-20 22:34:24 +00:00
inline void SetAlphaDegIC(double tt) { SetAlphaRadIC(tt*degtorad); }
inline void SetBetaDegIC(double tt) { SetBetaRadIC(tt*degtorad);}
2001-11-20 22:34:24 +00:00
inline void SetPitchAngleDegIC(double tt) { SetPitchAngleRadIC(tt*degtorad); }
inline void SetRollAngleDegIC(double tt) { SetRollAngleRadIC(tt*degtorad);}
inline void SetTrueHeadingDegIC(double tt){ SetTrueHeadingRadIC(tt*degtorad); }
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
void SetClimbRateFpmIC(double tt);
inline void SetFlightPathAngleDegIC(double tt) { SetFlightPathAngleRadIC(tt*degtorad); }
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
void SetAltitudeFtIC(double tt);
void SetAltitudeAGLFtIC(double tt);
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 SetSeaLevelRadiusFtIC(double tt);
void SetTerrainAltitudeFtIC(double tt);
2001-11-20 22:34:24 +00:00
inline void SetLatitudeDegIC(double tt) { latitude=tt*degtorad; }
inline void SetLongitudeDegIC(double tt) { longitude=tt*degtorad; }
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
inline double GetVcalibratedKtsIC(void) { return vc*fpstokts; }
inline double GetVequivalentKtsIC(void) { return ve*fpstokts; }
inline double GetVgroundKtsIC(void) { return vg*fpstokts; }
inline double GetVtrueKtsIC(void) { return vt*fpstokts; }
inline double GetMachIC(void) { return mach; }
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
inline double GetClimbRateFpmIC(void) { return hdot*60; }
inline double GetFlightPathAngleDegIC(void) { return gamma*radtodeg; }
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
inline double GetAlphaDegIC(void) { return alpha*radtodeg; }
inline double GetBetaDegIC(void) { return beta*radtodeg; }
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
inline double GetPitchAngleDegIC(void) { return theta*radtodeg; }
inline double GetRollAngleDegIC(void) { return phi*radtodeg; }
inline double GetHeadingDegIC(void) { return psi*radtodeg; }
2001-11-20 22:34:24 +00:00
inline double GetLatitudeDegIC(void) { return latitude*radtodeg; }
inline double GetLongitudeDegIC(void) { return longitude*radtodeg; }
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
inline double GetAltitudeFtIC(void) { return altitude; }
inline double GetAltitudeAGLFtIC(void) { return altitude - terrain_altitude; }
2000-11-03 23:02:47 +00:00
2001-11-20 22:34:24 +00:00
inline double GetSeaLevelRadiusFtIC(void) { return sea_level_radius; }
inline double GetTerrainAltitudeFtIC(void) { return terrain_altitude; }
void SetVgroundFpsIC(double tt);
void SetVtrueFpsIC(double tt);
void SetUBodyFpsIC(double tt);
void SetVBodyFpsIC(double tt);
void SetWBodyFpsIC(double tt);
void SetVnorthFpsIC(double tt);
void SetVeastFpsIC(double tt);
void SetVdownFpsIC(double tt);
2001-11-20 22:34:24 +00:00
void SetWindNEDFpsIC(double wN, double wE, double wD);
2001-11-20 22:34:24 +00:00
void SetWindMagKtsIC(double mag);
void SetWindDirDegIC(double dir);
2001-11-20 22:34:24 +00:00
void SetHeadWindKtsIC(double head);
void SetCrossWindKtsIC(double cross);// positive from left
2001-11-20 22:34:24 +00:00
void SetWindDownKtsIC(double wD);
2001-11-20 22:34:24 +00:00
void SetClimbRateFpsIC(double tt);
inline double GetVgroundFpsIC(void) { return vg; }
inline double GetVtrueFpsIC(void) { return vt; }
inline double GetWindUFpsIC(void) { return uw; }
inline double GetWindVFpsIC(void) { return vw; }
inline double GetWindWFpsIC(void) { return ww; }
inline double GetWindNFpsIC(void) { return wnorth; }
inline double GetWindEFpsIC(void) { return weast; }
inline double GetWindDFpsIC(void) { return wdown; }
inline double GetWindFpsIC(void) { return sqrt(wnorth*wnorth + weast*weast); }
double GetWindDirDegIC(void);
inline double GetClimbRateFpsIC(void) { return hdot; }
double GetUBodyFpsIC(void);
double GetVBodyFpsIC(void);
double GetWBodyFpsIC(void);
void SetFlightPathAngleRadIC(double tt);
void SetAlphaRadIC(double tt);
void SetPitchAngleRadIC(double tt);
void SetBetaRadIC(double tt);
void SetRollAngleRadIC(double tt);
void SetTrueHeadingRadIC(double tt);
inline void SetLatitudeRadIC(double tt) { latitude=tt; }
inline void SetLongitudeRadIC(double tt) { longitude=tt; }
inline double GetFlightPathAngleRadIC(void) { return gamma; }
inline double GetAlphaRadIC(void) { return alpha; }
inline double GetPitchAngleRadIC(void) { return theta; }
inline double GetBetaRadIC(void) { return beta; }
inline double GetRollAngleRadIC(void) { return phi; }
inline double GetHeadingRadIC(void) { return psi; }
inline double GetLatitudeRadIC(void) { return latitude; }
inline double GetLongitudeRadIC(void) { return longitude; }
inline double GetThetaRadIC(void) { return theta; }
inline double GetPhiRadIC(void) { return phi; }
inline double GetPsiRadIC(void) { return psi; }
2001-03-30 01:04:50 +00:00
inline speedset GetSpeedSet(void) { return lastSpeedSet; }
inline windset GetWindSet(void) { return lastWindSet; }
2001-11-20 22:34:24 +00:00
bool Load(string acpath, string acname, string rstname);
private:
2001-11-20 22:34:24 +00:00
double vt,vc,ve,vg;
double mach;
double altitude,hdot;
double latitude,longitude;
double u,v,w;
double uw,vw,ww;
double vnorth,veast,vdown;
double wnorth,weast,wdown;
double whead, wcross, wdir, wmag;
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
double sea_level_radius;
double terrain_altitude;
double radius_to_vehicle;
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
double alpha, beta, theta, phi, psi, gamma;
double salpha,sbeta,stheta,sphi,spsi,sgamma;
double calpha,cbeta,ctheta,cphi,cpsi,cgamma;
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
double xlo, xhi,xmin,xmax;
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
typedef double (FGInitialCondition::*fp)(double x);
2000-10-02 23:07:30 +00:00
fp sfunc;
speedset lastSpeedSet;
windset lastWindSet;
FGFDMExec *fdmex;
2001-03-30 01:04:50 +00:00
2000-10-02 23:07:30 +00:00
bool getAlpha(void);
bool getTheta(void);
2001-11-20 22:34:24 +00:00
bool getMachFromVcas(double *Mach,double vcas);
2001-03-30 01:04:50 +00:00
2001-11-20 22:34:24 +00:00
double GammaEqOfTheta(double Theta);
double GammaEqOfAlpha(double Alpha);
double calcVcas(double Mach);
void calcUVWfromNED(void);
2001-03-30 01:04:50 +00:00
void calcWindUVW(void);
2001-11-20 22:34:24 +00:00
bool findInterval(double x,double guess);
bool solve(double *y, double x);
1999-08-17 21:20:38 +00:00
};
#endif
2001-03-30 01:04:50 +00:00