From 58e1bc76981c569d353f1671f1ef238b525e7c67 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 10 Jan 2000 21:07:26 +0000 Subject: [PATCH] Updates to propogate V_calibrated_kts and Mach from all FDM codes. --- src/FDM/JSBSim.cxx | 47 +++++++++++++++++++++++------------------ src/FDM/LaRCsim.cxx | 4 +++- src/FDM/MagicCarpet.cxx | 2 ++ src/FDM/flight.hxx | 12 +++++------ 4 files changed, 38 insertions(+), 27 deletions(-) diff --git a/src/FDM/JSBSim.cxx b/src/FDM/JSBSim.cxx index fb6eafcca..52d860fe2 100644 --- a/src/FDM/JSBSim.cxx +++ b/src/FDM/JSBSim.cxx @@ -44,6 +44,9 @@ #include #include #include +#include +#include + #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: " <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); diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index ebce8eb0b..e95bdebd0 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -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 diff --git a/src/FDM/MagicCarpet.cxx b/src/FDM/MagicCarpet.cxx index 7964c7a41..56cd1381d 100644 --- a/src/FDM/MagicCarpet.cxx +++ b/src/FDM/MagicCarpet.cxx @@ -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 diff --git a/src/FDM/flight.hxx b/src/FDM/flight.hxx index 0f142124d..0f2e14ef6 100644 --- a/src/FDM/flight.hxx +++ b/src/FDM/flight.hxx @@ -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;