]> git.mxchange.org Git - flightgear.git/commitdiff
Updates to propogate V_calibrated_kts and Mach from all FDM codes.
authorcurt <curt>
Mon, 10 Jan 2000 21:07:26 +0000 (21:07 +0000)
committercurt <curt>
Mon, 10 Jan 2000 21:07:26 +0000 (21:07 +0000)
src/FDM/JSBSim.cxx
src/FDM/LaRCsim.cxx
src/FDM/MagicCarpet.cxx
src/FDM/flight.hxx

index fb6eafccaca0a1e6d8bf6ba399cb8510c92acebf..52d860fe2988eb616344d5fa3485a0093b9e0646 100644 (file)
@@ -44,6 +44,9 @@
 #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 "JSBsim.hxx"
 
@@ -67,27 +70,29 @@ int FGJSBsim::init( double dt ) {
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded aircraft" << 
            current_options.get_aircraft() );
 
-//    FDMExec.GetState()->Reset(aircraft_path.str(), "Reset00");
+    FG_LOG( FG_FLIGHT, FG_INFO, "Initializing JSBsim with:" );
+    FG_LOG( FG_FLIGHT, FG_INFO, "    U: " << current_options.get_uBody() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "    V: " <<current_options.get_vBody() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "    W: " <<current_options.get_wBody() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "  phi: " <<get_Phi() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "theta: " <<  get_Theta() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "  psi: " <<  get_Psi() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "  lat: " <<  get_Latitude() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "  lon: " <<  get_Longitude() );
+    FG_LOG( FG_FLIGHT, FG_INFO, "  alt: " <<  get_Altitude() );
 
     FDMExec.GetState()->Initialize(
       current_options.get_uBody(),
       current_options.get_vBody(),
       current_options.get_wBody(),
-      get_Phi(),
-      get_Theta(),
-      get_Psi(),
+      get_Phi() * DEGTORAD,
+      get_Theta() * DEGTORAD,
+      get_Psi() * DEGTORAD,
       get_Latitude(),
       get_Longitude(),
       get_Altitude()
     );
 
-//    FDMExec.GetState()->Setlatitude(f.get_Latitude());
-//    FDMExec.GetState()->Setlongitude(f.get_Longitude());
-//    FDMExec.GetState()->Seth(f.get_Altitude());
-//    FDMExec.GetRotation()->Setphi(f.get_Phi());
-//    FDMExec.GetRotation()->Settht(f.get_Theta());
-//    FDMExec.GetRotation()->Setpsi(f.get_Psi());
-
     FG_LOG( FG_FLIGHT, FG_INFO, "  loaded initial conditions" );
 
     FDMExec.GetState()->Setdt( dt );
@@ -176,8 +181,8 @@ int FGJSBsim::copy_from_JSBsim() {
 
     // Velocities
     set_Velocities_Local( FDMExec.GetPosition()->GetVn(), 
-                           FDMExec.GetPosition()->GetVe(), 
-                           FDMExec.GetPosition()->GetVd() );
+                         FDMExec.GetPosition()->GetVe(), 
+                         FDMExec.GetPosition()->GetVd() );
     // set_Velocities_Ground( V_north_rel_ground, V_east_rel_ground, 
     //                      V_down_rel_ground );
     // set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass,
@@ -194,18 +199,20 @@ int FGJSBsim::copy_from_JSBsim() {
     // set_V_ground_speed( V_ground_speed );
     // set_V_equiv( V_equiv );
 
-    /* ***FIXME*** */ set_V_equiv_kts( FDMExec.GetState()->GetVt() );
-    // set_V_calibrated( V_calibrated );
-    // set_V_calibrated_kts( V_calibrated_kts );
+    set_V_equiv_kts( FDMExec.GetAuxiliary()->GetVequivalentKTS() );
+    //set_V_calibrated( FDMExec.GetAuxiliary()->GetVcalibratedFPS() );
+    set_V_calibrated_kts( FDMExec.GetAuxiliary()->GetVcalibratedKTS() );
 
     set_Omega_Body( FDMExec.GetRotation()->GetP(), 
-                     FDMExec.GetRotation()->GetQ(), 
-                     FDMExec.GetRotation()->GetR() );
+                   FDMExec.GetRotation()->GetQ(), 
+                   FDMExec.GetRotation()->GetR() );
     // set_Omega_Local( P_local, Q_local, R_local );
     // set_Omega_Total( P_total, Q_total, R_total );
     
     // set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
     // ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
