Renamed JSBsim -> the official JSBSim.
#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 "JSBsim.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 "JSBSim.hxx"
/******************************************************************************/
//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();
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
}
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;
}
set_cos_lat_geocentric( lat_geoc );
set_sin_cos_longitude( lon );
set_sin_cos_latitude( lat_geod );
+
+ set_Climb_Rate(FDMExec.GetPosition()->Gethdot());
return 1;
}
-
-/******************************************************************************/
-
#ifndef _JSBSIM_HXX
#define _JSBSIM_HXX
-#include <FDM/JSBsim/FGFDMExec.h>
+#include <FDM/JSBSim/FGFDMExec.h>
#undef MAX_ENGINES
#include <Aircraft/aircraft.hxx>
// $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
// $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
#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
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);
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
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; }
{
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;
+ }
}
- }
- return Quot;
+
+ } else
+ cerr << "Attempt to divide by zero in method FGMatrix::operator/(const double scalar), object at " << this << endl;
+ return Quot;
}
/******************************************************************************/
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;
}
/******************************************************************************/
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;
+
+
}
/******************************************************************************/
{
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;
}
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;
+}
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);
};
*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;
+ }
}
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 \
testJSBsim_SOURCES = JSBSim.cpp
-testJSBsim_LDADD = libJSBsim.a filtersjb/libfiltersjb.a
+testJSBsim_LDADD = libJSBSim.a filtersjb/libfiltersjb.a
INCLUDES += -I$(top_builddir)/src
-SUBDIRS = Balloon JSBsim LaRCsim UIUCModel
+SUBDIRS = Balloon JSBSim LaRCsim UIUCModel
noinst_LIBRARIES = libFlight.a
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
#include "External.hxx"
#include "flight.hxx"
-#include "JSBsim.hxx"
+#include "JSBSim.hxx"
#include "LaRCsim.hxx"
#include "Balloon.h"