1 /**********************************************************************
3 FILENAME: uiuc_menu_init.cpp
5 ----------------------------------------------------------------------
7 DESCRIPTION: reads input data for specified aircraft and creates
8 approporiate data storage space
10 ----------------------------------------------------------------------
14 ----------------------------------------------------------------------
16 REFERENCES: based on "menu reader" format of Michael Selig
18 ----------------------------------------------------------------------
20 HISTORY: 04/04/2003 initial release
21 06/30/2003 (RD) replaced istrstream with istringstream
22 to get rid of the annoying warning about
23 using the strstream header
24 08/20/2003 (RD) removed old_flap_routine
26 ----------------------------------------------------------------------
28 AUTHOR(S): Robert Deters <rdeters@uiuc.edu>
29 Michael Selig <m-selig@uiuc.edu>
31 ----------------------------------------------------------------------
35 ----------------------------------------------------------------------
39 ----------------------------------------------------------------------
43 ----------------------------------------------------------------------
45 CALLED BY: uiuc_menu()
47 ----------------------------------------------------------------------
49 CALLS TO: check_float() if needed
55 ----------------------------------------------------------------------
57 COPYRIGHT: (C) 2003 by Michael Selig
59 This program is free software; you can redistribute it and/or
60 modify it under the terms of the GNU General Public License
61 as published by the Free Software Foundation.
63 This program is distributed in the hope that it will be useful,
64 but WITHOUT ANY WARRANTY; without even the implied warranty of
65 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
66 GNU General Public License for more details.
68 You should have received a copy of the GNU General Public License
69 along with this program; if not, write to the Free Software
70 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
72 **********************************************************************/
74 #include <simgear/compiler.h>
81 #include "uiuc_menu_init.h"
91 void parse_init( const string& linetoken2, const string& linetoken3,
92 const string& linetoken4, const string& linetoken5,
93 const string& linetoken6, const string& linetoken7,
94 const string& linetoken8, const string& linetoken9,
95 const string& linetoken10, const string& aircraft_directory,
98 istringstream token3(linetoken3.c_str());
99 istringstream token4(linetoken4.c_str());
100 istringstream token5(linetoken5.c_str());
101 istringstream token6(linetoken6.c_str());
102 istringstream token7(linetoken7.c_str());
103 istringstream token8(linetoken8.c_str());
104 istringstream token9(linetoken9.c_str());
105 istringstream token10(linetoken10.c_str());
106 int token_value_recordRate;
108 switch(init_map[linetoken2])
112 if (check_float(linetoken3))
113 token3 >> token_value;
115 uiuc_warnings_errors(1, *command_line);
117 Dx_pilot = token_value;
118 initParts -> storeCommands (*command_line);
123 if (check_float(linetoken3))
124 token3 >> token_value;
126 uiuc_warnings_errors(1, *command_line);
128 Dy_pilot = token_value;
129 initParts -> storeCommands (*command_line);
134 if (check_float(linetoken3))
135 token3 >> token_value;
137 uiuc_warnings_errors(1, *command_line);
139 Dz_pilot = token_value;
140 initParts -> storeCommands (*command_line);
145 if (check_float(linetoken3))
146 token3 >> token_value;
148 uiuc_warnings_errors(1, *command_line);
151 initParts -> storeCommands (*command_line);
156 if (check_float(linetoken3))
157 token3 >> token_value;
159 uiuc_warnings_errors(1, *command_line);
162 initParts -> storeCommands (*command_line);
167 if (check_float(linetoken3))
168 token3 >> token_value;
170 uiuc_warnings_errors(1, *command_line);
173 initParts -> storeCommands (*command_line);
178 if (check_float(linetoken3))
179 token3 >> token_value;
181 uiuc_warnings_errors(1, *command_line);
183 Altitude = token_value;
184 initParts -> storeCommands (*command_line);
189 if (check_float(linetoken3))
190 token3 >> token_value;
192 uiuc_warnings_errors(1, *command_line);
194 V_north = token_value;
195 initParts -> storeCommands (*command_line);
200 initParts -> storeCommands (*command_line);
201 if (check_float(linetoken3))
202 token3 >> token_value;
204 uiuc_warnings_errors(1, *command_line);
206 V_east = token_value;
211 if (check_float(linetoken3))
212 token3 >> token_value;
214 uiuc_warnings_errors(1, *command_line);
216 V_down = token_value;
217 initParts -> storeCommands (*command_line);
222 if (check_float(linetoken3))
223 token3 >> token_value;
225 uiuc_warnings_errors(1, *command_line);
227 P_body_init_true = true;
228 P_body_init = token_value;
229 initParts -> storeCommands (*command_line);
234 if (check_float(linetoken3))
235 token3 >> token_value;
237 uiuc_warnings_errors(1, *command_line);
239 Q_body_init_true = true;
240 Q_body_init = token_value;
241 initParts -> storeCommands (*command_line);
246 if (check_float(linetoken3))
247 token3 >> token_value;
249 uiuc_warnings_errors(1, *command_line);
251 R_body_init_true = true;
252 R_body_init = token_value;
253 initParts -> storeCommands (*command_line);
258 if (check_float(linetoken3))
259 token3 >> token_value;
261 uiuc_warnings_errors(1, *command_line);
263 Phi_init_true = true;
264 Phi_init = token_value;
265 initParts -> storeCommands (*command_line);
270 if (check_float(linetoken3))
271 token3 >> token_value;
273 uiuc_warnings_errors(1, *command_line);
275 Theta_init_true = true;
276 Theta_init = token_value;
277 initParts -> storeCommands (*command_line);
282 if (check_float(linetoken3))
283 token3 >> token_value;
285 uiuc_warnings_errors(1, *command_line);
287 Psi_init_true = true;
288 Psi_init = token_value;
289 initParts -> storeCommands (*command_line);
294 if (check_float(linetoken3))
295 token3 >> token_value;
297 uiuc_warnings_errors(1, *command_line);
299 Long_trim = token_value;
300 initParts -> storeCommands (*command_line);
303 case recordRate_flag:
305 //can't use check_float since variable is integer
306 token3 >> token_value_recordRate;
307 recordRate = 120 / token_value_recordRate;
310 case recordStartTime_flag:
312 if (check_float(linetoken3))
313 token3 >> token_value;
315 uiuc_warnings_errors(1, *command_line);
317 recordStartTime = token_value;
320 case use_V_rel_wind_2U_flag:
322 use_V_rel_wind_2U = true;
325 case nondim_rate_V_rel_wind_flag:
327 nondim_rate_V_rel_wind = true;
330 case use_abs_U_body_2U_flag:
332 use_abs_U_body_2U = true;
335 case dyn_on_speed_flag:
337 if (check_float(linetoken3))
338 token3 >> token_value;
340 uiuc_warnings_errors(1, *command_line);
342 dyn_on_speed = token_value;
345 case dyn_on_speed_zero_flag:
347 if (check_float(linetoken3))
348 token3 >> token_value;
350 uiuc_warnings_errors(1, *command_line);
352 dyn_on_speed_zero = token_value;
355 case use_dyn_on_speed_curve1_flag:
357 use_dyn_on_speed_curve1 = true;
360 case use_Alpha_dot_on_speed_flag:
362 use_Alpha_dot_on_speed = true;
363 if (check_float(linetoken3))
364 token3 >> token_value;
366 uiuc_warnings_errors(1, *command_line);
367 Alpha_dot_on_speed = token_value;
370 case use_gamma_horiz_on_speed_flag:
372 use_gamma_horiz_on_speed = true;
373 if (check_float(linetoken3))
374 token3 >> token_value;
376 uiuc_warnings_errors(1, *command_line);
377 gamma_horiz_on_speed = token_value;
380 case downwashMode_flag:
382 b_downwashMode = true;
383 token3 >> downwashMode;
384 if (downwashMode==100)
386 // compute downwash using downwashCoef, do nothing here
388 uiuc_warnings_errors(4, *command_line);
391 case downwashCoef_flag:
393 if (check_float(linetoken3))
394 token3 >> token_value;
396 uiuc_warnings_errors(1, *command_line);
397 downwashCoef = token_value;
402 if (check_float(linetoken3))
403 token3 >> token_value;
405 uiuc_warnings_errors(1, *command_line);
407 Alpha_init_true = true;
408 Alpha_init = token_value;
413 if (check_float(linetoken3))
414 token3 >> token_value;
416 uiuc_warnings_errors(1, *command_line);
418 Beta_init_true = true;
419 Beta_init = token_value;
424 if (check_float(linetoken3))
425 token3 >> token_value;
427 uiuc_warnings_errors(1, *command_line);
429 U_body_init_true = true;
430 U_body_init = token_value;
435 if (check_float(linetoken3))
436 token3 >> token_value;
438 uiuc_warnings_errors(1, *command_line);
440 V_body_init_true = true;
441 V_body_init = token_value;
446 if (check_float(linetoken3))
447 token3 >> token_value;
449 uiuc_warnings_errors(1, *command_line);
451 W_body_init_true = true;
452 W_body_init = token_value;
455 case ignore_unknown_keywords_flag:
457 ignore_unknown_keywords=true;
460 case trim_case_2_flag:
465 case use_uiuc_network_flag:
467 use_uiuc_network = true;
468 server_IP = linetoken3;
472 case icing_demo_flag:
477 case outside_control_flag:
479 outside_control = true;
484 if (ignore_unknown_keywords){
487 // print error message
488 uiuc_warnings_errors(2, *command_line);