JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGModel.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3  Header: FGModel.h
4  Author: Jon Berndt
5  Date started: 11/21/98
6 
7  ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
8 
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free
11  Software Foundation; either version 2 of the License, or (at your option) any
12  later version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17  details.
18 
19  You should have received a copy of the GNU Lesser General Public License along
20  with this program; if not, write to the Free Software Foundation, Inc., 59
21  Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23  Further information about the GNU Lesser General Public License can also be
24  found on the world wide web at http://www.gnu.org.
25 
26 HISTORY
27 --------------------------------------------------------------------------------
28 11/22/98 JSB Created
29 
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33 
34 #ifndef FGMODEL_H
35 #define FGMODEL_H
36 
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40 
41 #include <string>
42 
43 #include "math/FGModelFunctions.h"
44 #include "simgear/misc/sg_path.hxx"
45 
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 FORWARD DECLARATIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49 
50 namespace JSBSim {
51 
52 class FGFDMExec;
53 class Element;
54 class FGPropertyManager;
55 
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS DOCUMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59 
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 CLASS DECLARATION
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67 
68 class FGModel : public FGModelFunctions
69 {
70 public:
71 
73  explicit FGModel(FGFDMExec*);
75  ~FGModel() override;
76 
86  virtual bool Run(bool Holding);
87 
88  bool InitModel(void) override;
90  void SetRate(unsigned int tt) {rate = tt;}
92  unsigned int GetRate(void) {return rate;}
93  FGFDMExec* GetExec(void) {return FDMExec;}
94 
95  void SetPropertyManager(FGPropertyManager *fgpm) { PropertyManager=fgpm;}
96  virtual SGPath FindFullPathName(const SGPath& path) const;
97  const std::string& GetName(void) { return Name; }
98  virtual bool Load(Element* el) { return true; }
99 
100 protected:
101  unsigned int exe_ctr;
102  unsigned int rate;
103  std::string Name;
104 
112  bool Upload(Element* el, bool preLoad);
113 
114  virtual void Debug(int from);
115 
116  FGFDMExec* FDMExec;
117  FGPropertyManager* PropertyManager;
118 };
119 }
120 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
121 #endif
JSBSim::FGFDMExec
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:185
JSBSim::FGModel::Upload
bool Upload(Element *el, bool preLoad)
Uploads this model in memory.
Definition: FGModel.cpp:110
JSBSim::FGModel
Base class for all scheduled JSBSim models.
Definition: FGModel.h:68
JSBSim::FGModel::FGModel
FGModel(FGFDMExec *)
Constructor.
Definition: FGModel.cpp:57
JSBSim::FGModelFunctions
The model functions class provides the capability for loading, storing, and executing arbitrary funct...
Definition: FGModelFunctions.h:72
JSBSim::FGModel::GetRate
unsigned int GetRate(void)
Get the output rate for the model in frames.
Definition: FGModel.h:92
JSBSim::FGModel::SetRate
void SetRate(unsigned int tt)
Set the ouput rate for the model in frames.
Definition: FGModel.h:90
JSBSim::FGModel::Run
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
Definition: FGModel.cpp:89
JSBSim::FGModel::~FGModel
~FGModel() override
Destructor.
Definition: FGModel.cpp:74