1
0
Fork 0
flightgear/src/FDM/LaRCsim/c172_engine.c

105 lines
2.2 KiB
C
Raw Normal View History

1999-06-15 20:05:26 +00:00
/***************************************************************************
TITLE: engine.c
----------------------------------------------------------------------------
FUNCTION: dummy engine routine
----------------------------------------------------------------------------
MODULE STATUS: incomplete
----------------------------------------------------------------------------
GENEALOGY: This is a renamed navion_engine.c originall written by E. Bruce
Jackson
----------------------------------------------------------------------------
DESIGNED BY: designer
CODED BY: programmer
MAINTAINED BY: maintainer
----------------------------------------------------------------------------
MODIFICATION HISTORY:
DATE PURPOSE BY
CURRENT RCS HEADER INFO:
$Header$
* Revision 1.1 92/12/30 13:21:46 bjax
* Initial revision
*
----------------------------------------------------------------------------
REFERENCES:
----------------------------------------------------------------------------
CALLED BY: ls_model();
----------------------------------------------------------------------------
CALLS TO: none
----------------------------------------------------------------------------
INPUTS:
----------------------------------------------------------------------------
OUTPUTS:
--------------------------------------------------------------------------*/
#include <math.h>
#include "ls_types.h"
#include "ls_constants.h"
#include "ls_generic.h"
#include "ls_sim_control.h"
#include "ls_cockpit.h"
1999-08-17 21:18:16 +00:00
#include "c172_aero.h"
1999-06-15 20:05:26 +00:00
extern SIM_CONTROL sim_control_;
void c172_engine( SCALAR dt, int init ) {
2000-08-28 21:31:28 +00:00
float v,h,pa;
float bhp=160;
1999-06-15 20:05:26 +00:00
Throttle[3] = Throttle_pct;
2000-08-28 21:31:28 +00:00
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)
2000-08-28 21:31:28 +00:00
v=10;
if(Altitude < 0)
h=0;
pa=(0.00144*v + 0.546)*(1 - 1.6E-5*h)*bhp;
if(pa < 0)
2000-08-28 21:31:28 +00:00
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*/
1999-06-15 20:05:26 +00:00
}
1999-08-07 19:18:45 +00:00