From: curt Date: Mon, 28 Aug 2000 21:31:28 +0000 (+0000) Subject: Updates to test the 10520 engine code. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=306f01c41a8f466e3929944190a42779edc133cc;p=flightgear.git Updates to test the 10520 engine code. --- diff --git a/src/FDM/LaRCsim.cxx b/src/FDM/LaRCsim.cxx index 1305f0972..96bc484b2 100644 --- a/src/FDM/LaRCsim.cxx +++ b/src/FDM/LaRCsim.cxx @@ -21,8 +21,6 @@ // $Id$ -#include "LaRCsim.hxx" - #include #include @@ -33,10 +31,22 @@ #include #include +#include "10520d.hxx" +#include "LaRCsim.hxx" + + +FGEngine eng; + // Initialize the LaRCsim flight model, dt is the time increment for // each subsequent iteration through the EOM int FGLaRCsim::init( double dt ) { + +#ifdef USE_NEW_ENGINE_CODE + // Initialize our little engine that hopefully might + eng.init(); +#endif + // cout << "FGLaRCsim::init()" << endl; double save_alt = 0.0; @@ -74,6 +84,17 @@ int FGLaRCsim::init( double dt ) { int FGLaRCsim::update( int multiloop ) { // cout << "FGLaRCsim::update()" << endl; +#ifdef USE_NEW_ENGINE_CODE + // update simple engine model + eng.set_IAS( V_calibrated_kts ); + eng.set_Throttle_Lever_Pos( Throttle_pct * 100.0 ); + eng.set_Propeller_Lever_Pos( 95 ); + eng.set_Mixture_Lever_Pos( 100 ); + eng.update(); + cout << " Thrust = " << eng.get_FGProp1_Thrust() << endl; + F_X_engine = eng.get_FGProp1_Thrust() * 7; +#endif + double save_alt = 0.0; double time_step = (1.0 / current_options.get_model_hz()) * multiloop; double start_elev = get_Altitude(); @@ -90,7 +111,11 @@ int FGLaRCsim::update( int multiloop ) { Long_trim = controls.get_elevator_trim(); Rudder_pedal = controls.get_rudder() / current_options.get_speed_up(); Flap_handle = 30.0 * controls.get_flaps(); +#ifdef USE_NEW_ENGINE_CODE + Throttle_pct = -1.0; // tells engine model to use propellor thrust +#else Throttle_pct = controls.get_throttle( 0 ) * 1.0; +#endif Brake_pct[0] = controls.get_brake( 1 ); Brake_pct[1] = controls.get_brake( 0 ); diff --git a/src/FDM/LaRCsim/c172_engine.c b/src/FDM/LaRCsim/c172_engine.c index 8ab7b4502..4b3f784a6 100644 --- a/src/FDM/LaRCsim/c172_engine.c +++ b/src/FDM/LaRCsim/c172_engine.c @@ -71,24 +71,33 @@ extern SIM_CONTROL sim_control_; void c172_engine( SCALAR dt, int init ) { - float v,h,pa; - float bhp=160; + float v,h,pa; + float bhp=160; Throttle[3] = Throttle_pct; + if ( Throttle_pct >= 0 ) { + /* do a crude engine power calc based on throttle position */ v=V_rel_wind; h=Altitude; if(V_rel_wind < 10) - v=10; - if(Altitude < 0) - h=0; + v=10; + if(Altitude < 0) + h=0; pa=(0.00144*v + 0.546)*(1 - 1.6E-5*h)*bhp; if(pa < 0) - pa=0; - F_X_engine= Throttle[3]*(pa*550)/v; - M_m_engine = F_X_engine*0.734*cbar; - /* 0.734 - estimated (WAGged) location of thrust line in the z-axis*/ + pa=0; + + F_X_engine = Throttle[3]*(pa*550)/v; + } else { + /* accept external settings */ + } + + /* printf("F_X_engine = %.3f\n", F_X_engine); */ + + M_m_engine = F_X_engine*0.734*cbar; + /* 0.734 - estimated (WAGged) location of thrust line in the z-axis*/ }