]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/FGAuxiliary.cpp
Remove the deprecated warning for JSBSim's egt_degf
[flightgear.git] / src / FDM / JSBSim / models / FGAuxiliary.cpp
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 (jon@jsbsim.org) -------------
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 Software
13  Foundation; either version 2 of the License, or (at your option) any later
14  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 with
22  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23  Place - Suite 330, Boston, MA  02111-1307, USA.
24
25  Further information about the GNU Lesser General Public License can also be found on
26  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 "FGFDMExec.h"
47 #include "input_output/FGPropertyManager.h"
48
49 using namespace std;
50
51 namespace JSBSim {
52
53 static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.55 2011/11/12 18:59:11 bcoconni Exp $";
54 static const char *IdHdr = ID_AUXILIARY;
55
56 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
57 CLASS IMPLEMENTATION
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
59
60
61 FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
62 {
63   Name = "FGAuxiliary";
64   pt = 1.0;
65   tat = 1.0;
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   day_of_year = 1;
76   seconds_in_day = 0.0;
77   hoverbmac = hoverbcg = 0.0;
78   Re = 0.0;
79   Nz = 0.0;
80   lon_relative_position = lat_relative_position = relative_position = 0.0;
81
82   vPilotAccel.InitMatrix();
83   vPilotAccelN.InitMatrix();
84   vAeroUVW.InitMatrix();
85   vAeroPQR.InitMatrix();
86   vMachUVW.InitMatrix();
87   vEuler.InitMatrix();
88   vEulerRates.InitMatrix();
89
90   bind();
91
92   Debug(0);
93 }
94
95 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96
97 bool FGAuxiliary::InitModel(void)
98 {
99   pt = in.Pressure;
100   tat = in.Temperature;
101   tatc = RankineToCelsius(tat);
102
103   vcas = veas = 0.0;
104   qbar = qbarUW = qbarUV = 0.0;
105   Mach = MachU = 0.0;
106   alpha = beta = 0.0;
107   adot = bdot = 0.0;
108   gamma = Vt = Vground = 0.0;
109   psigt = 0.0;
110   day_of_year = 1;
111   seconds_in_day = 0.0;
112   hoverbmac = hoverbcg = 0.0;
113   Re = 0.0;
114   Nz = 0.0;
115   lon_relative_position = lat_relative_position = relative_position = 0.0;
116
117   vPilotAccel.InitMatrix();
118   vPilotAccelN.InitMatrix();
119   vAeroUVW.InitMatrix();
120   vAeroPQR.InitMatrix();
121   vMachUVW.InitMatrix();
122   vEuler.InitMatrix();
123   vEulerRates.InitMatrix();
124
125   return true;
126 }
127   
128 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
129
130 FGAuxiliary::~FGAuxiliary()
131 {
132   Debug(1);
133 }
134
135 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136
137 bool FGAuxiliary::Run(bool Holding)
138 {
139   double A,B,D;
140
141   if (FGModel::Run(Holding)) return true; // return true if error returned from base class
142   if (Holding) return false;
143
144   RunPreFunctions();
145
146 // Rotation
147
148   vEulerRates(eTht) = in.vPQR(eQ)*in.CosPhi - in.vPQR(eR)*in.SinPhi;
149   if (in.CosTht != 0.0) {
150     vEulerRates(ePsi) = (in.vPQR(eQ)*in.SinPhi + in.vPQR(eR)*in.CosPhi)/in.CosTht;
151     vEulerRates(ePhi) = in.vPQR(eP) + vEulerRates(ePsi)*in.SinTht;
152   }
153
154 // Combine the wind speed with aircraft speed to obtain wind relative speed
155   vAeroPQR = in.vPQR - in.TurbPQR;
156   vAeroUVW = in.vUVW - in.Tl2b * in.TotalWindNED;
157
158   Vt = vAeroUVW.Magnitude();
159   alpha = beta = adot = bdot = 0;
160   double AeroU2 = vAeroUVW(eU)*vAeroUVW(eU);
161   double AeroV2 = vAeroUVW(eV)*vAeroUVW(eV);
162   double AeroW2 = vAeroUVW(eW)*vAeroUVW(eW);
163   double mUW = AeroU2 + AeroW2;
164
165   double Vt2 = Vt*Vt;
166
167   if ( Vt > 1.0 ) {
168     if (vAeroUVW(eW) != 0.0)
169       alpha = AeroU2 > 0.0 ? atan2(vAeroUVW(eW), vAeroUVW(eU)) : 0.0;
170     if (vAeroUVW(eV) != 0.0)
171       beta  =    mUW > 0.0 ? atan2(vAeroUVW(eV), sqrt(mUW)) : 0.0;
172
173     double signU=1;
174     if (vAeroUVW(eU) < 0.0) signU=-1;
175
176     if ( mUW >= 1.0 ) {
177       adot = (vAeroUVW(eU)*in.vUVWdot(eW) - vAeroUVW(eW)*in.vUVWdot(eU))/mUW;
178       bdot = (signU*mUW*in.vUVWdot(eV)
179              - vAeroUVW(eV)*(vAeroUVW(eU)*in.vUVWdot(eU) + vAeroUVW(eW)*in.vUVWdot(eW)))/(Vt2*sqrt(mUW));
180     }
181   }
182
183   UpdateWindMatrices();
184
185   Re = Vt * in.Wingchord / in.KinematicViscosity;
186
187   double densityD2 = 0.5*in.Density;
188
189   qbar = densityD2 * Vt2;
190   qbarUW = densityD2 * (mUW);
191   qbarUV = densityD2 * (AeroU2 + AeroV2);
192   Mach = Vt / in.SoundSpeed;
193   MachU = vMachUVW(eU) = vAeroUVW(eU) / in.SoundSpeed;
194   vMachUVW(eV) = vAeroUVW(eV) / in.SoundSpeed;
195   vMachUVW(eW) = vAeroUVW(eW) / in.SoundSpeed;
196   double MachU2 = MachU * MachU;
197
198 // Position
199
200   Vground = sqrt( in.vVel(eNorth)*in.vVel(eNorth) + in.vVel(eEast)*in.vVel(eEast) );
201
202   psigt = atan2(in.vVel(eEast), in.vVel(eNorth));
203   if (psigt < 0.0) psigt += 2*M_PI;
204   gamma = atan2(-in.vVel(eDown), Vground);
205
206   tat = in.Temperature*(1 + 0.2*Mach*Mach); // Total Temperature, isentropic flow
207   tatc = RankineToCelsius(tat);
208
209   if (MachU < 1) {   // Calculate total pressure assuming isentropic flow
210     pt = in.Pressure*pow((1 + 0.2*MachU2),3.5);
211   } else {
212     // Use Rayleigh pitot tube formula for normal shock in front of pitot tube
213     B = 5.76 * MachU2 / (5.6*MachU2 - 0.8);
214     D = (2.8 * MachU2 - 0.4) * 0.4167;
215     pt = in.Pressure*pow(B,3.5)*D;
216   }
217
218   A = pow(((pt-in.Pressure)/in.PressureSL + 1),0.28571);
219   if (MachU > 0.0) {
220     vcas = sqrt(7 * in.PressureSL / in.DensitySL * (A-1));
221     veas = sqrt(2 * qbar / in.DensitySL);
222     vtrue = 1116.43559 * MachU * sqrt(in.Temperature / 518.67);
223   } else {
224     vcas = veas = vtrue = 0.0;
225   }
226
227   vPilotAccel.InitMatrix();
228   vNcg = in.vBodyAccel/in.SLGravity;
229   if ( Vt > 1.0 ) {
230     // Nz is Acceleration in "g's", along normal axis (-Z body axis)
231     Nz = -vNcg(eZ);
232     vPilotAccel = in.vBodyAccel + in.vPQRdot * in.ToEyePt;
233     vPilotAccel += in.vPQR * (in.vPQR * in.ToEyePt);
234   } else {
235     // The line below handles low velocity (and on-ground) cases, basically
236     // representing the opposite of the force that the landing gear would
237     // exert on the ground (which is just the total weight). This eliminates
238     // any jitter that could be introduced by the landing gear. Theoretically,
239     // this branch could be eliminated, with a penalty of having a short
240     // transient at startup (lasting only a fraction of a second).
241     vPilotAccel = in.Tl2b * FGColumnVector3( 0.0, 0.0, -in.SLGravity );
242     Nz = -vPilotAccel(eZ) / in.SLGravity;
243   }
244
245   vNwcg = mTb2w * vNcg;
246   vNwcg(eZ) = 1.0 - vNwcg(eZ);
247
248   vPilotAccelN = vPilotAccel / in.SLGravity;
249
250   // VRP computation
251   vLocationVRP = in.vLocation.LocalToLocation( in.Tb2l * in.VRPBody );
252
253   // Recompute some derived values now that we know the dependent parameters values ...
254   hoverbcg = in.DistanceAGL / in.Wingspan;
255
256   FGColumnVector3 vMac = in.Tb2l * in.RPBody;
257   hoverbmac = (in.DistanceAGL + vMac(3)) / in.Wingspan;
258
259   // When all models are executed calculate the distance from the initial point.
260   CalculateRelativePosition();
261
262   RunPostFunctions();
263
264   return false;
265 }
266
267 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
268 //
269 // From Stevens and Lewis, "Aircraft Control and Simulation", 3rd Ed., the
270 // transformation from body to wind axes is defined (where "a" is alpha and "B"
271 // is beta):
272 //
273 //   cos(a)*cos(B)     sin(B)    sin(a)*cos(B)
274 //  -cos(a)*sin(B)     cos(B)   -sin(a)*sin(B)
275 //  -sin(a)              0       cos(a)
276 //
277 // The transform from wind to body axes is then,
278 //
279 //   cos(a)*cos(B)  -cos(a)*sin(B)  -sin(a)
280 //          sin(B)          cos(B)     0
281 //   sin(a)*cos(B)  -sin(a)*sin(B)   cos(a)
282
283 void FGAuxiliary::UpdateWindMatrices(void)
284 {
285   double ca, cb, sa, sb;
286
287   ca = cos(alpha);
288   sa = sin(alpha);
289   cb = cos(beta);
290   sb = sin(beta);
291
292   mTw2b(1,1) =  ca*cb;
293   mTw2b(1,2) = -ca*sb;
294   mTw2b(1,3) = -sa;
295   mTw2b(2,1) =  sb;
296   mTw2b(2,2) =  cb;
297   mTw2b(2,3) =  0.0;
298   mTw2b(3,1) =  sa*cb;
299   mTw2b(3,2) = -sa*sb;
300   mTw2b(3,3) =  ca;
301
302   mTb2w = mTw2b.Transposed();
303 }
304
305 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
306 //
307 // A positive headwind is blowing with you, a negative headwind is blowing against you.
308 // psi is the direction the wind is blowing *towards*.
309 // ToDo: should this simply be in the atmosphere class? Same with Get Crosswind.
310
311 double FGAuxiliary::GetHeadWind(void) const
312 {
313   return in.Vwind * cos(in.WindPsi - in.Psi);
314 }
315
316 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
317 //
318 // A positive crosswind is blowing towards the right (from teh perspective of the
319 // pilot). A negative crosswind is blowing towards the -Y direction (left).
320 // psi is the direction the wind is blowing *towards*.
321
322 double FGAuxiliary::GetCrossWind(void) const
323 {
324   return in.Vwind * sin(in.WindPsi - in.Psi);
325 }
326
327 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
328
329 double FGAuxiliary::GethVRP(void) const
330 {
331   return vLocationVRP.GetRadius() - in.ReferenceRadius;
332 }
333
334 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
335
336 double FGAuxiliary::GetNlf(void) const
337 {
338   if (in.Mass != 0)
339     return (-in.vFw(3))/(in.Mass*slugtolb);
340   else
341     return 0.;
342 }
343
344 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
345
346 void FGAuxiliary::CalculateRelativePosition(void)  //ToDo: This belongs elsewhere - perhaps in FGPropagate or Exec
347
348   const double earth_radius_mt = in.ReferenceRadius*fttom;
349   lat_relative_position=(in.Latitude  - FDMExec->GetIC()->GetLatitudeDegIC() *degtorad)*earth_radius_mt;
350   lon_relative_position=(in.Longitude - FDMExec->GetIC()->GetLongitudeDegIC()*degtorad)*earth_radius_mt;
351   relative_position = sqrt(lat_relative_position*lat_relative_position + lon_relative_position*lon_relative_position);
352 };
353
354 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
355
356 void FGAuxiliary::bind(void)
357 {
358   typedef double (FGAuxiliary::*PMF)(int) const;
359   typedef double (FGAuxiliary::*PF)(void) const;
360   PropertyManager->Tie("propulsion/tat-r", this, &FGAuxiliary::GetTotalTemperature);
361   PropertyManager->Tie("propulsion/tat-c", this, &FGAuxiliary::GetTAT_C);
362   PropertyManager->Tie("propulsion/pt-lbs_sqft", this, &FGAuxiliary::GetTotalPressure);
363   PropertyManager->Tie("velocities/vc-fps", this, &FGAuxiliary::GetVcalibratedFPS);
364   PropertyManager->Tie("velocities/vc-kts", this, &FGAuxiliary::GetVcalibratedKTS);
365   PropertyManager->Tie("velocities/ve-fps", this, &FGAuxiliary::GetVequivalentFPS);
366   PropertyManager->Tie("velocities/ve-kts", this, &FGAuxiliary::GetVequivalentKTS);
367   PropertyManager->Tie("velocities/vtrue-fps", this, &FGAuxiliary::GetVtrueFPS);
368   PropertyManager->Tie("velocities/vtrue-kts", this, &FGAuxiliary::GetVtrueKTS);
369   PropertyManager->Tie("velocities/machU", this, &FGAuxiliary::GetMachU);
370   PropertyManager->Tie("velocities/p-aero-rad_sec", this, eX, (PMF)&FGAuxiliary::GetAeroPQR);
371   PropertyManager->Tie("velocities/q-aero-rad_sec", this, eY, (PMF)&FGAuxiliary::GetAeroPQR);
372   PropertyManager->Tie("velocities/r-aero-rad_sec", this, eZ, (PMF)&FGAuxiliary::GetAeroPQR);
373   PropertyManager->Tie("velocities/phidot-rad_sec", this, ePhi, (PMF)&FGAuxiliary::GetEulerRates);
374   PropertyManager->Tie("velocities/thetadot-rad_sec", this, eTht, (PMF)&FGAuxiliary::GetEulerRates);
375   PropertyManager->Tie("velocities/psidot-rad_sec", this, ePsi, (PMF)&FGAuxiliary::GetEulerRates);
376   PropertyManager->Tie("velocities/u-aero-fps", this, eU, (PMF)&FGAuxiliary::GetAeroUVW);
377   PropertyManager->Tie("velocities/v-aero-fps", this, eV, (PMF)&FGAuxiliary::GetAeroUVW);
378   PropertyManager->Tie("velocities/w-aero-fps", this, eW, (PMF)&FGAuxiliary::GetAeroUVW);
379   PropertyManager->Tie("velocities/vt-fps", this, &FGAuxiliary::GetVt);
380   PropertyManager->Tie("velocities/mach", this, &FGAuxiliary::GetMach);
381   PropertyManager->Tie("velocities/vg-fps", this, &FGAuxiliary::GetVground);
382   PropertyManager->Tie("accelerations/a-pilot-x-ft_sec2", this, eX, (PMF)&FGAuxiliary::GetPilotAccel);
383   PropertyManager->Tie("accelerations/a-pilot-y-ft_sec2", this, eY, (PMF)&FGAuxiliary::GetPilotAccel);
384   PropertyManager->Tie("accelerations/a-pilot-z-ft_sec2", this, eZ, (PMF)&FGAuxiliary::GetPilotAccel);
385   PropertyManager->Tie("accelerations/n-pilot-x-norm", this, eX, (PMF)&FGAuxiliary::GetNpilot);
386   PropertyManager->Tie("accelerations/n-pilot-y-norm", this, eY, (PMF)&FGAuxiliary::GetNpilot);
387   PropertyManager->Tie("accelerations/n-pilot-z-norm", this, eZ, (PMF)&FGAuxiliary::GetNpilot);
388   PropertyManager->Tie("accelerations/Nz", this, &FGAuxiliary::GetNz);
389   PropertyManager->Tie("forces/load-factor", this, &FGAuxiliary::GetNlf);
390   /* PropertyManager->Tie("atmosphere/headwind-fps", this, &FGAuxiliary::GetHeadWind, true);
391   PropertyManager->Tie("atmosphere/crosswind-fps", this, &FGAuxiliary::GetCrossWind, true); */
392   PropertyManager->Tie("aero/alpha-rad", this, (PF)&FGAuxiliary::Getalpha);
393   PropertyManager->Tie("aero/beta-rad", this, (PF)&FGAuxiliary::Getbeta);
394   PropertyManager->Tie("aero/mag-beta-rad", this, (PF)&FGAuxiliary::GetMagBeta);
395   PropertyManager->Tie("aero/alpha-deg", this, inDegrees, (PMF)&FGAuxiliary::Getalpha);
396   PropertyManager->Tie("aero/beta-deg", this, inDegrees, (PMF)&FGAuxiliary::Getbeta);
397   PropertyManager->Tie("aero/mag-beta-deg", this, inDegrees, (PMF)&FGAuxiliary::GetMagBeta);
398   PropertyManager->Tie("aero/Re", this, &FGAuxiliary::GetReynoldsNumber);
399   PropertyManager->Tie("aero/qbar-psf", this, &FGAuxiliary::Getqbar);
400   PropertyManager->Tie("aero/qbarUW-psf", this, &FGAuxiliary::GetqbarUW);
401   PropertyManager->Tie("aero/qbarUV-psf", this, &FGAuxiliary::GetqbarUV);
402   PropertyManager->Tie("aero/alphadot-rad_sec", this, (PF)&FGAuxiliary::Getadot);
403   PropertyManager->Tie("aero/betadot-rad_sec", this, (PF)&FGAuxiliary::Getbdot);
404   PropertyManager->Tie("aero/alphadot-deg_sec", this, inDegrees, (PMF)&FGAuxiliary::Getadot);
405   PropertyManager->Tie("aero/betadot-deg_sec", this, inDegrees, (PMF)&FGAuxiliary::Getbdot);
406   PropertyManager->Tie("aero/h_b-cg-ft", this, &FGAuxiliary::GetHOverBCG);
407   PropertyManager->Tie("aero/h_b-mac-ft", this, &FGAuxiliary::GetHOverBMAC);
408   PropertyManager->Tie("flight-path/gamma-rad", this, &FGAuxiliary::GetGamma);
409   PropertyManager->Tie("flight-path/psi-gt-rad", this, &FGAuxiliary::GetGroundTrack);
410
411   PropertyManager->Tie("position/distance-from-start-lon-mt", this, &FGAuxiliary::GetLongitudeRelativePosition);
412   PropertyManager->Tie("position/distance-from-start-lat-mt", this, &FGAuxiliary::GetLatitudeRelativePosition);
413   PropertyManager->Tie("position/distance-from-start-mag-mt", this, &FGAuxiliary::GetDistanceRelativePosition);
414   PropertyManager->Tie("position/vrp-gc-latitude_deg", &vLocationVRP, &FGLocation::GetLatitudeDeg);
415   PropertyManager->Tie("position/vrp-longitude_deg", &vLocationVRP, &FGLocation::GetLongitudeDeg);
416   PropertyManager->Tie("position/vrp-radius-ft", &vLocationVRP, &FGLocation::GetRadius);
417 }
418
419 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
420
421 double FGAuxiliary::BadUnits(void) const
422 {
423   cerr << "Bad units" << endl; return 0.0;
424 }
425
426 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
427 //    The bitmasked value choices are as follows:
428 //    unset: In this case (the default) JSBSim would only print
429 //       out the normally expected messages, essentially echoing
430 //       the config files as they are read. If the environment
431 //       variable is not set, debug_lvl is set to 1 internally
432 //    0: This requests JSBSim not to output any messages
433 //       whatsoever.
434 //    1: This value explicity requests the normal JSBSim
435 //       startup messages
436 //    2: This value asks for a message to be printed out when
437 //       a class is instantiated
438 //    4: When this value is set, a message is displayed when a
439 //       FGModel object executes its Run() method
440 //    8: When this value is set, various runtime state variables
441 //       are printed out periodically
442 //    16: When set various parameters are sanity checked and
443 //       a message is printed out when they go out of bounds
444
445 void FGAuxiliary::Debug(int from)
446 {
447   if (debug_lvl <= 0) return;
448
449   if (debug_lvl & 1) { // Standard console startup message output
450     if (from == 0) { // Constructor
451
452     }
453   }
454   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
455     if (from == 0) cout << "Instantiated: FGAuxiliary" << endl;
456     if (from == 1) cout << "Destroyed:    FGAuxiliary" << endl;
457   }
458   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
459   }
460   if (debug_lvl & 8 ) { // Runtime state variables
461   }
462   if (debug_lvl & 16) { // Sanity checking
463     if (Mach > 100 || Mach < 0.00)
464       cout << "FGPropagate::Mach is out of bounds: " << Mach << endl;
465     if (qbar > 1e6 || qbar < 0.00)
466       cout << "FGPropagate::qbar is out of bounds: " << qbar << endl;
467   }
468   if (debug_lvl & 64) {
469     if (from == 0) { // Constructor
470       cout << IdSrc << endl;
471       cout << IdHdr << endl;
472     }
473   }
474 }
475
476 } // namespace JSBSim