Debian Codegraph @

src/FDM/LaRCsim/c172_engine.c

raw symbols SCIP
1 /***************************************************************************
2
3 TITLE: engine.c
4
5 ----------------------------------------------------------------------------
6
7 FUNCTION: dummy engine routine
8
9 ----------------------------------------------------------------------------
10
11 MODULE STATUS: incomplete
12
13 ----------------------------------------------------------------------------
14
15 GENEALOGY: This is a renamed navion_engine.c originall written by E. Bruce
16 Jackson
17
18
19 ----------------------------------------------------------------------------
20
21 DESIGNED BY: designer
22
23 CODED BY: programmer
24
25 MAINTAINED BY: maintainer
26
27 ----------------------------------------------------------------------------
28
29 MODIFICATION HISTORY:
30
31 DATE PURPOSE BY
32
33 CURRENT RCS HEADER INFO:
34
35 $Header$
36
37 * Revision 1.1 92/12/30 13:21:46 bjax
38 * Initial revision
39 *
40
41 ----------------------------------------------------------------------------
42
43 REFERENCES:
44
45 ----------------------------------------------------------------------------
46
47 CALLED BY: ls_model();
48
49 ----------------------------------------------------------------------------
50
51 CALLS TO: none
52
53 ----------------------------------------------------------------------------
54
55 INPUTS:
56
57 ----------------------------------------------------------------------------
58
59 OUTPUTS:
60
61 --------------------------------------------------------------------------*/
62 #include <math.h>
63 #include "ls_types.h"
64 #include "ls_constants.h"
65 #include "ls_generic.h"
66 #include "ls_sim_control.h"
67 #include "ls_cockpit.h"
68 #include "c172_aero.h"
69
70 extern SIM_CONTROL sim_control_;
71
72 void c172_engine( SCALAR dt, int init ) {
73
74 float v,h,pa;
75 float bhp=160;
76
77 Throttle[3] = Throttle_pct;
78
79
80 if ( ! Use_External_Engine ) {
81 /* do a crude engine power calc based on throttle position */
82 v=V_rel_wind;
83 h=Altitude;
84 if(V_rel_wind < 10)
85 v=10;
86 if(Altitude < 0)
87 h=0;
88 pa=(0.00144*v + 0.546)*(1 - 1.6E-5*h)*bhp;
89 if(pa < 0)
90 pa=0;
91
92 F_X_engine = Throttle[3]*(pa*550)/v;
93 } else {
94 /* accept external settings */
95 }
96
97 /* printf("F_X_engine = %.3f\n", F_X_engine); */
98
99 M_m_engine = F_X_engine*0.734*cbar;
100 /* 0.734 - estimated (WAGged) location of thrust line in the z-axis*/
101
102 }
103
104