]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/flight_control/FGAccelerometer.h
Merge branch 'next' into comm-subsystem
[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.5 2011/07/17 13:51:23 jberndt 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   <input> property </input>
75   <lag> number </lag>
76   <noise variation="PERCENT|ABSOLUTE"> number </noise>
77   <quantization name="name">
78     <bits> number </bits>
79     <min> number </min>
80     <max> number </max>
81   </quantization>
82   <drift_rate> number </drift_rate>
83   <bias> number </bias>
84 </accelerometer>
85 @endcode
86
87 Example:
88
89 @code
90 <accelerometer name="aero/accelerometer/qbar">
91   <input> aero/qbar </input>
92   <lag> 0.5 </lag>
93   <noise variation="PERCENT"> 2 </noise>
94   <quantization name="aero/accelerometer/quantized/qbar">
95     <bits> 12 </bits>
96     <min> 0 </min>
97     <max> 400 </max>
98   </quantization>
99   <bias> 0.5 </bias>
100 </accelerometer>
101 @endcode
102
103 The only required element in the accelerometer definition is the input element. In that
104 case, no degradation would be modeled, and the output would simply be the input.
105
106 For noise, if the type is PERCENT, then the value supplied is understood to be a
107 percentage variance. That is, if the number given is 0.05, the the variance is
108 understood to be +/-0.05 percent maximum variance. So, the actual value for the accelerometer
109 will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value at any time -
110 even varying all the way from 0.95 to 1.05 in adjacent frames - whatever the delta
111 time.
112
113 @author Jon S. Berndt
114 @version $Revision: 1.5 $
115 */
116
117 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 CLASS DECLARATION
119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
120
121 class FGAccelerometer  : public FGSensor, public FGSensorOrientation
122 {
123 public:
124   FGAccelerometer(FGFCS* fcs, Element* element);
125   ~FGAccelerometer();
126
127   bool Run (void);
128
129 private:
130   FGPropagate* Propagate;
131   FGAccelerations* Accelerations;
132   FGMassBalance* MassBalance;
133   FGInertial* Inertial;
134   FGColumnVector3 vLocation;
135   FGColumnVector3 vRadius;
136   FGColumnVector3 vAccel;
137   
138   void Debug(int from);
139 };
140 }
141 #endif