]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/LaRCsim/c172_engine.c
resync JSBSim
[flightgear.git] / src / FDM / LaRCsim / c172_engine.c
index 8ab7b4502d70658d7ad8e4ba8d5939118e19b8a0..64632a2d103557b79d4005c0da57f080bd855ff1 100644 (file)
@@ -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 ( ! 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;
+           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*/
 
 }