]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/flight_control/FGKinemat.h
Sync. with JSBSim CVS (header cleanups).
[flightgear.git] / src / FDM / JSBSim / models / flight_control / FGKinemat.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGKinemat.h
4  Author:       Tony Peden, for flight control system authored by Jon S. Berndt
5  Date started: 12/02/01
6
7  ------------- Copyright (C) Anthony K. Peden -------------
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 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 Lesser General Public License for more
17  details.
18
19  You should have received a copy of the GNU Lesser 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 Lesser General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 SENTRY
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
32
33 #ifndef FGKinemat_H
34 #define FGKinemat_H
35
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40 #include "FGFCSComponent.h"
41 #include <input_output/FGXMLElement.h>
42 #include <vector>
43 #include <string>
44
45 using std::vector;
46 using std::string;
47
48 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49 DEFINITIONS
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
51
52 #define ID_FLAPS "$Id$"
53
54 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 FORWARD DECLARATIONS
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57
58 namespace JSBSim {
59
60 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61 CLASS DOCUMENTATION
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
63
64 /** Encapsulates a kinematic (mechanical) component for the flight control system.
65 This component models the action of a moving effector, such as an aerosurface or
66 other mechanized entity such as a landing gear strut for the purpose of effecting
67 vehicle control or configuration. The form of the component specification is:
68
69 @code
70 <kinematic name="Gear Control">
71   <input> [-]property </input>
72   <traverse>
73     <setting>
74       <position> number </position>
75       <time> number </time>
76     </setting>
77     ...
78   </traverse>
79   [<clipto>
80     <min> {[-]property name | value} </min>
81     <max> {[-]property name | value} </max>
82   </clipto>]
83   [<gain> {property name | value} </gain>]
84   [<output> {property} </output>]
85 </kinematic>
86 @endcode
87
88 The detent is the position that the component takes, and the lag is the time it
89 takes to get to that position from an adjacent setting. For example:
90
91 @code
92 <kinematic name="Gear Control">
93   <input>gear/gear-cmd-norm</input>
94   <traverse>
95     <setting>
96       <position>0</position>
97       <time>0</time>
98     </setting>
99     <setting>
100       <position>1</position>
101       <time>5</time>
102     </setting>
103   </traverse>
104   <output>gear/gear-pos-norm</output>
105 </kinematic>
106 @endcode
107
108 In this case, it takes 5 seconds to get to a 1 setting. As this is a software
109 mechanization of a servo-actuator, there should be an output specified.
110   */
111
112 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 CLASS DECLARATION
114 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
115
116 class FGKinemat  : public FGFCSComponent {
117 public:
118   /** Constructor.
119       @param fcs A reference to the current flight control system.
120       @param element reference to the current configuration file node.
121    */
122   FGKinemat(FGFCS* fcs, Element* element);
123
124   /// Destructor.
125   ~FGKinemat();
126
127   /** Kinematic component output value.
128       @return the current output of the kinematic object on the range of [0,1]. */
129   double GetOutputPct() const { return OutputPct; }
130
131   /** Run method, overrides FGModel::Run().
132       @return false on success, true on failure.
133       The routine doing the work.  */
134   bool Run (void);
135
136 private:
137   vector<double> Detents;
138   vector<double> TransitionTimes;
139   int NumDetents;
140   double OutputPct;
141   bool  DoScale;
142
143   void Debug(int from);
144 };
145 }
146 #endif