~ubuntu-branches/debian/sid/flightgear/sid

« back to all changes in this revision

Viewing changes to src/FDM/JSBSim/models/FGAuxiliary.cpp

  • Committer: Package Import Robot
  • Author(s): Markus Wanner, Markus Wanner, Rebecca Palmer
  • Date: 2014-01-21 22:31:02 UTC
  • mfrom: (1.3.1) (15.1.2 experimental)
  • Revision ID: package-import@ubuntu.com-20140121223102-cjw7g9le25acd119
Tags: 3.0.0~git20140204+c99ea4-1
[ Markus Wanner ]
* Upload to unstable.
* Adjust B-D to allow building on kfreebsd-*. Closes: #724686.
* Add a lintian-overrides on autotools; we use cmake.
* Upstream corrected the fgfs manpage. Closes: #556362.
* Drop unnecessary man page for gl-info. Closes: #698308.
* Drop README.Linux: it's outdated to the point of uselessness.
  Closes: #574173.
* Add an upper limit of libsimgear-dev versions that flightgear can be
  built with. Closes: #738436.
* Drop the libsvn-dev dependency, neither flightgear nor simgear depend
  on libsvn, anymore. Closes: #682947.
* List icons in debian/install rather than copying around from rules.
* Update menu entry for flightgear, add one for fgcom; add .xpm icons.
  Closes: #713924.
* flightgear.desktop: add German translation
* Bump Standards-Version to 3.9.5; no changes needed.

[ Rebecca Palmer ]
* New upstream release.
* Install the icons (based on code by Saikrishna Arcot).  (Not a
  complete fix for LP908153 as it only sets the menu/Dash icon, not the
  running window's icon, but better than nothing).
* Disable screensaver while running. Closes: LP#793599. Add required
  libdbus-1-dev dependency.
* Remove outdated README.Debian.
* Terrasync now works after just ticking the box. Closes: #252899.
* Always set Terrasync directory.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
namespace JSBSim {
52
52
 
53
 
static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.56 2011/12/11 17:03:05 bcoconni Exp $";
 
53
static const char *IdSrc = "$Id: FGAuxiliary.cpp,v 1.62 2013/09/11 12:43:20 jberndt Exp $";
54
54
static const char *IdHdr = ID_AUXILIARY;
55
55
 
56
56
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76
76
  seconds_in_day = 0.0;
77
77
  hoverbmac = hoverbcg = 0.0;
78
78
  Re = 0.0;
79
 
  Nz = 0.0;
 
79
  Nz = Ny = 0.0;
80
80
  lon_relative_position = lat_relative_position = relative_position = 0.0;
81
81
 
82
82
  vPilotAccel.InitMatrix();
111
111
  seconds_in_day = 0.0;
112
112
  hoverbmac = hoverbcg = 0.0;
113
113
  Re = 0.0;
114
 
  Nz = 0.0;
 
114
  Nz = Ny = 0.0;
115
115
  lon_relative_position = lat_relative_position = relative_position = 0.0;
116
116
 
117
117
  vPilotAccel.InitMatrix();
159
159
  double AeroV2 = vAeroUVW(eV)*vAeroUVW(eV);
160
160
  double AeroW2 = vAeroUVW(eW)*vAeroUVW(eW);
161
161
  double mUW = AeroU2 + AeroW2;
 
162
  double Vtdot = (vAeroUVW(eU)*in.vUVWdot(eU) + vAeroUVW(eV)*in.vUVWdot(eV) + vAeroUVW(eW)*in.vUVWdot(eW))/Vt;
162
163
 
163
164
  double Vt2 = Vt*Vt;
164
165
 
168
169
    if (vAeroUVW(eV) != 0.0)
169
170
      beta  =    mUW > 0.0 ? atan2(vAeroUVW(eV), sqrt(mUW)) : 0.0;
170
171
 
171
 
    double signU=1;
172
 
    if (vAeroUVW(eU) < 0.0) signU=-1;
 
172
    //double signU=1;
 
173
    //if (vAeroUVW(eU) < 0.0) signU=-1;
173
174
 
174
175
    if ( mUW >= 1.0 ) {
175
176
      adot = (vAeroUVW(eU)*in.vUVWdot(eW) - vAeroUVW(eW)*in.vUVWdot(eU))/mUW;
176
 
      bdot = (signU*mUW*in.vUVWdot(eV)
177
 
             - vAeroUVW(eV)*(vAeroUVW(eU)*in.vUVWdot(eU) + vAeroUVW(eW)*in.vUVWdot(eW)))/(Vt2*sqrt(mUW));
 
177
      // bdot = (signU*mUW*in.vUVWdot(eV)
 
178
      //        - vAeroUVW(eV)*(vAeroUVW(eU)*in.vUVWdot(eU) + vAeroUVW(eW)*in.vUVWdot(eW)))/(Vt2*sqrt(mUW));
 
179
      bdot = (in.vUVWdot(eV)*Vt - vAeroUVW(eV)*Vtdot)/(Vt*sqrt(mUW));
178
180
    }
179
181
  }
180
182
 
214
216
  }
