Debian Codegraph @

src/FDM/JSBSim/models/FGAuxiliary.cpp

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Module: FGAuxiliary.cpp
4 Author: Tony Peden, Jon Berndt
5 Date started: 01/26/99
6 Purpose: Calculates additional parameters needed by the visual system, etc.
7 Called by: FGFDMExec
8
9 ------------- Copyright (C) 1999 Jon S. Berndt ([email protected]) -------------
10
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU Lesser General Public License as published by the Free
13 Software Foundation; either version 2 of the License, or (at your option) any
14 later version.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
19 details.
20
21 You should have received a copy of the GNU Lesser General Public License along
22 with this program; if not, write to the Free Software Foundation, Inc., 59
23 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
25 Further information about the GNU Lesser General Public License can also be
26 found on the world wide web at http://www.gnu.org.
27
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30 This class calculates various auxiliary parameters.
31
32 REFERENCES
33 Anderson, John D. "Introduction to Flight", 3rd Edition, McGraw-Hill, 1989
34 pgs. 112-126
35 HISTORY
36 --------------------------------------------------------------------------------
37 01/26/99 JSB Created
38
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 INCLUDES
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42
43 #include <iostream>
44
45 #include "FGAuxiliary.h"
46 #include "initialization/FGInitialCondition.h"
47 #include "FGFDMExec.h"
48 #include "input_output/FGPropertyManager.h"
49 #include "FGInertial.h"
50 #include "FGAtmosphere.h"
51
52 using namespace std;
53
54 namespace JSBSim {
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS IMPLEMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60
61 FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
62 {
63 Name = "FGAuxiliary";
64 pt = FGAtmosphere::StdDaySLpressure; // ISA SL pressure
65 tat = FGAtmosphere::StdDaySLtemperature; // ISA SL temperature
66 tatc = RankineToCelsius(tat);
67
68 vcas = veas = 0.0;
69 qbar = qbarUW = qbarUV = 0.0;
70 Mach = MachU = 0.0;
71 alpha = beta = 0.0;
72 adot = bdot = 0.0;
73 gamma = Vt = Vground = 0.0;
74 psigt = 0.0;
75 hoverbmac = hoverbcg = 0.0;
76 Re = 0.0;
77 Nx = Ny = Nz = 0.0;
78
79 vPilotAccel.InitMatrix();
80 vPilotAccelN.InitMatrix();
81 vAeroUVW.InitMatrix();
82 vAeroPQR.InitMatrix();
83 vMachUVW.InitMatrix();
84 vEulerRates.InitMatrix();
85
86 bind();
87
88 Debug(0);
89 }
90
91 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92
93 bool FGAuxiliary::InitModel(void)
94 {
95 if (!FGModel::InitModel()) return false;
96
97 pt = in.Pressure;
98 tat = in.Temperature;
99 tatc = RankineToCelsius(tat);
100
101 vcas = veas = 0.0;
102 qbar = qbarUW = qbarUV = 0.0;
103 Mach = MachU = 0.0;
104 alpha = beta = 0.0;
105 adot = bdot = 0.0;
106 gamma = Vt = Vground = 0.0;
107 psigt = 0.0;
108 hoverbmac = hoverbcg = 0.0;
109 Re = 0.0;
110 Nz = Ny = 0.0;
111
112 vPilotAccel.InitMatrix();
113 vPilotAccelN.InitMatrix();
114 vAeroUVW.InitMatrix();
115 vAeroPQR.InitMatrix();
116 vMachUVW.InitMatrix();
117 vEulerRates.InitMatrix();
118
119 return true;
120 }
121
122 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
123
124 FGAuxiliary::~FGAuxiliary()
125 {
126 Debug(1);
127 }
128
129 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
130
131 bool FGAuxiliary::Run(bool Holding)
132 {
133 if (FGModel::Run(Holding)) return true; // return true if error returned from base class
134 if (Holding) return false;
135
136 // Rotation
137
138 vEulerRates(eTht) = in.vPQR(eQ)*in.CosPhi - in.vPQR(eR)*in.SinPhi;
139 if (in.CosTht != 0.0) {
140 vEulerRates(ePsi) = (in.vPQR(eQ)*in.SinPhi + in.vPQR(eR)*in.CosPhi)/in.CosTht;
141 vEulerRates(ePhi) = in.vPQR(eP) + vEulerRates(ePsi)*in.SinTht;
142 }
143
144 // Combine the wind speed with aircraft speed to obtain wind relative speed
145 vAeroPQR = in.vPQR - in.TurbPQR;
146 vAeroUVW = in.vUVW - in.Tl2b * in.TotalWindNED;
147
148 alpha = beta = adot = bdot = 0;
149 double AeroU2 = vAeroUVW(eU)*vAeroUVW(eU);
150 double AeroV2 = vAeroUVW(eV)*vAeroUVW(eV);
151 double AeroW2 = vAeroUVW(eW)*vAeroUVW(eW);
152 double mUW = AeroU2 + AeroW2;
153
154 double Vt2 = mUW + AeroV2;
155 Vt = sqrt(Vt2);
156
157 if ( Vt > 0.001 ) {
158 beta = atan2(vAeroUVW(eV), sqrt(mUW));
159
160 if ( mUW >= 1E-6 ) {
161 alpha = atan2(vAeroUVW(eW), vAeroUVW(eU));
162 double Vtdot = (vAeroUVW(eU)*in.vUVWdot(eU) + vAeroUVW(eV)*in.vUVWdot(eV) + vAeroUVW(eW)*in.vUVWdot(eW))/Vt;
163 adot = (vAeroUVW(eU)*in.vUVWdot(eW) - vAeroUVW(eW)*in.vUVWdot(eU))/mUW;
164 bdot = (in.vUVWdot(eV)*Vt - vAeroUVW(eV)*Vtdot)/(Vt*sqrt(mUW));
165 }
166 }
167
168 UpdateWindMatrices();
169
170 Re = Vt * in.Wingchord / in.KinematicViscosity;
171
172 double densityD2 = 0.5*in.Density;
173
174 qbar = densityD2 * Vt2;
175 qbarUW = densityD2 * (mUW);
176 qbarUV = densityD2 * (AeroU2 + AeroV2);
177 Mach = Vt / in.SoundSpeed;
178 MachU = vMachUVW(eU) = vAeroUVW(eU) / in.SoundSpeed;
179 vMachUVW(eV) = vAeroUVW(eV) / in.SoundSpeed;
180 vMachUVW(eW) = vAeroUVW(eW) / in.SoundSpeed;
181
182 // Position
183
184 Vground = sqrt( in.vVel(eNorth)*in.vVel(eNorth) + in.vVel(eEast)*in.vVel(eEast) );
185
186 psigt = atan2(in.vVel(eEast), in.vVel(eNorth));
187 if (psigt < 0.0) psigt += 2*M_PI;
188 gamma = atan2(-in.vVel(eDown), Vground);
189
190 tat = in.Temperature*(1 + 0.2*Mach*Mach); // Total Temperature, isentropic flow
191 tatc = RankineToCelsius(tat);
192
193 pt = PitotTotalPressure(Mach, in.Pressure);
194
195 if (abs(Mach) > 0.0) {
196 vcas = VcalibratedFromMach(Mach, in.Pressure);
197 veas = sqrt(2 * qbar / FGAtmosphere::StdDaySLdensity);
198 }
199 else
200 vcas = veas = 0.0;
201
202 vPilotAccel.InitMatrix();
203 vNcg = in.vBodyAccel/in.StandardGravity;
204 // Nz is Acceleration in "g's", along normal axis (-Z body axis)
205 Nz = -vNcg(eZ);
206 Ny = vNcg(eY);
207 Nx = vNcg(eX);
208 vPilotAccel = in.vBodyAccel + in.vPQRidot * in.ToEyePt;
209 vPilotAccel += in.vPQRi * (in.vPQRi * in.ToEyePt);
210
211 vNwcg = mTb2w * vNcg;
212 vNwcg(eZ) = 1.0 - vNwcg(eZ);
213
214 vPilotAccelN = vPilotAccel / in.StandardGravity;
215
216 // VRP computation
217 vLocationVRP = in.vLocation.LocalToLocation( in.Tb2l * in.VRPBody );
218
219 // Recompute some derived values now that we know the dependent parameters values ...
220 hoverbcg = in.DistanceAGL / in.Wingspan;
221
222 FGColumnVector3 vMac = in.Tb2l * in.RPBody;
223 hoverbmac = (in.DistanceAGL - vMac(3)) / in.Wingspan;
224
225 return false;
226 }
227
228 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229
230 double FGAuxiliary::PitotTotalPressure(double mach, double pressure) const
231 {
232 constexpr double SHRatio = FGAtmosphere::SHRatio;
233 constexpr double a = (SHRatio-1.0) / 2.0;
234 constexpr double b = SHRatio / (SHRatio-1.0);
235 constexpr double c = 2.0*b;
236 constexpr double d = 1.0 / (SHRatio-1.0);
237 const double coeff = pow(0.5*(SHRatio+1.0), b)
238 * pow((SHRatio+1.0)/(SHRatio-1.0), d);
239
240 if (mach < 0) return pressure;
241 if (mach < 1) //calculate total pressure assuming isentropic flow
242 return pressure*pow((1.0 + a*mach*mach), b);
243 else {
244 // Shock in front of pitot tube, we'll assume its normal and use the
245 // Rayleigh Pitot Tube Formula, i.e. the ratio of total pressure behind the
246 // shock to the static pressure in front of the normal shock assumption
247 // should not be a bad one -- most supersonic aircraft place the pitot probe
248 // out front so that it is the forward most point on the aircraft.
249 // The real shock would, of course, take on something like the shape of a
250 // rounded-off cone but, here again, the assumption should be good since the
251 // opening of the pitot probe is very small and, therefore, the effects of
252 // the shock curvature should be small as well. AFAIK, this approach is
253 // fairly well accepted within the aerospace community
254
255 // The denominator below is zero for Mach ~ 0.38, for which
256 // we'll never be here, so we're safe
257
258 return pressure*coeff*pow(mach, c)/pow(c*mach*mach-1.0, d);
259 }
260 }
261
262 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263
264 // Based on the formulas in the US Air Force Aircraft Performance Flight Testing
265 // Manual (AFFTC-TIH-99-01). In particular sections 4.6 to 4.8.
266
267 double FGAuxiliary::MachFromImpactPressure(double qc, double pressure) const
268 {
269 constexpr double SHRatio = FGAtmosphere::SHRatio;
270 constexpr double a = 2.0/(SHRatio-1.0);
271 constexpr double b = (SHRatio-1.0)/SHRatio;
272 constexpr double c = 2.0/b;
273 constexpr double d = 0.5*a;
274 const double coeff = pow(0.5*(SHRatio+1.0), -0.25*c)
275 * pow(0.5*(SHRatio+1.0)/SHRatio, -0.5*d);
276
277 double A = qc / pressure + 1;
278 double M = sqrt(a*(pow(A, b) - 1.0)); // Equation (4.12)
279
280 if (M > 1.0)
281 for (unsigned int i = 0; i<10; i++)
282 M = coeff*sqrt(A*pow(1 - 1.0 / (c*M*M), d)); // Equation (4.17)
283
284 return M;
285 }
286
287 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288
289 double FGAuxiliary::VcalibratedFromMach(double mach, double pressure) const
290 {
291 double qc = PitotTotalPressure(mach, pressure) - pressure;
292 return in.StdDaySLsoundspeed * MachFromImpactPressure(qc, FGAtmosphere::StdDaySLpressure);
293 }
294
295 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296
297 double FGAuxiliary::MachFromVcalibrated(double vcas, double pressure) const
298 {
299 constexpr double StdDaySLpressure = FGAtmosphere::StdDaySLpressure;
300 double qc = PitotTotalPressure(vcas / in.StdDaySLsoundspeed, StdDaySLpressure) - StdDaySLpressure;
301 return MachFromImpactPressure(qc, pressure);
302 }
303
304 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
305 //
306 // From Stevens and Lewis, "Aircraft Control and Simulation", 3rd Ed., the
307 // transformation from body to wind axes is defined (where "a" is alpha and "B"
308 // is beta):
309 //
310 // cos(a)*cos(B) sin(B) sin(a)*cos(B)
311 // -cos(a)*sin(B) cos(B) -sin(a)*sin(B)
312 // -sin(a) 0 cos(a)
313 //
314 // The transform from wind to body axes is then,
315 //
316 // cos(a)*cos(B) -cos(a)*sin(B) -sin(a)
317 // sin(B) cos(B) 0
318 // sin(a)*cos(B) -sin(a)*sin(B) cos(a)
319
320 void FGAuxiliary::UpdateWindMatrices(void)
321 {
322 double ca, cb, sa, sb;
323
324 ca = cos(alpha);
325 sa = sin(alpha);
326 cb = cos(beta);
327 sb = sin(beta);
328
329 mTw2b(1,1) = ca*cb;
330 mTw2b(1,2) = -ca*sb;
331 mTw2b(1,3) = -sa;
332 mTw2b(2,1) = sb;
333 mTw2b(2,2) = cb;
334 mTw2b(2,3) = 0.0;
335 mTw2b(3,1) = sa*cb;
336 mTw2b(3,2) = -sa*sb;
337 mTw2b(3,3) = ca;
338
339 mTb2w = mTw2b.Transposed();
340 }
341
342 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
343
344 double FGAuxiliary::GetNlf(void) const
345 {
346 if (in.Mass != 0)
347 return (in.vFw(3))/(in.Mass*slugtolb);
348 else
349 return 0.;
350 }
351
352 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
353
354 double FGAuxiliary::GetLongitudeRelativePosition(void) const
355 {
356 return in.vLocation.GetDistanceTo(FDMExec->GetIC()->GetLongitudeRadIC(),
357 in.vLocation.GetLatitude())* fttom;
358 }
359
360 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361
362 double FGAuxiliary::GetLatitudeRelativePosition(void) const
363 {
364 return in.vLocation.GetDistanceTo(in.vLocation.GetLongitude(),
365 FDMExec->GetIC()->GetLatitudeRadIC())* fttom;
366 }
367
368 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
369
370 double FGAuxiliary::GetDistanceRelativePosition(void) const
371 {
372 FGInitialCondition *ic = FDMExec->GetIC();
373 return in.vLocation.GetDistanceTo(ic->GetLongitudeRadIC(),
374 ic->GetLatitudeRadIC())* fttom;
375 }
376
377 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
378
379 void FGAuxiliary::bind(void)
380 {
381 typedef double (FGAuxiliary::*PMF)(int) const;
382 typedef double (FGAuxiliary::*PF)(void) const;
383 PropertyManager->Tie("propulsion/tat-r", this, &FGAuxiliary::GetTotalTemperature);
384 PropertyManager->Tie("propulsion/tat-c", this, &FGAuxiliary::GetTAT_C);
385 PropertyManager->Tie("propulsion/pt-lbs_sqft", this, &FGAuxiliary::GetTotalPressure);
386 PropertyManager->Tie("velocities/vc-fps", this, &FGAuxiliary::GetVcalibratedFPS);
387 PropertyManager->Tie("velocities/vc-kts", this, &FGAuxiliary::GetVcalibratedKTS);
388 PropertyManager->Tie("velocities/ve-fps", this, &FGAuxiliary::GetVequivalentFPS);
389 PropertyManager->Tie("velocities/ve-kts", this, &FGAuxiliary::GetVequivalentKTS);
390 PropertyManager->Tie("velocities/vtrue-fps", this, &FGAuxiliary::GetVtrueFPS);
391 PropertyManager->Tie("velocities/vtrue-kts", this, &FGAuxiliary::GetVtrueKTS);
392 PropertyManager->Tie("velocities/machU", this, &FGAuxiliary::GetMachU);
393 PropertyManager->Tie("velocities/p-aero-rad_sec", this, eX, (PMF)&FGAuxiliary::GetAeroPQR);
394 PropertyManager->Tie("velocities/q-aero-rad_sec", this, eY, (PMF)&FGAuxiliary::GetAeroPQR);
395 PropertyManager->Tie("velocities/r-aero-rad_sec", this, eZ, (PMF)&FGAuxiliary::GetAeroPQR);
396 PropertyManager->Tie("velocities/phidot-rad_sec", this, ePhi, (PMF)&FGAuxiliary::GetEulerRates);
397 PropertyManager->Tie("velocities/thetadot-rad_sec", this, eTht, (PMF)&FGAuxiliary::GetEulerRates);
398 PropertyManager->Tie("velocities/psidot-rad_sec", this, ePsi, (PMF)&FGAuxiliary::GetEulerRates);
399 PropertyManager->Tie("velocities/u-aero-fps", this, eU, (PMF)&FGAuxiliary::GetAeroUVW);
400 PropertyManager->Tie("velocities/v-aero-fps", this, eV, (PMF)&FGAuxiliary::GetAeroUVW);
401 PropertyManager->Tie("velocities/w-aero-fps", this, eW, (PMF)&FGAuxiliary::GetAeroUVW);
402 PropertyManager->Tie("velocities/vt-fps", this, &FGAuxiliary::GetVt);
403 PropertyManager->Tie("velocities/mach", this, &FGAuxiliary::GetMach);
404 PropertyManager->Tie("velocities/vg-fps", this, &FGAuxiliary::GetVground);
405 PropertyManager->Tie("accelerations/a-pilot-x-ft_sec2", this, eX, (PMF)&FGAuxiliary::GetPilotAccel);
406 PropertyManager->Tie("accelerations/a-pilot-y-ft_sec2", this, eY, (PMF)&FGAuxiliary::GetPilotAccel);
407 PropertyManager->Tie("accelerations/a-pilot-z-ft_sec2", this, eZ, (PMF)&FGAuxiliary::GetPilotAccel);
408 PropertyManager->Tie("accelerations/n-pilot-x-norm", this, eX, (PMF)&FGAuxiliary::GetNpilot);
409 PropertyManager->Tie("accelerations/n-pilot-y-norm", this, eY, (PMF)&FGAuxiliary::GetNpilot);
410 PropertyManager->Tie("accelerations/n-pilot-z-norm", this, eZ, (PMF)&FGAuxiliary::GetNpilot);
411 PropertyManager->Tie("accelerations/Nx", this, &FGAuxiliary::GetNx);
412 PropertyManager->Tie("accelerations/Ny", this, &FGAuxiliary::GetNy);
413 PropertyManager->Tie("accelerations/Nz", this, &FGAuxiliary::GetNz);
414 PropertyManager->Tie("forces/load-factor", this, &FGAuxiliary::GetNlf);
415 PropertyManager->Tie("aero/alpha-rad", this, (PF)&FGAuxiliary::Getalpha);
416 PropertyManager->Tie("aero/beta-rad", this, (PF)&FGAuxiliary::Getbeta);
417 PropertyManager->Tie("aero/mag-beta-rad", this, (PF)&FGAuxiliary::GetMagBeta);
418 PropertyManager->Tie("aero/alpha-deg", this, inDegrees, (PMF)&FGAuxiliary::Getalpha);
419 PropertyManager->Tie("aero/beta-deg", this, inDegrees, (PMF)&FGAuxiliary::Getbeta);
420 PropertyManager->Tie("aero/mag-beta-deg", this, inDegrees, (PMF)&FGAuxiliary::GetMagBeta);
421 PropertyManager->Tie("aero/Re", this, &FGAuxiliary::GetReynoldsNumber);
422 PropertyManager->Tie("aero/qbar-psf", this, &FGAuxiliary::Getqbar);
423 PropertyManager->Tie("aero/qbarUW-psf", this, &FGAuxiliary::GetqbarUW);
424 PropertyManager->Tie("aero/qbarUV-psf", this, &FGAuxiliary::GetqbarUV);
425 PropertyManager->Tie("aero/alphadot-rad_sec", this, (PF)&FGAuxiliary::Getadot);
426 PropertyManager->Tie("aero/betadot-rad_sec", this, (PF)&FGAuxiliary::Getbdot);
427 PropertyManager->Tie("aero/alphadot-deg_sec", this, inDegrees, (PMF)&FGAuxiliary::Getadot);
428 PropertyManager->Tie("aero/betadot-deg_sec", this, inDegrees, (PMF)&FGAuxiliary::Getbdot);
429 PropertyManager->Tie("aero/h_b-cg-ft", this, &FGAuxiliary::GetHOverBCG);
430 PropertyManager->Tie("aero/h_b-mac-ft", this, &FGAuxiliary::GetHOverBMAC);
431 PropertyManager->Tie("flight-path/gamma-rad", this, &FGAuxiliary::GetGamma);
432 PropertyManager->Tie("flight-path/gamma-deg", this, inDegrees, (PMF)&FGAuxiliary::GetGamma);
433 PropertyManager->Tie("flight-path/psi-gt-rad", this, &FGAuxiliary::GetGroundTrack);
434
435 PropertyManager->Tie("position/distance-from-start-lon-mt", this, &FGAuxiliary::GetLongitudeRelativePosition);
436 PropertyManager->Tie("position/distance-from-start-lat-mt", this, &FGAuxiliary::GetLatitudeRelativePosition);
437 PropertyManager->Tie("position/distance-from-start-mag-mt", this, &FGAuxiliary::GetDistanceRelativePosition);
438 PropertyManager->Tie("position/vrp-gc-latitude_deg", &vLocationVRP, &FGLocation::GetLatitudeDeg);
439 PropertyManager->Tie("position/vrp-longitude_deg", &vLocationVRP, &FGLocation::GetLongitudeDeg);
440 PropertyManager->Tie("position/vrp-radius-ft", &vLocationVRP, &FGLocation::GetRadius);
441 }
442
443 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
444
445 double FGAuxiliary::BadUnits(void) const
446 {
447 cerr << "Bad units" << endl; return 0.0;
448 }
449
450 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
451 // The bitmasked value choices are as follows:
452 // unset: In this case (the default) JSBSim would only print
453 // out the normally expected messages, essentially echoing
454 // the config files as they are read. If the environment
455 // variable is not set, debug_lvl is set to 1 internally
456 // 0: This requests JSBSim not to output any messages
457 // whatsoever.
458 // 1: This value explicity requests the normal JSBSim
459 // startup messages
460 // 2: This value asks for a message to be printed out when
461 // a class is instantiated
462 // 4: When this value is set, a message is displayed when a
463 // FGModel object executes its Run() method
464 // 8: When this value is set, various runtime state variables
465 // are printed out periodically
466 // 16: When set various parameters are sanity checked and
467 // a message is printed out when they go out of bounds
468
469 void FGAuxiliary::Debug(int from)
470 {
471 if (debug_lvl <= 0) return;
472
473 if (debug_lvl & 1) { // Standard console startup message output
474 if (from == 0) { // Constructor
475
476 }
477 }
478 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
479 if (from == 0) cout << "Instantiated: FGAuxiliary" << endl;
480 if (from == 1) cout << "Destroyed: FGAuxiliary" << endl;
481 }
482 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
483 }
484 if (debug_lvl & 8 ) { // Runtime state variables
485 }
486 if (debug_lvl & 16) { // Sanity checking
487 if (Mach > 100 || Mach < 0.00)
488 cout << "FGPropagate::Mach is out of bounds: " << Mach << endl;
489 if (qbar > 1e6 || qbar < 0.00)
490 cout << "FGPropagate::qbar is out of bounds: " << qbar << endl;
491 }
492 if (debug_lvl & 64) {
493 if (from == 0) { // Constructor
494 }
495 }
496 }
497
498 } // namespace JSBSim