1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 Purpose: Manage output of sim parameters to file or stdout
9 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
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
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
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.
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.
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30 This is the place where you create output routines to dump data for perusal
34 --------------------------------------------------------------------------------
36 11/09/07 HDW Added FlightGear Socket Interface
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43 #include "FGFDMExec.h"
44 #include "FGAtmosphere.h"
46 #include "FGAerodynamics.h"
47 #include "FGGroundReactions.h"
48 #include "FGExternalReactions.h"
49 #include "FGBuoyantForces.h"
50 #include "FGAircraft.h"
51 #include "FGMassBalance.h"
52 #include "FGPropagate.h"
53 #include "FGAuxiliary.h"
54 #include "FGInertial.h"
55 #include "FGPropulsion.h"
56 #include "models/propulsion/FGEngine.h"
57 #include "models/propulsion/FGTank.h"
58 #include "models/propulsion/FGPiston.h"
64 #if defined(WIN32) && !defined(__CYGWIN__)
67 # include <netinet/in.h> // htonl() ntohl()
70 static const int endianTest = 1;
71 #define isLittleEndian (*((char *) &endianTest ) != 0)
77 static const char *IdSrc = "$Id: FGOutput.cpp,v 1.50 2010/11/18 12:38:06 jberndt Exp $";
78 static const char *IdHdr = ID_OUTPUT;
80 // (stolen from FGFS native_fdm.cxx)
81 // The function htond is defined this way due to the way some
82 // processors and OSes treat floating point values. Some will raise
83 // an exception whenever a "bad" floating point value is loaded into a
84 // floating point register. Solaris is notorious for this, but then
85 // so is LynxOS on the PowerPC. By translating the data in place,
86 // there is no need to load a FP register with the "corruped" floating
87 // point value. By doing the BIG_ENDIAN test, I can optimize the
88 // routine for big-endian processors so it can be as efficient as
90 static void htond (double &x)
92 if ( isLittleEndian ) {
96 Double_Overlay = (int *) &x;
97 Holding_Buffer = Double_Overlay [0];
99 Double_Overlay [0] = htonl (Double_Overlay [1]);
100 Double_Overlay [1] = htonl (Holding_Buffer);
107 static void htonf (float &x)
109 if ( isLittleEndian ) {
113 Float_Overlay = (int *) &x;
114 Holding_Buffer = Float_Overlay [0];
116 Float_Overlay [0] = htonl (Holding_Buffer);
123 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
125 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
127 FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
130 sFirstPass = dFirstPass = true;
136 StartNewFile = false;
138 BaseFilename = Filename = "";
140 output_file_name = "";
142 memset(&fgSockBuf, 0x00, sizeof(fgSockBuf));
147 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
149 FGOutput::~FGOutput()
152 OutputProperties.clear();
156 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
158 bool FGOutput::InitModel(void)
160 if (!FGModel::InitModel()) return false;
162 if (Filename.size() > 0 && StartNewFile) {
164 string::size_type dot = BaseFilename.find_last_of('.');
165 if (dot != string::npos) {
166 buf << BaseFilename.substr(0, dot) << '_' << runID_postfix++ << BaseFilename.substr(dot);
168 buf << BaseFilename << '_' << runID_postfix++;
170 Filename = buf.str();
172 StartNewFile = false;
179 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
181 bool FGOutput::Run(void)
183 if (FGModel::Run()) return true;
185 if (enabled && !FDMExec->IntegrationSuspended()&& !FDMExec->Holding()) {
187 if (Type == otSocket) {
189 } else if (Type == otFlightGear) {
190 FlightGearSocketOutput();
191 } else if (Type == otCSV || Type == otTab) {
192 DelimitedOutput(Filename);
193 } else if (Type == otTerminal) {
195 } else if (Type == otNone) {
198 // Not a valid type of output
205 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207 void FGOutput::SetType(const string& type)
212 } else if (type == "TABULAR") {
215 } else if (type == "SOCKET") {
217 } else if (type == "FLIGHTGEAR") {
219 } else if (type == "TERMINAL") {
221 } else if (type != string("NONE")) {
223 cerr << "Unknown type of output specified in config file" << endl;
227 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229 void FGOutput::SetProtocol(const string& protocol)
231 if (protocol == "UDP") Protocol = FGfdmSocket::ptUDP;
232 else if (protocol == "TCP") Protocol = FGfdmSocket::ptTCP;
233 else Protocol = FGfdmSocket::ptTCP; // Default to TCP
236 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238 void FGOutput::DelimitedOutput(const string& fname)
240 const FGAerodynamics* Aerodynamics = FDMExec->GetAerodynamics();
241 const FGAuxiliary* Auxiliary = FDMExec->GetAuxiliary();
242 const FGAircraft* Aircraft = FDMExec->GetAircraft();
243 const FGAtmosphere* Atmosphere = FDMExec->GetAtmosphere();
244 const FGPropulsion* Propulsion = FDMExec->GetPropulsion();
245 const FGMassBalance* MassBalance = FDMExec->GetMassBalance();
246 const FGPropagate* Propagate = FDMExec->GetPropagate();
247 const FGFCS* FCS = FDMExec->GetFCS();
248 const FGInertial* Inertial = FDMExec->GetInertial();
249 const FGGroundReactions* GroundReactions = FDMExec->GetGroundReactions();
250 const FGExternalReactions* ExternalReactions = FDMExec->GetExternalReactions();
251 const FGBuoyantForces* BuoyantForces = FDMExec->GetBuoyantForces();
256 if (fname == "COUT" || fname == "cout") {
257 buffer = cout.rdbuf();
259 if (!datafile.is_open()) datafile.open(fname.c_str());
260 buffer = datafile.rdbuf();
263 ostream outstream(buffer);
265 outstream.precision(10);
269 if (SubSystems & ssSimulation) {
272 if (SubSystems & ssAerosurfaces) {
273 outstream << delimeter;
274 outstream << "Aileron Command (norm)" + delimeter;
275 outstream << "Elevator Command (norm)" + delimeter;
276 outstream << "Rudder Command (norm)" + delimeter;
277 outstream << "Flap Command (norm)" + delimeter;
278 outstream << "Left Aileron Position (deg)" + delimeter;
279 outstream << "Right Aileron Position (deg)" + delimeter;
280 outstream << "Elevator Position (deg)" + delimeter;
281 outstream << "Rudder Position (deg)" + delimeter;
282 outstream << "Flap Position (deg)";
284 if (SubSystems & ssRates) {
285 outstream << delimeter;
286 outstream << "P (deg/s)" + delimeter + "Q (deg/s)" + delimeter + "R (deg/s)" + delimeter;
287 outstream << "P dot (deg/s^2)" + delimeter + "Q dot (deg/s^2)" + delimeter + "R dot (deg/s^2)" + delimeter;
288 outstream << "P_{inertial} (deg/s)" + delimeter + "Q_{inertial} (deg/s)" + delimeter + "R_{inertial} (deg/s)";
290 if (SubSystems & ssVelocities) {
291 outstream << delimeter;
292 outstream << "q bar (psf)" + delimeter;
293 outstream << "Reynolds Number" + delimeter;
294 outstream << "V_{Total} (ft/s)" + delimeter;
295 outstream << "V_{Inertial} (ft/s)" + delimeter;
296 outstream << "UBody" + delimeter + "VBody" + delimeter + "WBody" + delimeter;
297 outstream << "Aero V_{X Body} (ft/s)" + delimeter + "Aero V_{Y Body} (ft/s)" + delimeter + "Aero V_{Z Body} (ft/s)" + delimeter;
298 outstream << "V_{X_{inertial}} (ft/s)" + delimeter + "V_{Y_{inertial}} (ft/s)" + delimeter + "V_{Z_{inertial}} (ft/s)" + delimeter;
299 outstream << "V_{North} (ft/s)" + delimeter + "V_{East} (ft/s)" + delimeter + "V_{Down} (ft/s)";
301 if (SubSystems & ssForces) {
302 outstream << delimeter;
303 outstream << "F_{Drag} (lbs)" + delimeter + "F_{Side} (lbs)" + delimeter + "F_{Lift} (lbs)" + delimeter;
304 outstream << "L/D" + delimeter;
305 outstream << "F_{Aero x} (lbs)" + delimeter + "F_{Aero y} (lbs)" + delimeter + "F_{Aero z} (lbs)" + delimeter;
306 outstream << "F_{Prop x} (lbs)" + delimeter + "F_{Prop y} (lbs)" + delimeter + "F_{Prop z} (lbs)" + delimeter;
307 outstream << "F_{Gear x} (lbs)" + delimeter + "F_{Gear y} (lbs)" + delimeter + "F_{Gear z} (lbs)" + delimeter;
308 outstream << "F_{Ext x} (lbs)" + delimeter + "F_{Ext y} (lbs)" + delimeter + "F_{Ext z} (lbs)" + delimeter;
309 outstream << "F_{Buoyant x} (lbs)" + delimeter + "F_{Buoyant y} (lbs)" + delimeter + "F_{Buoyant z} (lbs)" + delimeter;
310 outstream << "F_{Total x} (lbs)" + delimeter + "F_{Total y} (lbs)" + delimeter + "F_{Total z} (lbs)";
312 if (SubSystems & ssMoments) {
313 outstream << delimeter;
314 outstream << "L_{Aero} (ft-lbs)" + delimeter + "M_{Aero} ( ft-lbs)" + delimeter + "N_{Aero} (ft-lbs)" + delimeter;
315 outstream << "L_{Prop} (ft-lbs)" + delimeter + "M_{Prop} (ft-lbs)" + delimeter + "N_{Prop} (ft-lbs)" + delimeter;
316 outstream << "L_{Gear} (ft-lbs)" + delimeter + "M_{Gear} (ft-lbs)" + delimeter + "N_{Gear} (ft-lbs)" + delimeter;
317 outstream << "L_{ext} (ft-lbs)" + delimeter + "M_{ext} (ft-lbs)" + delimeter + "N_{ext} (ft-lbs)" + delimeter;
318 outstream << "L_{Buoyant} (ft-lbs)" + delimeter + "M_{Buoyant} (ft-lbs)" + delimeter + "N_{Buoyant} (ft-lbs)" + delimeter;
319 outstream << "L_{Total} (ft-lbs)" + delimeter + "M_{Total} (ft-lbs)" + delimeter + "N_{Total} (ft-lbs)";
321 if (SubSystems & ssAtmosphere) {
322 outstream << delimeter;
323 outstream << "Rho (slugs/ft^3)" + delimeter;
324 outstream << "Absolute Viscosity" + delimeter;
325 outstream << "Kinematic Viscosity" + delimeter;
326 outstream << "Temperature (R)" + delimeter;
327 outstream << "P_{SL} (psf)" + delimeter;
328 outstream << "P_{Ambient} (psf)" + delimeter;
329 outstream << "Turbulence Magnitude (ft/sec)" + delimeter;
330 outstream << "Turbulence X Direction (rad)" + delimeter + "Turbulence Y Direction (rad)" + delimeter + "Turbulence Z Direction (rad)" + delimeter;
331 outstream << "Wind V_{North} (ft/s)" + delimeter + "Wind V_{East} (ft/s)" + delimeter + "Wind V_{Down} (ft/s)";
333 if (SubSystems & ssMassProps) {
334 outstream << delimeter;
335 outstream << "I_{xx}" + delimeter;
336 outstream << "I_{xy}" + delimeter;
337 outstream << "I_{xz}" + delimeter;
338 outstream << "I_{yx}" + delimeter;
339 outstream << "I_{yy}" + delimeter;
340 outstream << "I_{yz}" + delimeter;
341 outstream << "I_{zx}" + delimeter;
342 outstream << "I_{zy}" + delimeter;
343 outstream << "I_{zz}" + delimeter;
344 outstream << "Mass" + delimeter;
345 outstream << "X_{cg}" + delimeter + "Y_{cg}" + delimeter + "Z_{cg}";
347 if (SubSystems & ssPropagate) {
348 outstream << delimeter;
349 outstream << "Altitude ASL (ft)" + delimeter;
350 outstream << "Altitude AGL (ft)" + delimeter;
351 outstream << "Phi (deg)" + delimeter + "Theta (deg)" + delimeter + "Psi (deg)" + delimeter;
352 outstream << "Alpha (deg)" + delimeter;
353 outstream << "Beta (deg)" + delimeter;
354 outstream << "Latitude (deg)" + delimeter;
355 outstream << "Longitude (deg)" + delimeter;
356 outstream << "X_{ECI} (ft)" + delimeter + "Y_{ECI} (ft)" + delimeter + "Z_{ECI} (ft)" + delimeter;
357 outstream << "X_{ECEF} (ft)" + delimeter + "Y_{ECEF} (ft)" + delimeter + "Z_{ECEF} (ft)" + delimeter;
358 outstream << "Earth Position Angle (deg)" + delimeter;
359 outstream << "Distance AGL (ft)" + delimeter;
360 outstream << "Terrain Elevation (ft)";
362 if (SubSystems & ssCoefficients) {
363 scratch = Aerodynamics->GetCoefficientStrings(delimeter);
364 if (scratch.length() != 0) outstream << delimeter << scratch;
366 if (SubSystems & ssFCS) {
367 scratch = FCS->GetComponentStrings(delimeter);
368 if (scratch.length() != 0) outstream << delimeter << scratch;
370 if (SubSystems & ssGroundReactions) {
371 outstream << delimeter;
372 outstream << GroundReactions->GetGroundReactionStrings(delimeter);
374 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
375 outstream << delimeter;
376 outstream << Propulsion->GetPropulsionStrings(delimeter);
378 if (OutputProperties.size() > 0) {
379 for (unsigned int i=0;i<OutputProperties.size();i++) {
380 outstream << delimeter << OutputProperties[i]->GetPrintableName();
388 outstream << FDMExec->GetSimTime();
389 if (SubSystems & ssSimulation) {
391 if (SubSystems & ssAerosurfaces) {
392 outstream << delimeter;
393 outstream << FCS->GetDaCmd() << delimeter;
394 outstream << FCS->GetDeCmd() << delimeter;
395 outstream << FCS->GetDrCmd() << delimeter;
396 outstream << FCS->GetDfCmd() << delimeter;
397 outstream << FCS->GetDaLPos(ofDeg) << delimeter;
398 outstream << FCS->GetDaRPos(ofDeg) << delimeter;
399 outstream << FCS->GetDePos(ofDeg) << delimeter;
400 outstream << FCS->GetDrPos(ofDeg) << delimeter;
401 outstream << FCS->GetDfPos(ofDeg);
403 if (SubSystems & ssRates) {
404 outstream << delimeter;
405 outstream << (radtodeg*Propagate->GetPQR()).Dump(delimeter) << delimeter;
406 outstream << (radtodeg*Propagate->GetPQRdot()).Dump(delimeter) << delimeter;
407 outstream << (radtodeg*Propagate->GetPQRi()).Dump(delimeter);
409 if (SubSystems & ssVelocities) {
410 outstream << delimeter;
411 outstream << Auxiliary->Getqbar() << delimeter;
412 outstream << Auxiliary->GetReynoldsNumber() << delimeter;
413 outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
414 outstream << Propagate->GetInertialVelocityMagnitude() << delimeter;
415 outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
416 outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
417 outstream << Propagate->GetInertialVelocity().Dump(delimeter) << delimeter;
418 outstream << Propagate->GetVel().Dump(delimeter);
419 outstream.precision(10);
421 if (SubSystems & ssForces) {
422 outstream << delimeter;
423 outstream << Aerodynamics->GetvFw().Dump(delimeter) << delimeter;
424 outstream << Aerodynamics->GetLoD() << delimeter;
425 outstream << Aerodynamics->GetForces().Dump(delimeter) << delimeter;
426 outstream << Propulsion->GetForces().Dump(delimeter) << delimeter;
427 outstream << GroundReactions->GetForces().Dump(delimeter) << delimeter;
428 outstream << ExternalReactions->GetForces().Dump(delimeter) << delimeter;
429 outstream << BuoyantForces->GetForces().Dump(delimeter) << delimeter;
430 outstream << Aircraft->GetForces().Dump(delimeter);
432 if (SubSystems & ssMoments) {
433 outstream << delimeter;
434 outstream << Aerodynamics->GetMoments().Dump(delimeter) << delimeter;
435 outstream << Propulsion->GetMoments().Dump(delimeter) << delimeter;
436 outstream << GroundReactions->GetMoments().Dump(delimeter) << delimeter;
437 outstream << ExternalReactions->GetMoments().Dump(delimeter) << delimeter;
438 outstream << BuoyantForces->GetMoments().Dump(delimeter) << delimeter;
439 outstream << Aircraft->GetMoments().Dump(delimeter);
441 if (SubSystems & ssAtmosphere) {
442 outstream << delimeter;
443 outstream << Atmosphere->GetDensity() << delimeter;
444 outstream << Atmosphere->GetAbsoluteViscosity() << delimeter;
445 outstream << Atmosphere->GetKinematicViscosity() << delimeter;
446 outstream << Atmosphere->GetTemperature() << delimeter;
447 outstream << Atmosphere->GetPressureSL() << delimeter;
448 outstream << Atmosphere->GetPressure() << delimeter;
449 outstream << Atmosphere->GetTurbMagnitude() << delimeter;
450 outstream << Atmosphere->GetTurbDirection().Dump(delimeter) << delimeter;
451 outstream << Atmosphere->GetTotalWindNED().Dump(delimeter);
453 if (SubSystems & ssMassProps) {
454 outstream << delimeter;
455 outstream << MassBalance->GetJ().Dump(delimeter) << delimeter;
456 outstream << MassBalance->GetMass() << delimeter;
457 outstream << MassBalance->GetXYZcg().Dump(delimeter);
459 if (SubSystems & ssPropagate) {
460 outstream.precision(14);
461 outstream << delimeter;
462 outstream << Propagate->GetAltitudeASL() << delimeter;
463 outstream << Propagate->GetDistanceAGL() << delimeter;
464 outstream << (radtodeg*Propagate->GetEuler()).Dump(delimeter) << delimeter;
465 outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
466 outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
467 outstream << Propagate->GetLocation().GetLatitudeDeg() << delimeter;
468 outstream << Propagate->GetLocation().GetLongitudeDeg() << delimeter;
469 outstream.precision(18);
470 outstream << ((FGColumnVector3)Propagate->GetInertialPosition()).Dump(delimeter) << delimeter;
471 outstream << ((FGColumnVector3)Propagate->GetLocation()).Dump(delimeter) << delimeter;
472 outstream.precision(14);
473 outstream << Inertial->GetEarthPositionAngleDeg() << delimeter;
474 outstream << Propagate->GetDistanceAGL() << delimeter;
475 outstream << Propagate->GetTerrainElevation();
476 outstream.precision(10);
478 if (SubSystems & ssCoefficients) {
479 scratch = Aerodynamics->GetCoefficientValues(delimeter);
480 if (scratch.length() != 0) outstream << delimeter << scratch;
482 if (SubSystems & ssFCS) {
483 scratch = FCS->GetComponentValues(delimeter);
484 if (scratch.length() != 0) outstream << delimeter << scratch;
486 if (SubSystems & ssGroundReactions) {
487 outstream << delimeter;
488 outstream << GroundReactions->GetGroundReactionValues(delimeter);
490 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
491 outstream << delimeter;
492 outstream << Propulsion->GetPropulsionValues(delimeter);
495 outstream.precision(18);
496 for (unsigned int i=0;i<OutputProperties.size();i++) {
497 outstream << delimeter << OutputProperties[i]->getDoubleValue();
499 outstream.precision(10);
505 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
507 void FGOutput::SocketDataFill(FGNetFDM* net)
509 const FGAerodynamics* Aerodynamics = FDMExec->GetAerodynamics();
510 const FGAuxiliary* Auxiliary = FDMExec->GetAuxiliary();
511 const FGPropulsion* Propulsion = FDMExec->GetPropulsion();
512 const FGMassBalance* MassBalance = FDMExec->GetMassBalance();
513 const FGPropagate* Propagate = FDMExec->GetPropagate();
514 const FGFCS* FCS = FDMExec->GetFCS();
515 const FGGroundReactions* GroundReactions = FDMExec->GetGroundReactions();
519 net->version = FG_NET_FDM_VERSION;
522 net->longitude = Propagate->GetLocation().GetLongitude(); // geodetic (radians)
523 net->latitude = Propagate->GetLocation().GetLatitude(); // geodetic (radians)
524 net->altitude = Propagate->GetAltitudeASL()*0.3048; // altitude, above sea level (meters)
525 net->agl = (float)(Propagate->GetDistanceAGL()*0.3048); // altitude, above ground level (meters)
527 net->phi = (float)(Propagate->GetEuler(ePhi)); // roll (radians)
528 net->theta = (float)(Propagate->GetEuler(eTht)); // pitch (radians)
529 net->psi = (float)(Propagate->GetEuler(ePsi)); // yaw or true heading (radians)
531 net->alpha = (float)(Auxiliary->Getalpha()); // angle of attack (radians)
532 net->beta = (float)(Auxiliary->Getbeta()); // side slip angle (radians)
535 net->phidot = (float)(Auxiliary->GetEulerRates(ePhi)); // roll rate (radians/sec)
536 net->thetadot = (float)(Auxiliary->GetEulerRates(eTht)); // pitch rate (radians/sec)
537 net->psidot = (float)(Auxiliary->GetEulerRates(ePsi)); // yaw rate (radians/sec)
538 net->vcas = (float)(Auxiliary->GetVcalibratedFPS()); // VCAS, ft/sec
539 net->climb_rate = (float)(Propagate->Gethdot()); // altitude rate, ft/sec
540 net->v_north = (float)(Propagate->GetVel(eNorth)); // north vel in NED frame, fps
541 net->v_east = (float)(Propagate->GetVel(eEast)); // east vel in NED frame, fps
542 net->v_down = (float)(Propagate->GetVel(eDown)); // down vel in NED frame, fps
543 //---ADD METHOD TO CALCULATE THESE TERMS---
544 net->v_wind_body_north = (float)(Propagate->GetVel(eNorth)); // north vel in NED relative to airmass, fps
545 net->v_wind_body_east = (float)(Propagate->GetVel(eEast)); // east vel in NED relative to airmass, fps
546 net->v_wind_body_down = (float)(Propagate->GetVel(eDown)); // down vel in NED relative to airmass, fps
549 net->A_X_pilot = (float)(Auxiliary->GetPilotAccel(1)); // X body accel, ft/s/s
550 net->A_Y_pilot = (float)(Auxiliary->GetPilotAccel(2)); // Y body accel, ft/s/s
551 net->A_Z_pilot = (float)(Auxiliary->GetPilotAccel(3)); // Z body accel, ft/s/s
554 net->stall_warning = 0.0; // 0.0 - 1.0 indicating the amount of stall
555 net->slip_deg = (float)(Auxiliary->Getbeta(inDegrees)); // slip ball deflection, deg
558 net->num_engines = Propulsion->GetNumEngines(); // Number of valid engines
560 for (i=0; i<net->num_engines; i++) {
561 if (Propulsion->GetEngine(i)->GetRunning())
562 net->eng_state[i] = 2; // Engine state running
563 else if (Propulsion->GetEngine(i)->GetCranking())
564 net->eng_state[i] = 1; // Engine state cranking
566 net->eng_state[i] = 0; // Engine state off
568 switch (Propulsion->GetEngine(i)->GetType()) {
569 case (FGEngine::etRocket):
571 case (FGEngine::etPiston):
572 net->rpm[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getRPM());
573 net->fuel_flow[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getFuelFlow_gph());
574 net->fuel_px[i] = 0; // Fuel pressure, psi (N/A in current model)
575 net->egt[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->GetEGT());
576 net->cht[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getCylinderHeadTemp_degF());
577 net->mp_osi[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getManifoldPressure_inHg());
578 net->oil_temp[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getOilTemp_degF());
579 net->oil_px[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getOilPressure_psi());
580 net->tit[i] = 0; // Turbine Inlet Temperature (N/A for piston)
582 case (FGEngine::etTurbine):
584 case (FGEngine::etTurboprop):
586 case (FGEngine::etElectric):
588 case (FGEngine::etUnknown):
594 net->num_tanks = Propulsion->GetNumTanks(); // Max number of fuel tanks
596 for (i=0; i<net->num_tanks; i++) {
597 net->fuel_quantity[i] = (float)(((FGTank *)Propulsion->GetTank(i))->GetContents());
601 net->num_wheels = GroundReactions->GetNumGearUnits();
603 for (i=0; i<net->num_wheels; i++) {
604 net->wow[i] = GroundReactions->GetGearUnit(i)->GetWOW();
605 if (GroundReactions->GetGearUnit(i)->GetGearUnitDown())
606 net->gear_pos[i] = 1; //gear down, using FCS convention
608 net->gear_pos[i] = 0; //gear up, using FCS convention
609 net->gear_steer[i] = (float)(GroundReactions->GetGearUnit(i)->GetSteerNorm());
610 net->gear_compression[i] = (float)(GroundReactions->GetGearUnit(i)->GetCompLen());
614 net->cur_time = (long int)1234567890; // Friday, Feb 13, 2009, 23:31:30 UTC (not processed by FGFS anyway)
615 net->warp = 0; // offset in seconds to unix time
616 net->visibility = 25000.0; // visibility in meters (for env. effects)
618 // Control surface positions (normalized values)
619 net->elevator = (float)(FCS->GetDePos(ofNorm)); // Norm Elevator Pos, --
620 net->elevator_trim_tab = (float)(FCS->GetPitchTrimCmd()); // Norm Elev Trim Tab Pos, --
621 net->left_flap = (float)(FCS->GetDfPos(ofNorm)); // Norm Flap Pos, --
622 net->right_flap = (float)(FCS->GetDfPos(ofNorm)); // Norm Flap Pos, --
623 net->left_aileron = (float)(FCS->GetDaLPos(ofNorm)); // Norm L Aileron Pos, --
624 net->right_aileron = (float)(FCS->GetDaRPos(ofNorm)); // Norm R Aileron Pos, --
625 net->rudder = (float)(FCS->GetDrPos(ofNorm)); // Norm Rudder Pos, --
626 net->nose_wheel = (float)(FCS->GetDrPos(ofNorm)); // *** FIX *** Using Rudder Pos for NWS, --
627 net->speedbrake = (float)(FCS->GetDsbPos(ofNorm)); // Norm Speedbrake Pos, --
628 net->spoilers = (float)(FCS->GetDspPos(ofNorm)); // Norm Spoiler Pos, --
630 // Convert the net buffer to network format
631 if ( isLittleEndian ) {
632 net->version = htonl(net->version);
634 htond(net->longitude);
635 htond(net->latitude);
636 htond(net->altitude);
645 htonf(net->thetadot);
648 htonf(net->climb_rate);
652 htonf(net->v_wind_body_north);
653 htonf(net->v_wind_body_east);
654 htonf(net->v_wind_body_down);
656 htonf(net->A_X_pilot);
657 htonf(net->A_Y_pilot);
658 htonf(net->A_Z_pilot);
660 htonf(net->stall_warning);
661 htonf(net->slip_deg);
663 for (i=0; i<net->num_engines; ++i ) {
664 net->eng_state[i] = htonl(net->eng_state[i]);
666 htonf(net->fuel_flow[i]);
667 htonf(net->fuel_px[i]);
670 htonf(net->mp_osi[i]);
672 htonf(net->oil_temp[i]);
673 htonf(net->oil_px[i]);
675 net->num_engines = htonl(net->num_engines);
677 for (i=0; i<net->num_tanks; ++i ) {
678 htonf(net->fuel_quantity[i]);
680 net->num_tanks = htonl(net->num_tanks);
682 for (i=0; i<net->num_wheels; ++i ) {
683 net->wow[i] = htonl(net->wow[i]);
684 htonf(net->gear_pos[i]);
685 htonf(net->gear_steer[i]);
686 htonf(net->gear_compression[i]);
688 net->num_wheels = htonl(net->num_wheels);
690 net->cur_time = htonl( net->cur_time );
691 net->warp = htonl( net->warp );
692 htonf(net->visibility);
694 htonf(net->elevator);
695 htonf(net->elevator_trim_tab);
696 htonf(net->left_flap);
697 htonf(net->right_flap);
698 htonf(net->left_aileron);
699 htonf(net->right_aileron);
701 htonf(net->nose_wheel);
702 htonf(net->speedbrake);
703 htonf(net->spoilers);
707 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
709 void FGOutput::FlightGearSocketOutput(void)
711 int length = sizeof(fgSockBuf);
713 if (socket == NULL) return;
714 if (!socket->GetConnectStatus()) return;
716 SocketDataFill(&fgSockBuf);
717 socket->Send((char *)&fgSockBuf, length);
720 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
722 void FGOutput::SocketOutput(void)
724 const FGAerodynamics* Aerodynamics = FDMExec->GetAerodynamics();
725 const FGAuxiliary* Auxiliary = FDMExec->GetAuxiliary();
726 const FGPropulsion* Propulsion = FDMExec->GetPropulsion();
727 const FGMassBalance* MassBalance = FDMExec->GetMassBalance();
728 const FGPropagate* Propagate = FDMExec->GetPropagate();
729 const FGFCS* FCS = FDMExec->GetFCS();
730 const FGAtmosphere* Atmosphere = FDMExec->GetAtmosphere();
731 const FGAircraft* Aircraft = FDMExec->GetAircraft();
732 const FGGroundReactions* GroundReactions = FDMExec->GetGroundReactions();
734 string asciiData, scratch;
736 if (socket == NULL) return;
737 if (!socket->GetConnectStatus()) return;
741 socket->Clear("<LABELS>");
742 socket->Append("Time");
744 if (SubSystems & ssAerosurfaces) {
745 socket->Append("Aileron Command");
746 socket->Append("Elevator Command");
747 socket->Append("Rudder Command");
748 socket->Append("Flap Command");
749 socket->Append("Left Aileron Position");
750 socket->Append("Right Aileron Position");
751 socket->Append("Elevator Position");
752 socket->Append("Rudder Position");
753 socket->Append("Flap Position");
756 if (SubSystems & ssRates) {
760 socket->Append("PDot");
761 socket->Append("QDot");
762 socket->Append("RDot");
765 if (SubSystems & ssVelocities) {
766 socket->Append("QBar");
767 socket->Append("Vtotal");
768 socket->Append("UBody");
769 socket->Append("VBody");
770 socket->Append("WBody");
771 socket->Append("UAero");
772 socket->Append("VAero");
773 socket->Append("WAero");
774 socket->Append("Vn");
775 socket->Append("Ve");
776 socket->Append("Vd");
778 if (SubSystems & ssForces) {
779 socket->Append("F_Drag");
780 socket->Append("F_Side");
781 socket->Append("F_Lift");
782 socket->Append("LoD");
783 socket->Append("Fx");
784 socket->Append("Fy");
785 socket->Append("Fz");
787 if (SubSystems & ssMoments) {
792 if (SubSystems & ssAtmosphere) {
793 socket->Append("Rho");
794 socket->Append("SL pressure");
795 socket->Append("Ambient pressure");
796 socket->Append("Turbulence Magnitude");
797 socket->Append("Turbulence Direction X");
798 socket->Append("Turbulence Direction Y");
799 socket->Append("Turbulence Direction Z");
800 socket->Append("NWind");
801 socket->Append("EWind");
802 socket->Append("DWind");
804 if (SubSystems & ssMassProps) {
805 socket->Append("Ixx");
806 socket->Append("Ixy");
807 socket->Append("Ixz");
808 socket->Append("Iyx");
809 socket->Append("Iyy");
810 socket->Append("Iyz");
811 socket->Append("Izx");
812 socket->Append("Izy");
813 socket->Append("Izz");
814 socket->Append("Mass");
815 socket->Append("Xcg");
816 socket->Append("Ycg");
817 socket->Append("Zcg");
819 if (SubSystems & ssPropagate) {
820 socket->Append("Altitude");
821 socket->Append("Phi (deg)");
822 socket->Append("Tht (deg)");
823 socket->Append("Psi (deg)");
824 socket->Append("Alpha (deg)");
825 socket->Append("Beta (deg)");
826 socket->Append("Latitude (deg)");
827 socket->Append("Longitude (deg)");
829 if (SubSystems & ssCoefficients) {
830 scratch = Aerodynamics->GetCoefficientStrings(",");
831 if (scratch.length() != 0) socket->Append(scratch);
833 if (SubSystems & ssFCS) {
834 scratch = FCS->GetComponentStrings(",");
835 if (scratch.length() != 0) socket->Append(scratch);
837 if (SubSystems & ssGroundReactions) {
838 socket->Append(GroundReactions->GetGroundReactionStrings(","));
840 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
841 socket->Append(Propulsion->GetPropulsionStrings(","));
843 if (OutputProperties.size() > 0) {
844 for (unsigned int i=0;i<OutputProperties.size();i++) {
845 socket->Append(OutputProperties[i]->GetPrintableName());
854 socket->Append(FDMExec->GetSimTime());
856 if (SubSystems & ssAerosurfaces) {
857 socket->Append(FCS->GetDaCmd());
858 socket->Append(FCS->GetDeCmd());
859 socket->Append(FCS->GetDrCmd());
860 socket->Append(FCS->GetDfCmd());
861 socket->Append(FCS->GetDaLPos());
862 socket->Append(FCS->GetDaRPos());
863 socket->Append(FCS->GetDePos());
864 socket->Append(FCS->GetDrPos());
865 socket->Append(FCS->GetDfPos());
867 if (SubSystems & ssRates) {
868 socket->Append(radtodeg*Propagate->GetPQR(eP));
869 socket->Append(radtodeg*Propagate->GetPQR(eQ));
870 socket->Append(radtodeg*Propagate->GetPQR(eR));
871 socket->Append(radtodeg*Propagate->GetPQRdot(eP));
872 socket->Append(radtodeg*Propagate->GetPQRdot(eQ));
873 socket->Append(radtodeg*Propagate->GetPQRdot(eR));
875 if (SubSystems & ssVelocities) {
876 socket->Append(Auxiliary->Getqbar());
877 socket->Append(Auxiliary->GetVt());
878 socket->Append(Propagate->GetUVW(eU));
879 socket->Append(Propagate->GetUVW(eV));
880 socket->Append(Propagate->GetUVW(eW));
881 socket->Append(Auxiliary->GetAeroUVW(eU));
882 socket->Append(Auxiliary->GetAeroUVW(eV));
883 socket->Append(Auxiliary->GetAeroUVW(eW));
884 socket->Append(Propagate->GetVel(eNorth));
885 socket->Append(Propagate->GetVel(eEast));
886 socket->Append(Propagate->GetVel(eDown));
888 if (SubSystems & ssForces) {
889 socket->Append(Aerodynamics->GetvFw()(eDrag));
890 socket->Append(Aerodynamics->GetvFw()(eSide));
891 socket->Append(Aerodynamics->GetvFw()(eLift));
892 socket->Append(Aerodynamics->GetLoD());
893 socket->Append(Aircraft->GetForces(eX));
894 socket->Append(Aircraft->GetForces(eY));
895 socket->Append(Aircraft->GetForces(eZ));
897 if (SubSystems & ssMoments) {
898 socket->Append(Aircraft->GetMoments(eL));
899 socket->Append(Aircraft->GetMoments(eM));
900 socket->Append(Aircraft->GetMoments(eN));
902 if (SubSystems & ssAtmosphere) {
903 socket->Append(Atmosphere->GetDensity());
904 socket->Append(Atmosphere->GetPressureSL());
905 socket->Append(Atmosphere->GetPressure());
906 socket->Append(Atmosphere->GetTurbMagnitude());
907 socket->Append(Atmosphere->GetTurbDirection().Dump(","));
908 socket->Append(Atmosphere->GetTotalWindNED().Dump(","));
910 if (SubSystems & ssMassProps) {
911 socket->Append(MassBalance->GetJ()(1,1));
912 socket->Append(MassBalance->GetJ()(1,2));
913 socket->Append(MassBalance->GetJ()(1,3));
914 socket->Append(MassBalance->GetJ()(2,1));
915 socket->Append(MassBalance->GetJ()(2,2));
916 socket->Append(MassBalance->GetJ()(2,3));
917 socket->Append(MassBalance->GetJ()(3,1));
918 socket->Append(MassBalance->GetJ()(3,2));
919 socket->Append(MassBalance->GetJ()(3,3));
920 socket->Append(MassBalance->GetMass());
921 socket->Append(MassBalance->GetXYZcg()(eX));
922 socket->Append(MassBalance->GetXYZcg()(eY));
923 socket->Append(MassBalance->GetXYZcg()(eZ));
925 if (SubSystems & ssPropagate) {
926 socket->Append(Propagate->GetAltitudeASL());
927 socket->Append(radtodeg*Propagate->GetEuler(ePhi));
928 socket->Append(radtodeg*Propagate->GetEuler(eTht));
929 socket->Append(radtodeg*Propagate->GetEuler(ePsi));
930 socket->Append(Auxiliary->Getalpha(inDegrees));
931 socket->Append(Auxiliary->Getbeta(inDegrees));
932 socket->Append(Propagate->GetLocation().GetLatitudeDeg());
933 socket->Append(Propagate->GetLocation().GetLongitudeDeg());
935 if (SubSystems & ssCoefficients) {
936 scratch = Aerodynamics->GetCoefficientValues(",");
937 if (scratch.length() != 0) socket->Append(scratch);
939 if (SubSystems & ssFCS) {
940 scratch = FCS->GetComponentValues(",");
941 if (scratch.length() != 0) socket->Append(scratch);
943 if (SubSystems & ssGroundReactions) {
944 socket->Append(GroundReactions->GetGroundReactionValues(","));
946 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
947 socket->Append(Propulsion->GetPropulsionValues(","));
950 for (unsigned int i=0;i<OutputProperties.size();i++) {
951 socket->Append(OutputProperties[i]->getDoubleValue());
957 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
959 void FGOutput::SocketStatusOutput(const string& out_str)
963 if (socket == NULL) return;
966 asciiData = string("<STATUS>") + out_str;
967 socket->Append(asciiData.c_str());
971 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
973 bool FGOutput::Load(Element* element)
979 Element *property_element;
981 string separator = "/";
983 if (!DirectivesFile.empty()) { // A directives filename from the command line overrides
984 output_file_name = DirectivesFile; // one found in the config file.
985 document = LoadXMLDocument(output_file_name);
986 } else if (!element->GetAttributeValue("file").empty()) {
987 output_file_name = FDMExec->GetRootDir() + element->GetAttributeValue("file");
988 document = LoadXMLDocument(output_file_name);
993 if (!document) return false;
995 name = FDMExec->GetRootDir() + document->GetAttributeValue("name");
996 SetType(document->GetAttributeValue("type"));
997 Port = document->GetAttributeValue("port");
998 if (!Port.empty() && (Type == otSocket || Type == otFlightGear)) {
999 port = atoi(Port.c_str());
1000 SetProtocol(document->GetAttributeValue("protocol"));
1001 socket = new FGfdmSocket(name, port, Protocol);
1003 BaseFilename = Filename = name;
1005 if (!document->GetAttributeValue("rate").empty()) {
1006 OutRate = (int)document->GetAttributeValueAsNumber("rate");
1011 if (document->FindElementValue("simulation") == string("ON"))
1012 SubSystems += ssSimulation;
1013 if (document->FindElementValue("aerosurfaces") == string("ON"))
1014 SubSystems += ssAerosurfaces;
1015 if (document->FindElementValue("rates") == string("ON"))
1016 SubSystems += ssRates;
1017 if (document->FindElementValue("velocities") == string("ON"))
1018 SubSystems += ssVelocities;
1019 if (document->FindElementValue("forces") == string("ON"))
1020 SubSystems += ssForces;
1021 if (document->FindElementValue("moments") == string("ON"))
1022 SubSystems += ssMoments;
1023 if (document->FindElementValue("atmosphere") == string("ON"))
1024 SubSystems += ssAtmosphere;
1025 if (document->FindElementValue("massprops") == string("ON"))
1026 SubSystems += ssMassProps;
1027 if (document->FindElementValue("position") == string("ON"))
1028 SubSystems += ssPropagate;
1029 if (document->FindElementValue("coefficients") == string("ON"))
1030 SubSystems += ssCoefficients;
1031 if (document->FindElementValue("ground_reactions") == string("ON"))
1032 SubSystems += ssGroundReactions;
1033 if (document->FindElementValue("fcs") == string("ON"))
1034 SubSystems += ssFCS;
1035 if (document->FindElementValue("propulsion") == string("ON"))
1036 SubSystems += ssPropulsion;
1037 property_element = document->FindElement("property");
1038 while (property_element) {
1039 string property_str = property_element->GetDataLine();
1040 FGPropertyManager* node = PropertyManager->GetNode(property_str);
1042 cerr << fgred << highint << endl << " No property by the name "
1043 << property_str << " has been defined. This property will " << endl
1044 << " not be logged. You should check your configuration file."
1047 OutputProperties.push_back(node);
1049 property_element = document->FindNextElement("property");
1059 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1061 void FGOutput::SetRate(int rtHz)
1063 rtHz = rtHz>1000?1000:(rtHz<0?0:rtHz);
1065 rate = (int)(0.5 + 1.0/(FDMExec->GetDeltaT()*rtHz));
1073 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1074 // The bitmasked value choices are as follows:
1075 // unset: In this case (the default) JSBSim would only print
1076 // out the normally expected messages, essentially echoing
1077 // the config files as they are read. If the environment
1078 // variable is not set, debug_lvl is set to 1 internally
1079 // 0: This requests JSBSim not to output any messages
1081 // 1: This value explicity requests the normal JSBSim
1083 // 2: This value asks for a message to be printed out when
1084 // a class is instantiated
1085 // 4: When this value is set, a message is displayed when a
1086 // FGModel object executes its Run() method
1087 // 8: When this value is set, various runtime state variables
1088 // are printed out periodically
1089 // 16: When set various parameters are sanity checked and
1090 // a message is printed out when they go out of bounds
1092 void FGOutput::Debug(int from)
1096 if (debug_lvl <= 0) return;
1098 if (debug_lvl & 1) { // Standard console startup message output
1099 if (from == 0) { // Constructor
1103 if (output_file_name.empty())
1104 cout << " " << "Output parameters read inline" << endl;
1106 cout << " Output parameters read from file: " << output_file_name << endl;
1108 if (Filename == "cout" || Filename == "COUT") {
1109 scratch = " Log output goes to screen console";
1110 } else if (!Filename.empty()) {
1111 scratch = " Log output goes to file: " + Filename;
1115 cout << scratch << " in CSV format output at rate " << 1/(FDMExec->GetDeltaT()*rate) << " Hz" << endl;
1119 cout << " No log output" << endl;
1123 if (SubSystems & ssSimulation) cout << " Simulation parameters logged" << endl;
1124 if (SubSystems & ssAerosurfaces) cout << " Aerosurface parameters logged" << endl;
1125 if (SubSystems & ssRates) cout << " Rate parameters logged" << endl;
1126 if (SubSystems & ssVelocities) cout << " Velocity parameters logged" << endl;
1127 if (SubSystems & ssForces) cout << " Force parameters logged" << endl;
1128 if (SubSystems & ssMoments) cout << " Moments parameters logged" << endl;
1129 if (SubSystems & ssAtmosphere) cout << " Atmosphere parameters logged" << endl;
1130 if (SubSystems & ssMassProps) cout << " Mass parameters logged" << endl;
1131 if (SubSystems & ssCoefficients) cout << " Coefficient parameters logged" << endl;
1132 if (SubSystems & ssPropagate) cout << " Propagate parameters logged" << endl;
1133 if (SubSystems & ssGroundReactions) cout << " Ground parameters logged" << endl;
1134 if (SubSystems & ssFCS) cout << " FCS parameters logged" << endl;
1135 if (SubSystems & ssPropulsion) cout << " Propulsion parameters logged" << endl;
1136 if (OutputProperties.size() > 0) cout << " Properties logged:" << endl;
1137 for (unsigned int i=0;i<OutputProperties.size();i++) {
1138 cout << " - " << OutputProperties[i]->GetName() << endl;
1142 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
1143 if (from == 0) cout << "Instantiated: FGOutput" << endl;
1144 if (from == 1) cout << "Destroyed: FGOutput" << endl;
1146 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
1148 if (debug_lvl & 8 ) { // Runtime state variables
1150 if (debug_lvl & 16) { // Sanity checking
1152 if (debug_lvl & 64) {
1153 if (from == 0) { // Constructor
1154 cout << IdSrc << endl;
1155 cout << IdHdr << endl;