]> git.mxchange.org Git - flightgear.git/commitdiff
Updates to test the 10520 engine code.
authorcurt <curt>
Mon, 28 Aug 2000 21:31:28 +0000 (21:31 +0000)
committercurt <curt>
Mon, 28 Aug 2000 21:31:28 +0000 (21:31 +0000)
src/FDM/LaRCsim.cxx
src/FDM/LaRCsim/c172_engine.c

index 1305f0972603ceba20763dbe9478bd71d0ebaf86..96bc484b273431ce8e302f3c0aed7c2a477fe0e2 100644 (file)
@@ -21,8 +21,6 @@
 // $Id$
 
 
-#include "LaRCsim.hxx"
-
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
 
 #include <FDM/LaRCsim/ls_generic.h>
 #include <FDM/LaRCsim/ls_interface.h>
 
+#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 );
 
index 8ab7b4502d70658d7ad8e4ba8d5939118e19b8a0..4b3f784a66e292c8c607752b0ee713e73eb9b7bf 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 ( 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*/
 
 }