]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGFCS.h
Check return value of FDM::init().
[flightgear.git] / src / FDM / JSBSim / FGFCS.h
1 /*******************************************************************************
2  
3  Header:       FGGFCS.h
4  Author:       Jon S. Berndt
5  Date started: 12/12/98
6  
7  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
8  
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  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 General Public License for more
17  details.
18  
19  You should have received a copy of the GNU General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22  
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25  
26 HISTORY
27 --------------------------------------------------------------------------------
28 12/12/98   JSB   Created
29  
30 ********************************************************************************
31 SENTRY
32 *******************************************************************************/
33
34 #ifndef FGFCS_H
35 #define FGFCS_H
36
37 /*******************************************************************************
38 INCLUDES
39 *******************************************************************************/
40
41 #ifdef FGFS
42 #  include <simgear/compiler.h>
43 #  ifdef FG_HAVE_STD_INCLUDES
44 #    include <vector>
45 #  else
46 #    include <vector.h>
47 #  endif
48 #else
49 #  include <vector>
50 #endif
51
52 #include <string>
53 #include "filtersjb/FGFCSComponent.h"
54 #include "FGModel.h"
55 #include "FGConfigFile.h"
56
57 #define ID_FCS "$Header"
58
59 /*******************************************************************************
60 CLASS DECLARATION
61 *******************************************************************************/
62
63 class FGFCS : public FGModel {
64 private:
65   float DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
66   float DaPos, DePos, DrPos, DfPos, DsbPos, DspPos;
67   float PTrimCmd;
68   float ThrottleCmd[MAX_ENGINES];       // Needs to be changed: no limit
69   float ThrottlePos[MAX_ENGINES];       // Needs to be changed: no limit
70
71   vector <FGFCSComponent*> Components;
72
73 public:
74   FGFCS(FGFDMExec*);
75   ~FGFCS(void);
76
77   bool Run(void);
78
79   inline float GetDaCmd(void) { return DaCmd; }
80   inline float GetDeCmd(void) { return DeCmd; }
81   inline float GetDrCmd(void) { return DrCmd; }
82   inline float GetDfCmd(void) { return DfCmd; }
83   inline float GetDsbCmd(void) { return DsbCmd; }
84   inline float GetDspCmd(void) { return DspCmd; }
85   inline float GetThrottleCmd(int ii) { return ThrottleCmd[ii]; }
86   inline float GetPitchTrimCmd(void) { return PTrimCmd; }
87
88   inline float GetDaPos(void) { return DaPos; }
89   inline float GetDePos(void) { return DePos; }
90   inline float GetDrPos(void) { return DrPos; }
91   inline float GetDfPos(void) { return DfPos; }
92   inline float GetDsbPos(void) { return DsbPos; }
93   inline float GetDspPos(void) { return DspPos; }
94
95   inline float GetThrottlePos(int ii) { return ThrottlePos[ii]; }
96   inline FGState* GetState(void) { return State; }
97   float GetComponentOutput(eParam idx);
98   string GetComponentName(int idx);
99
100   inline void SetDaCmd(float tt) { DaCmd = tt; }
101   inline void SetDeCmd(float tt) { DeCmd = tt; }
102   inline void SetDrCmd(float tt) { DrCmd = tt; }
103   inline void SetDfCmd(float tt) { DfCmd = tt; }
104   inline void SetDsbCmd(float tt) { DsbCmd = tt; }
105   inline void SetDspCmd(float tt) { DspCmd = tt; }
106   inline void SetPitchTrimCmd(float tt) { PTrimCmd = tt; }
107
108   void SetThrottleCmd(int ii, float tt);
109
110   inline void SetDaPos(float tt) { DaPos = tt; }
111   inline void SetDePos(float tt) { DePos = tt; }
112   inline void SetDrPos(float tt) { DrPos = tt; }
113   inline void SetDfPos(float tt) { DfPos = tt; }
114   inline void SetDsbPos(float tt) { DsbPos = tt; }
115   inline void SetDspPos(float tt) { DspPos = tt; }
116
117   void SetLBrake(float);
118   void SetRBrake(float);
119   void SetCBrake(float);
120
121   void SetThrottlePos(int ii, float tt);
122
123   bool LoadFCS(FGConfigFile* AC_cfg);
124   string FCSName;
125 };
126
127 #include "FGState.h"
128
129 #endif