]> git.mxchange.org Git - flightgear.git/blob - src/FDM/LaRCsim/ls_model.c
Erik Hofman: Irix build fixes.
[flightgear.git] / src / FDM / LaRCsim / ls_model.c
1 /***************************************************************************
2
3         TITLE:          ls_model()      
4         
5 ----------------------------------------------------------------------------
6
7         FUNCTION:       Model loop executive
8
9 ----------------------------------------------------------------------------
10
11         MODULE STATUS:  developmental
12
13 ----------------------------------------------------------------------------
14
15         GENEALOGY:      Created 15 October 1992 as part of LaRCSIM project
16                         by Bruce Jackson.
17
18 ----------------------------------------------------------------------------
19
20         DESIGNED BY:    Bruce Jackson
21         
22         CODED BY:       Bruce Jackson
23         
24         MAINTAINED BY:  maintainer
25
26 ----------------------------------------------------------------------------
27
28         MODIFICATION HISTORY:
29         
30         DATE    PURPOSE                                         BY
31
32         950306  Added parameters to call: dt, which is the step size
33                 to be taken this loop (caution: may vary from call to call)
34                 and Initialize, which if non-zero, implies an initialization
35                 is requested.                                   EBJ
36
37         CURRENT RCS HEADER INFO:
38 $Header$
39 $Log$
40 Revision 1.1  2002/09/10 01:14:02  curt
41 Initial revision
42
43 Revision 1.5  2002/04/01 19:37:34  curt
44 I have attached revisions to the UIUC code.  The revisions include the
45 ability to run a nonlinear model with flaps.  The files ls_model.c and
46 uiuc_aero.c were changed since we had some functions with the same
47 name.  The name changes doesn't affect the code, it just makes it a
48 little easier to read.  There are changes in LaRCsim.cxx so UIUC
49 models have engine sound.  Could you send me an email when you receive
50 this and/or when the changes make it to the CVS?  Thanks.
51
52 Also I noticed you have some outdated files that are no longer used in
53 the UIUCModel directory.  They are uiuc_initializemaps1.cpp,
54 uiuc_initializemaps2.cpp, uiuc_initializemaps3.cpp, and
55 uiuc_initializemaps4.cpp
56
57 Rob
58
59 Revision 1.4  2001/09/14 18:47:27  curt
60 More changes in support of UIUCModel.
61
62 Revision 1.3  2000/10/28 14:30:33  curt
63 Updates by Tony working on the FDM interface bus.
64
65 Revision 1.2  2000/04/10 18:09:41  curt
66 David Megginson made a few (mostly minor) mods to the LaRCsim files, and
67 it's now possible to choose the LaRCsim model at runtime, as in
68
69   fgfs --aircraft=c172
70
71 or
72
73   fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747
74
75 I did this so that I could play with the UIUC stuff without losing
76 Tony's C172 with its flaps, etc.  I did my best to respect the design
77 of the LaRCsim code by staying in C, making only minimal changes, and
78 not introducing any dependencies on the rest of FlightGear.  The
79 modified files are attached.
80
81 Revision 1.1.1.1  1999/06/17 18:07:33  curt
82 Start of 0.7.x branch
83
84 Revision 1.1.1.1  1999/04/05 21:32:45  curt
85 Start of 0.6.x branch.
86
87 Revision 1.3  1998/08/06 12:46:39  curt
88 Header change.
89
90 Revision 1.2  1998/01/19 18:40:27  curt
91 Tons of little changes to clean up the code and to remove fatal errors
92 when building with the c++ compiler.
93
94 Revision 1.1  1997/05/29 00:09:58  curt
95 Initial Flight Gear revision.
96
97  * Revision 1.3  1995/03/06  18:49:46  bjax
98  * Added dt and initialize flag parameters to subroutine calls. This will
99  * support trim routine (to allow single throttle setting to drive
100  * all four throttle positions, for example, if initialize is TRUE).
101  *
102  * Revision 1.2  1993/03/10  06:38:09  bjax
103  * Added additional calls: inertias() and subsystems()... EBJ
104  *
105  * Revision 1.1  92/12/30  13:19:08  bjax
106  * Initial revision
107  * 
108
109 ----------------------------------------------------------------------------
110
111         REFERENCES:
112
113 ----------------------------------------------------------------------------
114
115         CALLED BY:      ls_step (in initialization), ls_loop (planned)
116
117 ----------------------------------------------------------------------------
118
119         CALLS TO:       aero(), engine(), gear()
120
121 ----------------------------------------------------------------------------
122
123         INPUTS:
124
125 ----------------------------------------------------------------------------
126
127         OUTPUTS:
128
129 --------------------------------------------------------------------------*/
130 #include "ls_types.h"
131 #include "ls_model.h"
132 #include "default_model_routines.h"
133
134 Model current_model;
135
136
137 void ls_model( SCALAR dt, int Initialize ) {
138     switch (current_model) {
139     case NAVION:
140       inertias( dt, Initialize );
141       subsystems( dt, Initialize );
142       navion_aero( dt, Initialize );
143       navion_engine( dt, Initialize );
144       navion_gear( dt, Initialize );
145       break;
146     case C172:
147       if(Initialize < 0) c172_init();
148       inertias( dt, Initialize );
149       subsystems( dt, Initialize );
150       c172_aero( dt, Initialize );
151       c172_engine( dt, Initialize );
152       c172_gear( dt, Initialize );
153       break;
154     case CHEROKEE:
155       inertias( dt, Initialize );
156       subsystems( dt, Initialize );
157       cherokee_aero( dt, Initialize );
158       cherokee_engine( dt, Initialize );
159       cherokee_gear( dt, Initialize );
160       break;
161     case UIUC:
162       inertias( dt, Initialize );
163       subsystems( dt, Initialize );
164       uiuc_aero_2_wrapper( dt, Initialize );
165       uiuc_engine_2_wrapper( dt, Initialize );
166       uiuc_gear_2_wrapper( dt, Initialize );
167       //uiuc_network_2_wrapper();
168       uiuc_record_2_wrapper(dt);
169       break;
170     }
171 }