Debian Codegraph @

src/FDM/JSBSim/models/flight_control/FGMagnetometer.h

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGMagnetometer.h
4 Author: Matthew Chave
5 Date started: August 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
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
16 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
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
30 SENTRY
31 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
32
33 #ifndef FGMAGNETOMETER_H
34 #define FGMAGNETOMETER_H
35
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 INCLUDES
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40 #include "FGSensor.h"
41 #include "FGSensorOrientation.h"
42
43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 FORWARD DECLARATIONS
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
46
47 namespace JSBSim {
48
49 class FGFCS;
50 class FGPropagate;
51 class FGMassBalance;
52 class FGInertial;
53
54 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
55 CLASS DOCUMENTATION
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
57
58 /** Encapsulates a magnetometer component for the flight control system.
59
60 Syntax:
61
62 @code
63 <magnetometer name="name">
64 <axis> {X|Y|Z} </axis>
65 <lag> number </lag>
66 <orientation unit=DEG">
67 <x> number </x>
68 <y> number </y>
69 <z> number </z>
70 </orientation>
71 <noise variation="PERCENT|ABSOLUTE"> number </noise>
72 <quantization name="name">
73 <bits> number </bits>
74 <min> number </min>
75 <max> number </max>
76 </quantization>
77 <drift_rate> number </drift_rate>
78 <bias> number </bias>
79 <gain> number </gain>
80 </magnetometer>
81 @endcode
82
83 Example:
84
85 @code
86 <magnetometer name="aero/magnetometer/X">
87 <axis> X </axis>
88 <lag> 0.5 </lag>
89 <noise variation="PERCENT"> 2 </noise>
90 <quantization name="aero/magnetometer/quantized/qbar">
91 <bits> 12 </bits>
92 <min> 0 </min>
93 <max> 400 </max>
94 </quantization>
95 <bias> 0.5 </bias>
96 <gain> 0.5 </gain>
97 </magnetometer>
98 @endcode
99
100 The only required element in the magnetometer definition is the axis element. In
101 the default case, no degradation would be modeled, and the output would simply
102 be the input.
103
104 For noise, if the type is PERCENT, then the value supplied is understood to be a
105 percentage variance. That is, if the number given is 0.05, the the variance is
106 understood to be +/-0.05 percent maximum variance. So, the actual value for the
107 magnetometer will be *anywhere* from 0.95 to 1.05 of the actual "perfect" value
108 at any time - even varying all the way from 0.95 to 1.05 in adjacent frames -
109 whatever the delta time.
110
111 @author Jon S. Berndt
112 @version $Revision: 1.5 $
113 */
114
115 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
116 CLASS DECLARATION
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
118
119 class FGMagnetometer : public FGSensor, public FGSensorOrientation
120 {
121 public:
122 FGMagnetometer(FGFCS* fcs, Element* element);
123 ~FGMagnetometer();
124
125 bool Run (void) override;
126 void ResetPastStates(void) override;
127
128 private:
129 FGPropagate* Propagate;
130 FGMassBalance* MassBalance;
131 FGInertial* Inertial;
132 FGColumnVector3 vLocation;
133 FGColumnVector3 vRadius;
134 FGColumnVector3 vMag;
135 void updateInertialMag(void);
136 double field[6];
137 double usedLat;
138 double usedLon;
139 double usedAlt;
140 unsigned long int date;
141 unsigned int counter;
142 const unsigned int INERTIAL_UPDATE_RATE;
143
144 void Debug(int from) override;
145 };
146 }
147 #endif