]> git.mxchange.org Git - flightgear.git/blob - src/FDM/LaRCsim/ls_model.c
Attempt #1 to sort out confusion between left / right / parking brake
[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.4  2003/07/25 17:53:41  mselig
41 UIUC code initilization mods to tidy things up a bit.
42
43 Revision 1.3  2003/05/13 18:45:06  curt
44 Robert Deters:
45
46   I have attached some revisions for the UIUCModel and some LaRCsim.
47   The only thing you should need to check is LaRCsim.cxx.  The file
48   I attached is a revised version of 1.5 and the latest is 1.7.  Also,
49   uiuc_getwind.c and uiuc_getwind.h are no longer in the LaRCsim
50   directory.  They have been moved over to UIUCModel.
51
52 Revision 1.2  2003/03/31 03:05:41  m-selig
53 uiuc wind changes, MSS
54
55 Revision 1.1.1.1  2003/02/28 01:33:39  rob
56 uiuc version of FlightGear v0.9.0
57
58 Revision 1.3  2002/12/12 00:01:04  rob
59 *** empty log message ***
60
61 Revision 1.2  2002/10/22 21:06:49  rob
62 *** empty log message ***
63
64 Revision 1.2  2002/08/29 18:56:37  rob
65 *** empty log message ***
66
67 Revision 1.1.1.1  2002/04/24 17:08:23  rob
68 UIUC version of FlightGear-0.7.pre11
69
70 Revision 1.5  2002/04/01 19:37:34  curt
71 I have attached revisions to the UIUC code.  The revisions include the
72 ability to run a nonlinear model with flaps.  The files ls_model.c and
73 uiuc_aero.c were changed since we had some functions with the same
74 name.  The name changes doesn't affect the code, it just makes it a
75 little easier to read.  There are changes in LaRCsim.cxx so UIUC
76 models have engine sound.  Could you send me an email when you receive
77 this and/or when the changes make it to the CVS?  Thanks.
78
79 Also I noticed you have some outdated files that are no longer used in
80 the UIUCModel directory.  They are uiuc_initializemaps1.cpp,
81 uiuc_initializemaps2.cpp, uiuc_initializemaps3.cpp, and
82 uiuc_initializemaps4.cpp
83
84 Rob
85
86 Revision 1.4  2001/09/14 18:47:27  curt
87 More changes in support of UIUCModel.
88
89 Revision 1.3  2000/10/28 14:30:33  curt
90 Updates by Tony working on the FDM interface bus.
91
92 Revision 1.2  2000/04/10 18:09:41  curt
93 David Megginson made a few (mostly minor) mods to the LaRCsim files, and
94 it's now possible to choose the LaRCsim model at runtime, as in
95
96   fgfs --aircraft=c172
97
98 or
99
100   fgfs --aircraft=uiuc --aircraft-dir=Aircraft-uiuc/Boeing747
101
102 I did this so that I could play with the UIUC stuff without losing
103 Tony's C172 with its flaps, etc.  I did my best to respect the design
104 of the LaRCsim code by staying in C, making only minimal changes, and
105 not introducing any dependencies on the rest of FlightGear.  The
106 modified files are attached.
107
108 Revision 1.1.1.1  1999/06/17 18:07:33  curt
109 Start of 0.7.x branch
110
111 Revision 1.1.1.1  1999/04/05 21:32:45  curt
112 Start of 0.6.x branch.
113
114 Revision 1.3  1998/08/06 12:46:39  curt
115 Header change.
116
117 Revision 1.2  1998/01/19 18:40:27  curt
118 Tons of little changes to clean up the code and to remove fatal errors
119 when building with the c++ compiler.
120
121 Revision 1.1  1997/05/29 00:09:58  curt
122 Initial Flight Gear revision.
123
124  * Revision 1.3  1995/03/06  18:49:46  bjax
125  * Added dt and initialize flag parameters to subroutine calls. This will
126  * support trim routine (to allow single throttle setting to drive
127  * all four throttle positions, for example, if initialize is TRUE).
128  *
129  * Revision 1.2  1993/03/10  06:38:09  bjax
130  * Added additional calls: inertias() and subsystems()... EBJ
131  *
132  * Revision 1.1  92/12/30  13:19:08  bjax
133  * Initial revision
134  * 
135
136 ----------------------------------------------------------------------------
137
138         REFERENCES:
139
140 ----------------------------------------------------------------------------
141
142         CALLED BY:      ls_step (in initialization), ls_loop (planned)
143
144 ----------------------------------------------------------------------------
145
146         CALLS TO:       aero(), engine(), gear()
147
148 ----------------------------------------------------------------------------
149
150         INPUTS:
151
152 ----------------------------------------------------------------------------
153
154         OUTPUTS:
155
156 --------------------------------------------------------------------------*/
157 #include "ls_types.h"
158 #include "ls_model.h"
159 #include "default_model_routines.h"
160
161 Model current_model;
162
163
164 void ls_model( SCALAR dt, int Initialize ) {
165     switch (current_model) {
166     case NAVION:
167       inertias( dt, Initialize );
168       subsystems( dt, Initialize );
169       navion_aero( dt, Initialize );
170       navion_engine( dt, Initialize );
171       navion_gear( dt, Initialize );
172       break;
173     case C172:
174       printf("here we are in C172 \n");
175       if(Initialize < 0) c172_init();
176       inertias( dt, Initialize );
177       subsystems( dt, Initialize );
178       c172_aero( dt, Initialize );
179       c172_engine( dt, Initialize );
180       c172_gear( dt, Initialize );
181       break;
182     case CHEROKEE:
183       inertias( dt, Initialize );
184       subsystems( dt, Initialize );
185       cherokee_aero( dt, Initialize );
186       cherokee_engine( dt, Initialize );
187       cherokee_gear( dt, Initialize );
188       break;
189     case BASIC:
190       //      printf("here we are in BASIC \n");
191       if(Initialize < 0) basic_init();
192       printf("Initialize %d \n", Initialize);
193       inertias( dt, Initialize );
194       subsystems( dt, Initialize );
195       basic_aero( dt, Initialize );
196       basic_engine( dt, Initialize );
197       basic_gear( dt, Initialize );
198       break;
199     case UIUC:
200       inertias( dt, Initialize );
201       subsystems( dt, Initialize );
202       // During initialization period, re-initialize velocities
203       // and euler angles
204       if (Initialize !=0) uiuc_init_2_wrapper();
205       uiuc_network_recv_2_wrapper();
206       uiuc_engine_2_wrapper( dt, Initialize );
207       uiuc_wind_2_wrapper( dt, Initialize );
208       uiuc_aero_2_wrapper( dt, Initialize );
209       uiuc_gear_2_wrapper( dt, Initialize );
210       uiuc_network_send_2_wrapper();
211       uiuc_record_2_wrapper(dt);
212       break;
213     }
214 }