]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/flight_control/FGKinemat.h
Sync. w. JSB CVS as of 15/01/2007
[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 #ifdef FGFS
41 #  include <simgear/compiler.h>
42 #  ifdef SG_HAVE_STD_INCLUDES
43 #    include <vector>
44 #  else
45 #    include <vector.h>
46 #  endif
47 #else
48 #  include <vector>
49 #endif
50
51 #include <string>
52 #include "FGFCSComponent.h"
53 #include <input_output/FGXMLElement.h>
54
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 DEFINITIONS
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58
59 #define ID_FLAPS "$Id$"
60
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62 FORWARD DECLARATIONS
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
64
65 namespace JSBSim {
66
67 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68 CLASS DOCUMENTATION
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
70
71 /** Encapsulates a kinematic (mechanical) component for the flight control system.
72 This component models the action of a moving effector, such as an aerosurface or
73 other mechanized entity such as a landing gear strut for the purpose of effecting
74 vehicle control or configuration. The form of the component specification is:
75
76 @code
77 <kinematic name="Gear Control">
78   <input> [-]property </input>
79   <traverse>
80     <setting>
81       <position> number </position>
82       <time> number </time>
83     </setting>
84     \85
85   </traverse>
86   [<clipto>
87     <min> {[-]property name | value} </min>
88     <max> {[-]property name | value} </max>
89   </clipto>]
90   [<gain> {property name | value} </gain>]
91   [<output> {property} </output>]
92 </kinematic>
93 @endcode
94
95 The detent is the position that the component takes, and the lag is the time it
96 takes to get to that position from an adjacent setting. For example:
97
98 @code
99 <kinematic name="Gear Control">
100   <input>gear/gear-cmd-norm</input>
101   <traverse>
102     <setting>
103       <position>0</position>
104       <time>0</time>
105     </setting>
106     <setting>
107       <position>1</position>
108       <time>5</time>
109     </setting>
110   </traverse>
111   <output>gear/gear-pos-norm</output>
112 </kinematic>
113 @endcode
114
115 In this case, it takes 5 seconds to get to a 1 setting. As this is a software
116 mechanization of a servo-actuator, there should be an output specified.
117   */
118
119 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120 CLASS DECLARATION
121 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
122
123 class FGKinemat  : public FGFCSComponent {
124 public:
125   /** Constructor.
126       @param fcs A reference to the ccurrent flightcontrolsystem.
127       @param AC_cfg reference to the current aircraft configuration file.
128       Initializes the FGKinemat object from the given configuration
129       file. The Configuration file is expected to be at the stream
130       position where the kinematic object starts. Also it is expected to
131       be past the end of the current kinematic configuration on exit.
132    */
133   FGKinemat(FGFCS* fcs, Element* element);
134
135   /// Destructor.
136   ~FGKinemat();
137
138   /** Kinematic component output value.
139       @return the current output of the kinematic object on the range of [0,1]. */
140   double GetOutputPct() const { return OutputPct; }
141
142   /** Run method, overrides FGModel::Run().
143       @return false on success, true on failure.
144       The routine doing the work.  */
145   bool Run (void);
146
147 private:
148   vector<double> Detents;
149   vector<double> TransitionTimes;
150   int NumDetents;
151   double OutputPct;
152   bool  DoScale;
153
154   void Debug(int from);
155 };
156 }
157 #endif