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