1 /*******************************************************************************
6 Purpose: Encapsulates an aircraft
9 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
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
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
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.
25 Further information about the GNU General Public License can also be found on
26 the world wide web at http://www.gnu.org.
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.
35 --------------------------------------------------------------------------------
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
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
50 [2] D. M. Henderson, "Euler Angles, Quaternions, and Transformation Matrices",
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
59 The aerodynamic coefficients used in this model are:
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
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
78 Cyb - Side force due to sideslip
79 Cyr - Side force due to yaw rate
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)
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
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
100 ********************************************************************************
102 *******************************************************************************/
104 #include <sys/stat.h>
105 #include <sys/types.h>
108 # ifndef __BORLANDC__
109 # include <simgear/compiler.h>
111 # ifdef FG_HAVE_STD_INCLUDES
120 #include "FGAircraft.h"
121 #include "FGTranslation.h"
122 #include "FGRotation.h"
123 #include "FGAtmosphere.h"
125 #include "FGFDMExec.h"
127 #include "FGPosition.h"
128 #include "FGAuxiliary.h"
129 #include "FGOutput.h"
131 /*******************************************************************************
132 ************************************ CODE **************************************
133 *******************************************************************************/
135 FGAircraft::FGAircraft(FGFDMExec* fdmex) : FGModel(fdmex),
152 AxisIdx["PITCH"] = 4;
157 numTanks = numEngines = numSelectedFuelTanks = numSelectedOxiTanks = 0;
161 /******************************************************************************/
164 FGAircraft::~FGAircraft(void) {}
166 /******************************************************************************/
168 bool FGAircraft::LoadAircraft(string aircraft_path, string engine_path, string fname) {
171 string aircraftCfgFileName;
174 AircraftPath = aircraft_path;
175 EnginePath = engine_path;
177 aircraftCfgFileName = AircraftPath + "/" + fname + "/" + fname + ".cfg";
179 FGConfigFile AC_cfg(aircraftCfgFileName);
180 if (!AC_cfg.IsOpen()) return false;
182 ReadPrologue(&AC_cfg);
184 while ((AC_cfg.GetNextConfigLine() != "EOF") &&
185 (token = AC_cfg.GetValue()) != "/FDM_CONFIG") {
186 if (token == "METRICS") {
187 cout << " Reading Metrics" << endl;
188 ReadMetrics(&AC_cfg);
189 } else if (token == "AERODYNAMICS") {
190 cout << " Reading Aerodynamics" << endl;
191 ReadAerodynamics(&AC_cfg);
192 } else if (token == "UNDERCARRIAGE") {
193 cout << " Reading Landing Gear" << endl;
194 ReadUndercarriage(&AC_cfg);
195 } else if (token == "PROPULSION") {
196 cout << " Reading Propulsion" << endl;
197 ReadPropulsion(&AC_cfg);
198 } else if (token == "FLIGHT_CONTROL") {
199 cout << " Reading Flight Control" << endl;
200 ReadFlightControls(&AC_cfg);
201 } else if (token == "OUTPUT") {
209 /******************************************************************************/
211 bool FGAircraft::Run(void) {
212 if (!FGModel::Run()) { // if false then execute this Run()
215 for (int i = 1; i <= 3; i++) vForces(i) = vMoments(i) = 0.0;
224 } else { // skip Run() execution this time
231 /******************************************************************************/
233 void FGAircraft::MassChange() {
234 static FGColumnVector vXYZtank(3);
236 float IXXt, IYYt, IZZt, IXZt;
238 unsigned int axis_ctr;
240 for (axis_ctr=1; axis_ctr<=3; axis_ctr++) vXYZtank(axis_ctr) = 0.0;
242 // UPDATE TANK CONTENTS
244 // For each engine, cycle through the tanks and draw an equal amount of
245 // fuel (or oxidizer) from each active tank. The needed amount of fuel is
246 // determined by the engine in the FGEngine class. If more fuel is needed
247 // than is available in the tank, then that amount is considered a shortage,
248 // and will be drawn from the next tank. If the engine cannot be fed what it
249 // needs, it will be considered to be starved, and will shut down.
251 float Oshortage, Fshortage;
253 for (unsigned int e=0; e<numEngines; e++) {
254 Fshortage = Oshortage = 0.0;
255 for (t=0; t<numTanks; t++) {
256 switch(Engine[e]->GetType()) {
257 case FGEngine::etRocket:
259 switch(Tank[t]->GetType()) {
261 if (Tank[t]->GetSelected()) {
262 Fshortage = Tank[t]->Reduce((Engine[e]->CalcFuelNeed()/
263 numSelectedFuelTanks)*(dt*rate) + Fshortage);
266 case FGTank::ttOXIDIZER:
267 if (Tank[t]->GetSelected()) {
268 Oshortage = Tank[t]->Reduce((Engine[e]->CalcOxidizerNeed()/
269 numSelectedOxiTanks)*(dt*rate) + Oshortage);
275 case FGEngine::etPiston:
276 case FGEngine::etTurboJet:
277 case FGEngine::etTurboProp:
279 if (Tank[t]->GetSelected()) {
280 Fshortage = Tank[t]->Reduce((Engine[e]->CalcFuelNeed()/
281 numSelectedFuelTanks)*(dt*rate) + Fshortage);
286 if ((Fshortage <= 0.0) || (Oshortage <= 0.0)) Engine[e]->SetStarved();
287 else Engine[e]->SetStarved(false);
290 Weight = EmptyWeight;
291 for (t=0; t<numTanks; t++)
292 Weight += Tank[t]->GetContents();
294 Mass = Weight / GRAVITY;
295 // Calculate new CG here.
298 for (t=0; t<numTanks; t++) {
299 vXYZtank(eX) += Tank[t]->GetX()*Tank[t]->GetContents();
300 vXYZtank(eY) += Tank[t]->GetY()*Tank[t]->GetContents();
301 vXYZtank(eZ) += Tank[t]->GetZ()*Tank[t]->GetContents();
303 Tw += Tank[t]->GetContents();
306 vXYZcg = (vXYZtank + EmptyWeight*vbaseXYZcg) / (Tw + EmptyWeight);
308 // Calculate new moments of inertia here
310 IXXt = IYYt = IZZt = IXZt = 0.0;
311 for (t=0; t<numTanks; t++) {
312 IXXt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetX() - vXYZcg(eX))/12.0)*Tank[t]->GetContents()/GRAVITY;
313 IYYt += ((Tank[t]->GetY()-vXYZcg(eY))/12.0)*((Tank[t]->GetY() - vXYZcg(eY))/12.0)*Tank[t]->GetContents()/GRAVITY;
314 IZZt += ((Tank[t]->GetZ()-vXYZcg(eZ))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
315 IXZt += ((Tank[t]->GetX()-vXYZcg(eX))/12.0)*((Tank[t]->GetZ() - vXYZcg(eZ))/12.0)*Tank[t]->GetContents()/GRAVITY;
318 Ixx = baseIxx + IXXt;
319 Iyy = baseIyy + IYYt;
320 Izz = baseIzz + IZZt;
321 Ixz = baseIxz + IXZt;
325 /******************************************************************************/
327 void FGAircraft::FMAero(void) {
328 static FGColumnVector vDXYZcg(3);
329 static FGColumnVector vAeroBodyForces(3);
330 unsigned int axis_ctr,ctr;
332 for (axis_ctr=1; axis_ctr<=3; axis_ctr++) vFs(axis_ctr) = 0.0;
334 for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
335 for (ctr=0; ctr < Coeff[axis_ctr].size(); ctr++) {
336 vFs(axis_ctr+1) += Coeff[axis_ctr][ctr].TotalValue();
340 vAeroBodyForces = State->GetTs2b(alpha, beta)*vFs;
341 vForces += vAeroBodyForces;
342 // The d*cg distances below, given in inches, are the distances FROM the c.g.
343 // TO the reference point. Since the c.g. and ref point are given in inches in
344 // the structural system (X positive rearwards) and the body coordinate system
345 // is given with X positive out the nose, the dxcg and dzcg values are
346 // *rotated* 180 degrees about the Y axis.
348 vDXYZcg(eX) = -(vXYZrp(eX) - vXYZcg(eX))/12.0; //cg and rp values are in inches
349 vDXYZcg(eY) = (vXYZrp(eY) - vXYZcg(eY))/12.0;
350 vDXYZcg(eZ) = -(vXYZrp(eZ) - vXYZcg(eZ))/12.0;
352 vMoments(eL) += vAeroBodyForces(eZ)*vDXYZcg(eY) - vAeroBodyForces(eY)*vDXYZcg(eZ); // rolling moment
353 vMoments(eM) += vAeroBodyForces(eX)*vDXYZcg(eZ) - vAeroBodyForces(eZ)*vDXYZcg(eX); // pitching moment
354 vMoments(eN) += vAeroBodyForces(eY)*vDXYZcg(eX) - vAeroBodyForces(eX)*vDXYZcg(eY); // yawing moment
356 for (axis_ctr = 0; axis_ctr < 3; axis_ctr++) {
357 for (ctr = 0; ctr < Coeff[axis_ctr+3].size(); ctr++) {
358 vMoments(axis_ctr+1) += Coeff[axis_ctr+3][ctr].TotalValue();
363 /******************************************************************************/
365 void FGAircraft::FMGear(void) {
370 for (unsigned int i=0;i<lGear.size();i++) {
371 vForces += lGear[i]->Force();
372 vMoments += lGear[i]->Moment();
377 /******************************************************************************/
379 void FGAircraft::FMMass(void) {
380 vForces(eX) += -GRAVITY*sin(vEuler(eTht)) * Mass;
381 vForces(eY) += GRAVITY*sin(vEuler(ePhi))*cos(vEuler(eTht)) * Mass;
382 vForces(eZ) += GRAVITY*cos(vEuler(ePhi))*cos(vEuler(eTht)) * Mass;
385 /******************************************************************************/
387 void FGAircraft::FMProp(void) {
388 for (unsigned int i=0;i<numEngines;i++) {
390 // Changes required here for new engine placement parameters (i.e. location and direction)
392 vForces(eX) += Engine[i]->CalcThrust();
397 /******************************************************************************/
399 void FGAircraft::GetState(void) {
402 alpha = Translation->Getalpha();
403 beta = Translation->Getbeta();
404 vEuler = Rotation->GetEuler();
407 /******************************************************************************/
409 void FGAircraft::ReadMetrics(FGConfigFile* AC_cfg) {
413 AC_cfg->GetNextConfigLine();
415 while ((token = AC_cfg->GetValue()) != "/METRICS") {
416 *AC_cfg >> parameter;
417 if (parameter == "AC_WINGAREA") {
419 cout << " WingArea: " << WingArea << endl;
420 } else if (parameter == "AC_WINGSPAN") {
422 cout << " WingSpan: " << WingSpan << endl;
423 } else if (parameter == "AC_CHORD") {
425 cout << " Chord: " << cbar << endl;
426 } else if (parameter == "AC_IXX") {
428 cout << " baseIxx: " << baseIxx << endl;
429 } else if (parameter == "AC_IYY") {
431 cout << " baseIyy: " << baseIyy << endl;
432 } else if (parameter == "AC_IZZ") {
434 cout << " baseIzz: " << baseIzz << endl;
435 } else if (parameter == "AC_IXZ") {
437 cout << " baseIxz: " << baseIxz << endl;
438 } else if (parameter == "AC_EMPTYWT") {
439 *AC_cfg >> EmptyWeight;
440 cout << " EmptyWeight: " << EmptyWeight << endl;
441 } else if (parameter == "AC_CGLOC") {
442 *AC_cfg >> vbaseXYZcg(eX) >> vbaseXYZcg(eY) >> vbaseXYZcg(eZ);
443 cout << " Xcg: " << vbaseXYZcg(eX)
444 << " Ycg: " << vbaseXYZcg(eY)
445 << " Zcg: " << vbaseXYZcg(eZ)
447 } else if (parameter == "AC_EYEPTLOC") {
448 *AC_cfg >> vXYZep(eX) >> vXYZep(eY) >> vXYZep(eZ);
449 cout << " Xep: " << vXYZep(eX)
450 << " Yep: " << vXYZep(eY)
451 << " Zep: " << vXYZep(eZ)
453 } else if (parameter == "AC_AERORP") {
454 *AC_cfg >> vXYZrp(eX) >> vXYZrp(eY) >> vXYZrp(eZ);
455 cout << " Xrp: " << vXYZrp(eX)
456 << " Yrp: " << vXYZrp(eY)
457 << " Zrp: " << vXYZrp(eZ)
459 } else if (parameter == "AC_ALPHALIMITS") {
460 *AC_cfg >> alphaclmin >> alphaclmax;
461 cout << " Maximum Alpha: " << alphaclmax
462 << " Minimum Alpha: " << alphaclmin
468 /******************************************************************************/
470 void FGAircraft::ReadPropulsion(FGConfigFile* AC_cfg) {
475 AC_cfg->GetNextConfigLine();
477 while ((token = AC_cfg->GetValue()) != "/PROPULSION") {
478 *AC_cfg >> parameter;
480 if (parameter == "AC_ENGINE") {
482 *AC_cfg >> engine_name;
483 Engine[numEngines] = new FGEngine(FDMExec, EnginePath, engine_name, numEngines);
486 } else if (parameter == "AC_TANK") {
488 Tank[numTanks] = new FGTank(AC_cfg);
489 switch(Tank[numTanks]->GetType()) {
491 numSelectedFuelTanks++;
493 case FGTank::ttOXIDIZER:
494 numSelectedOxiTanks++;
502 /******************************************************************************/
504 void FGAircraft::ReadFlightControls(FGConfigFile* AC_cfg) {
507 FCS->LoadFCS(AC_cfg);
510 /******************************************************************************/
512 void FGAircraft::ReadAerodynamics(FGConfigFile* AC_cfg) {
515 AC_cfg->GetNextConfigLine();
517 Coeff.push_back(*(new CoeffArray()));
518 Coeff.push_back(*(new CoeffArray()));
519 Coeff.push_back(*(new CoeffArray()));
520 Coeff.push_back(*(new CoeffArray()));
521 Coeff.push_back(*(new CoeffArray()));
522 Coeff.push_back(*(new CoeffArray()));
524 while ((token = AC_cfg->GetValue()) != "/AERODYNAMICS") {
525 if (token == "AXIS") {
526 axis = AC_cfg->GetValue("NAME");
527 AC_cfg->GetNextConfigLine();
528 while ((token = AC_cfg->GetValue()) != "/AXIS") {
529 Coeff[AxisIdx[axis]].push_back(*(new FGCoefficient(FDMExec, AC_cfg)));
530 DisplayCoeffFactors(Coeff[AxisIdx[axis]].back().Getmultipliers());
532 AC_cfg->GetNextConfigLine();
537 /******************************************************************************/
539 void FGAircraft::ReadUndercarriage(FGConfigFile* AC_cfg) {
542 AC_cfg->GetNextConfigLine();
544 while ((token = AC_cfg->GetValue()) != "/UNDERCARRIAGE") {
545 lGear.push_back(new FGLGear(AC_cfg, FDMExec));
549 /******************************************************************************/
551 void FGAircraft::ReadOutput(FGConfigFile* AC_cfg) {
552 string token, parameter;
556 token = AC_cfg->GetValue("NAME");
557 Output->SetFilename(token);
558 token = AC_cfg->GetValue("TYPE");
559 Output->SetType(token);
560 AC_cfg->GetNextConfigLine();
562 while ((token = AC_cfg->GetValue()) != "/OUTPUT") {
563 *AC_cfg >> parameter;
564 if (parameter == "RATE_IN_HZ") *AC_cfg >> OutRate;
565 if (parameter == "SIMULATION") {
566 *AC_cfg >> parameter;
567 if (parameter == "ON") subsystems += ssSimulation;
569 if (parameter == "AEROSURFACES") {
570 *AC_cfg >> parameter;
571 if (parameter == "ON") subsystems += ssAerosurfaces;
573 if (parameter == "RATES") {
574 *AC_cfg >> parameter;
575 if (parameter == "ON") subsystems += ssRates;
577 if (parameter == "VELOCITIES") {
578 *AC_cfg >> parameter;
579 if (parameter == "ON") subsystems += ssVelocities;
581 if (parameter == "FORCES") {
582 *AC_cfg >> parameter;
583 if (parameter == "ON") subsystems += ssForces;
585 if (parameter == "MOMENTS") {
586 *AC_cfg >> parameter;
587 if (parameter == "ON") subsystems += ssMoments;
589 if (parameter == "ATMOSPHERE") {
590 *AC_cfg >> parameter;
591 if (parameter == "ON") subsystems += ssAtmosphere;
593 if (parameter == "MASSPROPS") {
594 *AC_cfg >> parameter;
595 if (parameter == "ON") subsystems += ssMassProps;
597 if (parameter == "POSITION") {
598 *AC_cfg >> parameter;
599 if (parameter == "ON") subsystems += ssPosition;
601 if (parameter == "COEFFICIENTS") {
602 *AC_cfg >> parameter;
603 if (parameter == "ON") subsystems += ssCoefficients;
605 if (parameter == "GROUND_REACTIONS") {
606 *AC_cfg >> parameter;
607 if (parameter == "ON") subsystems += ssGroundReactions;
611 Output->SetSubsystems(subsystems);
613 OutRate = OutRate>120?120:(OutRate<0?0:OutRate);
614 Output->SetRate( (int)(0.5 + 1.0/(State->Getdt()*OutRate)) );
617 /******************************************************************************/
619 void FGAircraft::ReadPrologue(FGConfigFile* AC_cfg) {
620 string token = AC_cfg->GetValue();
622 AircraftName = AC_cfg->GetValue("NAME");
623 cout << "Reading Aircraft Configuration File: " << AircraftName << endl;
624 scratch=AC_cfg->GetValue("VERSION").c_str();
626 CFGVersion = AC_cfg->GetValue("VERSION");
627 cout << " Version: " << CFGVersion << endl;
628 if (CFGVersion != NEEDED_CFG_VERSION) {
629 cout << endl << "YOU HAVE AN INCOMPATIBLE CFG FILE FOR THIS AIRCRAFT."
630 " RESULTS WILL BE UNPREDICTABLE !!" << endl;
631 cout << "Current version needed is: " << NEEDED_CFG_VERSION << endl;
632 cout << " You have version: " << CFGVersion << endl << endl;
639 /******************************************************************************/
641 void FGAircraft::DisplayCoeffFactors(int multipliers) {
642 cout << " Non-Dimensionalized by: ";
644 if (multipliers & FG_QBAR) cout << "qbar ";
645 if (multipliers & FG_WINGAREA) cout << "S ";
646 if (multipliers & FG_WINGSPAN) cout << "b ";
647 if (multipliers & FG_CBAR) cout << "c ";
648 if (multipliers & FG_ALPHA) cout << "alpha ";
649 if (multipliers & FG_ALPHADOT) cout << "alphadot ";
650 if (multipliers & FG_BETA) cout << "beta ";
651 if (multipliers & FG_BETADOT) cout << "betadot ";
652 if (multipliers & FG_PITCHRATE) cout << "q ";
653 if (multipliers & FG_ROLLRATE) cout << "p ";
654 if (multipliers & FG_YAWRATE) cout << "r ";
656 if (multipliers & FG_ELEVATOR_CMD) cout << "De cmd ";
657 if (multipliers & FG_AILERON_CMD) cout << "Da cmd ";
658 if (multipliers & FG_RUDDER_CMD) cout << "Dr cmd ";
659 if (multipliers & FG_FLAPS_CMD) cout << "Df cmd ";
660 if (multipliers & FG_SPOILERS_CMD) cout << "Dsp cmd ";
661 if (multipliers & FG_SPDBRAKE_CMD) cout << "Dsb cmd ";
663 if (multipliers & FG_ELEVATOR_POS) cout << "De ";
664 if (multipliers & FG_AILERON_POS) cout << "Da ";
665 if (multipliers & FG_RUDDER_POS) cout << "Dr ";
666 if (multipliers & FG_FLAPS_POS) cout << "Df ";
667 if (multipliers & FG_SPOILERS_POS) cout << "Dsp ";
668 if (multipliers & FG_SPDBRAKE_POS) cout << "Dsb ";
670 if (multipliers & FG_MACH) cout << "Mach ";
671 if (multipliers & FG_ALTITUDE) cout << "h ";
672 if (multipliers & FG_BI2VEL) cout << "b /(2*Vt) ";
673 if (multipliers & FG_CI2VEL) cout << "c /(2*Vt) ";
678 /******************************************************************************/
680 string FGAircraft::GetCoefficientStrings(void) {
681 string CoeffStrings = "";
682 bool firstime = true;
684 for (unsigned int axis = 0; axis < 6; axis++) {
685 for (unsigned int sd = 0; sd < Coeff[axis].size(); sd++) {
689 CoeffStrings += ", ";
691 CoeffStrings += Coeff[axis][sd].Getname();
698 /******************************************************************************/
700 string FGAircraft::GetCoefficientValues(void) {
701 string SDValues = "";
703 bool firstime = true;
705 for (unsigned int axis = 0; axis < 6; axis++) {
706 for (unsigned int sd = 0; sd < Coeff[axis].size(); sd++) {
712 sprintf(buffer, "%9.6f", Coeff[axis][sd].GetSD());
713 SDValues += string(buffer);
721 /******************************************************************************/
723 string FGAircraft::GetGroundReactionStrings(void) {
724 string GroundReactionStrings = "";
725 bool firstime = true;
727 for (unsigned int i=0;i<lGear.size();i++) {
728 if (!firstime) GroundReactionStrings += ", ";
729 GroundReactionStrings += (lGear[i]->GetName() + "_WOW, ");
730 GroundReactionStrings += (lGear[i]->GetName() + "_compressLength, ");
731 GroundReactionStrings += (lGear[i]->GetName() + "_compressSpeed, ");
732 GroundReactionStrings += (lGear[i]->GetName() + "_Force");
737 return GroundReactionStrings;
740 /******************************************************************************/
742 string FGAircraft::GetGroundReactionValues(void) {
744 string GroundReactionValues = "";
746 bool firstime = true;
748 for (unsigned int i=0;i<lGear.size();i++) {
749 if (!firstime) GroundReactionValues += ", ";
750 GroundReactionValues += string( lGear[i]->GetWOW()?"1":"0" ) + ", ";
751 GroundReactionValues += (string(gcvt(lGear[i]->GetCompLen(), 5, buff)) + ", ");
752 GroundReactionValues += (string(gcvt(lGear[i]->GetCompVel(), 6, buff)) + ", ");
753 GroundReactionValues += (string(gcvt(lGear[i]->GetCompForce(), 10, buff)));
758 return GroundReactionValues;