]> git.mxchange.org Git - flightgear.git/commitdiff
JSBSim updates.
authorcurt <curt>
Tue, 25 Jul 2000 21:41:59 +0000 (21:41 +0000)
committercurt <curt>
Tue, 25 Jul 2000 21:41:59 +0000 (21:41 +0000)
Updates to put more internal JSBSim values on the "bus".

src/FDM/JSBSim.cxx
src/FDM/JSBSim/FGAircraft.h
src/FDM/JSBSim/FGAuxiliary.cpp
src/FDM/JSBSim/FGAuxiliary.h
src/FDM/JSBSim/FGPosition.cpp
src/FDM/JSBSim/FGPosition.h
src/FDM/flight.hxx
src/Main/fg_init.cxx

index 7216e05945f2a765fa11b6fb93f11a8413f0ed34..b3303625e1b8d3a62b561cadcbdf9543b396620e 100644 (file)
@@ -89,7 +89,7 @@ int FGJSBsim::init( double dt ) {
 
   FDMExec.GetAtmosphere()->UseInternal();
 
-  FG_LOG( FG_FLIGHT, FG_INFO, "  Initializing JSBsim with:" );
+  FG_LOG( FG_FLIGHT, FG_INFO, "  Initializing JSBSim with:" );
 
   FGInitialCondition *fgic = new FGInitialCondition(&FDMExec);
   fgic->SetAltitudeFtIC(get_Altitude());
@@ -157,7 +157,7 @@ int FGJSBsim::init( double dt ) {
 
   FG_LOG( FG_FLIGHT, FG_INFO, "  set dt" );
 
-  FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing JSBsim" );
+  FG_LOG( FG_FLIGHT, FG_INFO, "Finished initializing JSBSim" );
 
   copy_from_JSBsim();
 
@@ -186,8 +186,8 @@ int FGJSBsim::update( int multiloop ) {
   FDMExec.GetFCS()->SetPitchTrimCmd(controls.get_elevator_trim());
   FDMExec.GetFCS()->SetDrCmd( controls.get_rudder());
   FDMExec.GetFCS()->SetDfCmd( controls.get_flaps() );
-  FDMExec.GetFCS()->SetDsbCmd( 0.0 );
-  FDMExec.GetFCS()->SetDspCmd( 0.0 );
+  FDMExec.GetFCS()->SetDsbCmd( 0.0 ); //speedbrakes
+  FDMExec.GetFCS()->SetDspCmd( 0.0 ); //spoilers
   FDMExec.GetFCS()->SetThrottleCmd( FGControls::ALL_ENGINES,
                                     controls.get_throttle( 0 ) * 100.0 );
 
@@ -246,23 +246,65 @@ int FGJSBsim::copy_to_JSBsim() {
 
 int FGJSBsim::copy_from_JSBsim() {
 
+  set_Inertias( FDMExec.GetAircraft()->GetMass(),
+                FDMExec.GetAircraft()->GetIxx(),
+                FDMExec.GetAircraft()->GetIyy(),
+                FDMExec.GetAircraft()->GetIzz(),
+                FDMExec.GetAircraft()->GetIxz() );
+  
+  set_CG_Position ( FDMExec.GetAircraft()->GetXYZcg()(1),
+                    FDMExec.GetAircraft()->GetXYZcg()(2),
+                    FDMExec.GetAircraft()->GetXYZcg()(3) );
+  
+  set_Accels_Body ( FDMExec.GetTranslation()->GetUVWdot()(1),
+                    FDMExec.GetTranslation()->GetUVWdot()(2),
+                    FDMExec.GetTranslation()->GetUVWdot()(3) );
+  
+  set_Accels_CG_Body ( FDMExec.GetTranslation()->GetUVWdot()(1),
+                       FDMExec.GetTranslation()->GetUVWdot()(2),
+                       FDMExec.GetTranslation()->GetUVWdot()(3) );
+  
+  set_Accels_CG_Body_N ( FDMExec.GetTranslation()->GetNcg()(1),
+                         FDMExec.GetTranslation()->GetNcg()(2),
+                         FDMExec.GetTranslation()->GetNcg()(3) );
+  
+  set_Accels_Pilot_Body( FDMExec.GetAuxiliary()->GetPilotAccel()(1),
+                         FDMExec.GetAuxiliary()->GetPilotAccel()(2),
+                         FDMExec.GetAuxiliary()->GetPilotAccel()(3) );
+  
+  set_Accels_Pilot_Body_N( FDMExec.GetAuxiliary()->GetNpilot()(1),
+                           FDMExec.GetAuxiliary()->GetNpilot()(2),
+                           FDMExec.GetAuxiliary()->GetNpilot()(3) );
+  
+                           
+  
+  set_Nlf( FDMExec.GetAircraft()->GetNlf());                       
+  
+  
+   
   // Velocities
 
   set_Velocities_Local( FDMExec.GetPosition()->GetVn(),
                         FDMExec.GetPosition()->GetVe(),
                         FDMExec.GetPosition()->GetVd() );
 
+  set_Velocities_Wind_Body( FDMExec.GetTranslation()->GetUVW()(1),
+                            FDMExec.GetTranslation()->GetUVW()(2),
+                            FDMExec.GetTranslation()->GetUVW()(3)  );
+  
   set_V_equiv_kts( FDMExec.GetAuxiliary()->GetVequivalentKTS() );
 
   //set_V_calibrated( FDMExec.GetAuxiliary()->GetVcalibratedFPS() );
 
   set_V_calibrated_kts( FDMExec.GetAuxiliary()->GetVcalibratedKTS() );
+  
+  set_V_ground_speed ( FDMExec.GetPosition()->GetVground() );
 
   set_Omega_Body( FDMExec.GetState()->GetParameter(FG_ROLLRATE),
                   FDMExec.GetState()->GetParameter(FG_PITCHRATE),
                   FDMExec.GetState()->GetParameter(FG_YAWRATE) );
 
-  set_Euler_Rates( FDMExec.GetRotation()->Getphi(),
+  /* HUH!?! */ set_Euler_Rates( FDMExec.GetRotation()->Getphi(),
                    FDMExec.GetRotation()->Gettht(),
                    FDMExec.GetRotation()->Getpsi() );
 
index e71e47850cfdf53234ee4db3cf75c2c6bf2ee628..7d7a6021fe09c6eaa53f99541383d9ed2502dc42 100644 (file)
@@ -158,6 +158,7 @@ public:
   inline unsigned int GetNumEngines(void) { return numEngines; }
   inline FGColumnVector GetXYZcg(void) { return vXYZcg; }
   inline FGColumnVector GetXYZrp(void) { return vXYZrp; }
+  inline FGColumnVector GetXYZep(void) { return vXYZep; }
   inline float GetNlf(void) { return nlf; }
   inline float GetAlphaCLMax(void) { return alphaclmax; }
   inline float GetAlphaCLMin(void) { return alphaclmin; }
index 3b9f400323947a30f9a86b8630316dd6a3a356ed..618fbc74dfec2ffb3294ef52e16ee554054a3522 100644 (file)
@@ -50,6 +50,7 @@ INCLUDES
 #include "FGAircraft.h"
 #include "FGPosition.h"
 #include "FGOutput.h"
+#include "FGMatrix.h"
 
 /*******************************************************************************
 ************************************ CODE **************************************
@@ -90,6 +91,8 @@ bool FGAuxiliary::Run() {
     A = pow(((pt-p)/psl+1),0.28571);
     vcas = sqrt(7*psl/rhosl*(A-1));
     veas = sqrt(2*qbar/rhosl);
+    
+    vPilotAccel = Translation->GetUVWdot() + Aircraft->GetXYZep() * Rotation->GetPQRdot();
 
 
 
index 2d64cd68ee9a6212539d9f2ce724c4ae8aaa0a21..f3b6e87de9a7d03843d663dacfaa05a118d131ba 100644 (file)
@@ -39,6 +39,7 @@ SENTRY
 INCLUDES
 *******************************************************************************/
 #include "FGModel.h"
+#include "FGMatrix.h"
 
 /*******************************************************************************
 DEFINES
@@ -60,9 +61,11 @@ public:
   inline float GetVcalibratedKTS(void) { return vcas*FPSTOKTS; }
   inline float GetVequivalentFPS(void) { return veas; }
   inline float GetVequivalentKTS(void) { return veas*FPSTOKTS; }
-
-
-
+  
+  inline FGColumnVector GetPilotAccel(void) { return vPilotAccel; }
+  inline FGColumnVector GetNpilot(void) { return vPilotAccel*INVGRAVITY; }
+  
 protected:
 
 private:
@@ -76,6 +79,10 @@ private:
   //if a general freestream total is needed, e-mail Tony Peden
   // (apeden@earthlink.net) or you can add it your self using the
   // isentropic flow equations
+  
+  
+  FGColumnVector vPilotAccel;
 
   void GetState(void);
 };
index aeb73cd95681b57ebf2c53d318200468236dd8d3..7805e1293cdcac54488409bc7d618863ebaa19b5 100644 (file)
@@ -94,7 +94,7 @@ FGPosition::FGPosition(FGFDMExec* fdmex) : FGModel(fdmex),
   LongitudeDot = LatitudeDot = RadiusDot = 0.0;
   lastLongitudeDot = lastLatitudeDot = lastRadiusDot = 0.0;
   Longitude = Latitude = 0.0;
-  gamma = Vt = 0.0;
+  gamma = Vt = Vground = 0.0;
   h = 3.0;                                 // Est. height of aircraft cg off runway
   SeaLevelRadius = EARTHRAD;               // For initialization ONLY
   Radius         = SeaLevelRadius + h;
@@ -121,6 +121,8 @@ bool FGPosition:: Run(void) {
   if (!FGModel::Run()) {
     GetState();
 
+    Vground = sqrt( vVel(eNorth)*vVel(eNorth) + vVel(eEast)*vVel(eEast) );
+    
     invMass   = 1.0 / Aircraft->GetMass();
     Radius    = h + SeaLevelRadius;
     invRadius = 1.0 / Radius;
index 423889bc35ab5ea29fa3f1360f176ead854d71eb..07a9a6c856a9a14aafa519eee6b72c71440c8e84 100644 (file)
@@ -63,7 +63,7 @@ class FGPosition : public FGModel {
   double DistanceAGL;
   double SeaLevelRadius;
   double gamma;
-  double Vt;
+  double Vt, Vground;
   double hoverb,b;
 
   void GetState(void);
@@ -77,6 +77,7 @@ public:
   inline double GetVn(void)  { return vVel(eX); }
   inline double GetVe(void)  { return vVel(eY); }
   inline double GetVd(void)  { return vVel(eZ); }
+  inline double GetVground(void) { return Vground; }
   inline double Geth(void)  { return h; }
   inline double Gethdot(void) { return RadiusDot; }
   inline double GetLatitude(void) { return Latitude; }
index 20fc9a6c60278afc5c1cfcd489b939b0b3b61e7e..efd04db45ea47bae6dd00feae40918db2183ca86 100644 (file)
@@ -341,26 +341,30 @@ public:
     }
 
     FG_VECTOR_3    n_cg_body_v;
-    // inline double * get_N_cg_body_v() { return n_cg_body_v; }
-    // inline double get_N_X_cg() const { return n_cg_body_v[0]; }
-    // inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
-    // inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
-    /* inline void set_Accels_CG_Body_N( double x, double y, double z ) {
+     inline double * get_N_cg_body_v() { return n_cg_body_v; }
+     inline double get_N_X_cg() const { return n_cg_body_v[0]; }
+     inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
+     inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
+     inline void set_Accels_CG_Body_N( double x, double y, double z ) {
        n_cg_body_v[0] = x;
        n_cg_body_v[1] = y;
        n_cg_body_v[2] = z;
-    } */
+    } 
 
     FG_VECTOR_3    n_pilot_body_v;
     // inline double * get_N_pilot_body_v() { return n_pilot_body_v; }
-    // inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
-    // inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
-    // inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
-    /* inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
+    inline double get_N_X_pilot() const { return n_pilot_body_v[0]; }
+    inline double get_N_Y_pilot() const { return n_pilot_body_v[1]; }
+    inline double get_N_Z_pilot() const { return n_pilot_body_v[2]; }
+    inline void set_Accels_Pilot_Body_N( double x, double y, double z ) {
        n_pilot_body_v[0] = x;
        n_pilot_body_v[1] = y;
        n_pilot_body_v[2] = z;
-    } */
+    } 
+    
+    double nlf;  //Normal Load Factor
+    double get_Nlf(void) { return nlf; }  
+    void set_Nlf(double n) { nlf=n;  }
 
     FG_VECTOR_3    omega_dot_body_v;
     // inline double * get_Omega_dot_body_v() { return omega_dot_body_v; }
@@ -876,5 +880,3 @@ void fgFDMSetGroundElevation(int model, double alt_meters);
 
 
 #endif // _FLIGHT_HXX
-
-
index ef9ee26a8d8315f9e470e8c8fd88b38ae2f743b0..efbdf522bb2d3d164d3e0c08597dbbfad3bed1b8 100644 (file)
@@ -192,8 +192,8 @@ bool fgInitPosition( void ) {
     f->set_Longitude( current_options.get_lon() * DEG_TO_RAD );
     f->set_Latitude( current_options.get_lat() * DEG_TO_RAD );
 
-    if ( scenery.cur_elev > current_options.get_altitude() - ) {
-       current_options.set_altitude( scenery.cur_elev + 2 );
+    if ( scenery.cur_elev > current_options.get_altitude() - 1) {
+       current_options.set_altitude( scenery.cur_elev + 1 );
     }
 
     FG_LOG( FG_GENERAL, FG_INFO,
@@ -201,7 +201,7 @@ bool fgInitPosition( void ) {
 
     f->set_Altitude( current_options.get_altitude() * METER_TO_FEET );
     fgFDMSetGroundElevation( current_options.get_flight_model(),
-                            (f->get_Altitude() - 3.758099) * FEET_TO_METER );
+                            f->get_Altitude() * FEET_TO_METER );
 
     FG_LOG( FG_GENERAL, FG_INFO,
            "Initial position is: ("