FlightGear next
FGAuxiliary.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGAuxiliary.h
4 Author: Jon Berndt
5 Date started: 01/26/99
6
7 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
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
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
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
26HISTORY
27--------------------------------------------------------------------------------
2811/22/98 JSB Created
29 1/1/00 TP Added calcs and getters for VTAS, VCAS, VEAS, Vground, in knots
30
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32SENTRY
33%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
34
35#ifndef FGAUXILIARY_H
36#define FGAUXILIARY_H
37
38/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39INCLUDES
40%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41
42#include "FGModel.h"
43#include "math/FGLocation.h"
44
45/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46FORWARD DECLARATIONS
47%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
49namespace JSBSim {
50
51/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52CLASS DOCUMENTATION
53%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54
95
96/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97CLASS DECLARATION
98%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
99
100class FGAuxiliary : public FGModel {
101public:
104 explicit FGAuxiliary(FGFDMExec* Executive);
105
107 ~FGAuxiliary();
108
109 bool InitModel(void) override;
110
119 bool Run(bool Holding) override;
120
121// GET functions
122
123 // Atmospheric parameters GET functions
125 double GetVcalibratedFPS(void) const { return vcas; }
127 double GetVcalibratedKTS(void) const { return vcas*fpstokts; }
129 double GetVequivalentFPS(void) const { return veas; }
131 double GetVequivalentKTS(void) const { return veas*fpstokts; }
133 double GetVtrueFPS() const { return Vt; }
135 double GetVtrueKTS() const { return Vt * fpstokts; }
136
141 double GetTotalPressure(void) const { return pt; }
142
150
151 double GetTotalTemperature(void) const { return tat; }
152 double GetTAT_C(void) const { return tatc; }
153
154 double GetPilotAccel(int idx) const { return vPilotAccel(idx); }
155 double GetNpilot(int idx) const { return vPilotAccelN(idx); }
156 double GetAeroPQR(int axis) const { return vAeroPQR(axis); }
157 double GetEulerRates(int axis) const { return vEulerRates(axis); }
158
159 const FGColumnVector3& GetPilotAccel (void) const { return vPilotAccel; }
160 const FGColumnVector3& GetNpilot (void) const { return vPilotAccelN; }
161 const FGColumnVector3& GetNcg (void) const { return vNcg; }
162 double GetNcg (int idx) const { return vNcg(idx); }
163 double GetNlf (void) const;
164 const FGColumnVector3& GetAeroPQR (void) const { return vAeroPQR; }
165 const FGColumnVector3& GetEulerRates (void) const { return vEulerRates; }
166 const FGColumnVector3& GetAeroUVW (void) const { return vAeroUVW; }
167 const FGLocation& GetLocationVRP(void) const { return vLocationVRP; }
168
169 double GetAeroUVW (int idx) const { return vAeroUVW(idx); }
170 double Getalpha (void) const { return alpha; }
171 double Getbeta (void) const { return beta; }
172 double Getadot (void) const { return adot; }
173 double Getbdot (void) const { return bdot; }
174 double GetMagBeta (void) const { return fabs(beta); }
175
176 double Getalpha (int unit) const { if (unit == inDegrees) return alpha*radtodeg;
177 else return BadUnits(); }
178 double Getbeta (int unit) const { if (unit == inDegrees) return beta*radtodeg;
179 else return BadUnits(); }
180 double Getadot (int unit) const { if (unit == inDegrees) return adot*radtodeg;
181 else return BadUnits(); }
182 double Getbdot (int unit) const { if (unit == inDegrees) return bdot*radtodeg;
183 else return BadUnits(); }
184 double GetMagBeta (int unit) const { if (unit == inDegrees) return fabs(beta)*radtodeg;
185 else return BadUnits(); }
186
190 const FGMatrix33& GetTw2b(void) const { return mTw2b; }
191
195 const FGMatrix33& GetTb2w(void) const { return mTb2w; }
196
197 double Getqbar (void) const { return qbar; }
198 double GetqbarUW (void) const { return qbarUW; }
199 double GetqbarUV (void) const { return qbarUV; }
200 double GetReynoldsNumber(void) const { return Re; }
201
204 double GetVt (void) const { return Vt; }
205
210 double GetVground (void) const { return Vground; }
211
213 double GetMach (void) const { return Mach; }
214
216 double GetMachU (void) const { return MachU; }
217
219 double GetNx (void) const { return Nx; }
220
222 double GetNy (void) const { return Ny; }
223
225 double GetNz (void) const { return Nz; }
226
227 const FGColumnVector3& GetNwcg(void) const { return vNwcg; }
228
229 double GetHOverBCG(void) const { return hoverbcg; }
230 double GetHOverBMAC(void) const { return hoverbmac; }
231
232 double GetGamma(void) const { return gamma; }
233 double GetGroundTrack(void) const { return psigt; }
234
235 double GetGamma(int unit) const {
236 if (unit == inDegrees) return gamma*radtodeg;
237 else return BadUnits();
238 }
239
240// Time routines, SET and GET functions, used by FGMSIS atmosphere
241
242 void SetDayOfYear (int doy) { day_of_year = doy; }
243 void SetSecondsInDay (double sid) { seconds_in_day = sid; }
244
245 int GetDayOfYear (void) const { return day_of_year; }
246 double GetSecondsInDay (void) const { return seconds_in_day; }
247
248 double GetLongitudeRelativePosition (void) const;
249 double GetLatitudeRelativePosition (void) const;
250 double GetDistanceRelativePosition (void) const;
251
252 void SetAeroPQR(const FGColumnVector3& tt) { vAeroPQR = tt; }
253
288
289private:
290 double vcas, veas;
291 double pt, tat, tatc; // Don't add a getter for pt!
292
293 FGMatrix33 mTw2b;
294 FGMatrix33 mTb2w;
295
296 FGColumnVector3 vPilotAccel;
297 FGColumnVector3 vPilotAccelN;
298 FGColumnVector3 vNcg;
299 FGColumnVector3 vNwcg;
300 FGColumnVector3 vAeroPQR;
301 FGColumnVector3 vAeroUVW;
302 FGColumnVector3 vEulerRates;
303 FGColumnVector3 vMachUVW;
304 FGLocation vLocationVRP;
305
306 double Vt, Vground;
307 double Mach, MachU;
308 double qbar, qbarUW, qbarUV;
309 double Re; // Reynolds Number = V*c/mu
310 double alpha, beta;
311 double adot,bdot;
312 double psigt, gamma;
313 double Nx, Ny, Nz;
314 double seconds_in_day; // seconds since current GMT day began
315 int day_of_year; // GMT day, 1 .. 366
316
317 double hoverbcg, hoverbmac;
318
319 void UpdateWindMatrices(void);
320
321 void CalculateRelativePosition(void);
322
323 void bind(void);
324 double BadUnits(void) const;
325 void Debug(int from) override;
326};
327
328} // namespace JSBSim
329
330//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
331#endif
double GetqbarUV(void) const
double Getadot(int unit) const
double GetMagBeta(int unit) const
double Getbeta(void) const
bool Run(bool Holding) override
Runs the Auxiliary routines; called by the Executive Can pass in a value indicating if the executive ...
double GetqbarUW(void) const
double GetVtrueFPS() const
Returns the true airspeed in feet per second.
const FGColumnVector3 & GetEulerRates(void) const
void SetSecondsInDay(double sid)
const FGLocation & GetLocationVRP(void) const
double GetMachU(void) const
The mach number calculated using the vehicle X axis velocity.
const FGMatrix33 & GetTw2b(void) const
Calculates and returns the wind-to-body axis transformation matrix.
double GetNlf(void) const
double GetLongitudeRelativePosition(void) const
int GetDayOfYear(void) const
double Getbeta(int unit) const
double GetAeroUVW(int idx) const
double GetTAT_C(void) const
double GetVequivalentKTS(void) const
Returns equivalent airspeed in knots.
double GetVcalibratedFPS(void) const
Returns Calibrated airspeed in feet/second.
double GetGamma(int unit) const
double GetPilotAccel(int idx) const
void SetAeroPQR(const FGColumnVector3 &tt)
double Getadot(void) const
double Getalpha(int unit) const
struct JSBSim::FGAuxiliary::Inputs in
~FGAuxiliary()
Destructor.
double GetTotalPressure(void) const
Returns the total pressure.
double GetNy(void) const
The lateral acceleration in g's of the aircraft center of gravity.
double GetEulerRates(int axis) const
const FGColumnVector3 & GetAeroUVW(void) const
double GetReynoldsNumber(void) const
double GetTotalTemperature(void) const
Returns the total temperature.
double GetVtrueKTS() const
Returns the true airspeed in knots.
double GetHOverBCG(void) const
double GetAeroPQR(int axis) const
const FGColumnVector3 & GetNpilot(void) const
double GetNcg(int idx) const
const FGMatrix33 & GetTb2w(void) const
Calculates and returns the body-to-wind axis transformation matrix.
double Getbdot(int unit) const
double GetVequivalentFPS(void) const
Returns equivalent airspeed in feet/second.
const FGColumnVector3 & GetAeroPQR(void) const
double GetDistanceRelativePosition(void) const
void SetDayOfYear(int doy)
double Getalpha(void) const
const FGColumnVector3 & GetPilotAccel(void) const
double GetVground(void) const
Gets the ground speed in feet per second.
double GetNz(void) const
The vertical acceleration in g's of the aircraft center of gravity.
double GetVt(void) const
Gets the magnitude of total vehicle velocity including wind effects in feet per second.
bool InitModel(void) override
const FGColumnVector3 & GetNcg(void) const
double GetSecondsInDay(void) const
double GetMach(void) const
Gets the Mach number.
double GetNx(void) const
The longitudinal acceleration in g's of the aircraft center of gravity.
double Getbdot(void) const
double GetGroundTrack(void) const
double GetNpilot(int idx) const
double GetGamma(void) const
const FGColumnVector3 & GetNwcg(void) const
double GetHOverBMAC(void) const
FGAuxiliary(FGFDMExec *Executive)
Constructor.
double Getqbar(void) const
double GetLatitudeRelativePosition(void) const
double GetVcalibratedKTS(void) const
Returns Calibrated airspeed in knots.
double GetMagBeta(void) const
This class implements a 3 element column vector.
static constexpr double radtodeg
Definition FGJSBBase.h:348
static constexpr double fpstokts
Definition FGJSBBase.h:354
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF).
Definition FGLocation.h:152
Handles matrix math operations.
Definition FGMatrix33.h:70
FGModel(FGFDMExec *)
Constructor.
Definition FGModel.cpp:57
FGColumnVector3 TotalWindNED