]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGAircraft.cpp
5/26/2000 updated from Jon and Tony.
[flightgear.git] / src / FDM / JSBSim / FGAircraft.cpp
1 /*******************************************************************************
2  
3  Module:       FGAircraft.cpp
4  Author:       Jon S. Berndt
5  Date started: 12/12/98                                   
6  Purpose:      Encapsulates an aircraft
7  Called by:    FGFDMExec
8  
9  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
10  
11  This program is free software; you can redistribute it and/or modify it under
12  the terms of the GNU 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 General Public License for more
19  details.
20  
21  You should have received a copy of the GNU 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 General Public License can also be found on
26  the world wide web at http://www.gnu.org.
27  
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30 Models the aircraft reactions and forces. This class is instantiated by the
31 FGFDMExec class and scheduled as an FDM entry. LoadAircraft() is supplied with a
32 name of a valid, registered aircraft, and the data file is parsed.
33  
34 HISTORY
35 --------------------------------------------------------------------------------
36 12/12/98   JSB   Created
37 04/03/99   JSB   Changed Aero() method to correct body axis force calculation
38                  from wind vector. Fix provided by Tony Peden.
39 05/03/99   JSB   Changed (for the better?) the way configurations are read in.
40 9/17/99     TP   Combined force and moment functions. Added aero reference 
41                  point to config file. Added calculations for moments due to 
42                  difference in cg and aero reference point
43  
44 ********************************************************************************
45 COMMENTS, REFERENCES,  and NOTES
46 ********************************************************************************
47 [1] Cooke, Zyda, Pratt, and McGhee, "NPSNET: Flight Simulation Dynamic Modeling
48       Using Quaternions", Presence, Vol. 1, No. 4, pp. 404-420  Naval Postgraduate
49       School, January 1994
50 [2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
51       JSC 12960, July 1977
52 [3] Richard E. McFarland, "A Standard Kinematic Model for Flight Simulation at
53       NASA-Ames", NASA CR-2497, January 1975
54 [4] Barnes W. McCormick, "Aerodynamics, Aeronautics, and Flight Mechanics",
55       Wiley & Sons, 1979 ISBN 0-471-03032-5
56 [5] Bernard Etkin, "Dynamics of Flight, Stability and Control", Wiley & Sons,
57       1982 ISBN 0-471-08936-2
58  
59 The aerodynamic coefficients used in this model are:
60  
61 Longitudinal
62   CL0 - Reference lift at zero alpha
63   CD0 - Reference drag at zero alpha
64   CDM - Drag due to Mach
65   CLa - Lift curve slope (w.r.t. alpha)
66   CDa - Drag curve slope (w.r.t. alpha)
67   CLq - Lift due to pitch rate
68   CLM - Lift due to Mach
69   CLadt - Lift due to alpha rate
70  
71   Cmadt - Pitching Moment due to alpha rate
72   Cm0 - Reference Pitching moment at zero alpha
73   Cma - Pitching moment slope (w.r.t. alpha)
74   Cmq - Pitch damping (pitch moment due to pitch rate)
75   CmM - Pitch Moment due to Mach
76  
77 Lateral
78   Cyb - Side force due to sideslip
79   Cyr - Side force due to yaw rate
80  
81   Clb - Dihedral effect (roll moment due to sideslip)
82   Clp - Roll damping (roll moment due to roll rate)
83   Clr - Roll moment due to yaw rate
84   Cnb - Weathercocking stability (yaw moment due to sideslip)
85   Cnp - Rudder adverse yaw (yaw moment due to roll rate)
86   Cnr - Yaw damping (yaw moment due to yaw rate)
87  
88 Control
89   CLDe - Lift due to elevator
90   CDDe - Drag due to elevator
91   CyDr - Side force due to rudder
92   CyDa - Side force due to aileron
93  
94   CmDe - Pitch moment due to elevator
95   ClDa - Roll moment due to aileron
96   ClDr - Roll moment due to rudder
97   CnDr - Yaw moment due to rudder
98   CnDa - Yaw moment due to aileron
99  
100 ********************************************************************************
101 INCLUDES
102 *******************************************************************************/
103
104 #include <sys/stat.h>
105 #include <sys/types.h>
106
107 #ifdef FGFS
108 #  ifndef __BORLANDC__
109 #    include <simgear/compiler.h>
110 #  endif
111 #  ifdef FG_HAVE_STD_INCLUDES
112 #    include <cmath>
113 #  else
114 #    include <math.h>
115 #  endif
116 #else
117 #  include <cmath>
118 #endif
119
120 #include "FGAircraft.h"
121 #include "FGTranslation.h"
122 #include "FGRotation.h"
123 #include "FGAtmosphere.h"
124 #include "FGState.h"
125 #include "FGFDMExec.h"
126 #include "FGFCS.h"
127 #include "FGPosition.h"
128 #include "FGAuxiliary.h"
129 #include "FGOutput.h"
130
131 /*******************************************************************************
132 ************************************ CODE **************************************
133 *******************************************************************************/
134
135 FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex),
136     vMoments(3),
137     vForces(3),
138     vXYZrp(3),
139     vbaseXYZcg(3),
140     vXYZcg(3),
141     vXYZep(3),
142     vEuler(3),
143     vFs(3)
144 {
145   Name = "FGAircraft";
146
147   AxisIdx["DRAG"]  = 0;
148   AxisIdx["SIDE"]  = 1;
149   AxisIdx["LIFT"]  = 2;
150   AxisIdx["ROLL"]  = 3;
151   AxisIdx["PITCH"] = 4;
152   AxisIdx["YAW"]   = 5;
153
154   GearUp = false;
155
156   numTanks = numEngines = numSelectedFuelTanks = numSelectedOxiTanks = 0;
157 }
158
159
160 /******************************************************************************/
161
162
163 FGAircraft::~FGAircraft(void) {}
164
165 /******************************************************************************/
166
167 bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string fname) {
168   string path;
169   string filename;
170   string aircraftCfgFileName;
171   string token;
172
173   AircraftPath = aircraft_path;
174   EnginePath = engine_path;
175
176   aircraftCfgFileName = AircraftPath + "/" + fname + "/" + fname + ".cfg";
177
178   FGConfigFile AC_cfg(aircraftCfgFileName);
179
180   ReadPrologue(&AC_cfg);
181
182   while ((AC_cfg.GetNextConfigLine() != "EOF") &&
183          (token = AC_cfg.GetValue()) != "/FDM_CONFIG") {
184     if (token == "METRICS") {
185       cout << "  Reading Metrics" << endl;
186       ReadMetrics(&AC_cfg);
187     } else if (token == "AERODYNAMICS") {
188       cout << "  Reading Aerodynamics" << endl;
189       ReadAerodynamics(&AC_cfg);
190     } else if (token == "UNDERCARRIAGE") {
191       cout << "  Reading Landing Gear" << endl;
192       ReadUndercarriage(&AC_cfg);
193     } else if (token == "PROPULSION") {
194       cout << "  Reading Propulsion" << endl;
195       ReadPropulsion(&AC_cfg);
196     } else if (token == "FLIGHT_CONTROL") {
197       cout << "  Reading Flight Control" << endl;
198       ReadFlightControls(&AC_cfg);
199     } else if (token == "OUTPUT") {
200       ReadOutput(&AC_cfg);
201     }
202   }
203
204   return true;
205 }
206
207 /******************************************************************************/
208
209 bool FGAircraft::Run(void) {
210   if (!FGModel::Run()) {                 // if false then execute this Run()
211     GetState();
212
213     for (int i = 1; i <= 3; i++)  vForces(i) = vMoments(i) = 0.0;
214
215     MassChange();
216
217     FMProp();
218     FMAero();
219     FMGear();
220     FMMass();
221
222     nlf=vFs(eZ)/Weight;
223   } else {                               // skip Run() execution this time
224   }
225
226
227   return false;
228 }
229
230 /******************************************************************************/
231
232 void FGAircraft::MassChange() {
233   static FGColumnVector vXYZtank(3);
234   float Tw;
235   float IXXt, IYYt, IZZt, IXZt;
236   int t;
237   unsigned int axis_ctr;
238
239   for (axis_ctr=1; axis_ctr<=3; axis_ctr++) vXYZtank(axis_ctr) = 0.0;
240
241   // UPDATE TANK CONTENTS
242   //
243   // For each engine, cycle through the tanks and draw an equal amount of
244   // fuel (or oxidizer) from each active tank. The needed amount of fuel is
245   // determined by the engine in the FGEngine class. If more fuel is needed
246   // than is available in the tank, then that amount is considered a shortage,
247   // and will be drawn from the next tank. If the engine cannot be fed what it
248   // needs, it will be considered to be starved, and will shut down.
249
250   float Oshortage, Fshortage;
251
252   for (int e=0; e<numEngines; e++) {
253     Fshortage = Oshortage = 0.0;
254     for (t=0; t<numTanks; t++) {
255       switch(Engine[e]->GetType()) {
256       case FGEngine::etRocket:
257
258         switch(Tank[t]->GetType()) {
259         case FGTank::ttFUEL:
260           if (Tank[t]->GetSelected()) {
261             Fshortage = Tank[t]->Reduce((Engine[e]->CalcFuelNeed()/
262                                          numSelectedFuelTanks)*(dt*rate) + Fshortage);
263           }
264           break;
265         case FGTank::ttOXIDIZER:
266           if (Tank[t]->GetSelected()) {
267             Oshortage = Tank[t]->Reduce((Engine[e]->CalcOxidizerNeed()/
268                                          numSelectedOxiTanks)*(dt*rate) + Oshortage);
269           }
270           break;
271         }
272         break;
273
274       case FGEngine::etPiston:
275       case FGEngine::etTurboJet:
276       case FGEngine::etTurboProp:
277
278         if (Tank[t]->GetSelected()) {
279           Fshortage = Tank[t]->Reduce((Engine[e]->CalcFuelNeed()/
280                                        numSelectedFuelTanks)*(dt*rate) + Fshortage);
281         }
282         break;
283       }
284     }
285     if ((Fshortage <= 0.0) || (Oshortage <= 0.0)) Engine[e]->SetStarved();
286     else Engine[e]->SetStarved(false);
287   }
288
289   Weight = EmptyWeight;
290   for (t=0; t<numTanks; t++)
291     Weight += Tank[t]->GetContents();
292
293   Mass = Weight / GRAVITY;
294   // Calculate new CG here.
295
296   Tw = 0;
297   for (t=0; t<numTanks; t++) {
298     vXYZtank(eX) += Tank[t]->GetX()*Tank[t]->GetContents();
299     vXYZtank(eY) += Tank[t]->GetY()*Tank[t]->GetContents();
300     vXYZtank(eZ) += Tank[t]->GetZ()*Tank[t]->GetContents();
301
302     Tw += Tank[t]->GetContents();
303   }
304
305   vXYZcg = (vXYZtank + EmptyWeight*vbaseXYZcg) / (Tw + EmptyWeight);
306
307   // Calculate new moments of inertia here
308
309   IXXt = IYYt = IZZt = IXZt = 0.0;
310   for (t=0; t<numTanks; t++) {
311     IXXt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetX() - vXYZcg(eX))/12.0)*Tank[t]->GetContents()/GRAVITY;
312     IYYt += ((Tank[t]->GetY()-vXYZcg(eY))/12.0)*((Tank[t]->GetY() - vXYZcg(eY))/12.0)*Tank[t]->GetContents()/GRAVITY;
313     IZZt += ((Tank[t]->GetZ()-vXYZcg(eZ))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
314     IXZt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
315   }
316
317   Ixx = baseIxx + IXXt;
318   Iyy = baseIyy + IYYt;
319   Izz = baseIzz + IZZt;
320   Ixz = baseIxz + IXZt;
321
322 }
323
324 /******************************************************************************/
325
326 void FGAircraft::FMAero(void) {
327   static FGColumnVector vDXYZcg(3);
328   unsigned int axis_ctr,ctr;
329
330   for (axis_ctr=1; axis_ctr<=3; axis_ctr++) vFs(axis_ctr) = 0.0;
331
332   for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
333     for (ctr=0; ctr < Coeff[axis_ctr].size(); ctr++) {
334       vFs(axis_ctr+1) += Coeff[axis_ctr][ctr].TotalValue();
335     }
336   }
337
338   vForces += State->GetTs2b(alpha, beta)*vFs;
339
340   // The d*cg distances below, given in inches, are the distances FROM the c.g.
341   // TO the reference point. Since the c.g. and ref point are given in inches in
342   // the structural system (X positive rearwards) and the body coordinate system
343   // is given with X positive out the nose, the dxcg and dzcg values are
344   // *rotated* 180 degrees about the Y axis.
345
346   vDXYZcg(eX) = -(vXYZrp(eX) - vXYZcg(eX))/12.0;  //cg and rp values are in inches
347   vDXYZcg(eY) =  (vXYZrp(eY) - vXYZcg(eY))/12.0;
348   vDXYZcg(eZ) = -(vXYZrp(eZ) - vXYZcg(eZ))/12.0;
349
350   vMoments(eL) += vForces(eZ)*vDXYZcg(eY) - vForces(eY)*vDXYZcg(eZ); // rolling moment
351   vMoments(eM) += vForces(eX)*vDXYZcg(eZ) - vForces(eZ)*vDXYZcg(eX); // pitching moment
352   vMoments(eN) += vForces(eY)*vDXYZcg(eX) - vForces(eX)*vDXYZcg(eY); // yawing moment
353
354   for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
355     for (ctr = 0; ctr < Coeff[axis_ctr+3].size(); ctr++) {
356       vMoments(axis_ctr+1) += Coeff[axis_ctr+3][ctr].TotalValue();
357     }
358   }
359 }
360
361 /******************************************************************************/
362
363 void FGAircraft::FMGear(void) {
364   if (GearUp) {
365     // crash routine
366   }
367   else {
368     for (unsigned int i=0;i<lGear.size();i++) {
369       vForces  += lGear[i]->Force();
370       vMoments += lGear[i]->Moment();
371     }
372   }
373 }
374
375 /******************************************************************************/
376
377 void FGAircraft::FMMass(void) {
378   vForces(eX) += -GRAVITY*sin(vEuler(eTht)) * Mass;
379   vForces(eY) +=  GRAVITY*sin(vEuler(ePhi))*cos(vEuler(eTht)) * Mass;
380   vForces(eZ) +=  GRAVITY*cos(vEuler(ePhi))*cos(vEuler(eTht)) * Mass;
381 }
382
383 /******************************************************************************/
384
385 void FGAircraft::FMProp(void) {
386   for (int i=0;i<numEngines;i++) {
387     vForces(eX) += Engine[i]->CalcThrust();
388   }
389 }
390
391 /******************************************************************************/
392
393 void FGAircraft::GetState(void) {
394   dt = State->Getdt();
395
396   alpha = Translation->Getalpha();
397   beta = Translation->Getbeta();
398   vEuler = Rotation->GetEuler();
399 }
400
401 /******************************************************************************/
402
403 void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg) {
404   string token = "";
405   string parameter;
406
407   AC_cfg->GetNextConfigLine();
408
409   while ((token = AC_cfg->GetValue()) != "/METRICS") {
410     *AC_cfg >> parameter;
411     if (parameter == "AC_WINGAREA") *AC_cfg >> WingArea;
412     else if (parameter == "AC_WINGSPAN") *AC_cfg >> WingSpan;
413     else if (parameter == "AC_CHORD") *AC_cfg >> cbar;
414     else if (parameter == "AC_IXX") *AC_cfg >> baseIxx;
415     else if (parameter == "AC_IYY") *AC_cfg >> baseIyy;
416     else if (parameter == "AC_IZZ") *AC_cfg >> baseIzz;
417     else if (parameter == "AC_IXZ") *AC_cfg >> baseIxz;
418     else if (parameter == "AC_EMPTYWT") *AC_cfg >> EmptyWeight;
419     else if (parameter == "AC_CGLOC") *AC_cfg >> vbaseXYZcg(eX) >> vbaseXYZcg(eY) >> vbaseXYZcg(eZ);
420     else if (parameter == "AC_EYEPTLOC") *AC_cfg >> vXYZep(eX) >> vXYZep(eY) >> vXYZep(eZ);
421     else if (parameter == "AC_AERORP") *AC_cfg >> vXYZrp(eX) >> vXYZrp(eY) >> vXYZrp(eZ);
422     else if (parameter == "AC_ALPHALIMITS") *AC_cfg >> alphaclmin >> alphaclmax;
423   }
424 }
425
426 /******************************************************************************/
427
428 void FGAircraft::ReadPropulsion(FGConfigFile* AC_cfg) {
429   string token;
430   string engine_name;
431   string parameter;
432
433   AC_cfg->GetNextConfigLine();
434
435   while ((token = AC_cfg->GetValue()) != "/PROPULSION") {
436     *AC_cfg >> parameter;
437
438     if (parameter == "AC_ENGINE") {
439
440       *AC_cfg >> engine_name;
441       Engine[numEngines] = new FGEngine(FDMExec, EnginePath, engine_name, numEngines);
442       numEngines++;
443
444     } else if (parameter == "AC_TANK") {
445
446       Tank[numTanks] = new FGTank(AC_cfg);
447       switch(Tank[numTanks]->GetType()) {
448       case FGTank::ttFUEL:
449         numSelectedFuelTanks++;
450         break;
451       case FGTank::ttOXIDIZER:
452         numSelectedOxiTanks++;
453         break;
454       }
455       numTanks++;
456     }
457   }
458 }
459
460 /******************************************************************************/
461
462 void FGAircraft::ReadFlightControls(FGConfigFile* AC_cfg) {
463   string token;
464
465   FCS->LoadFCS(AC_cfg);
466 }
467
468 /******************************************************************************/
469
470 void FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg) {
471   string token, axis;
472
473   AC_cfg->GetNextConfigLine();
474
475   Coeff.push_back(*(new CoeffArray()));
476   Coeff.push_back(*(new CoeffArray()));
477   Coeff.push_back(*(new CoeffArray()));
478   Coeff.push_back(*(new CoeffArray()));
479   Coeff.push_back(*(new CoeffArray()));
480   Coeff.push_back(*(new CoeffArray()));
481
482   while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") {
483     if (token == "AXIS") {
484       axis = AC_cfg->GetValue("NAME");
485       AC_cfg->GetNextConfigLine();
486       while ((token = AC_cfg->GetValue()) != "/AXIS") {
487         Coeff[AxisIdx[axis]].push_back(*(new FGCoefficient(FDMExec, AC_cfg)));
488         DisplayCoeffFactors(Coeff[AxisIdx[axis]].back().Getmultipliers());
489       }
490       AC_cfg->GetNextConfigLine();
491     }
492   }
493 }
494
495 /******************************************************************************/
496
497 void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg) {
498   string token;
499
500   AC_cfg->GetNextConfigLine();
501
502   while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") {
503     lGear.push_back(new FGLGear(AC_cfg, FDMExec));
504   }
505 }
506
507 /******************************************************************************/
508
509 void FGAircraft::ReadOutput(FGConfigFile* AC_cfg) {
510   string token, parameter;
511   int OutRate = 0;
512   int subsystems = 0;
513
514   token = AC_cfg->GetValue("NAME");
515   Output->SetFilename(token);
516   token = AC_cfg->GetValue("TYPE");
517   Output->SetType(token);
518   AC_cfg->GetNextConfigLine();
519
520   while ((token = AC_cfg->GetValue()) != "/OUTPUT") {
521     *AC_cfg >> parameter;
522     if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate;
523     if (parameter == "SIMULATION") {
524       *AC_cfg >> parameter;
525       if (parameter == "ON") subsystems += ssSimulation;
526     }
527     if (parameter == "AEROSURFACES") {
528       *AC_cfg >> parameter;
529       if (parameter == "ON") subsystems += ssAerosurfaces;
530     }
531     if (parameter == "RATES") {
532       *AC_cfg >> parameter;
533       if (parameter == "ON") subsystems += ssRates;
534     }
535     if (parameter == "VELOCITIES") {
536       *AC_cfg >> parameter;
537       if (parameter == "ON") subsystems += ssVelocities;
538     }
539     if (parameter == "FORCES") {
540       *AC_cfg >> parameter;
541       if (parameter == "ON") subsystems += ssForces;
542     }
543     if (parameter == "MOMENTS") {
544       *AC_cfg >> parameter;
545       if (parameter == "ON") subsystems += ssMoments;
546     }
547     if (parameter == "ATMOSPHERE") {
548       *AC_cfg >> parameter;
549       if (parameter == "ON") subsystems += ssAtmosphere;
550     }
551     if (parameter == "MASSPROPS") {
552       *AC_cfg >> parameter;
553       if (parameter == "ON") subsystems += ssMassProps;
554     }
555     if (parameter == "POSITION") {
556       *AC_cfg >> parameter;
557       if (parameter == "ON") subsystems += ssPosition;
558     }
559     if (parameter == "COEFFICIENTS") {
560       *AC_cfg >> parameter;
561       if (parameter == "ON") subsystems += ssCoefficients;
562     }
563     if (parameter == "GROUND_REACTIONS") {
564       *AC_cfg >> parameter;
565       if (parameter == "ON") subsystems += ssGroundReactions;
566     }
567   }
568
569   Output->SetSubsystems(subsystems);
570
571   OutRate = OutRate>120?120:(OutRate<0?0:OutRate);
572   Output->SetRate( (int)(0.5 + 1.0/(State->Getdt()*OutRate)) );
573 }
574
575 /******************************************************************************/
576
577 void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg) {
578   string token = AC_cfg->GetValue();
579   string scratch;
580   AircraftName = AC_cfg->GetValue("NAME");
581   cout << "Reading Aircraft Configuration File: " << AircraftName << endl;
582   scratch=AC_cfg->GetValue("VERSION").c_str();
583
584   CFGVersion = AC_cfg->GetValue("VERSION");
585   cout << "                            Version: " << CFGVersion << endl;
586   if (CFGVersion != NEEDED_CFG_VERSION) {
587     cout << endl << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
588     " RESULTS WILL BE UNPREDICTABLE !!" << endl;
589     cout << "Current version needed is: " << NEEDED_CFG_VERSION << endl;
590     cout << "         You have version: " << CFGVersion << endl << endl;
591     //exit(-1);
592   }
593
594
595 }
596
597 /******************************************************************************/
598
599 void FGAircraft::DisplayCoeffFactors(int multipliers) {
600   cout << "   Non-Dimensionalized by: ";
601
602   if (multipliers & FG_QBAR)      cout << "qbar ";
603   if (multipliers & FG_WINGAREA)  cout << "S ";
604   if (multipliers & FG_WINGSPAN)  cout << "b ";
605   if (multipliers & FG_CBAR)      cout << "c ";
606   if (multipliers & FG_ALPHA)     cout << "alpha ";
607   if (multipliers & FG_ALPHADOT)  cout << "alphadot ";
608   if (multipliers & FG_BETA)      cout << "beta ";
609   if (multipliers & FG_BETADOT)   cout << "betadot ";
610   if (multipliers & FG_PITCHRATE) cout << "q ";
611   if (multipliers & FG_ROLLRATE)  cout << "p ";
612   if (multipliers & FG_YAWRATE)   cout << "r ";
613
614   if (multipliers & FG_ELEVATOR_CMD)  cout << "De cmd ";
615   if (multipliers & FG_AILERON_CMD)   cout << "Da cmd ";
616   if (multipliers & FG_RUDDER_CMD)    cout << "Dr cmd ";
617   if (multipliers & FG_FLAPS_CMD)     cout << "Df cmd ";
618   if (multipliers & FG_SPOILERS_CMD)  cout << "Dsp cmd ";
619   if (multipliers & FG_SPDBRAKE_CMD)   cout << "Dsb cmd ";
620
621   if (multipliers & FG_ELEVATOR_POS)  cout << "De ";
622   if (multipliers & FG_AILERON_POS)   cout << "Da ";
623   if (multipliers & FG_RUDDER_POS)    cout << "Dr ";
624   if (multipliers & FG_FLAPS_POS)     cout << "Df ";
625   if (multipliers & FG_SPOILERS_POS)  cout << "Dsp ";
626   if (multipliers & FG_SPDBRAKE_POS)  cout << "Dsb ";
627
628   if (multipliers & FG_MACH)      cout << "Mach ";
629   if (multipliers & FG_ALTITUDE)  cout << "h ";
630   if (multipliers & FG_BI2VEL)    cout << "b /(2*Vt) ";
631   if (multipliers & FG_CI2VEL)    cout << "c /(2*Vt) ";
632
633   cout << endl;
634 }
635
636 /******************************************************************************/
637
638 string FGAircraft::GetCoefficientStrings(void) {
639   string CoeffStrings = "";
640   bool firstime = true;
641
642   for (unsigned int axis = 0; axis < 6; axis++) {
643     for (unsigned int sd = 0; sd < Coeff[axis].size(); sd++) {
644       if (firstime) {
645         firstime = false;
646       } else {
647         CoeffStrings += ", ";
648       }
649       CoeffStrings += Coeff[axis][sd].Getname();
650     }
651   }
652
653   return CoeffStrings;
654 }
655
656 /******************************************************************************/
657
658 string FGAircraft::GetCoefficientValues(void) {
659   string SDValues = "";
660   char buffer[10];
661   bool firstime = true;
662
663   for (unsigned int axis = 0; axis < 6; axis++) {
664     for (unsigned int sd = 0; sd < Coeff[axis].size(); sd++) {
665       if (firstime) {
666         firstime = false;
667       } else {
668         SDValues += ", ";
669       }
670       sprintf(buffer, "%9.6f", Coeff[axis][sd].GetSD());
671       SDValues += string(buffer);
672     }
673   }
674
675   return SDValues;
676   ;
677 }
678
679 /******************************************************************************/
680
681 string FGAircraft::GetGroundReactionStrings(void) {
682   string GroundReactionStrings = "";
683   bool firstime = true;
684
685   for (unsigned int i=0;i<lGear.size();i++) {
686     if (!firstime) GroundReactionStrings += ", ";
687     GroundReactionStrings += (lGear[i]->GetName() + "_WOW, ");
688     GroundReactionStrings += (lGear[i]->GetName() + "_compressLength, ");
689     GroundReactionStrings += (lGear[i]->GetName() + "_compressSpeed, ");
690     GroundReactionStrings += (lGear[i]->GetName() + "_Force");
691
692     firstime = false;
693   }
694
695   return GroundReactionStrings;
696 }
697
698 /******************************************************************************/
699
700 string FGAircraft::GetGroundReactionValues(void) {
701   char buff[20];
702   string GroundReactionValues = "";
703
704   bool firstime = true;
705
706   for (unsigned int i=0;i<lGear.size();i++) {
707     if (!firstime) GroundReactionValues += ", ";
708     GroundReactionValues += string( lGear[i]->GetWOW()?"1":"0" ) + ", ";
709     GroundReactionValues += (string(gcvt(lGear[i]->GetCompLen(),    5, buff)) + ", ");
710     GroundReactionValues += (string(gcvt(lGear[i]->GetCompVel(),    6, buff)) + ", ");
711     GroundReactionValues += (string(gcvt(lGear[i]->GetCompForce(), 10, buff)));
712
713     firstime = false;
714   }
715
716   return GroundReactionValues;
717 }
718