FlightGear next
JSBSim.cpp
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Module: JSBSim.cpp
4 Author: Jon S. Berndt
5 Date started: 08/17/99
6 Purpose: Standalone version of JSBSim.
7 Called by: The USER.
8
9 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
10
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU Lesser General Public License as published by the Free Software
13 Foundation; either version 2 of the License, or (at your option) any later
14 version.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
19 details.
20
21 You should have received a copy of the GNU Lesser General Public License along with
22 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23 Place - Suite 330, Boston, MA 02111-1307, USA.
24
25 Further information about the GNU Lesser General Public License can also be found on
26 the world wide web at http://www.gnu.org.
27
28FUNCTIONAL DESCRIPTION
29--------------------------------------------------------------------------------
30
31This class implements the JSBSim standalone application. It is set up for compilation
32under gnu C++, MSVC++, or other compiler.
33
34HISTORY
35--------------------------------------------------------------------------------
3608/17/99 JSB Created
37
38%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39INCLUDES
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41
43#include "FGFDMExec.h"
45
46#if !defined(__GNUC__) && !defined(sgi) && !defined(_MSC_VER)
47# include <time>
48#else
49# include <time.h>
50#endif
51
52#if defined(_MSC_VER)
53# include <float.h>
54#elif defined(__GNUC__) && !defined(sgi)
55# include <fenv.h>
56#endif
57
58#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
59# define WIN32_LEAN_AND_MEAN
60# include <windows.h>
61# include <mmsystem.h>
62# include <regstr.h>
63# include <sys/types.h>
64# include <sys/timeb.h>
65#else
66# include <sys/time.h>
67#endif
68
69#include <iostream>
70#include <cstdlib>
71
72using namespace std;
74using JSBSim::Element;
75
76/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77GLOBAL DATA
78%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
79
80SGPath RootDir;
83SGPath ResetName;
84vector <string> LogOutputName;
85vector <SGPath> LogDirectiveName;
86vector <string> CommandLineProperties;
90
96
97double end_time = 1e99;
98double simulation_rate = 1./120.;
99bool override_sim_rate = false;
100double sleep_period=0.01;
101
102/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
103FORWARD DECLARATIONS
104%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
105
106bool options(int, char**);
107int real_main(int argc, char* argv[]);
108void PrintHelp(void);
109
110#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
111 double getcurrentseconds(void)
112 {
113 struct timeb tm_ptr;
114 ftime(&tm_ptr);
115 return tm_ptr.time + tm_ptr.millitm*0.001;
116 }
117#else
118 double getcurrentseconds(void)
119 {
120 struct timeval tval;
121 struct timezone tz;
122
123 gettimeofday(&tval, &tz);
124 return (tval.tv_sec + tval.tv_usec*1e-6);
125 }
126#endif
127
128#if defined(__BORLANDC__) || defined(_MSC_VER) || defined(__MINGW32__)
129 void sim_nsleep(long nanosec)
130 {
131 Sleep((DWORD)(nanosec*1e-6)); // convert nanoseconds (passed in) to milliseconds for Win32.
132 }
133#else
134 void sim_nsleep(long nanosec)
135 {
136 struct timespec ts, ts1;
137
138 ts.tv_sec = 0;
139 ts.tv_nsec = nanosec;
140 nanosleep(&ts, &ts1);
141 }
142#endif
143
146class XMLFile : public FGXMLFileRead {
147public:
148 bool IsScriptFile(const SGPath& filename) {
149 bool result=false;
150 Element *document = LoadXMLDocument(filename, false);
151 if (document && document->GetName() == "runscript") result = true;
152 ResetParser();
153 return result;
154 }
155 bool IsLogDirectiveFile(const SGPath& filename) {
156 bool result=false;
157 Element *document = LoadXMLDocument(filename, false);
158 if (document && document->GetName() == "output") result = true;
159 ResetParser();
160 return result;
161 }
162 bool IsAircraftFile(const SGPath& filename) {
163 bool result=false;
164 Element* document = LoadXMLDocument(filename, false);
165 if (document && document->GetName() == "fdm_config") result = true;
166 ResetParser();
167 return result;
168 }
169 bool IsInitFile(const SGPath& filename) {
170 bool result=false;
171 Element *document = LoadXMLDocument(filename, false);
172 if (document && document->GetName() == "initialize") result = true;
173 ResetParser();
174 return result;
175 }
176};
177
178/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
179CLASS DOCUMENTATION
180%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
181
272
273/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
274IMPLEMENTATION
275%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
276
277int main(int argc, char* argv[])
278{
279#if defined(_MSC_VER)
280 _clearfp();
281 _controlfp(_controlfp(0, 0) & ~(_EM_INVALID | _EM_ZERODIVIDE | _EM_OVERFLOW),
282 _MCW_EM);
283#elif defined(__GNUC__) && !defined(sgi) && !defined(__APPLE__)
284 feenableexcept(FE_DIVBYZERO | FE_INVALID);
285#endif
286
287 try {
288 real_main(argc, argv);
289 } catch (string& msg) {
290 std::cerr << "FATAL ERROR: JSBSim terminated with an exception."
291 << std::endl << "The message was: " << msg << std::endl;
292 return 1;
293 } catch (...) {
294 std::cerr << "FATAL ERROR: JSBSim terminated with an unknown exception."
295 << std::endl;
296 return 1;
297 }
298 return 0;
299}
300
301int real_main(int argc, char* argv[])
302{
303 // *** INITIALIZATIONS *** //
304
305 ScriptName = "";
306 AircraftName = "";
307 ResetName = "";
308 LogOutputName.clear();
309 LogDirectiveName.clear();
310 bool result = false, success;
311 bool was_paused = false;
312
313 double frame_duration;
314
315 double new_five_second_value = 0.0;
316 double actual_elapsed_time = 0;
317 double initial_seconds = 0;
318 double current_seconds = 0.0;
319 double paused_seconds = 0.0;
320 double sim_lag_time = 0;
321 double cycle_duration = 0.0;
322 double override_sim_rate_value = 0.0;
323 long sleep_nseconds = 0;
324
325 realtime = false;
326 play_nice = false;
327 suspend = false;
328 catalog = false;
329 nohighlight = false;
330
331 // *** PARSE OPTIONS PASSED INTO THIS SPECIFIC APPLICATION: JSBSim *** //
332 success = options(argc, argv);
333 if (!success) {
334 PrintHelp();
335 exit(-1);
336 }
337
338 // *** SET UP JSBSIM *** //
340 FDMExec->SetRootDir(RootDir);
341 FDMExec->SetAircraftPath(SGPath("aircraft"));
342 FDMExec->SetEnginePath(SGPath("engine"));
343 FDMExec->SetSystemsPath(SGPath("systems"));
344 FDMExec->GetPropertyManager()->Tie("simulation/frame_start_time", &actual_elapsed_time);
345 FDMExec->GetPropertyManager()->Tie("simulation/cycle_duration", &cycle_duration);
346
347 if (nohighlight) FDMExec->disableHighLighting();
348
349 if (simulation_rate < 1.0 )
350 FDMExec->Setdt(simulation_rate);
351 else
352 FDMExec->Setdt(1.0/simulation_rate);
353
354 if (override_sim_rate) override_sim_rate_value = FDMExec->GetDeltaT();
355
356 // SET PROPERTY VALUES THAT ARE GIVEN ON THE COMMAND LINE and which are for the simulation only.
357
358 for (unsigned int i=0; i<CommandLineProperties.size(); i++) {
359
360 if (CommandLineProperties[i].find("simulation") != std::string::npos) {
361 if (FDMExec->GetPropertyManager()->GetNode(CommandLineProperties[i])) {
363 }
364 }
365 }
366
367 // *** OPTION A: LOAD A SCRIPT, WHICH LOADS EVERYTHING ELSE *** //
368 if (!ScriptName.isNull()) {
369
370 result = FDMExec->LoadScript(ScriptName, override_sim_rate_value, ResetName);
371
372 if (!result) {
373 cerr << "Script file " << ScriptName << " was not successfully loaded" << endl;
374 delete FDMExec;
375 exit(-1);
376 }
377
378 // *** OPTION B: LOAD AN AIRCRAFT AND A SET OF INITIAL CONDITIONS *** //
379 } else if (!AircraftName.empty() || !ResetName.isNull()) {
380
381 if (catalog) FDMExec->SetDebugLevel(0);
382
383 if ( ! FDMExec->LoadModel(SGPath("aircraft"),
384 SGPath("engine"),
385 SGPath("systems"),
386 AircraftName)) {
387 cerr << " JSBSim could not be started" << endl << endl;
388 delete FDMExec;
389 exit(-1);
390 }
391
392 if (catalog) {
393 FDMExec->PrintPropertyCatalog();
394 delete FDMExec;
395 return 0;
396 }
397
398 JSBSim::FGInitialCondition *IC = FDMExec->GetIC();
399 if ( ! IC->Load(ResetName)) {
400 delete FDMExec;
401 cerr << "Initialization unsuccessful" << endl;
402 exit(-1);
403 }
404
405 } else {
406 cout << " No Aircraft, Script, or Reset information given" << endl << endl;
407 delete FDMExec;
408 exit(-1);
409 }
410
411 // Load output directives file[s], if given
412 for (unsigned int i=0; i<LogDirectiveName.size(); i++) {
413 if (!LogDirectiveName[i].isNull()) {
414 if (!FDMExec->SetOutputDirectives(LogDirectiveName[i])) {
415 cout << "Output directives not properly set in file " << LogDirectiveName[i] << endl;
416 delete FDMExec;
417 exit(-1);
418 }
419 }
420 }
421
422 // OVERRIDE OUTPUT FILE NAME. THIS IS USEFUL FOR CASES WHERE MULTIPLE
423 // RUNS ARE BEING MADE (SUCH AS IN A MONTE CARLO STUDY) AND THE OUTPUT FILE
424 // NAME MUST BE SET EACH TIME TO AVOID THE PREVIOUS RUN DATA FROM BEING OVER-
425 // WRITTEN.
426 for (unsigned int i=0; i<LogOutputName.size(); i++) {
427 string old_filename = FDMExec->GetOutputFileName(i);
428 if (!FDMExec->SetOutputFileName(i, LogOutputName[i])) {
429 cout << "Output filename could not be set" << endl;
430 } else {
431 cout << "Output filename change from " << old_filename << " from aircraft"
432 " configuration file to " << LogOutputName[i] << " specified on"
433 " command line" << endl;
434 }
435 }
436
437 // SET PROPERTY VALUES THAT ARE GIVEN ON THE COMMAND LINE
438
439 for (unsigned int i=0; i<CommandLineProperties.size(); i++) {
440
441 if (!FDMExec->GetPropertyManager()->GetNode(CommandLineProperties[i])) {
442 cerr << endl << " No property by the name " << CommandLineProperties[i] << endl;
443 delete FDMExec;
444 exit(-1);
445 } else {
447 }
448 }
449
450 FDMExec->RunIC();
451
452 // PRINT SIMULATION CONFIGURATION
453 FDMExec->PrintSimulationConfiguration();
454
455 // Dump the simulation state (position, orientation, etc.)
456 FDMExec->GetPropagate()->DumpState();
457
458 // Perform trim if requested via the initialization file
459 JSBSim::TrimMode icTrimRequested = (JSBSim::TrimMode)FDMExec->GetIC()->TrimRequested();
460 if (icTrimRequested != JSBSim::TrimMode::tNone) {
461 trimmer = new JSBSim::FGTrim( FDMExec, icTrimRequested );
462 try {
463 trimmer->DoTrim();
464
465 if (FDMExec->GetDebugLevel() > 0)
466 trimmer->Report();
467
468 delete trimmer;
469 } catch (string& msg) {
470 cerr << endl << msg << endl << endl;
471 exit(1);
472 }
473 }
474
476 << "---- JSBSim Execution beginning ... --------------------------------------------"
477 << JSBSim::FGFDMExec::reset << endl << endl;
478
479 result = FDMExec->Run(); // MAKE AN INITIAL RUN
480
481 if (suspend) FDMExec->Hold();
482
483 // Print actual time at start
484 char s[100];
485 time_t tod;
486 time(&tod);
487 strftime(s, 99, "%A %B %d %Y %X", localtime(&tod));
488 cout << "Start: " << s << " (HH:MM:SS)" << endl;
489
490 frame_duration = FDMExec->GetDeltaT();
491 if (realtime) sleep_nseconds = (long)(frame_duration*1e9);
492 else sleep_nseconds = (sleep_period )*1e9; // 0.01 seconds
493
494 tzset();
495 current_seconds = initial_seconds = getcurrentseconds();
496
497 // *** CYCLIC EXECUTION LOOP, AND MESSAGE READING *** //
498 while (result && FDMExec->GetSimTime() <= end_time) {
499
500 FDMExec->ProcessMessage(); // Process messages, if any.
501
502 // Check if increment then hold is on and take appropriate actions if it is
503 // Iterate is not supported in realtime - only in batch and playnice modes
504 FDMExec->CheckIncrementalHold();
505
506 // if running realtime, throttle the execution, else just run flat-out fast
507 // unless "playing nice", in which case sleep for a while (0.01 seconds) each frame.
508 // If suspended, then don't increment cumulative realtime "stopwatch".
509
510 if ( ! FDMExec->Holding()) {
511 if ( ! realtime ) { // ------------ RUNNING IN BATCH MODE
512
513 result = FDMExec->Run();
514
515 if (play_nice) sim_nsleep(sleep_nseconds);
516
517 } else { // ------------ RUNNING IN REALTIME MODE
518
519 // "was_paused" will be true if entering this "run" loop from a paused state.
520 if (was_paused) {
521 initial_seconds += paused_seconds;
522 was_paused = false;
523 }
524 current_seconds = getcurrentseconds(); // Seconds since 1 Jan 1970
525 actual_elapsed_time = current_seconds - initial_seconds; // Real world elapsed seconds since start
526 sim_lag_time = actual_elapsed_time - FDMExec->GetSimTime(); // How far behind sim-time is from actual
527 // elapsed time.
528 for (int i=0; i<(int)(sim_lag_time/frame_duration); i++) { // catch up sim time to actual elapsed time.
529 result = FDMExec->Run();
530 cycle_duration = getcurrentseconds() - current_seconds; // Calculate cycle duration
531 current_seconds = getcurrentseconds(); // Get new current_seconds
532 if (FDMExec->Holding()) break;
533 }
534
535 if (play_nice) sim_nsleep(sleep_nseconds);
536
537 if (FDMExec->GetSimTime() >= new_five_second_value) { // Print out elapsed time every five seconds.
538 cout << "Simulation elapsed time: " << FDMExec->GetSimTime() << endl;
539 new_five_second_value += 5.0;
540 }
541 }
542 } else { // Suspended
543 was_paused = true;
544 paused_seconds = getcurrentseconds() - current_seconds;
545 sim_nsleep(sleep_nseconds);
546 result = FDMExec->Run();
547 }
548
549 }
550
551 // PRINT ENDING CLOCK TIME
552 time(&tod);
553 strftime(s, 99, "%A %B %d %Y %X", localtime(&tod));
554 cout << "End: " << s << " (HH:MM:SS)" << endl;
555
556 // CLEAN UP
557 delete FDMExec;
558
559 return 0;
560}
561
562//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
563
564#define gripe cerr << "Option '" << keyword \
565 << "' requires a value, as in '" \
566 << keyword << "=something'" << endl << endl;/**/
567
568bool options(int count, char **arg)
569{
570 int i;
571 bool result = true;
572
573 if (count == 1) {
574 PrintHelp();
575 exit(0);
576 }
577
578 cout.setf(ios_base::fixed);
579
580 for (i=1; i<count; i++) {
581 string argument = string(arg[i]);
582 string keyword(argument);
583 string value("");
584 string::size_type n=argument.find("=");
585
586 if (n != string::npos && n > 0) {
587 keyword = argument.substr(0, n);
588 value = argument.substr(n+1);
589 }
590
591 if (keyword == "--help") {
592 PrintHelp();
593 exit(0);
594 } else if (keyword == "--version") {
595 cout << endl << " JSBSim Version: " << FDMExec->GetVersion() << endl << endl;
596 exit (0);
597 } else if (keyword == "--realtime") {
598 realtime = true;
599 } else if (keyword == "--nice") {
600 play_nice = true;
601 if (n != string::npos) {
602 try {
603 sleep_period = atof( value.c_str() );
604 } catch (...) {
605 cerr << endl << " Invalid sleep period given!" << endl << endl;
606 result = false;
607 }
608 } else {
609 sleep_period = 0.01;
610 }
611 } else if (keyword == "--suspend") {
612 suspend = true;
613 } else if (keyword == "--nohighlight") {
614 nohighlight = true;
615 } else if (keyword == "--outputlogfile") {
616 if (n != string::npos) {
617 LogOutputName.push_back(value);
618 }
619 } else if (keyword == "--logdirectivefile") {
620 if (n != string::npos) {
621 LogDirectiveName.push_back(SGPath::fromLocal8Bit(value.c_str()));
622 } else {
623 gripe;
624 exit(1);
625 }
626 } else if (keyword == "--root") {
627 if (n != string::npos) {
628 RootDir = SGPath::fromLocal8Bit(value.c_str());
629 } else {
630 gripe;
631 exit(1);
632 }
633 } else if (keyword == "--aircraft") {
634 if (n != string::npos) {
635 AircraftName = value;
636 } else {
637 gripe;
638 exit(1);
639 }
640 } else if (keyword == "--script") {
641 if (n != string::npos) {
642 ScriptName = SGPath::fromLocal8Bit(value.c_str());
643 } else {
644 gripe;
645 exit(1);
646 }
647 } else if (keyword == "--initfile") {
648 if (n != string::npos) {
649 ResetName = SGPath::fromLocal8Bit(value.c_str());
650 } else {
651 gripe;
652 exit(1);
653 }
654
655 } else if (keyword == "--property") {
656 if (n != string::npos) {
657 string propName = value.substr(0,value.find("="));
658 string propValueString = value.substr(value.find("=")+1);
659 double propValue = atof(propValueString.c_str());
660 CommandLineProperties.push_back(propName);
661 CommandLinePropertyValues.push_back(propValue);
662 } else {
663 gripe;
664 exit(1);
665 }
666
667 } else if (keyword.substr(0,5) == "--end") {
668 if (n != string::npos) {
669 try {
670 end_time = atof( value.c_str() );
671 } catch (...) {
672 cerr << endl << " Invalid end time given!" << endl << endl;
673 result = false;
674 }
675 } else {
676 gripe;
677 exit(1);
678 }
679
680 } else if (keyword == "--simulation-rate") {
681 if (n != string::npos) {
682 try {
683 simulation_rate = atof( value.c_str() );
684 override_sim_rate = true;
685 } catch (...) {
686 cerr << endl << " Invalid simulation rate given!" << endl << endl;
687 result = false;
688 }
689 } else {
690 gripe;
691 exit(1);
692 }
693
694 } else if (keyword == "--catalog") {
695 catalog = true;
696 if (value.size() > 0) AircraftName=value;
697 } else if (keyword.substr(0,2) != "--" && value.empty() ) {
698 // See what kind of files we are specifying on the command line
699
700 XMLFile xmlFile;
701 SGPath path = SGPath::fromLocal8Bit(keyword.c_str());
702
703 if (xmlFile.IsScriptFile(path)) ScriptName = path;
704 else if (xmlFile.IsLogDirectiveFile(path)) LogDirectiveName.push_back(path);
705 else if (xmlFile.IsAircraftFile(SGPath("aircraft")/keyword/keyword)) AircraftName = keyword;
706 else if (xmlFile.IsInitFile(path)) ResetName = path;
707 else if (xmlFile.IsInitFile(SGPath("aircraft")/AircraftName/keyword)) ResetName = SGPath("aircraft")/AircraftName/keyword;
708 else {
709 cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
710 exit(1);
711 }
712
713 }
714 else //Unknown keyword so print the help file, the bad keyword and abort
715 {
716 PrintHelp();
717 cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
718 exit(1);
719 }
720
721 }
722
723 // Post-processing for script options. check for incompatible options.
724
725 if (catalog && !ScriptName.isNull()) {
726 cerr << "Cannot specify catalog with script option" << endl << endl;
727 result = false;
728 }
729 if (!AircraftName.empty() && ResetName.isNull() && !catalog) {
730 cerr << "You must specify an initialization file with the aircraft name." << endl << endl;
731 result = false;
732 }
733 if (!ScriptName.isNull() && !AircraftName.empty()) {
734 cerr << "You cannot specify an aircraft file with a script." << endl;
735 result = false;
736 }
737
738 return result;
739
740}
741
742//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
743
744void PrintHelp(void)
745{
746 cout << endl << " JSBSim version " << FDMExec->GetVersion() << endl << endl;
747 cout << " Usage: jsbsim [script file name] [output file names] <options>" << endl << endl;
748 cout << " options:" << endl;
749 cout << " --help returns this message" << endl;
750 cout << " --version returns the version number" << endl;
751 cout << " --outputlogfile=<filename> sets (overrides) the name of a data output file" << endl;
752 cout << " --logdirectivefile=<filename> specifies the name of a data logging directives file" << endl;
753 cout << " (can appear multiple times)" << endl;
754 cout << " --root=<path> specifies the JSBSim root directory (where aircraft/, engine/, etc. reside)" << endl;
755 cout << " --aircraft=<filename> specifies the name of the aircraft to be modeled" << endl;
756 cout << " --script=<filename> specifies a script to run" << endl;
757 cout << " --realtime specifies to run in actual real world time" << endl;
758 cout << " --nice specifies to run at lower CPU usage" << endl;
759 cout << " --nohighlight specifies that console output should be pure text only (no color)" << endl;
760 cout << " --suspend specifies to suspend the simulation after initialization" << endl;
761 cout << " --initfile=<filename> specifies an initilization file" << endl;
762 cout << " --catalog specifies that all properties for this aircraft model should be printed" << endl;
763 cout << " (catalog=aircraftname is an optional format)" << endl;
764 cout << " --property=<name=value> e.g. --property=simulation/integrator/rate/rotational=1" << endl;
765 cout << " --simulation-rate=<rate (double)> specifies the sim dT time or frequency" << endl;
766 cout << " If rate specified is less than 1, it is interpreted as" << endl;
767 cout << " a time step size, otherwise it is assumed to be a rate in Hertz." << endl;
768 cout << " --end=<time (double)> specifies the sim end time" << endl << endl;
769
770 cout << " NOTE: There can be no spaces around the = sign when" << endl;
771 cout << " an option is followed by a filename" << endl << endl;
772}
JSBSim::FGFDMExec * FDMExec
Definition JSBSim.cpp:88
SGPath ScriptName
Definition JSBSim.cpp:81
void sim_nsleep(long nanosec)
Definition JSBSim.cpp:134
void PrintHelp(void)
Definition JSBSim.cpp:744
bool nohighlight
Definition JSBSim.cpp:95
bool override_sim_rate
Definition JSBSim.cpp:99
JSBSim::FGTrim * trimmer
Definition JSBSim.cpp:89
double simulation_rate
Definition JSBSim.cpp:98
double sleep_period
Definition JSBSim.cpp:100
double getcurrentseconds(void)
Definition JSBSim.cpp:118
bool play_nice
Definition JSBSim.cpp:92
bool suspend
Definition JSBSim.cpp:93
string AircraftName
Definition JSBSim.cpp:82
double end_time
Definition JSBSim.cpp:97
SGPath ResetName
Definition JSBSim.cpp:83
bool realtime
Definition JSBSim.cpp:91
#define gripe
Definition JSBSim.cpp:564
vector< SGPath > LogDirectiveName
Definition JSBSim.cpp:85
bool options(int, char **)
Definition JSBSim.cpp:568
SGPath RootDir
Definition JSBSim.cpp:80
vector< string > LogOutputName
Definition JSBSim.cpp:84
int real_main(int argc, char *argv[])
Definition JSBSim.cpp:301
vector< string > CommandLineProperties
Definition JSBSim.cpp:86
bool catalog
Definition JSBSim.cpp:94
vector< double > CommandLinePropertyValues
Definition JSBSim.cpp:87
#define i(x)
const std::string & GetName(void) const
Retrieves the element name.
bool Load(const SGPath &rstname, bool useStoredPath=true)
Loads the initial conditions.
static char highint[5]
highlights text
Definition FGJSBBase.h:123
static char reset[5]
resets text properties
Definition FGJSBBase.h:129
static char fggreen[6]
green text
Definition FGJSBBase.h:141
The trimming routine for JSBSim.
Definition FGTrim.h:124
Element * LoadXMLDocument(const SGPath &XML_filename, bool verbose=true)
This class is solely for the purpose of determining what type of file is given on the command line.
Definition JSBSim.cpp:146
bool IsLogDirectiveFile(const SGPath &filename)
Definition JSBSim.cpp:155
bool IsAircraftFile(const SGPath &filename)
Definition JSBSim.cpp:162
bool IsInitFile(const SGPath &filename)
Definition JSBSim.cpp:169
bool IsScriptFile(const SGPath &filename)
Definition JSBSim.cpp:148
int main()
TrimMode
Definition FGTrim.h:65
@ tNone
Definition FGTrim.h:66
static double atof(const string &str)
Definition options.cxx:107