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