]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/JSBSim.cpp
Various SGI portability tweaks.
[flightgear.git] / src / FDM / JSBSim / JSBSim.cpp
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 (jsb@hal-pc.org) -------------
10
11  This program is free software; you can redistribute it and/or modify it under
12  the terms of the GNU 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 General Public License for more
19  details.
20
21  You should have received a copy of the GNU 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 General Public License can also be found on
26  the world wide web at http://www.gnu.org.
27
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30
31 This class Handles calling JSBSim standalone. It is set up for compilation under
32 Borland C+Builder or other compiler.
33
34 HISTORY
35 --------------------------------------------------------------------------------
36 08/17/99   JSB   Created
37
38 ********************************************************************************
39 INCLUDES
40 *******************************************************************************/
41
42 #if __BCPLUSPLUS__      >= 0x0540   // If compiling under Borland C++Builder
43   //---------------------------------------------------------------------------
44   #pragma hdrstop
45   #include <condefs.h>
46   USEUNIT("FGAircraft.cpp");
47   USEUNIT("FGAtmosphere.cpp");
48   USEUNIT("FGAuxiliary.cpp");
49   USEUNIT("FGCoefficient.cpp");
50   USEUNIT("FGEngine.cpp");
51   USEUNIT("FGFCS.cpp");
52   USEUNIT("FGFDMExec.cpp");
53   USEUNIT("FGInitialCondition.cpp");
54   USEUNIT("FGModel.cpp");
55   USEUNIT("FGOutput.cpp");
56   USEUNIT("FGPosition.cpp");
57   USEUNIT("FGRotation.cpp");
58   USEUNIT("FGState.cpp");
59   USEUNIT("FGTank.cpp");
60   USEUNIT("FGTranslation.cpp");
61   USEUNIT("FGUtility.cpp");
62   USERES("JSBSim.res");
63   //---------------------------------------------------------------------------
64   #pragma argsused
65 #endif
66
67 #include "FGFDMExec.h"
68 #include "FGRotation.h"
69 #include "FGAtmosphere.h"
70 #include "FGState.h"
71 #include "FGFCS.h"
72 #include "FGAircraft.h"
73 #include "FGTranslation.h"
74 #include "FGPosition.h"
75 #include "FGAuxiliary.h"
76 #include "FGOutput.h"
77
78 #ifdef FGFS
79 #include <Include/compiler.h>
80 #include STL_IOSTREAM
81 #  ifdef FG_HAVE_STD_INCLUDES
82 #    include <ctime>
83 #  else
84 #    include <time.h>
85 #  endif
86 #else
87 #include <iostream>
88 #include <ctime>
89 #endif
90
91 int main(int argc, char** argv)
92 {
93         FGFDMExec* FDMExec;
94
95   if (argc != 3) {
96     cout << endl
97          << "  You must enter the name of a registered aircraft and reset point:"
98          << endl << endl << "  FDM <aircraft name> <reset file>" << endl;
99     exit(0);
100   }
101
102   FDMExec = new FGFDMExec();
103
104   FDMExec->GetAircraft()->LoadAircraft("aircraft", "engine", string(argv[1]));
105   FDMExec->GetState()->Reset("aircraft", string(argv[2]));
106
107   while (FDMExec->GetState()->Getsim_time() <= 25.0)
108   {
109     //
110     // Fake an elevator kick here after 5 seconds
111     //
112
113                 if (FDMExec->GetState()->Getsim_time() > 5.0 &&
114         FDMExec->GetState()->Getsim_time() < 6.0)
115     {
116                         FDMExec->GetFCS()->SetDe(0.05);
117                 }
118
119     FDMExec->Run();
120   }
121
122   delete FDMExec;
123   
124   return 0;
125 }
126
127 #ifndef FGFS
128 WinMain()
129 {
130 }
131 #endif