X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FFDM%2FLaRCsim%2Fc172_engine.c;h=64632a2d103557b79d4005c0da57f080bd855ff1;hb=e1d5a52a3a535007d4249aeba84fc645158997a7;hp=2b738dae151855ff537aa6104fb16059c13223df;hpb=09987296b492f52f03b4d2878cda1f601abad63e;p=flightgear.git diff --git a/src/FDM/LaRCsim/c172_engine.c b/src/FDM/LaRCsim/c172_engine.c index 2b738dae1..64632a2d1 100644 --- a/src/FDM/LaRCsim/c172_engine.c +++ b/src/FDM/LaRCsim/c172_engine.c @@ -65,20 +65,40 @@ $Header$ #include "ls_generic.h" #include "ls_sim_control.h" #include "ls_cockpit.h" +#include "c172_aero.h" extern SIM_CONTROL sim_control_; -void engine( SCALAR dt, int init ) { - /* if (init) { */ +void c172_engine( SCALAR dt, int init ) { + + float v,h,pa; + float bhp=160; + Throttle[3] = Throttle_pct; - /* } */ - /* F_X_engine = Throttle[3]*813.4/0.2; */ /* original code */ - /* F_Z_engine = Throttle[3]*11.36/0.2; */ /* original code */ - F_X_engine = Throttle[3]*268.42/0.83; - F_Z_engine = Throttle[3]*3.75/0.83; + + if ( ! Use_External_Engine ) { + /* 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; + 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; + } 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*/ - Throttle_pct = Throttle[3]; }