+       
+    set_Mach_number( FDMExec.GetState()->GetMach());
 
     // Positions
     double lat_geoc = FDMExec.GetState()->Getlatitude();
@@ -227,8 +234,8 @@ int FGJSBsim::copy_from_JSBsim() {
                               sl_radius2 * METER_TO_FEET + alt );
     set_Geodetic_Position( lat_geod, lon, alt );
     set_Euler_Angles( FDMExec.GetRotation()->Getphi(), 
-                       FDMExec.GetRotation()->Gettht(),
-                       FDMExec.GetRotation()->Getpsi() );
+                     FDMExec.GetRotation()->Gettht(),
+                     FDMExec.GetRotation()->Getpsi() );
 
     // Miscellaneous quantities
     // set_T_Local_to_Body(T_local_to_body_m);
index ebce8eb0b0a1ffc450e37a42b7d445f85faa8e95..e95bdebd0df59155f9f69f0c0c30b08988271890 100644 (file)
@@ -354,7 +354,7 @@ int FGLaRCsim::copy_from_LaRCsim() {
     // set_V_equiv( V_equiv );
     set_V_equiv_kts( V_equiv_kts );
     // set_V_calibrated( V_calibrated );
-    // set_V_calibrated_kts( V_calibrated_kts );
+    set_V_calibrated_kts( V_calibrated_kts );
 
     set_Omega_Body( P_body, Q_body, R_body );
     // set_Omega_Local( P_local, Q_local, R_local );
@@ -363,6 +363,8 @@ int FGLaRCsim::copy_from_LaRCsim() {
     // set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
     set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
 
+    set_Mach_number( mach_number );
+
     FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << Longitude 
            << " lat_geoc = " << Lat_geocentric << " lat_geod = " << Latitude 
            << " alt = " << Altitude << " sl_radius = " << Sea_level_radius 
index 7964c7a41a333d7bffaad2cbc42de99cc748e84a..56cd1381d22c4b41e3bae77a839b3e6490cce926 100644 (file)
@@ -51,7 +51,9 @@ int FGMagicCarpet::update( int multiloop ) {
     double dist = speed * time_step;
     double kts = speed * METER_TO_NM * 3600.0;
     set_V_equiv_kts( kts );
+    set_V_calibrated_kts( kts );
     set_V_ground_speed( kts );
+    set_Mach_number(0);
 
     // angle of turn
     double turn_rate = controls.get_aileron() * FG_PI_4; // radians/sec
index 0f142124dc33e15b0278fe6fb12a6675a8712484..0f2e14ef6a6a6b4abaf28ee95ebf6be85e531b35 100644 (file)
@@ -488,11 +488,11 @@ public:
     inline double get_V_equiv_kts() const { return v_equiv_kts; }
     inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
 
-    // inline double get_V_calibrated() const { return v_calibrated; }
-    // inline void set_V_calibrated( double v ) { v_calibrated = v; }
+    //inline double get_V_calibrated() const { return v_calibrated; }
+    //inline void set_V_calibrated( double v ) { v_calibrated = v; }
 
-    // inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
-    // inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
+    inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
+    inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
 
     FG_VECTOR_3    omega_body_v;   // Angular B rates     
     // inline double * get_Omega_body_v() { return omega_body_v; }
@@ -697,8 +697,8 @@ public:
     // inline void set_Density( double d ) { density = d; }
     // inline double get_V_sound() const { return v_sound; }
     // inline void set_V_sound( double v ) { v_sound = v; }
-    // inline double get_Mach_number() const { return mach_number; }
-    // inline void set_Mach_number( double m ) { mach_number = m; }
+    inline double get_Mach_number() const { return mach_number; }
+    inline void set_Mach_number( double m ) { mach_number = m; }
 
     double    static_pressure, total_pressure, impact_pressure;
     double    dynamic_pressure;