1
0
Fork 0

Updates to test the 10520 engine code.

This commit is contained in:
curt 2000-08-28 21:31:28 +00:00
parent fa000a3447
commit 306f01c41a
2 changed files with 45 additions and 11 deletions

View file

@ -21,8 +21,6 @@
// $Id$
#include "LaRCsim.hxx"
#include <simgear/constants.h>
#include <simgear/debug/logstream.hxx>
@ -33,10 +31,22 @@
#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 );

View 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*/
}