]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_engine.cpp
5e0a52047cd21b0bad14531572b34009339e550a
[flightgear.git] / src / FDM / UIUCModel / uiuc_engine.cpp
1 /**********************************************************************
2
3  FILENAME:     uiuc_engine.cpp
4
5 ----------------------------------------------------------------------
6
7  DESCRIPTION:  determine the engine forces and moments
8                
9 ----------------------------------------------------------------------
10
11  STATUS:       alpha version
12
13 ----------------------------------------------------------------------
14
15  REFERENCES:   based on portions of c172_engine.c, called from ls_model
16
17 ----------------------------------------------------------------------
18
19  HISTORY:      01/30/2000   initial release
20
21 ----------------------------------------------------------------------
22
23  AUTHOR(S):    Bipin Sehgal       <bsehgal@uiuc.edu>
24                Jeff Scott         <jscott@mail.com>
25                Michael Selig      <m-selig@uiuc.edu>
26
27 ----------------------------------------------------------------------
28
29  VARIABLES:
30
31 ----------------------------------------------------------------------
32
33  INPUTS:       -engine model
34
35 ----------------------------------------------------------------------
36
37  OUTPUTS:      -F_X_engine
38                -F_Z_engine
39                -M_m_engine
40
41 ----------------------------------------------------------------------
42
43  CALLED BY:   uiuc_wrapper.cpp 
44
45 ----------------------------------------------------------------------
46
47  CALLS TO:     none
48
49 ----------------------------------------------------------------------
50
51  COPYRIGHT:    (C) 2000 by Michael Selig
52
53  This program is free software; you can redistribute it and/or
54  modify it under the terms of the GNU General Public License
55  as published by the Free Software Foundation.
56
57  This program is distributed in the hope that it will be useful,
58  but WITHOUT ANY WARRANTY; without even the implied warranty of
59  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
60  GNU General Public License for more details.
61
62  You should have received a copy of the GNU General Public License
63  along with this program; if not, write to the Free Software
64  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
65  USA or view http://www.gnu.org/copyleft/gpl.html.
66
67 **********************************************************************/
68
69 #include "uiuc_engine.h"
70
71 void uiuc_engine() 
72 {
73   stack command_list;
74   string linetoken1;
75   string linetoken2;
76   
77   /* [] mss questions: why do this here ... and then undo it later? 
78      ... does Throttle[3] get modified? */
79   Throttle[3] = Throttle_pct;
80
81   command_list = engineParts -> getCommands();
82   
83   if (command_list.begin() == command_list.end())
84   {
85         cerr << "ERROR: Engine not specified. Aircraft cannot fly without the engine" << endl;
86         exit(-1);
87   }
88  
89   for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
90     {
91       //cout << *command_line << endl;
92       
93       linetoken1 = engineParts -> getToken(*command_line, 1); // function parameters gettoken(string,tokenNo);
94       linetoken2 = engineParts -> getToken(*command_line, 2); // 2 represents token No 2
95       
96       switch(engine_map[linetoken2])
97             {
98           case simpleSingle_flag:
99             {
100               //c172 engine lines ... looks like 0.83 is just a thrust reduction
101               /* F_X_engine = Throttle[3]*350/0.83; */
102               /* F_Z_engine = Throttle[3]*4.9/0.83; */
103               /* M_m_engine = F_X_engine*0.734*cbar; */
104               F_X_engine = Throttle[3]*simpleSingleMaxThrust;
105               break;
106             }
107             case c172_flag:
108               {
109                 F_X_engine = Throttle[3]*350/0.83;
110                 F_Z_engine = Throttle[3]*4.9/0.83;
111                 M_m_engine = F_X_engine*0.734*cbar;
112                 break;
113               }
114             };
115       
116       Throttle_pct = Throttle[3];
117       return;
118     }
119 }
120
121 // end uiuc_engine.cpp