]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/flight_control/FGAccelerometer.h
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / flight_control / FGAccelerometer.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGAccelerometer.h
4  Author:       Jon Berndt
5  Date started: May 2009
6
7  ------------- Copyright (C) 2009 -------------
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 FGACCELEROMETER_H
34 #define FGACCELEROMETER_H
35
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40 #include "FGSensor.h"
41 #include "input_output/FGXMLElement.h"
42 #include "math/FGColumnVector3.h"
43 #include "math/FGMatrix33.h"
44 #include "FGSensorOrientation.h"
45
46 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
47 DEFINITIONS
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
49
50 #define ID_ACCELEROMETER "$Id: FGAccelerometer.h,v 1.6 2012/01/08 12:39:14 bcoconni Exp $"
51
52 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 FORWARD DECLARATIONS
54 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
55
56 namespace JSBSim {
57
58 class FGFCS;
59 class FGPropagate;
60 class FGAccelerations;
61 class FGInertial;
62 class FGMassBalance;
63
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 CLASS DOCUMENTATION
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67
68 /** Encapsulates a Accelerometer component for the flight control system.
69
70 Syntax:
71
72 @code
73 <accelerometer name="name">
74   <location unit="{IN | M}">
75     <x> number </x>
76     <y> number </y>
77     <z> number </z>
78   </location>
79   <orientation unit="{RAD | DEG}">
80     <pitch> {number} </pitch>
81     <roll> {number} </roll>
82     <yaw> {number} </yaw>
83   </orientation>
84   <axis> {X | Y | Z} </axis>
85   <lag> number </lag>
86   <noise variation="PERCENT|ABSOLUTE"> number </noise>
87   <quantization name="name">
88     <bits> number </bits>
89     <min> number </min>
90     <max> number </max>
91   </quantization>
92   <drift_rate> number </drift_rate>
93   <gain> number </gain>
94   <bias> number </bias>
95 </accelerometer>
96 @endcode
97
98 Example:
99
100 @code
101 <accelerometer name="aero/accelerometer/right_tip_wing">
102   <location unit="IN">
103     <x> 43.2 </x>
104     <y> 214. </y>
105     <z> 59.4 </z>
106   </location>
107   <axis> Z </axis>
108   <lag> 0.5 </lag>
109   <noise variation="PERCENT"> 2 </noise>
110   <quantization name="aero/accelerometer/quantized/right_tip_wing">
111     <bits> 12 </bits>
112     <min> 0 </min>
113     <max> 400 </max>
114   </quantization>
115   <bias> 0.5 </bias>
116 </accelerometer>
117 @endcode
118
119 The only required element in the accelerometer definition is the input element. In that
120 case, no degradation would be modeled, and the output would simply be the input.
121
122 For noise, if the type is PERCENT, then the value supplied is understood to be a
123 percentage variance. That is, if the number given is 0.05, the the variance is
124 understood to be +/-0.05 percent maximum variance. So, the actual value for the accelerometer
125 will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
126 even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
127 time.
128
129 @author Jon S. Berndt
130 @version $Revision: 1.6 $
131 */
132
133 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
134 CLASS DECLARATION
135 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
136
137 class FGAccelerometer  : public FGSensor, public FGSensorOrientation
138 {
139 public:
140   FGAccelerometer(FGFCS* fcs, Element* element);
141   ~FGAccelerometer();
142
143   bool Run (void);
144
145 private:
146   FGPropagate* Propagate;
147   FGAccelerations* Accelerations;
148   FGMassBalance* MassBalance;
149   FGInertial* Inertial;
150   FGColumnVector3 vLocation;
151   FGColumnVector3 vRadius;
152   FGColumnVector3 vAccel;
153   
154   void Debug(int from);
155 };
156 }
157 #endif