]> git.mxchange.org Git - flightgear.git/blob - src/FDM/UIUCModel/uiuc_engine.cpp
MSVC5 Compatibility tweaks.
[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 #include <simgear/compiler.h>
69
70 #include "uiuc_engine.h"
71
72 FG_USING_STD(cerr);
73
74 void uiuc_engine() 
75 {
76   stack command_list;
77   string linetoken1;
78   string linetoken2;
79   
80   /* [] mss questions: why do this here ... and then undo it later? 
81      ... does Throttle[3] get modified? */
82   Throttle[3] = Throttle_pct;
83
84   command_list = engineParts -> getCommands();
85   
86   if (command_list.begin() == command_list.end())
87   {
88         cerr << "ERROR: Engine not specified. Aircraft cannot fly without the engine" << endl;
89         exit(-1);
90   }
91  
92   for (LIST command_line = command_list.begin(); command_line!=command_list.end(); ++command_line)
93     {
94       //cout << *command_line << endl;
95       
96       linetoken1 = engineParts -> getToken(*command_line, 1); // function parameters gettoken(string,tokenNo);
97       linetoken2 = engineParts -> getToken(*command_line, 2); // 2 represents token No 2
98       
99       switch(engine_map[linetoken2])
100             {
101           case simpleSingle_flag:
102             {
103               //c172 engine lines ... looks like 0.83 is just a thrust reduction
104               /* F_X_engine = Throttle[3]*350/0.83; */
105               /* F_Z_engine = Throttle[3]*4.9/0.83; */
106               /* M_m_engine = F_X_engine*0.734*cbar; */
107               F_X_engine = Throttle[3]*simpleSingleMaxThrust;
108               break;
109             }
110             case c172_flag:
111               {
112                 F_X_engine = Throttle[3]*350/0.83;
113                 F_Z_engine = Throttle[3]*4.9/0.83;
114                 M_m_engine = F_X_engine*0.734*cbar;
115                 break;
116               }
117             };
118       
119       Throttle_pct = Throttle[3];
120       return;
121     }
122 }
123
124 // end uiuc_engine.cpp