215
217
 
216
218
  A = pow(((pt-in.Pressure)/in.PressureSL + 1),0.28571);
217
 
  if (MachU > 0.0) {
 
219
  if (abs(MachU) > 0.0) {
218
220
    vcas = sqrt(7 * in.PressureSL / in.DensitySL * (A-1));
219
221
    veas = sqrt(2 * qbar / in.DensitySL);
220
222
    vtrue = 1116.43559 * MachU * sqrt(in.Temperature / 518.67);
224
226
 
225
227
  vPilotAccel.InitMatrix();
226
228
  vNcg = in.vBodyAccel/in.SLGravity;
227
 
  if ( Vt > 1.0 ) {
228
 
    // Nz is Acceleration in "g's", along normal axis (-Z body axis)
229
 
    Nz = -vNcg(eZ);
230
 
    vPilotAccel = in.vBodyAccel + in.vPQRdot * in.ToEyePt;
231
 
    vPilotAccel += in.vPQR * (in.vPQR * in.ToEyePt);
232
 
  } else {
233
 
    // The line below handles low velocity (and on-ground) cases, basically
234
 
    // representing the opposite of the force that the landing gear would
235
 
    // exert on the ground (which is just the total weight). This eliminates
236
 
    // any jitter that could be introduced by the landing gear. Theoretically,
237
 
    // this branch could be eliminated, with a penalty of having a short
238
 
    // transient at startup (lasting only a fraction of a second).
239
 
    vPilotAccel = in.Tl2b * FGColumnVector3( 0.0, 0.0, -in.SLGravity );
240
 
    Nz = -vPilotAccel(eZ) / in.SLGravity;
241
 
  }
 
229
  // Nz is Acceleration in "g's", along normal axis (-Z body axis)
 
230
  Nz = -vNcg(eZ);
 
231
  Ny =  vNcg(eY);
 
232
  vPilotAccel = in.vBodyAccel + in.vPQRdot * in.ToEyePt;
 
233
  vPilotAccel += in.vPQR * (in.vPQR * in.ToEyePt);
242
234
 
243
235
  vNwcg = mTb2w * vNcg;
244
236
  vNwcg(eZ) = 1.0 - vNwcg(eZ);
342
334
void FGAuxiliary::CalculateRelativePosition(void)  //ToDo: This belongs elsewhere - perhaps in FGPropagate or Exec
343
335
{
344
336
  const double earth_radius_mt = in.ReferenceRadius*fttom;
345
 
  lat_relative_position=(in.Latitude  - FDMExec->GetIC()->GetLatitudeDegIC() *degtorad)*earth_radius_mt;
346
 
  lon_relative_position=(in.Longitude - FDMExec->GetIC()->GetLongitudeDegIC()*degtorad)*earth_radius_mt;
 
337
  lat_relative_position=(in.vLocation.GetLatitude()  - FDMExec->GetIC()->GetLatitudeDegIC() *degtorad)*earth_radius_mt;
 
338
  lon_relative_position=(in.vLocation.GetLongitude() - FDMExec->GetIC()->GetLongitudeDegIC()*degtorad)*earth_radius_mt;
347
339
  relative_position = sqrt(lat_relative_position*lat_relative_position + lon_relative_position*lon_relative_position);
348
340
};
349
341
 
382
374
  PropertyManager->Tie("accelerations/n-pilot-y-norm", this, eY, (PMF)&FGAuxiliary::GetNpilot);
383
375
  PropertyManager->Tie("accelerations/n-pilot-z-norm", this, eZ, (PMF)&FGAuxiliary::GetNpilot);
384
376
  PropertyManager->Tie("accelerations/Nz", this, &FGAuxiliary::GetNz);
 
377
  PropertyManager->Tie("accelerations/Ny", this, &FGAuxiliary::GetNy);
385
378
  PropertyManager->Tie("forces/load-factor", this, &FGAuxiliary::GetNlf);
386
379
  /* PropertyManager->Tie("atmosphere/headwind-fps", this, &FGAuxiliary::GetHeadWind, true);
387
380
  PropertyManager->Tie("atmosphere/crosswind-fps", this, &FGAuxiliary::GetCrossWind, true); */