Updates to propogate V_calibrated_kts and Mach from all FDM codes.
This commit is contained in:
parent
c722481805
commit
58e1bc7698
4 changed files with 38 additions and 27 deletions
|
@ -44,6 +44,9 @@
|
||||||
#include <FDM/JSBsim/FGRotation.h>
|
#include <FDM/JSBsim/FGRotation.h>
|
||||||
#include <FDM/JSBsim/FGState.h>
|
#include <FDM/JSBsim/FGState.h>
|
||||||
#include <FDM/JSBsim/FGTranslation.h>
|
#include <FDM/JSBsim/FGTranslation.h>
|
||||||
|
#include <FDM/JSBsim/FGAuxiliary.h>
|
||||||
|
#include <FDM/JSBsim/FGDefs.h>
|
||||||
|
|
||||||
|
|
||||||
#include "JSBsim.hxx"
|
#include "JSBsim.hxx"
|
||||||
|
|
||||||
|
@ -67,27 +70,29 @@ int FGJSBsim::init( double dt ) {
|
||||||
FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft" <<
|
FG_LOG( FG_FLIGHT, FG_INFO, " loaded aircraft" <<
|
||||||
current_options.get_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(
|
FDMExec.GetState()->Initialize(
|
||||||
current_options.get_uBody(),
|
current_options.get_uBody(),
|
||||||
current_options.get_vBody(),
|
current_options.get_vBody(),
|
||||||
current_options.get_wBody(),
|
current_options.get_wBody(),
|
||||||
get_Phi(),
|
get_Phi() * DEGTORAD,
|
||||||
get_Theta(),
|
get_Theta() * DEGTORAD,
|
||||||
get_Psi(),
|
get_Psi() * DEGTORAD,
|
||||||
get_Latitude(),
|
get_Latitude(),
|
||||||
get_Longitude(),
|
get_Longitude(),
|
||||||
get_Altitude()
|
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" );
|
FG_LOG( FG_FLIGHT, FG_INFO, " loaded initial conditions" );
|
||||||
|
|
||||||
FDMExec.GetState()->Setdt( dt );
|
FDMExec.GetState()->Setdt( dt );
|
||||||
|
@ -176,8 +181,8 @@ int FGJSBsim::copy_from_JSBsim() {
|
||||||
|
|
||||||
// Velocities
|
// Velocities
|
||||||
set_Velocities_Local( FDMExec.GetPosition()->GetVn(),
|
set_Velocities_Local( FDMExec.GetPosition()->GetVn(),
|
||||||
FDMExec.GetPosition()->GetVe(),
|
FDMExec.GetPosition()->GetVe(),
|
||||||
FDMExec.GetPosition()->GetVd() );
|
FDMExec.GetPosition()->GetVd() );
|
||||||
// set_Velocities_Ground( V_north_rel_ground, V_east_rel_ground,
|
// set_Velocities_Ground( V_north_rel_ground, V_east_rel_ground,
|
||||||
// V_down_rel_ground );
|
// V_down_rel_ground );
|
||||||
// set_Velocities_Local_Airmass( V_north_airmass, V_east_airmass,
|
// 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_ground_speed( V_ground_speed );
|
||||||
// set_V_equiv( V_equiv );
|
// set_V_equiv( V_equiv );
|
||||||
|
|
||||||
/* ***FIXME*** */ set_V_equiv_kts( FDMExec.GetState()->GetVt() );
|
set_V_equiv_kts( FDMExec.GetAuxiliary()->GetVequivalentKTS() );
|
||||||
// set_V_calibrated( V_calibrated );
|
//set_V_calibrated( FDMExec.GetAuxiliary()->GetVcalibratedFPS() );
|
||||||
// set_V_calibrated_kts( V_calibrated_kts );
|
set_V_calibrated_kts( FDMExec.GetAuxiliary()->GetVcalibratedKTS() );
|
||||||
|
|
||||||
set_Omega_Body( FDMExec.GetRotation()->GetP(),
|
set_Omega_Body( FDMExec.GetRotation()->GetP(),
|
||||||
FDMExec.GetRotation()->GetQ(),
|
FDMExec.GetRotation()->GetQ(),
|
||||||
FDMExec.GetRotation()->GetR() );
|
FDMExec.GetRotation()->GetR() );
|
||||||
// set_Omega_Local( P_local, Q_local, R_local );
|
// set_Omega_Local( P_local, Q_local, R_local );
|
||||||
// set_Omega_Total( P_total, Q_total, R_total );
|
// set_Omega_Total( P_total, Q_total, R_total );
|
||||||
|
|
||||||
// set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
|
// set_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
|
||||||
// ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
|
// ***FIXME*** set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
|
||||||
|
|
||||||
|
set_Mach_number( FDMExec.GetState()->GetMach());
|
||||||
|
|
||||||
// Positions
|
// Positions
|
||||||
double lat_geoc = FDMExec.GetState()->Getlatitude();
|
double lat_geoc = FDMExec.GetState()->Getlatitude();
|
||||||
|
@ -227,8 +234,8 @@ int FGJSBsim::copy_from_JSBsim() {
|
||||||
sl_radius2 * METER_TO_FEET + alt );
|
sl_radius2 * METER_TO_FEET + alt );
|
||||||
set_Geodetic_Position( lat_geod, lon, alt );
|
set_Geodetic_Position( lat_geod, lon, alt );
|
||||||
set_Euler_Angles( FDMExec.GetRotation()->Getphi(),
|
set_Euler_Angles( FDMExec.GetRotation()->Getphi(),
|
||||||
FDMExec.GetRotation()->Gettht(),
|
FDMExec.GetRotation()->Gettht(),
|
||||||
FDMExec.GetRotation()->Getpsi() );
|
FDMExec.GetRotation()->Getpsi() );
|
||||||
|
|
||||||
// Miscellaneous quantities
|
// Miscellaneous quantities
|
||||||
// set_T_Local_to_Body(T_local_to_body_m);
|
// set_T_Local_to_Body(T_local_to_body_m);
|
||||||
|
|
|
@ -354,7 +354,7 @@ int FGLaRCsim::copy_from_LaRCsim() {
|
||||||
// set_V_equiv( V_equiv );
|
// set_V_equiv( V_equiv );
|
||||||
set_V_equiv_kts( V_equiv_kts );
|
set_V_equiv_kts( V_equiv_kts );
|
||||||
// set_V_calibrated( V_calibrated );
|
// 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_Body( P_body, Q_body, R_body );
|
||||||
// set_Omega_Local( P_local, Q_local, R_local );
|
// 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_Euler_Rates( Phi_dot, Theta_dot, Psi_dot );
|
||||||
set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
|
set_Geocentric_Rates( Latitude_dot, Longitude_dot, Radius_dot );
|
||||||
|
|
||||||
|
set_Mach_number( mach_number );
|
||||||
|
|
||||||
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << Longitude
|
FG_LOG( FG_FLIGHT, FG_DEBUG, "lon = " << Longitude
|
||||||
<< " lat_geoc = " << Lat_geocentric << " lat_geod = " << Latitude
|
<< " lat_geoc = " << Lat_geocentric << " lat_geod = " << Latitude
|
||||||
<< " alt = " << Altitude << " sl_radius = " << Sea_level_radius
|
<< " alt = " << Altitude << " sl_radius = " << Sea_level_radius
|
||||||
|
|
|
@ -51,7 +51,9 @@ int FGMagicCarpet::update( int multiloop ) {
|
||||||
double dist = speed * time_step;
|
double dist = speed * time_step;
|
||||||
double kts = speed * METER_TO_NM * 3600.0;
|
double kts = speed * METER_TO_NM * 3600.0;
|
||||||
set_V_equiv_kts( kts );
|
set_V_equiv_kts( kts );
|
||||||
|
set_V_calibrated_kts( kts );
|
||||||
set_V_ground_speed( kts );
|
set_V_ground_speed( kts );
|
||||||
|
set_Mach_number(0);
|
||||||
|
|
||||||
// angle of turn
|
// angle of turn
|
||||||
double turn_rate = controls.get_aileron() * FG_PI_4; // radians/sec
|
double turn_rate = controls.get_aileron() * FG_PI_4; // radians/sec
|
||||||
|
|
|
@ -488,11 +488,11 @@ public:
|
||||||
inline double get_V_equiv_kts() const { return v_equiv_kts; }
|
inline double get_V_equiv_kts() const { return v_equiv_kts; }
|
||||||
inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
|
inline void set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
|
||||||
|
|
||||||
// inline double get_V_calibrated() const { return v_calibrated; }
|
//inline double get_V_calibrated() const { return v_calibrated; }
|
||||||
// inline void set_V_calibrated( double v ) { v_calibrated = v; }
|
//inline void set_V_calibrated( double v ) { v_calibrated = v; }
|
||||||
|
|
||||||
// inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
|
inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
|
||||||
// inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
|
inline void set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
|
||||||
|
|
||||||
FG_VECTOR_3 omega_body_v; // Angular B rates
|
FG_VECTOR_3 omega_body_v; // Angular B rates
|
||||||
// inline double * get_Omega_body_v() { return omega_body_v; }
|
// inline double * get_Omega_body_v() { return omega_body_v; }
|
||||||
|
@ -697,8 +697,8 @@ public:
|
||||||
// inline void set_Density( double d ) { density = d; }
|
// inline void set_Density( double d ) { density = d; }
|
||||||
// inline double get_V_sound() const { return v_sound; }
|
// inline double get_V_sound() const { return v_sound; }
|
||||||
// inline void set_V_sound( double v ) { v_sound = v; }
|
// inline void set_V_sound( double v ) { v_sound = v; }
|
||||||
// inline double get_Mach_number() const { return mach_number; }
|
inline double get_Mach_number() const { return mach_number; }
|
||||||
// inline void set_Mach_number( double m ) { mach_number = m; }
|
inline void set_Mach_number( double m ) { mach_number = m; }
|
||||||
|
|
||||||
double static_pressure, total_pressure, impact_pressure;
|
double static_pressure, total_pressure, impact_pressure;
|
||||||
double dynamic_pressure;
|
double dynamic_pressure;
|
||||||
|
|
Loading…
Add table
Reference in a new issue