Sync the JSBSim code with the Jon & Tony's devel version.
Renamed JSBsim -> the official JSBSim.
This commit is contained in:
parent
941f27c9a0
commit
64d6f149e0
14 changed files with 89 additions and 52 deletions
|
@ -40,20 +40,20 @@
|
|||
#include <Controls/controls.hxx>
|
||||
#include <Main/options.hxx>
|
||||
|
||||
#include <FDM/JSBsim/FGFDMExec.h>
|
||||
#include <FDM/JSBsim/FGAircraft.h>
|
||||
#include <FDM/JSBsim/FGFCS.h>
|
||||
#include <FDM/JSBsim/FGPosition.h>
|
||||
#include <FDM/JSBsim/FGRotation.h>
|
||||
#include <FDM/JSBsim/FGState.h>
|
||||
#include <FDM/JSBsim/FGTranslation.h>
|
||||
#include <FDM/JSBsim/FGAuxiliary.h>
|
||||
#include <FDM/JSBsim/FGDefs.h>
|
||||
#include <FDM/JSBsim/FGInitialCondition.h>
|
||||
#include <FDM/JSBsim/FGTrimLong.h>
|
||||
#include <FDM/JSBsim/FGAtmosphere.h>
|
||||
#include <FDM/JSBSim/FGFDMExec.h>
|
||||
#include <FDM/JSBSim/FGAircraft.h>
|
||||
#include <FDM/JSBSim/FGFCS.h>
|
||||
#include <FDM/JSBSim/FGPosition.h>
|
||||
#include <FDM/JSBSim/FGRotation.h>
|
||||
#include <FDM/JSBSim/FGState.h>
|
||||
#include <FDM/JSBSim/FGTranslation.h>
|
||||
#include <FDM/JSBSim/FGAuxiliary.h>
|
||||
#include <FDM/JSBSim/FGDefs.h>
|
||||
#include <FDM/JSBSim/FGInitialCondition.h>
|
||||
#include <FDM/JSBSim/FGTrimLong.h>
|
||||
#include <FDM/JSBSim/FGAtmosphere.h>
|
||||
|
||||
#include "JSBsim.hxx"
|
||||
#include "JSBSim.hxx"
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
@ -130,6 +130,7 @@ int FGJSBsim::init( double dt ) {
|
|||
|
||||
//must check > 0, != 0 will give bad result if --notrim set
|
||||
if(current_options.get_trim_mode() > 0) {
|
||||
FDMExec.RunIC(fgic);
|
||||
FG_LOG( FG_FLIGHT, FG_INFO, " Starting trim..." );
|
||||
FGTrimLong *fgtrim=new FGTrimLong(&FDMExec,fgic);
|
||||
fgtrim->DoTrim();
|
||||
|
@ -137,7 +138,7 @@ int FGJSBsim::init( double dt ) {
|
|||
fgtrim->TrimStats();
|
||||
fgtrim->ReportState();
|
||||
|
||||
controls.set_elevator_trim(FDMExec.GetFCS()->GetDeCmd());
|
||||
controls.set_elevator_trim(FDMExec.GetFCS()->GetPitchTrimCmd());
|
||||
controls.set_throttle(FGControls::ALL_ENGINES,FDMExec.GetFCS()->GetThrottleCmd(0)/100);
|
||||
//the trimming routine only knows how to get 1 value for throttle
|
||||
|
||||
|
@ -223,10 +224,10 @@ int FGJSBsim::update( int multiloop ) {
|
|||
}
|
||||
|
||||
double end_elev = get_Altitude();
|
||||
if ( time_step > 0.0 ) {
|
||||
//if ( time_step > 0.0 ) {
|
||||
// feet per second
|
||||
set_Climb_Rate( (end_elev - start_elev) / time_step );
|
||||
}
|
||||
// set_Climb_Rate( (end_elev - start_elev) / time_step );
|
||||
//}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -310,8 +311,7 @@ int FGJSBsim::copy_from_JSBsim() {
|
|||
set_sin_cos_longitude( lon );
|
||||
set_sin_cos_latitude( lat_geod );
|
||||
|
||||
set_Climb_Rate(FDMExec.GetPosition()->Gethdot());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#ifndef _JSBSIM_HXX
|
||||
#define _JSBSIM_HXX
|
||||
|
||||
#include <FDM/JSBsim/FGFDMExec.h>
|
||||
#include <FDM/JSBSim/FGFDMExec.h>
|
||||
#undef MAX_ENGINES
|
||||
|
||||
#include <Aircraft/aircraft.hxx>
|
||||
|
|
|
@ -51,8 +51,9 @@ FGControls::~FGControls() {
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.13 2000/07/06 19:02:46 curt
|
||||
// Updates from Jon's official CVS tree.
|
||||
// Revision 1.14 2000/07/24 15:26:06 curt
|
||||
// Sync the JSBSim code with the Jon & Tony's devel version.
|
||||
// Renamed JSBsim -> the official JSBSim.
|
||||
//
|
||||
// Revision 1.3 2000/04/26 10:55:57 jsb
|
||||
// Made changes as required by Curt to install JSBSim into FGFS
|
||||
|
|
|
@ -177,8 +177,9 @@ extern FGControls controls;
|
|||
|
||||
|
||||
// $Log$
|
||||
// Revision 1.12 2000/07/06 19:02:46 curt
|
||||
// Updates from Jon's official CVS tree.
|
||||
// Revision 1.13 2000/07/24 15:26:06 curt
|
||||
// Sync the JSBSim code with the Jon & Tony's devel version.
|
||||
// Renamed JSBsim -> the official JSBSim.
|
||||
//
|
||||
// Revision 1.6 2000/06/03 13:59:52 jsb
|
||||
// Changes for compatibility with MSVC
|
||||
|
|
|
@ -53,6 +53,7 @@ SENTRY
|
|||
#define DEGTORAD 1.745329E-2
|
||||
#define KTSTOFPS 1.68781
|
||||
#define FPSTOKTS 0.592484
|
||||
#define INCHTOFT 0.08333333
|
||||
#define NEEDED_CFG_VERSION "1.30"
|
||||
|
||||
#define HPTOFTLBSSEC 550
|
||||
|
|
|
@ -163,13 +163,13 @@ void FGInitialCondition::SetAltitudeFtIC(float tt) {
|
|||
|
||||
switch(lastSpeedSet) {
|
||||
case setvt:
|
||||
SetVtrueKtsIC(vt);
|
||||
SetVtrueKtsIC(vt*FPSTOKTS);
|
||||
break;
|
||||
case setvc:
|
||||
SetVcalibratedKtsIC(vc);
|
||||
SetVcalibratedKtsIC(vc*FPSTOKTS);
|
||||
break;
|
||||
case setve:
|
||||
SetVequivalentKtsIC(ve);
|
||||
SetVequivalentKtsIC(ve*FPSTOKTS);
|
||||
break;
|
||||
case setmach:
|
||||
SetMachIC(mach);
|
||||
|
|
|
@ -63,7 +63,7 @@ INCLUDES
|
|||
CLASS DECLARATION
|
||||
*******************************************************************************/
|
||||
|
||||
typedef enum { none,setvt, setvc, setve, setmach } speedset;
|
||||
typedef enum { setvt, setvc, setve, setmach } speedset;
|
||||
|
||||
/* USAGE NOTES
|
||||
With a valid object of FGFDMExec and an aircraft model loaded
|
||||
|
@ -140,6 +140,7 @@ public:
|
|||
inline void SetPitchAngleRadIC(float tt) { theta=tt; alpha=theta-gamma; }
|
||||
|
||||
inline void SetBetaDegIC(float tt) { beta=tt*DEGTORAD; }
|
||||
inline void SetBetaRadIC(float tt) { beta=tt; }
|
||||
|
||||
inline void SetRollAngleDegIC(float tt) { phi=tt*DEGTORAD; }
|
||||
inline void SetRollAngleRadIC(float tt) { phi=tt; }
|
||||
|
|
|
@ -337,11 +337,15 @@ FGMatrix FGMatrix::operator/(const double scalar)
|
|||
{
|
||||
FGMatrix Quot(Rows(), Cols());
|
||||
|
||||
for (unsigned int i=1; i<=Rows(); i++) {
|
||||
for (unsigned int j=1; j<=Cols(); j++) {
|
||||
Quot(i,j) = data[i][j]/scalar;
|
||||
if(scalar != 0) {
|
||||
for (unsigned int i=1; i<=Rows(); i++) {
|
||||
for (unsigned int j=1; j<=Cols(); j++) {
|
||||
Quot(i,j) = data[i][j]/scalar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else
|
||||
cerr << "Attempt to divide by zero in method FGMatrix::operator/(const double scalar), object at " << this << endl;
|
||||
return Quot;
|
||||
}
|
||||
|
||||
|
@ -349,11 +353,15 @@ FGMatrix FGMatrix::operator/(const double scalar)
|
|||
|
||||
void FGMatrix::operator/=(const double scalar)
|
||||
{
|
||||
for (unsigned int i=1; i<=Rows(); i++) {
|
||||
for (unsigned int j=1; j<=Cols(); j++) {
|
||||
data[i][j]/=scalar;
|
||||
|
||||
if(scalar != 0) {
|
||||
for (unsigned int i=1; i<=Rows(); i++) {
|
||||
for (unsigned int j=1; j<=Cols(); j++) {
|
||||
data[i][j]/=scalar;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
cerr << "Attempt to divide by zero in method FGMatrix::operator/=(const double scalar), object " << this << endl;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -512,10 +520,16 @@ FGColumnVector FGColumnVector::operator-(const FGColumnVector& V)
|
|||
FGColumnVector FGColumnVector::operator/(const double scalar)
|
||||
{
|
||||
FGColumnVector Quotient(Rows());
|
||||
if(scalar != 0) {
|
||||
|
||||
for (unsigned int i=1; i<=Rows(); i++) Quotient(i) = data[i][1] / scalar;
|
||||
|
||||
for (unsigned int i=1; i<=Rows(); i++) Quotient(i) = data[i][1] / scalar;
|
||||
|
||||
} else
|
||||
cerr << "Attempt to divide by zero in method FGColumnVector::operator/(const double scalar), object " << this << endl;
|
||||
return Quotient;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -554,9 +568,11 @@ FGColumnVector FGColumnVector::Normalize(void)
|
|||
{
|
||||
double Mag = Magnitude();
|
||||
|
||||
for (unsigned int i=1; i<=Rows(); i++)
|
||||
for (unsigned int j=1; j<=Cols(); j++)
|
||||
data[i][j] = data[i][j]/Mag;
|
||||
if (Mag != 0) {
|
||||
for (unsigned int i=1; i<=Rows(); i++)
|
||||
for (unsigned int j=1; j<=Cols(); j++)
|
||||
data[i][j] = data[i][j]/Mag;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -169,5 +169,17 @@ void FGPosition::GetState(void) {
|
|||
vVel = State->GetTb2l()*vUVW;
|
||||
|
||||
b = Aircraft->GetWingSpan();
|
||||
|
||||
}
|
||||
|
||||
void FGPosition::Seth(double tt) {
|
||||
h=tt;
|
||||
Radius = h + SeaLevelRadius;
|
||||
DistanceAGL = Radius - RunwayRadius; // Geocentric
|
||||
}
|
||||
|
||||
void FGPosition::SetDistanceAGL(double tt) {
|
||||
DistanceAGL=tt;
|
||||
Radius = RunwayRadius + DistanceAGL;
|
||||
h = Radius - SeaLevelRadius;
|
||||
}
|
||||
|
|
|
@ -88,10 +88,10 @@ public:
|
|||
void SetvVel(const FGColumnVector& v) { vVel = v; }
|
||||
void SetLatitude(float tt) { Latitude = tt; }
|
||||
void SetLongitude(double tt) { Longitude = tt; }
|
||||
void Seth(double tt) { h = tt; }
|
||||
void Seth(double tt);
|
||||
void SetRunwayRadius(double tt) { RunwayRadius = tt; }
|
||||
void SetSeaLevelRadius(double tt) { SeaLevelRadius = tt;}
|
||||
void SetDistanceAGL(double tt) { DistanceAGL = tt; }
|
||||
void SetDistanceAGL(double tt);
|
||||
|
||||
bool Run(void);
|
||||
};
|
||||
|
|
|
@ -58,7 +58,12 @@ FGTank::FGTank(FGConfigFile* AC_cfg)
|
|||
*AC_cfg >> Capacity; // pounds (amount it can hold)
|
||||
*AC_cfg >> Contents; // pounds (amount it is holding)
|
||||
Selected = true;
|
||||
PctFull = 100.0*Contents/Capacity; // percent full; 0 to 100.0
|
||||
if(Capacity != 0)
|
||||
PctFull = 100.0*Contents/Capacity; // percent full; 0 to 100.0
|
||||
else {
|
||||
Contents=0;
|
||||
PctFull=0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ SUBDIRS = filtersjb
|
|||
|
||||
EXTRA_DIST = JSBSim.cpp Makefile.solo
|
||||
|
||||
noinst_LIBRARIES = libJSBsim.a
|
||||
noinst_LIBRARIES = libJSBSim.a
|
||||
|
||||
libJSBsim_a_SOURCES = FGAircraft.cpp FGAircraft.h \
|
||||
libJSBSim_a_SOURCES = FGAircraft.cpp FGAircraft.h \
|
||||
FGAtmosphere.cpp FGAtmosphere.h \
|
||||
FGAuxiliary.cpp FGAuxiliary.h \
|
||||
FGCoefficient.cpp FGCoefficient.h \
|
||||
|
@ -32,7 +32,7 @@ noinst_PROGRAMS = testJSBsim
|
|||
|
||||
testJSBsim_SOURCES = JSBSim.cpp
|
||||
|
||||
testJSBsim_LDADD = libJSBsim.a filtersjb/libfiltersjb.a
|
||||
testJSBsim_LDADD = libJSBSim.a filtersjb/libfiltersjb.a
|
||||
|
||||
INCLUDES += -I$(top_builddir)/src
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS = Balloon JSBsim LaRCsim UIUCModel
|
||||
SUBDIRS = Balloon JSBSim LaRCsim UIUCModel
|
||||
|
||||
noinst_LIBRARIES = libFlight.a
|
||||
|
||||
|
@ -6,7 +6,7 @@ libFlight_a_SOURCES = \
|
|||
Balloon.cxx Balloon.h \
|
||||
External.cxx External.hxx \
|
||||
flight.cxx flight.hxx \
|
||||
JSBsim.cxx JSBsim.hxx \
|
||||
JSBSim.cxx JSBSim.hxx \
|
||||
LaRCsim.cxx LaRCsim.hxx \
|
||||
MagicCarpet.cxx MagicCarpet.hxx
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "External.hxx"
|
||||
#include "flight.hxx"
|
||||
#include "JSBsim.hxx"
|
||||
#include "JSBSim.hxx"
|
||||
#include "LaRCsim.hxx"
|
||||
#include "Balloon.h"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue