JSBSim Flight Dynamics Model  1.0 (02 March 2017)
An Open Source Flight Dynamics and Control Software Library in C++
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 "initialization/FGInitialCondition.h"
47 #include "FGFDMExec.h"
48 #include "input_output/FGPropertyManager.h"
49 
50 using namespace std;
51 
52 namespace JSBSim {
53 
54 IDENT(IdSrc,"$Id: FGAuxiliary.cpp,v 1.72 2016/05/21 11:45:22 bcoconni Exp $");
55 IDENT(IdHdr,ID_AUXILIARY);
56 
57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 CLASS IMPLEMENTATION
59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
60 
61 
62 FGAuxiliary::FGAuxiliary(FGFDMExec* fdmex) : FGModel(fdmex)
63 {
64  Name = "FGAuxiliary";
65  pt = 1.0;
66  tat = 1.0;
67  tatc = RankineToCelsius(tat);
68 
69  vcas = veas = 0.0;
70  qbar = qbarUW = qbarUV = 0.0;
71  Mach = MachU = MachPitot = 0.0;
72  alpha = beta = 0.0;
73  adot = bdot = 0.0;
74  gamma = Vt = Vground = Vpitot = 0.0;
75  psigt = 0.0;
76  day_of_year = 1;
77  seconds_in_day = 0.0;
78  hoverbmac = hoverbcg = 0.0;
79  Re = 0.0;
80  Nz = Ny = 0.0;
81 
82  vPilotAccel.InitMatrix();
83  vPilotAccelN.InitMatrix();
84  vAeroUVW.InitMatrix();
85  vAeroPQR.InitMatrix();
86  vMachUVW.InitMatrix();
87  vWindUVW.InitMatrix();
88  vPitotUVW.InitMatrix();
89  vEuler.InitMatrix();
90  vEulerRates.InitMatrix();
91 
92  bind();
93 
94  Debug(0);
95 }
96 
97 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98 
99 bool FGAuxiliary::InitModel(void)
100 {
101  if (!FGModel::InitModel()) return false;
102 
103  pt = in.Pressure;
104  tat = in.Temperature;
105  tatc = RankineToCelsius(tat);
106 
107  vcas = veas = 0.0;
108  qbar = qbarUW = qbarUV = 0.0;
109  Mach = MachU = MachPitot = 0.0;
110  alpha = beta = 0.0;
111  adot = bdot = 0.0;
112  gamma = Vt = Vground = Vpitot = 0.0;
113  psigt = 0.0;
114  day_of_year = 1;
115  seconds_in_day = 0.0;
116  hoverbmac = hoverbcg = 0.0;
117  Re = 0.0;
118  Nz = Ny = 0.0;
119 
120  vPilotAccel.InitMatrix();
121  vPilotAccelN.InitMatrix();
122  vAeroUVW.InitMatrix();
123  vAeroPQR.InitMatrix();
124  vMachUVW.InitMatrix();
125  vEuler.InitMatrix();
126  vEulerRates.InitMatrix();
127 
128  return true;
129 }
130 
131 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 
134 {
135  Debug(1);
136 }
137 
138 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139 
140 bool FGAuxiliary::Run(bool Holding)
141 {
142  if (FGModel::Run(Holding)) return true; // return true if error returned from base class
143  if (Holding) return false;
144 
145  // Rotation
146 
147  vEulerRates(eTht) = in.vPQR(eQ)*in.CosPhi - in.vPQR(eR)*in.SinPhi;
148  if (in.CosTht != 0.0) {
149  vEulerRates(ePsi) = (in.vPQR(eQ)*in.SinPhi + in.vPQR(eR)*in.CosPhi)/in.CosTht;
150  vEulerRates(ePhi) = in.vPQR(eP) + vEulerRates(ePsi)*in.SinTht;
151  }
152 
153  // Combine the wind speed with aircraft speed to obtain wind relative speed
154  vAeroPQR = in.vPQR - in.TurbPQR;
155  vAeroUVW = in.vUVW - in.Tl2b * in.TotalWindNED;
156 
157  Vt = vAeroUVW.Magnitude();
158  alpha = beta = adot = bdot = 0;
159  double AeroU2 = vAeroUVW(eU)*vAeroUVW(eU);
160  double AeroV2 = vAeroUVW(eV)*vAeroUVW(eV);
161  double AeroW2 = vAeroUVW(eW)*vAeroUVW(eW);
162  double mUW = AeroU2 + AeroW2;
163 
164  double Vt2 = Vt*Vt;
165 
166  if ( Vt > 0.001 ) {
167  if (vAeroUVW(eW) != 0.0)
168  alpha = AeroU2 > 0.0 ? atan2(vAeroUVW(eW), vAeroUVW(eU)) : 0.0;
169  if (vAeroUVW(eV) != 0.0)
170  beta = mUW > 0.0 ? atan2(vAeroUVW(eV), sqrt(mUW)) : 0.0;
171 
172  //double signU=1;
173  //if (vAeroUVW(eU) < 0.0) signU=-1;
174 
175  if ( mUW >= 0.001 ) {
176  double Vtdot = (vAeroUVW(eU)*in.vUVWdot(eU) + vAeroUVW(eV)*in.vUVWdot(eV) + vAeroUVW(eW)*in.vUVWdot(eW))/Vt;
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  bdot = (in.vUVWdot(eV)*Vt - vAeroUVW(eV)*Vtdot)/(Vt*sqrt(mUW));
181  }
182  }
183 
184  UpdateWindMatrices();
185 
186  Re = Vt * in.Wingchord / in.KinematicViscosity;
187 
188  double densityD2 = 0.5*in.Density;
189 
190  qbar = densityD2 * Vt2;
191  qbarUW = densityD2 * (mUW);
192  qbarUV = densityD2 * (AeroU2 + AeroV2);
193  Mach = Vt / in.SoundSpeed;
194  MachU = vMachUVW(eU) = vAeroUVW(eU) / in.SoundSpeed;
195  vMachUVW(eV) = vAeroUVW(eV) / in.SoundSpeed;
196  vMachUVW(eW) = vAeroUVW(eW) / in.SoundSpeed;
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  // Pitot
210 
211  vWindUVW(eU) = Vt;
212  vPitotUVW = mTw2p * vWindUVW;
213  Vpitot = vPitotUVW(eU);
214  if (Vpitot < 0.0) Vpitot = 0.0;
215  MachPitot = Vpitot / in.SoundSpeed;
216  pt = PitotTotalPressure(MachPitot, in.Pressure);
217 
218  if (abs(MachPitot) > 0.0) {
219  vcas = VcalibratedFromMach(MachPitot, in.Pressure, in.PressureSL, in.DensitySL);
220  veas = sqrt(2 * qbar / in.DensitySL);
221  vtrue = 1116.43559 * Mach * sqrt(in.Temperature / 518.67);
222  } else {
223  vcas = veas = vtrue = 0.0;
224  }
225 
226  vPilotAccel.InitMatrix();
227  vNcg = in.vBodyAccel/in.SLGravity;
228  // Nz is Acceleration in "g's", along normal axis (-Z body axis)
229  Nz = -vNcg(eZ);
230  Ny = vNcg(eY);
231  vPilotAccel = in.vBodyAccel + in.vPQRidot * in.ToEyePt;
232  vPilotAccel += in.vPQRi * (in.vPQRi * in.ToEyePt);
233 
234  vNwcg = mTb2w * vNcg;
235  vNwcg(eZ) = 1.0 - vNwcg(eZ);
236 
237  vPilotAccelN = vPilotAccel / in.SLGravity;
238 
239  // VRP computation
240  vLocationVRP = in.vLocation.LocalToLocation( in.Tb2l * in.VRPBody );
241 
242  // Recompute some derived values now that we know the dependent parameters values ...
243  hoverbcg = in.DistanceAGL / in.Wingspan;
244 
245  FGColumnVector3 vMac = in.Tb2l * in.RPBody;
246  hoverbmac = (in.DistanceAGL + vMac(3)) / in.Wingspan;
247 
248  return false;
249 }
250 
251 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
252 //
253 // From Stevens and Lewis, "Aircraft Control and Simulation", 3rd Ed., the
254 // transformation from body to wind axes is defined (where "a" is alpha and "B"
255 // is beta):
256 //
257 // cos(a)*cos(B) sin(B) sin(a)*cos(B)
258 // -cos(a)*sin(B) cos(B) -sin(a)*sin(B)
259 // -sin(a) 0 cos(a)
260 //
261 // The transform from wind to body axes is then,
262 //
263 // cos(a)*cos(B) -cos(a)*sin(B) -sin(a)
264 // sin(B) cos(B) 0
265 // sin(a)*cos(B) -sin(a)*sin(B) cos(a)
266 
267 void FGAuxiliary::UpdateWindMatrices(void)
268 {
269  double ca, cb, sa, sb;
270 
271  ca = cos(alpha);
272  sa = sin(alpha);
273  cb = cos(beta);
274  sb = sin(beta);
275 
276  mTw2b(1,1) = ca*cb;
277  mTw2b(1,2) = -ca*sb;
278  mTw2b(1,3) = -sa;
279  mTw2b(2,1) = sb;
280  mTw2b(2,2) = cb;
281  mTw2b(2,3) = 0.0;
282  mTw2b(3,1) = sa*cb;
283  mTw2b(3,2) = -sa*sb;
284  mTw2b(3,3) = ca;
285 
286  mTb2w = mTw2b.Transposed();
287 
288  // The pitot frame is the same as the body frame except rotated about the
289  // Y axis by the pitot attachment angle.
290 
291  ca = cos(alpha + in.PitotAngle);
292  sa = sin(alpha + in.PitotAngle);
293 
294  mTw2p(1,1) = ca*cb;
295  mTw2p(1,2) = -ca*sb;
296  mTw2p(1,3) = -sa;
297  mTw2p(2,1) = sb;
298  mTw2p(2,2) = cb;
299  mTw2p(2,3) = 0.0;
300  mTw2p(3,1) = sa*cb;
301  mTw2p(3,2) = -sa*sb;
302  mTw2p(3,3) = ca;
303 
304 }
305 
306 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
307 //
308 // A positive headwind is blowing with you, a negative headwind is blowing against you.
309 // psi is the direction the wind is blowing *towards*.
310 // ToDo: should this simply be in the atmosphere class? Same with Get Crosswind.
311 
312 double FGAuxiliary::GetHeadWind(void) const
313 {
314  return in.Vwind * cos(in.WindPsi - in.Psi);
315 }
316 
317 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318 //
319 // A positive crosswind is blowing towards the right (from teh perspective of the
320 // pilot). A negative crosswind is blowing towards the -Y direction (left).
321 // psi is the direction the wind is blowing *towards*.
322 
323 double FGAuxiliary::GetCrossWind(void) const
324 {
325  return in.Vwind * sin(in.WindPsi - in.Psi);
326 }
327 
328 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
329 
330 double FGAuxiliary::GetNlf(void) const
331 {
332  if (in.Mass != 0)
333  return (-in.vFw(3))/(in.Mass*slugtolb);
334  else
335  return 0.;
336 }
337 
338 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339 
340 double FGAuxiliary::GetLongitudeRelativePosition(void) const
341 {
342  FGLocation source(FDMExec->GetIC()->GetLongitudeRadIC(),
343  FDMExec->GetIC()->GetLatitudeRadIC(),
344  in.vLocation.GetSeaLevelRadius());
345  return source.GetDistanceTo(in.vLocation.GetLongitude(),
346  FDMExec->GetIC()->GetLatitudeRadIC()) * fttom;
347 }
348 
349 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350 
351 double FGAuxiliary::GetLatitudeRelativePosition(void) const
352 {
353  FGLocation source(FDMExec->GetIC()->GetLongitudeRadIC(),
354  FDMExec->GetIC()->GetLatitudeRadIC(),
355  in.vLocation.GetSeaLevelRadius());
356  return source.GetDistanceTo(FDMExec->GetIC()->GetLongitudeRadIC(),
357  in.vLocation.GetLatitude()) * fttom;
358 }
359 
360 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
361 
362 double FGAuxiliary::GetDistanceRelativePosition(void) const
363 {
364  FGLocation source(FDMExec->GetIC()->GetLongitudeRadIC(),
365  FDMExec->GetIC()->GetLatitudeRadIC(),
366  in.vLocation.GetSeaLevelRadius());
367  return source.GetDistanceTo(in.vLocation.GetLongitude(),
368  in.vLocation.GetLatitude()) * fttom;
369 }
370 
371 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
372 
373 void FGAuxiliary::bind(void)
374 {
375  typedef double (FGAuxiliary::*PMF)(int) const;
376  typedef double (FGAuxiliary::*PF)(void) const;
377  PropertyManager->Tie("propulsion/tat-r", this, &FGAuxiliary::GetTotalTemperature);
378  PropertyManager->Tie("propulsion/tat-c", this, &FGAuxiliary::GetTAT_C);
379  PropertyManager->Tie("propulsion/pt-lbs_sqft", this, &FGAuxiliary::GetTotalPressure);
380  PropertyManager->Tie("velocities/vc-fps", this, &FGAuxiliary::GetVcalibratedFPS);
381  PropertyManager->Tie("velocities/vc-kts", this, &FGAuxiliary::GetVcalibratedKTS);
382  PropertyManager->Tie("velocities/ve-fps", this, &FGAuxiliary::GetVequivalentFPS);
383  PropertyManager->Tie("velocities/ve-kts", this, &FGAuxiliary::GetVequivalentKTS);
384  PropertyManager->Tie("velocities/vtrue-fps", this, &FGAuxiliary::GetVtrueFPS);
385  PropertyManager->Tie("velocities/vtrue-kts", this, &FGAuxiliary::GetVtrueKTS);
386  PropertyManager->Tie("velocities/machU", this, &FGAuxiliary::GetMachU);
387  PropertyManager->Tie("velocities/p-aero-rad_sec", this, eX, (PMF)&FGAuxiliary::GetAeroPQR);
388  PropertyManager->Tie("velocities/q-aero-rad_sec", this, eY, (PMF)&FGAuxiliary::GetAeroPQR);
389  PropertyManager->Tie("velocities/r-aero-rad_sec", this, eZ, (PMF)&FGAuxiliary::GetAeroPQR);
390  PropertyManager->Tie("velocities/phidot-rad_sec", this, ePhi, (PMF)&FGAuxiliary::GetEulerRates);
391  PropertyManager->Tie("velocities/thetadot-rad_sec", this, eTht, (PMF)&FGAuxiliary::GetEulerRates);
392  PropertyManager->Tie("velocities/psidot-rad_sec", this, ePsi, (PMF)&FGAuxiliary::GetEulerRates);
393  PropertyManager->Tie("velocities/u-aero-fps", this, eU, (PMF)&FGAuxiliary::GetAeroUVW);
394  PropertyManager->Tie("velocities/v-aero-fps", this, eV, (PMF)&FGAuxiliary::GetAeroUVW);
395  PropertyManager->Tie("velocities/w-aero-fps", this, eW, (PMF)&FGAuxiliary::GetAeroUVW);
396  PropertyManager->Tie("velocities/vt-fps", this, &FGAuxiliary::GetVt);
397  PropertyManager->Tie("velocities/mach", this, &FGAuxiliary::GetMach);
398  PropertyManager->Tie("velocities/vg-fps", this, &FGAuxiliary::GetVground);
399  PropertyManager->Tie("accelerations/a-pilot-x-ft_sec2", this, eX, (PMF)&FGAuxiliary::GetPilotAccel);
400  PropertyManager->Tie("accelerations/a-pilot-y-ft_sec2", this, eY, (PMF)&FGAuxiliary::GetPilotAccel);
401  PropertyManager->Tie("accelerations/a-pilot-z-ft_sec2", this, eZ, (PMF)&FGAuxiliary::GetPilotAccel);
402  PropertyManager->Tie("accelerations/n-pilot-x-norm", this, eX, (PMF)&FGAuxiliary::GetNpilot);
403  PropertyManager->Tie("accelerations/n-pilot-y-norm", this, eY, (PMF)&FGAuxiliary::GetNpilot);
404  PropertyManager->Tie("accelerations/n-pilot-z-norm", this, eZ, (PMF)&FGAuxiliary::GetNpilot);
405  PropertyManager->Tie("accelerations/Nz", this, &FGAuxiliary::GetNz);
406  PropertyManager->Tie("accelerations/Ny", this, &FGAuxiliary::GetNy);
407  PropertyManager->Tie("forces/load-factor", this, &FGAuxiliary::GetNlf);
408  /* PropertyManager->Tie("atmosphere/headwind-fps", this, &FGAuxiliary::GetHeadWind, true);
409  PropertyManager->Tie("atmosphere/crosswind-fps", this, &FGAuxiliary::GetCrossWind, true); */
410  PropertyManager->Tie("aero/alpha-rad", this, (PF)&FGAuxiliary::Getalpha);
411  PropertyManager->Tie("aero/beta-rad", this, (PF)&FGAuxiliary::Getbeta);
412  PropertyManager->Tie("aero/mag-beta-rad", this, (PF)&FGAuxiliary::GetMagBeta);
413  PropertyManager->Tie("aero/alpha-deg", this, inDegrees, (PMF)&FGAuxiliary::Getalpha);
414  PropertyManager->Tie("aero/beta-deg", this, inDegrees, (PMF)&FGAuxiliary::Getbeta);
415  PropertyManager->Tie("aero/mag-beta-deg", this, inDegrees, (PMF)&FGAuxiliary::GetMagBeta);
416  PropertyManager->Tie("aero/Re", this, &FGAuxiliary::GetReynoldsNumber);
417  PropertyManager->Tie("aero/qbar-psf", this, &FGAuxiliary::Getqbar);
418  PropertyManager->Tie("aero/qbarUW-psf", this, &FGAuxiliary::GetqbarUW);
419  PropertyManager->Tie("aero/qbarUV-psf", this, &FGAuxiliary::GetqbarUV);
420  PropertyManager->Tie("aero/alphadot-rad_sec", this, (PF)&FGAuxiliary::Getadot);
421  PropertyManager->Tie("aero/betadot-rad_sec", this, (PF)&FGAuxiliary::Getbdot);
422  PropertyManager->Tie("aero/alphadot-deg_sec", this, inDegrees, (PMF)&FGAuxiliary::Getadot);
423  PropertyManager->Tie("aero/betadot-deg_sec", this, inDegrees, (PMF)&FGAuxiliary::Getbdot);
424  PropertyManager->Tie("aero/h_b-cg-ft", this, &FGAuxiliary::GetHOverBCG);
425  PropertyManager->Tie("aero/h_b-mac-ft", this, &FGAuxiliary::GetHOverBMAC);
426  PropertyManager->Tie("flight-path/gamma-rad", this, &FGAuxiliary::GetGamma);
427  PropertyManager->Tie("flight-path/psi-gt-rad", this, &FGAuxiliary::GetGroundTrack);
428 
429  PropertyManager->Tie("position/distance-from-start-lon-mt", this, &FGAuxiliary::GetLongitudeRelativePosition);
430  PropertyManager->Tie("position/distance-from-start-lat-mt", this, &FGAuxiliary::GetLatitudeRelativePosition);
431  PropertyManager->Tie("position/distance-from-start-mag-mt", this, &FGAuxiliary::GetDistanceRelativePosition);
432  PropertyManager->Tie("position/vrp-gc-latitude_deg", &vLocationVRP, &FGLocation::GetLatitudeDeg);
433  PropertyManager->Tie("position/vrp-longitude_deg", &vLocationVRP, &FGLocation::GetLongitudeDeg);
434  PropertyManager->Tie("position/vrp-radius-ft", &vLocationVRP, &FGLocation::GetRadius);
435 }
436 
437 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
438 
439 double FGAuxiliary::BadUnits(void) const
440 {
441  cerr << "Bad units" << endl; return 0.0;
442 }
443 
444 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
445 // The bitmasked value choices are as follows:
446 // unset: In this case (the default) JSBSim would only print
447 // out the normally expected messages, essentially echoing
448 // the config files as they are read. If the environment
449 // variable is not set, debug_lvl is set to 1 internally
450 // 0: This requests JSBSim not to output any messages
451 // whatsoever.
452 // 1: This value explicity requests the normal JSBSim
453 // startup messages
454 // 2: This value asks for a message to be printed out when
455 // a class is instantiated
456 // 4: When this value is set, a message is displayed when a
457 // FGModel object executes its Run() method
458 // 8: When this value is set, various runtime state variables
459 // are printed out periodically
460 // 16: When set various parameters are sanity checked and
461 // a message is printed out when they go out of bounds
462 
463 void FGAuxiliary::Debug(int from)
464 {
465  if (debug_lvl <= 0) return;
466 
467  if (debug_lvl & 1) { // Standard console startup message output
468  if (from == 0) { // Constructor
469 
470  }
471  }
472  if (debug_lvl & 2 ) { // Instantiation/Destruction notification
473  if (from == 0) cout << "Instantiated: FGAuxiliary" << endl;
474  if (from == 1) cout << "Destroyed: FGAuxiliary" << endl;
475  }
476  if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
477  }
478  if (debug_lvl & 8 ) { // Runtime state variables
479  }
480  if (debug_lvl & 16) { // Sanity checking
481  if (Mach > 100 || Mach < 0.00)
482  cout << "FGPropagate::Mach is out of bounds: " << Mach << endl;
483  if (qbar > 1e6 || qbar < 0.00)
484  cout << "FGPropagate::qbar is out of bounds: " << qbar << endl;
485  }
486  if (debug_lvl & 64) {
487  if (from == 0) { // Constructor
488  cout << IdSrc << endl;
489  cout << IdHdr << endl;
490  }
491  }
492 }
493 
494 } // namespace JSBSim
double GetLatitudeRadIC(void) const
Gets the initial latitude.
FGInitialCondition * GetIC(void)
Returns a pointer to the FGInitialCondition object.
Definition: FGFDMExec.h:385
double GetVequivalentKTS(void) const
Returns equivalent airspeed in knots.
Definition: FGAuxiliary.h:139
double GetSeaLevelRadius(void) const
Get the local sea level radius.
Definition: FGLocation.h:347
static double RankineToCelsius(double rankine)
Converts from degrees Rankine to degrees Celsius.
Definition: FGJSBBase.h:211
double GetTotalTemperature(void) const
Returns the total temperature.
Definition: FGAuxiliary.h:158
double GetVcalibratedFPS(void) const
Returns Calibrated airspeed in feet/second.
Definition: FGAuxiliary.h:133
double GetVtrueKTS() const
Returns the true airspeed in knots.
Definition: FGAuxiliary.h:143
double GetDistanceTo(double target_longitude, double target_latitude) const
Get the geodetic distance between the current location and a given location.
Definition: FGLocation.cpp:418
double GetLatitude() const
Get the latitude.
Definition: FGLocation.h:272
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF)...
Definition: FGLocation.h:160
STL namespace.
double GetNy(void) const
The lateral acceleration in g&#39;s of the aircraft center of gravity.
Definition: FGAuxiliary.h:229
double GetLongitudeRadIC(void) const
Gets the initial longitude.
static double PitotTotalPressure(double mach, double p)
Compute the total pressure in front of the Pitot tube.
Definition: FGJSBBase.cpp:278
double GetRadius() const
Get the distance from the center of the earth.
Definition: FGLocation.h:323
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
Definition: FGModel.cpp:92
static double VcalibratedFromMach(double mach, double p, double psl, double rhosl)
Calculate the calibrated airspeed from the Mach number.
Definition: FGJSBBase.cpp:305
double GetLongitude() const
Get the longitude.
Definition: FGLocation.h:254
void Tie(const std::string &name, bool *pointer, bool useDefault=true)
Tie a property to an external bool variable.
double GetVtrueFPS() const
Returns the true airspeed in feet per second.
Definition: FGAuxiliary.h:141
double GetNz(void) const
The vertical acceleration in g&#39;s of the aircraft center of gravity.
Definition: FGAuxiliary.h:226
FGLocation LocalToLocation(const FGColumnVector3 &lvec) const
Conversion from Local frame coordinates to a location in the earth centered and fixed frame...
Definition: FGLocation.h:467
Base class for all scheduled JSBSim models.
Definition: FGModel.h:74
double GetVequivalentFPS(void) const
Returns equivalent airspeed in feet/second.
Definition: FGAuxiliary.h:137
This class implements a 3 element column vector.
double GetLongitudeDeg() const
Get the longitude.
Definition: FGLocation.h:260
Encapsulates various uncategorized scheduled functions.
Definition: FGAuxiliary.h:109
double GetMachU(void) const
The mach number calculated using the vehicle X axis velocity.
Definition: FGAuxiliary.h:223
FGMatrix33 Transposed(void) const
Transposed matrix.
Definition: FGMatrix33.h:243
~FGAuxiliary()
Destructor.
double Magnitude(void) const
Length of the vector.
double GetLatitudeDeg() const
Get the latitude.
Definition: FGLocation.h:284
bool Run(bool Holding)
Runs the Auxiliary routines; called by the Executive Can pass in a value indicating if the executive ...
double GetMach(void) const
Gets the Mach number.
Definition: FGAuxiliary.h:220
double GetTotalPressure(void) const
Returns the total pressure.
Definition: FGAuxiliary.h:149
double GetVcalibratedKTS(void) const
Returns Calibrated airspeed in knots.
Definition: FGAuxiliary.h:135
Encapsulates the JSBSim simulation executive.
Definition: FGFDMExec.h:189
double GetVground(void) const
Gets the ground speed in feet per second.
Definition: FGAuxiliary.h:217
double GetVt(void) const
Gets the magnitude of total vehicle velocity including wind effects in feet per second.
Definition: FGAuxiliary.h:211