]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/models/FGOutput.cpp
Sync. w. JSBSIm one more time to fix at least one bug
[flightgear.git] / src / FDM / JSBSim / models / FGOutput.cpp
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Module:       FGOutput.cpp
4  Author:       Jon Berndt
5  Date started: 12/02/98
6  Purpose:      Manage output of sim parameters to file or stdout
7  Called by:    FGSimExec
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 Lesser General Public License as published by the Free Software
13  Foundation; either version 2 of the License, or (at your option) any later
14  version.
15
16  This program is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18  FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
19  details.
20
21  You should have received a copy of the GNU Lesser General Public License along with
22  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
23  Place - Suite 330, Boston, MA  02111-1307, USA.
24
25  Further information about the GNU Lesser General Public License can also be found on
26  the world wide web at http://www.gnu.org.
27
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30 This is the place where you create output routines to dump data for perusal
31 later.
32
33 HISTORY
34 --------------------------------------------------------------------------------
35 12/02/98   JSB   Created
36 11/09/07   HDW   Added FlightGear Socket Interface
37
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 INCLUDES
40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41
42 #include "FGOutput.h"
43 #include "FGState.h"
44 #include "FGFDMExec.h"
45 #include "FGAtmosphere.h"
46 #include "FGFCS.h"
47 #include "FGAerodynamics.h"
48 #include "FGGroundReactions.h"
49 #include "FGExternalReactions.h"
50 #include "FGBuoyantForces.h"
51 #include "FGAircraft.h"
52 #include "FGMassBalance.h"
53 #include "FGPropagate.h"
54 #include "FGAuxiliary.h"
55 #include "FGInertial.h"
56 #include "FGPropulsion.h"   //access to FGEngine, FGTank
57 #include "models/propulsion/FGPiston.h"
58 #include <fstream>
59 #include <iomanip>
60 #include <cstring>
61
62 #include "input_output/net_fdm.hxx"
63
64 #if defined(WIN32) && !defined(__CYGWIN__)
65 #  include <windows.h>
66 #else
67 #  include <netinet/in.h>       // htonl() ntohl()
68 #endif
69
70 static const int endianTest = 1;
71 #define isLittleEndian (*((char *) &endianTest ) != 0)
72
73 namespace JSBSim {
74
75 static const char *IdSrc = "$Id$";
76 static const char *IdHdr = ID_OUTPUT;
77
78 // (stolen from FGFS native_fdm.cxx)
79 // The function htond is defined this way due to the way some
80 // processors and OSes treat floating point values.  Some will raise
81 // an exception whenever a "bad" floating point value is loaded into a
82 // floating point register.  Solaris is notorious for this, but then
83 // so is LynxOS on the PowerPC.  By translating the data in place,
84 // there is no need to load a FP register with the "corruped" floating
85 // point value.  By doing the BIG_ENDIAN test, I can optimize the
86 // routine for big-endian processors so it can be as efficient as
87 // possible
88 static void htond (double &x)
89 {
90     if ( isLittleEndian ) {
91         int    *Double_Overlay;
92         int     Holding_Buffer;
93
94         Double_Overlay = (int *) &x;
95         Holding_Buffer = Double_Overlay [0];
96
97         Double_Overlay [0] = htonl (Double_Overlay [1]);
98         Double_Overlay [1] = htonl (Holding_Buffer);
99     } else {
100         return;
101     }
102 }
103
104 // Float version
105 static void htonf (float &x)
106 {
107     if ( isLittleEndian ) {
108         int    *Float_Overlay;
109         int     Holding_Buffer;
110
111         Float_Overlay = (int *) &x;
112         Holding_Buffer = Float_Overlay [0];
113
114         Float_Overlay [0] = htonl (Holding_Buffer);
115     } else {
116         return;
117     }
118 }
119
120
121 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
122 CLASS IMPLEMENTATION
123 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
124
125 FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
126 {
127   Name = "FGOutput";
128   sFirstPass = dFirstPass = true;
129   socket = 0;
130   flightGearSocket = 0;
131   runID_postfix = 0;
132   Type = otNone;
133   SubSystems = 0;
134   enabled = true;
135   StartNewFile = false;
136   delimeter = ", ";
137   BaseFilename = Filename = "";
138   DirectivesFile = "";
139   output_file_name = "";
140
141   memset(&fgSockBuf, 0x00, sizeof(fgSockBuf));
142
143   Debug(0);
144 }
145
146 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
147
148 FGOutput::~FGOutput()
149 {
150   delete socket;
151   delete flightGearSocket;
152   OutputProperties.clear();
153   Debug(1);
154 }
155
156 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
157
158 bool FGOutput::InitModel(void)
159 {
160   char fname[1000] = "";
161
162   if (!FGModel::InitModel()) return false;
163
164   if (Filename.size() > 0 && StartNewFile) {
165     int idx = BaseFilename.find_last_of(".");
166     int len = BaseFilename.length();
167     string extension = "";
168     if (idx != string::npos) {
169       extension = BaseFilename.substr(idx, len-idx);
170       len -= extension.length();
171     }
172     sprintf(fname, "%s_%d%s", BaseFilename.substr(0,len).c_str(), runID_postfix++, extension.c_str());
173     Filename = string(fname);
174     datafile.close();
175     StartNewFile = false;
176     dFirstPass = true;
177   }
178
179   return true;
180 }
181
182 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
183
184 bool FGOutput::Run(void)
185 {
186   if (FGModel::Run()) return true;
187
188   if (enabled && !State->IntegrationSuspended()&& !FDMExec->Holding()) {
189     if (Type == otSocket) {
190       SocketOutput();
191     } else if (Type == otFlightGear) {
192       FlightGearSocketOutput();
193     } else if (Type == otCSV || Type == otTab) {
194       DelimitedOutput(Filename);
195     } else if (Type == otTerminal) {
196       // Not done yet
197     } else if (Type == otNone) {
198       // Do nothing
199     } else {
200       // Not a valid type of output
201     }
202   }
203   return false;
204 }
205
206 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
207
208 void FGOutput::SetType(string type)
209 {
210   if (type == "CSV") {
211     Type = otCSV;
212     delimeter = ", ";
213   } else if (type == "TABULAR") {
214     Type = otTab;
215     delimeter = "\t";
216   } else if (type == "SOCKET") {
217     Type = otSocket;
218   } else if (type == "FLIGHTGEAR") {
219     Type = otFlightGear;
220   } else if (type == "TERMINAL") {
221     Type = otTerminal;
222   } else if (type != string("NONE")) {
223     Type = otUnknown;
224     cerr << "Unknown type of output specified in config file" << endl;
225   }
226 }
227
228 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
229
230 void FGOutput::DelimitedOutput(string fname)
231 {
232   streambuf* buffer;
233   string scratch = "";
234
235   if (fname == "COUT" || fname == "cout") {
236     buffer = cout.rdbuf();
237   } else {
238     if (!datafile.is_open()) datafile.open(fname.c_str());
239     buffer = datafile.rdbuf();
240   }
241
242   ostream outstream(buffer);
243
244   outstream.precision(10);
245
246   if (dFirstPass) {
247     outstream << "Time";
248     if (SubSystems & ssSimulation) {
249       // Nothing here, yet
250     }
251     if (SubSystems & ssAerosurfaces) {
252       outstream << delimeter;
253       outstream << "Aileron Command (norm)" + delimeter;
254       outstream << "Elevator Command (norm)" + delimeter;
255       outstream << "Rudder Command (norm)" + delimeter;
256       outstream << "Flap Command (norm)" + delimeter;
257       outstream << "Left Aileron Position (deg)" + delimeter;
258       outstream << "Right Aileron Position (deg)" + delimeter;
259       outstream << "Elevator Position (deg)" + delimeter;
260       outstream << "Rudder Position (deg)" + delimeter;
261       outstream << "Flap Position (deg)";
262     }
263     if (SubSystems & ssRates) {
264       outstream << delimeter;
265       outstream << "P (deg/s)" + delimeter + "Q (deg/s)" + delimeter + "R (deg/s)" + delimeter;
266       outstream << "P dot (deg/s^2)" + delimeter + "Q dot (deg/s^2)" + delimeter + "R dot (deg/s^2)";
267     }
268     if (SubSystems & ssVelocities) {
269       outstream << delimeter;
270       outstream << "q bar (psf)" + delimeter;
271       outstream << "Reynolds Number" + delimeter;
272       outstream << "V_{Total} (ft/s)" + delimeter;
273       outstream << "V_{Inertial} (ft/s)" + delimeter;
274       outstream << "UBody" + delimeter + "VBody" + delimeter + "WBody" + delimeter;
275       outstream << "Aero V_{X Body} (ft/s)" + delimeter + "Aero V_{Y Body} (ft/s)" + delimeter + "Aero V_{Z Body} (ft/s)" + delimeter;
276       outstream << "V_{North} (ft/s)" + delimeter + "V_{East} (ft/s)" + delimeter + "V_{Down} (ft/s)";
277     }
278     if (SubSystems & ssForces) {
279       outstream << delimeter;
280       outstream << "F_{Drag} (lbs)" + delimeter + "F_{Side} (lbs)" + delimeter + "F_{Lift} (lbs)" + delimeter;
281       outstream << "L/D" + delimeter;
282       outstream << "F_{Aero x} (lbs)" + delimeter + "F_{Aero y} (lbs)" + delimeter + "F_{Aero z} (lbs)" + delimeter;
283       outstream << "F_{Prop x} (lbs)" + delimeter + "F_{Prop y} (lbs)" + delimeter + "F_{Prop z} (lbs)" + delimeter;
284       outstream << "F_{Gear x} (lbs)" + delimeter + "F_{Gear y} (lbs)" + delimeter + "F_{Gear z} (lbs)" + delimeter;
285       outstream << "F_{Ext x} (lbs)" + delimeter + "F_{Ext y} (lbs)" + delimeter + "F_{Ext z} (lbs)" + delimeter;
286       outstream << "F_{Buoyant x} (lbs)" + delimeter + "F_{Buoyant y} (lbs)" + delimeter + "F_{Buoyant z} (lbs)" + delimeter;
287       outstream << "F_{Total x} (lbs)" + delimeter + "F_{Total y} (lbs)" + delimeter + "F_{Total z} (lbs)";
288     }
289     if (SubSystems & ssMoments) {
290       outstream << delimeter;
291       outstream << "L_{Aero} (ft-lbs)" + delimeter + "M_{Aero} ( ft-lbs)" + delimeter + "N_{Aero} (ft-lbs)" + delimeter;
292       outstream << "L_{Prop} (ft-lbs)" + delimeter + "M_{Prop} (ft-lbs)" + delimeter + "N_{Prop} (ft-lbs)" + delimeter;
293       outstream << "L_{Gear} (ft-lbs)" + delimeter + "M_{Gear} (ft-lbs)" + delimeter + "N_{Gear} (ft-lbs)" + delimeter;
294       outstream << "L_{ext} (ft-lbs)" + delimeter + "M_{ext} (ft-lbs)" + delimeter + "N_{ext} (ft-lbs)" + delimeter;
295       outstream << "L_{Buoyant} (ft-lbs)" + delimeter + "M_{Buoyant} (ft-lbs)" + delimeter + "N_{Buoyant} (ft-lbs)" + delimeter;
296       outstream << "L_{Total} (ft-lbs)" + delimeter + "M_{Total} (ft-lbs)" + delimeter + "N_{Total} (ft-lbs)";
297     }
298     if (SubSystems & ssAtmosphere) {
299       outstream << delimeter;
300       outstream << "Rho (slugs/ft^3)" + delimeter;
301       outstream << "Absolute Viscosity" + delimeter;
302       outstream << "Kinematic Viscosity" + delimeter;
303       outstream << "Temperature (R)" + delimeter;
304       outstream << "P_{SL} (psf)" + delimeter;
305       outstream << "P_{Ambient} (psf)" + delimeter;
306       outstream << "Turbulence Magnitude (ft/sec)" + delimeter;
307       outstream << "Turbulence X Direction (rad)" + delimeter + "Turbulence Y Direction (rad)" + delimeter + "Turbulence Z Direction (rad)" + delimeter;
308       outstream << "Wind V_{North} (ft/s)" + delimeter + "Wind V_{East} (ft/s)" + delimeter + "Wind V_{Down} (ft/s)";
309     }
310     if (SubSystems & ssMassProps) {
311       outstream << delimeter;
312       outstream << "I_{xx}" + delimeter;
313       outstream << "I_{xy}" + delimeter;
314       outstream << "I_{xz}" + delimeter;
315       outstream << "I_{yx}" + delimeter;
316       outstream << "I_{yy}" + delimeter;
317       outstream << "I_{yz}" + delimeter;
318       outstream << "I_{zx}" + delimeter;
319       outstream << "I_{zy}" + delimeter;
320       outstream << "I_{zz}" + delimeter;
321       outstream << "Mass" + delimeter;
322       outstream << "X_{cg}" + delimeter + "Y_{cg}" + delimeter + "Z_{cg}";
323     }
324     if (SubSystems & ssPropagate) {
325       outstream << delimeter;
326       outstream << "Altitude (ft)" + delimeter;
327       outstream << "Phi (deg)" + delimeter + "Theta (deg)" + delimeter + "Psi (deg)" + delimeter;
328       outstream << "Alpha (deg)" + delimeter;
329       outstream << "Beta (deg)" + delimeter;
330       outstream << "Latitude (deg)" + delimeter;
331       outstream << "Longitude (deg)" + delimeter;
332       outstream << "ECEF X (ft)" + delimeter + "ECEF Y (ft)" + delimeter + "ECEF Z (ft)" + delimeter;
333       outstream << "EPA (deg)" + delimeter;
334       outstream << "Distance AGL (ft)" + delimeter;
335       outstream << "Runway Radius (ft)";
336     }
337     if (SubSystems & ssCoefficients) {
338       scratch = Aerodynamics->GetCoefficientStrings(delimeter);
339       if (scratch.length() != 0) outstream << delimeter << scratch;
340     }
341     if (SubSystems & ssFCS) {
342       scratch = FCS->GetComponentStrings(delimeter);
343       if (scratch.length() != 0) outstream << delimeter << scratch;
344     }
345     if (SubSystems & ssGroundReactions) {
346       outstream << delimeter;
347       outstream << GroundReactions->GetGroundReactionStrings(delimeter);
348     }
349     if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
350       outstream << delimeter;
351       outstream << Propulsion->GetPropulsionStrings(delimeter);
352     }
353     if (OutputProperties.size() > 0) {
354       for (unsigned int i=0;i<OutputProperties.size();i++) {
355         outstream << delimeter << OutputProperties[i]->GetPrintableName();
356       }
357     }
358
359     outstream << endl;
360     dFirstPass = false;
361   }
362
363   outstream << State->Getsim_time();
364   if (SubSystems & ssSimulation) {
365   }
366   if (SubSystems & ssAerosurfaces) {
367     outstream << delimeter;
368     outstream << FCS->GetDaCmd() << delimeter;
369     outstream << FCS->GetDeCmd() << delimeter;
370     outstream << FCS->GetDrCmd() << delimeter;
371     outstream << FCS->GetDfCmd() << delimeter;
372     outstream << FCS->GetDaLPos(ofDeg) << delimeter;
373     outstream << FCS->GetDaRPos(ofDeg) << delimeter;
374     outstream << FCS->GetDePos(ofDeg) << delimeter;
375     outstream << FCS->GetDrPos(ofDeg) << delimeter;
376     outstream << FCS->GetDfPos(ofDeg);
377   }
378   if (SubSystems & ssRates) {
379     outstream << delimeter;
380     outstream << (radtodeg*Propagate->GetPQR()).Dump(delimeter) << delimeter;
381     outstream << (radtodeg*Propagate->GetPQRdot()).Dump(delimeter);
382   }
383   if (SubSystems & ssVelocities) {
384     outstream << delimeter;
385     outstream << Auxiliary->Getqbar() << delimeter;
386     outstream << Auxiliary->GetReynoldsNumber() << delimeter;
387     outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
388     outstream << Propagate->GetInertialVelocityMagnitude() << delimeter;
389     outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
390     outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
391     outstream << Propagate->GetVel().Dump(delimeter);
392     outstream.precision(10);
393   }
394   if (SubSystems & ssForces) {
395     outstream << delimeter;
396     outstream << Aerodynamics->GetvFw() << delimeter;
397     outstream << Aerodynamics->GetLoD() << delimeter;
398     outstream << Aerodynamics->GetForces() << delimeter;
399     outstream << Propulsion->GetForces() << delimeter;
400     outstream << GroundReactions->GetForces() << delimeter;
401     outstream << ExternalReactions->GetForces() << delimeter;
402     outstream << BuoyantForces->GetForces() << delimeter;
403     outstream << Aircraft->GetForces().Dump(delimeter);
404   }
405   if (SubSystems & ssMoments) {
406     outstream << delimeter;
407     outstream << Aerodynamics->GetMoments() << delimeter;
408     outstream << Propulsion->GetMoments() << delimeter;
409     outstream << GroundReactions->GetMoments() << delimeter;
410     outstream << ExternalReactions->GetMoments() << delimeter;
411     outstream << BuoyantForces->GetMoments() << delimeter;
412     outstream << Aircraft->GetMoments().Dump(delimeter);
413   }
414   if (SubSystems & ssAtmosphere) {
415     outstream << delimeter;
416     outstream << Atmosphere->GetDensity() << delimeter;
417     outstream << Atmosphere->GetAbsoluteViscosity() << delimeter;
418     outstream << Atmosphere->GetKinematicViscosity() << delimeter;
419     outstream << Atmosphere->GetTemperature() << delimeter;
420     outstream << Atmosphere->GetPressureSL() << delimeter;
421     outstream << Atmosphere->GetPressure() << delimeter;
422     outstream << Atmosphere->GetTurbMagnitude() << delimeter;
423     outstream << Atmosphere->GetTurbDirection().Dump(delimeter) << delimeter;
424     outstream << Atmosphere->GetTotalWindNED().Dump(delimeter);
425   }
426   if (SubSystems & ssMassProps) {
427     outstream << delimeter;
428     outstream << MassBalance->GetJ() << delimeter;
429     outstream << MassBalance->GetMass() << delimeter;
430     outstream << MassBalance->GetXYZcg();
431   }
432   if (SubSystems & ssPropagate) {
433     outstream.precision(14);
434     outstream << delimeter;
435     outstream << Propagate->Geth() << delimeter;
436     outstream << (radtodeg*Propagate->GetEuler()).Dump(delimeter) << delimeter;
437     outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
438     outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
439     outstream << Propagate->GetLocation().GetLatitudeDeg() << delimeter;
440     outstream << Propagate->GetLocation().GetLongitudeDeg() << delimeter;
441     outstream.precision(18);
442     outstream << ((FGColumnVector3)Propagate->GetLocation()).Dump(delimeter) << delimeter;
443     outstream.precision(14);
444     outstream << Inertial->GetEarthPositionAngleDeg() << delimeter;
445     outstream << Propagate->GetDistanceAGL() << delimeter;
446     outstream << Propagate->GetRunwayRadius();
447     outstream.precision(10);
448   }
449   if (SubSystems & ssCoefficients) {
450     scratch = Aerodynamics->GetCoefficientValues(delimeter);
451     if (scratch.length() != 0) outstream << delimeter << scratch;
452   }
453   if (SubSystems & ssFCS) {
454     scratch = FCS->GetComponentValues(delimeter);
455     if (scratch.length() != 0) outstream << delimeter << scratch;
456   }
457   if (SubSystems & ssGroundReactions) {
458     outstream << delimeter;
459     outstream << GroundReactions->GetGroundReactionValues(delimeter);
460   }
461   if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
462     outstream << delimeter;
463     outstream << Propulsion->GetPropulsionValues(delimeter);
464   }
465
466   for (unsigned int i=0;i<OutputProperties.size();i++) {
467     outstream << delimeter << OutputProperties[i]->getDoubleValue();
468   }
469
470   outstream << endl;
471   outstream.flush();
472 }
473
474 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
475
476 void FGOutput::SocketDataFill(FGNetFDM* net)
477 {
478     unsigned int i;
479
480     // Version
481     net->version = FG_NET_FDM_VERSION;
482
483     // Positions
484     net->longitude = Propagate->GetLocation().GetLongitude(); // geodetic (radians)
485     net->latitude  = Propagate->GetLocation().GetLatitude(); // geodetic (radians)
486     net->altitude  = Propagate->Geth()*0.3048; // altitude, above sea level (meters)
487     net->agl       = (float)(Propagate->GetDistanceAGL()*0.3048); // altitude, above ground level (meters)
488
489     net->phi       = (float)(Propagate->GetEuler(ePhi)); // roll (radians)
490     net->theta     = (float)(Propagate->GetEuler(eTht)); // pitch (radians)
491     net->psi       = (float)(Propagate->GetEuler(ePsi)); // yaw or true heading (radians)
492
493     net->alpha     = (float)(Auxiliary->Getalpha()); // angle of attack (radians)
494     net->beta      = (float)(Auxiliary->Getbeta()); // side slip angle (radians)
495
496     // Velocities
497     net->phidot     = (float)(Auxiliary->GetEulerRates(ePhi)); // roll rate (radians/sec)
498     net->thetadot   = (float)(Auxiliary->GetEulerRates(eTht)); // pitch rate (radians/sec)
499     net->psidot     = (float)(Auxiliary->GetEulerRates(ePsi)); // yaw rate (radians/sec)
500     net->vcas       = (float)(Auxiliary->GetVcalibratedFPS()); // VCAS, ft/sec
501     net->climb_rate = (float)(Propagate->Gethdot());           // altitude rate, ft/sec
502     net->v_north    = (float)(Propagate->GetVel(eNorth));      // north vel in NED frame, fps
503     net->v_east     = (float)(Propagate->GetVel(eEast));       // east vel in NED frame, fps
504     net->v_down     = (float)(Propagate->GetVel(eDown));       // down vel in NED frame, fps
505 //---ADD METHOD TO CALCULATE THESE TERMS---
506     net->v_wind_body_north = (float)(Propagate->GetVel(eNorth)); // north vel in NED relative to airmass, fps
507     net->v_wind_body_east = (float)(Propagate->GetVel(eEast)); // east vel in NED relative to airmass, fps
508     net->v_wind_body_down = (float)(Propagate->GetVel(eDown)); // down vel in NED relative to airmass, fps
509
510     // Accelerations
511     net->A_X_pilot   = (float)(Auxiliary->GetPilotAccel(1));    // X body accel, ft/s/s
512     net->A_Y_pilot   = (float)(Auxiliary->GetPilotAccel(2));    // Y body accel, ft/s/s
513     net->A_Z_pilot   = (float)(Auxiliary->GetPilotAccel(3));    // Z body accel, ft/s/s
514
515     // Stall
516     net->stall_warning = 0.0;  // 0.0 - 1.0 indicating the amount of stall
517     net->slip_deg    = (float)(Auxiliary->Getbeta(inDegrees));  // slip ball deflection, deg
518
519     // Engine status
520     net->num_engines = Propulsion->GetNumEngines(); // Number of valid engines
521
522     for (i=0; i<net->num_engines; i++) {
523        if (Propulsion->GetEngine(i)->GetRunning())
524           net->eng_state[i] = 2;       // Engine state running
525        else if (Propulsion->GetEngine(i)->GetCranking())
526           net->eng_state[i] = 1;       // Engine state cranking
527        else
528           net->eng_state[i] = 0;       // Engine state off
529
530        switch (Propulsion->GetEngine(i)->GetType()) {
531        case (FGEngine::etRocket):
532        break;
533        case (FGEngine::etPiston):
534           net->rpm[i]       = (float)(((FGPiston *)Propulsion->GetEngine(i))->getRPM());
535           net->fuel_flow[i] = (float)(((FGPiston *)Propulsion->GetEngine(i))->getFuelFlow_gph());
536           net->fuel_px[i]   = 0; // Fuel pressure, psi  (N/A in current model)
537           net->egt[i]       = (float)(((FGPiston *)Propulsion->GetEngine(i))->GetEGT());
538           net->cht[i]       = (float)(((FGPiston *)Propulsion->GetEngine(i))->getCylinderHeadTemp_degF());
539           net->mp_osi[i]    = (float)(((FGPiston *)Propulsion->GetEngine(i))->getManifoldPressure_inHg());
540           net->oil_temp[i]  = (float)(((FGPiston *)Propulsion->GetEngine(i))->getOilTemp_degF());
541           net->oil_px[i]    = (float)(((FGPiston *)Propulsion->GetEngine(i))->getOilPressure_psi());
542           net->tit[i]       = 0; // Turbine Inlet Temperature  (N/A for piston)
543        break;
544        case (FGEngine::etTurbine):
545        break;
546        case (FGEngine::etTurboprop):
547        break;
548        case (FGEngine::etElectric):
549        break;
550        case (FGEngine::etUnknown):
551        break;
552        }
553     }
554
555
556     // Consumables
557     net->num_tanks = Propulsion->GetNumTanks();   // Max number of fuel tanks
558
559     for (i=0; i<net->num_tanks; i++) {
560        net->fuel_quantity[i] = (float)(((FGTank *)Propulsion->GetTank(i))->GetContents());
561     }
562
563
564     // Gear status
565     net->num_wheels  = GroundReactions->GetNumGearUnits();
566
567     for (i=0; i<net->num_wheels; i++) {
568        net->wow[i]              = GroundReactions->GetGearUnit(i)->GetWOW();
569        if (GroundReactions->GetGearUnit(i)->GetGearUnitDown())
570           net->gear_pos[i]      = 1;  //gear down, using FCS convention
571        else
572           net->gear_pos[i]      = 0;  //gear up, using FCS convention
573        net->gear_steer[i]       = (float)(GroundReactions->GetGearUnit(i)->GetSteerNorm());
574        net->gear_compression[i] = (float)(GroundReactions->GetGearUnit(i)->GetCompLen());
575     }
576
577
578     // Environment
579     net->cur_time    = (long int)1234567890;    // Friday, Feb 13, 2009, 23:31:30 UTC (not processed by FGFS anyway)
580     net->warp        = 0;                       // offset in seconds to unix time
581     net->visibility  = 25000.0;                 // visibility in meters (for env. effects)
582
583
584     // Control surface positions (normalized values)
585     net->elevator          = (float)(FCS->GetDePos(ofNorm));    // Norm Elevator Pos, --
586     net->elevator_trim_tab = (float)(FCS->GetPitchTrimCmd());   // Norm Elev Trim Tab Pos, --
587     net->left_flap         = (float)(FCS->GetDfPos(ofNorm));    // Norm Flap Pos, --
588     net->right_flap        = (float)(FCS->GetDfPos(ofNorm));    // Norm Flap Pos, --
589     net->left_aileron      = (float)(FCS->GetDaLPos(ofNorm));   // Norm L Aileron Pos, --
590     net->right_aileron     = (float)(FCS->GetDaRPos(ofNorm));   // Norm R Aileron Pos, --
591     net->rudder            = (float)(FCS->GetDrPos(ofNorm));    // Norm Rudder Pos, --
592     net->nose_wheel        = (float)(FCS->GetDrPos(ofNorm));    // *** FIX ***  Using Rudder Pos for NWS, --
593     net->speedbrake        = (float)(FCS->GetDsbPos(ofNorm));   // Norm Speedbrake Pos, --
594     net->spoilers          = (float)(FCS->GetDspPos(ofNorm));   // Norm Spoiler Pos, --
595
596
597     // Convert the net buffer to network format
598     if ( isLittleEndian ) {
599         net->version = htonl(net->version);
600
601         htond(net->longitude);
602         htond(net->latitude);
603         htond(net->altitude);
604         htonf(net->agl);
605         htonf(net->phi);
606         htonf(net->theta);
607         htonf(net->psi);
608         htonf(net->alpha);
609         htonf(net->beta);
610
611         htonf(net->phidot);
612         htonf(net->thetadot);
613         htonf(net->psidot);
614         htonf(net->vcas);
615         htonf(net->climb_rate);
616         htonf(net->v_north);
617         htonf(net->v_east);
618         htonf(net->v_down);
619         htonf(net->v_wind_body_north);
620         htonf(net->v_wind_body_east);
621         htonf(net->v_wind_body_down);
622
623         htonf(net->A_X_pilot);
624         htonf(net->A_Y_pilot);
625         htonf(net->A_Z_pilot);
626
627         htonf(net->stall_warning);
628         htonf(net->slip_deg);
629
630         for (i=0; i<net->num_engines; ++i ) {
631             net->eng_state[i] = htonl(net->eng_state[i]);
632             htonf(net->rpm[i]);
633             htonf(net->fuel_flow[i]);
634             htonf(net->fuel_px[i]);
635             htonf(net->egt[i]);
636             htonf(net->cht[i]);
637             htonf(net->mp_osi[i]);
638             htonf(net->tit[i]);
639             htonf(net->oil_temp[i]);
640             htonf(net->oil_px[i]);
641         }
642         net->num_engines = htonl(net->num_engines);
643
644         for (i=0; i<net->num_tanks; ++i ) {
645             htonf(net->fuel_quantity[i]);
646         }
647         net->num_tanks = htonl(net->num_tanks);
648
649         for (i=0; i<net->num_wheels; ++i ) {
650             net->wow[i] = htonl(net->wow[i]);
651             htonf(net->gear_pos[i]);
652             htonf(net->gear_steer[i]);
653             htonf(net->gear_compression[i]);
654         }
655         net->num_wheels = htonl(net->num_wheels);
656
657         net->cur_time = htonl( net->cur_time );
658         net->warp = htonl( net->warp );
659         htonf(net->visibility);
660
661         htonf(net->elevator);
662         htonf(net->elevator_trim_tab);
663         htonf(net->left_flap);
664         htonf(net->right_flap);
665         htonf(net->left_aileron);
666         htonf(net->right_aileron);
667         htonf(net->rudder);
668         htonf(net->nose_wheel);
669         htonf(net->speedbrake);
670         htonf(net->spoilers);
671     }
672 }
673
674 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
675
676 void FGOutput::FlightGearSocketOutput(void)
677 {
678   int length = sizeof(fgSockBuf);
679
680
681   if (flightGearSocket == NULL) return;
682   if (!flightGearSocket->GetConnectStatus()) return;
683
684   SocketDataFill(&fgSockBuf);
685   flightGearSocket->Send((char *)&fgSockBuf, length);
686 }
687
688 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
689
690 void FGOutput::SocketOutput(void)
691 {
692   string asciiData, scratch;
693
694   if (socket == NULL) return;
695   if (!socket->GetConnectStatus()) return;
696
697   socket->Clear();
698   if (sFirstPass) {
699     socket->Clear("<LABELS>");
700     socket->Append("Time");
701
702     if (SubSystems & ssAerosurfaces) {
703       socket->Append("Aileron Command");
704       socket->Append("Elevator Command");
705       socket->Append("Rudder Command");
706       socket->Append("Flap Command");
707       socket->Append("Left Aileron Position");
708       socket->Append("Right Aileron Position");
709       socket->Append("Elevator Position");
710       socket->Append("Rudder Position");
711       socket->Append("Flap Position");
712     }
713
714     if (SubSystems & ssRates) {
715       socket->Append("P");
716       socket->Append("Q");
717       socket->Append("R");
718       socket->Append("PDot");
719       socket->Append("QDot");
720       socket->Append("RDot");
721     }
722
723     if (SubSystems & ssVelocities) {
724       socket->Append("QBar");
725       socket->Append("Vtotal");
726       socket->Append("UBody");
727       socket->Append("VBody");
728       socket->Append("WBody");
729       socket->Append("UAero");
730       socket->Append("VAero");
731       socket->Append("WAero");
732       socket->Append("Vn");
733       socket->Append("Ve");
734       socket->Append("Vd");
735     }
736     if (SubSystems & ssForces) {
737       socket->Append("F_Drag");
738       socket->Append("F_Side");
739       socket->Append("F_Lift");
740       socket->Append("LoD");
741       socket->Append("Fx");
742       socket->Append("Fy");
743       socket->Append("Fz");
744     }
745     if (SubSystems & ssMoments) {
746       socket->Append("L");
747       socket->Append("M");
748       socket->Append("N");
749     }
750     if (SubSystems & ssAtmosphere) {
751       socket->Append("Rho");
752       socket->Append("SL pressure");
753       socket->Append("Ambient pressure");
754       socket->Append("Turbulence Magnitude");
755       socket->Append("Turbulence Direction X");
756       socket->Append("Turbulence Direction Y");
757       socket->Append("Turbulence Direction Z");
758       socket->Append("NWind");
759       socket->Append("EWind");
760       socket->Append("DWind");
761     }
762     if (SubSystems & ssMassProps) {
763       socket->Append("Ixx");
764       socket->Append("Ixy");
765       socket->Append("Ixz");
766       socket->Append("Iyx");
767       socket->Append("Iyy");
768       socket->Append("Iyz");
769       socket->Append("Izx");
770       socket->Append("Izy");
771       socket->Append("Izz");
772       socket->Append("Mass");
773       socket->Append("Xcg");
774       socket->Append("Ycg");
775       socket->Append("Zcg");
776     }
777     if (SubSystems & ssPropagate) {
778         socket->Append("Altitude");
779         socket->Append("Phi (deg)");
780         socket->Append("Tht (deg)");
781         socket->Append("Psi (deg)");
782         socket->Append("Alpha (deg)");
783         socket->Append("Beta (deg)");
784         socket->Append("Latitude (deg)");
785         socket->Append("Longitude (deg)");
786     }
787     if (SubSystems & ssCoefficients) {
788       scratch = Aerodynamics->GetCoefficientStrings(",");
789       if (scratch.length() != 0) socket->Append(scratch);
790     }
791     if (SubSystems & ssFCS) {
792       scratch = FCS->GetComponentStrings(",");
793       if (scratch.length() != 0) socket->Append(scratch);
794     }
795     if (SubSystems & ssGroundReactions) {
796       socket->Append(GroundReactions->GetGroundReactionStrings(","));
797     }
798     if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
799       socket->Append(Propulsion->GetPropulsionStrings(","));
800     }
801     if (OutputProperties.size() > 0) {
802       for (unsigned int i=0;i<OutputProperties.size();i++) {
803         socket->Append(OutputProperties[i]->GetPrintableName());
804       }
805     }
806
807     sFirstPass = false;
808     socket->Send();
809   }
810
811   socket->Clear();
812   socket->Append(State->Getsim_time());
813
814   if (SubSystems & ssAerosurfaces) {
815     socket->Append(FCS->GetDaCmd());
816     socket->Append(FCS->GetDeCmd());
817     socket->Append(FCS->GetDrCmd());
818     socket->Append(FCS->GetDfCmd());
819     socket->Append(FCS->GetDaLPos());
820     socket->Append(FCS->GetDaRPos());
821     socket->Append(FCS->GetDePos());
822     socket->Append(FCS->GetDrPos());
823     socket->Append(FCS->GetDfPos());
824   }
825   if (SubSystems & ssRates) {
826     socket->Append(radtodeg*Propagate->GetPQR(eP));
827     socket->Append(radtodeg*Propagate->GetPQR(eQ));
828     socket->Append(radtodeg*Propagate->GetPQR(eR));
829     socket->Append(radtodeg*Propagate->GetPQRdot(eP));
830     socket->Append(radtodeg*Propagate->GetPQRdot(eQ));
831     socket->Append(radtodeg*Propagate->GetPQRdot(eR));
832   }
833   if (SubSystems & ssVelocities) {
834     socket->Append(Auxiliary->Getqbar());
835     socket->Append(Auxiliary->GetVt());
836     socket->Append(Propagate->GetUVW(eU));
837     socket->Append(Propagate->GetUVW(eV));
838     socket->Append(Propagate->GetUVW(eW));
839     socket->Append(Auxiliary->GetAeroUVW(eU));
840     socket->Append(Auxiliary->GetAeroUVW(eV));
841     socket->Append(Auxiliary->GetAeroUVW(eW));
842     socket->Append(Propagate->GetVel(eNorth));
843     socket->Append(Propagate->GetVel(eEast));
844     socket->Append(Propagate->GetVel(eDown));
845   }
846   if (SubSystems & ssForces) {
847     socket->Append(Aerodynamics->GetvFw()(eDrag));
848     socket->Append(Aerodynamics->GetvFw()(eSide));
849     socket->Append(Aerodynamics->GetvFw()(eLift));
850     socket->Append(Aerodynamics->GetLoD());
851     socket->Append(Aircraft->GetForces(eX));
852     socket->Append(Aircraft->GetForces(eY));
853     socket->Append(Aircraft->GetForces(eZ));
854   }
855   if (SubSystems & ssMoments) {
856     socket->Append(Aircraft->GetMoments(eL));
857     socket->Append(Aircraft->GetMoments(eM));
858     socket->Append(Aircraft->GetMoments(eN));
859   }
860   if (SubSystems & ssAtmosphere) {
861     socket->Append(Atmosphere->GetDensity());
862     socket->Append(Atmosphere->GetPressureSL());
863     socket->Append(Atmosphere->GetPressure());
864     socket->Append(Atmosphere->GetTurbMagnitude());
865     socket->Append(Atmosphere->GetTurbDirection().Dump(","));
866     socket->Append(Atmosphere->GetTotalWindNED().Dump(","));
867   }
868   if (SubSystems & ssMassProps) {
869     socket->Append(MassBalance->GetJ()(1,1));
870     socket->Append(MassBalance->GetJ()(1,2));
871     socket->Append(MassBalance->GetJ()(1,3));
872     socket->Append(MassBalance->GetJ()(2,1));
873     socket->Append(MassBalance->GetJ()(2,2));
874     socket->Append(MassBalance->GetJ()(2,3));
875     socket->Append(MassBalance->GetJ()(3,1));
876     socket->Append(MassBalance->GetJ()(3,2));
877     socket->Append(MassBalance->GetJ()(3,3));
878     socket->Append(MassBalance->GetMass());
879     socket->Append(MassBalance->GetXYZcg()(eX));
880     socket->Append(MassBalance->GetXYZcg()(eY));
881     socket->Append(MassBalance->GetXYZcg()(eZ));
882   }
883   if (SubSystems & ssPropagate) {
884     socket->Append(Propagate->Geth());
885     socket->Append(radtodeg*Propagate->GetEuler(ePhi));
886     socket->Append(radtodeg*Propagate->GetEuler(eTht));
887     socket->Append(radtodeg*Propagate->GetEuler(ePsi));
888     socket->Append(Auxiliary->Getalpha(inDegrees));
889     socket->Append(Auxiliary->Getbeta(inDegrees));
890     socket->Append(Propagate->GetLocation().GetLatitudeDeg());
891     socket->Append(Propagate->GetLocation().GetLongitudeDeg());
892   }
893   if (SubSystems & ssCoefficients) {
894     scratch = Aerodynamics->GetCoefficientValues(",");
895     if (scratch.length() != 0) socket->Append(scratch);
896   }
897   if (SubSystems & ssFCS) {
898     scratch = FCS->GetComponentValues(",");
899     if (scratch.length() != 0) socket->Append(scratch);
900   }
901   if (SubSystems & ssGroundReactions) {
902     socket->Append(GroundReactions->GetGroundReactionValues(","));
903   }
904   if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
905     socket->Append(Propulsion->GetPropulsionValues(","));
906   }
907
908   for (unsigned int i=0;i<OutputProperties.size();i++) {
909     socket->Append(OutputProperties[i]->getDoubleValue());
910   }
911
912   socket->Send();
913 }
914
915 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
916
917 void FGOutput::SocketStatusOutput(string out_str)
918 {
919   string asciiData;
920
921   if (socket == NULL) return;
922
923   socket->Clear();
924   asciiData = string("<STATUS>") + out_str;
925   socket->Append(asciiData.c_str());
926   socket->Send();
927 }
928
929 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
930
931 bool FGOutput::Load(Element* element)
932 {
933   string type="", parameter="";
934   string name="";
935   string protocol="tcp";
936   int OutRate = 0;
937   string property;
938   unsigned int port;
939   Element *property_element;
940
941   string separator = "/";
942
943   if (!DirectivesFile.empty()) { // A directives filename from the command line overrides
944     output_file_name = DirectivesFile;      // one found in the config file.
945     document = LoadXMLDocument(output_file_name);
946   } else if (!element->GetAttributeValue("file").empty()) {
947     output_file_name = element->GetAttributeValue("file");
948     document = LoadXMLDocument(output_file_name);
949   } else {
950     document = element;
951   }
952
953   name = document->GetAttributeValue("name");
954   type = document->GetAttributeValue("type");
955   SetType(type);
956   if (!document->GetAttributeValue("port").empty() && type == string("SOCKET")) {
957     port = atoi(document->GetAttributeValue("port").c_str());
958     socket = new FGfdmSocket(name, port);
959   } else if (!document->GetAttributeValue("port").empty() && type == string("FLIGHTGEAR")) {
960     port = atoi(document->GetAttributeValue("port").c_str());
961     if (!document->GetAttributeValue("protocol").empty())
962        protocol = document->GetAttributeValue("protocol");
963     if (protocol == "udp")
964        flightGearSocket = new FGfdmSocket(name, port, FGfdmSocket::ptUDP);  // create udp socket
965     else
966        flightGearSocket = new FGfdmSocket(name, port, FGfdmSocket::ptTCP);  // create tcp socket (default)
967   } else {
968     BaseFilename = Filename = name;
969   }
970   if (!document->GetAttributeValue("rate").empty()) {
971     OutRate = (int)document->GetAttributeValueAsNumber("rate");
972   } else {
973     OutRate = 1;
974   }
975
976   if (document->FindElementValue("simulation") == string("ON"))
977     SubSystems += ssSimulation;
978   if (document->FindElementValue("aerosurfaces") == string("ON"))
979     SubSystems += ssAerosurfaces;
980   if (document->FindElementValue("rates") == string("ON"))
981     SubSystems += ssRates;
982   if (document->FindElementValue("velocities") == string("ON"))
983     SubSystems += ssVelocities;
984   if (document->FindElementValue("forces") == string("ON"))
985     SubSystems += ssForces;
986   if (document->FindElementValue("moments") == string("ON"))
987     SubSystems += ssMoments;
988   if (document->FindElementValue("atmosphere") == string("ON"))
989     SubSystems += ssAtmosphere;
990   if (document->FindElementValue("massprops") == string("ON"))
991     SubSystems += ssMassProps;
992   if (document->FindElementValue("position") == string("ON"))
993     SubSystems += ssPropagate;
994   if (document->FindElementValue("coefficients") == string("ON"))
995     SubSystems += ssCoefficients;
996   if (document->FindElementValue("ground_reactions") == string("ON"))
997     SubSystems += ssGroundReactions;
998   if (document->FindElementValue("fcs") == string("ON"))
999     SubSystems += ssFCS;
1000   if (document->FindElementValue("propulsion") == string("ON"))
1001     SubSystems += ssPropulsion;
1002   property_element = document->FindElement("property");
1003   while (property_element) {
1004     string property_str = property_element->GetDataLine();
1005     FGPropertyManager* node = PropertyManager->GetNode(property_str);
1006     if (!node) {
1007       cerr << fgred << highint << endl << "  No property by the name "
1008            << property_str << " has been defined. This property will " << endl
1009            << "  not be logged. You should check your configuration file."
1010            << reset << endl;
1011     } else {
1012       OutputProperties.push_back(node);
1013     }
1014     property_element = document->FindNextElement("property");
1015   }
1016
1017   OutRate = OutRate>1000?1000:(OutRate<0?0:OutRate);
1018   rate = (int)(0.5 + 1.0/(State->Getdt()*OutRate));
1019
1020   Debug(2);
1021
1022   return true;
1023 }
1024
1025 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1026 //    The bitmasked value choices are as follows:
1027 //    unset: In this case (the default) JSBSim would only print
1028 //       out the normally expected messages, essentially echoing
1029 //       the config files as they are read. If the environment
1030 //       variable is not set, debug_lvl is set to 1 internally
1031 //    0: This requests JSBSim not to output any messages
1032 //       whatsoever.
1033 //    1: This value explicity requests the normal JSBSim
1034 //       startup messages
1035 //    2: This value asks for a message to be printed out when
1036 //       a class is instantiated
1037 //    4: When this value is set, a message is displayed when a
1038 //       FGModel object executes its Run() method
1039 //    8: When this value is set, various runtime state variables
1040 //       are printed out periodically
1041 //    16: When set various parameters are sanity checked and
1042 //       a message is printed out when they go out of bounds
1043
1044 void FGOutput::Debug(int from)
1045 {
1046   string scratch="";
1047
1048   if (debug_lvl <= 0) return;
1049
1050   if (debug_lvl & 1) { // Standard console startup message output
1051     if (from == 0) { // Constructor
1052
1053     }
1054     if (from == 2) {
1055       if (output_file_name.empty())
1056         cout << "  " << "Output parameters read inline" << endl;
1057       else
1058         cout << "    Output parameters read from file: " << output_file_name << endl;
1059
1060       if (Filename == "cout" || Filename == "COUT") {
1061         scratch = "    Log output goes to screen console";
1062       } else if (!Filename.empty()) {
1063         scratch = "    Log output goes to file: " + Filename;
1064       }
1065       switch (Type) {
1066       case otCSV:
1067         cout << scratch << " in CSV format output at rate " << 1/(State->Getdt()*rate) << " Hz" << endl;
1068         break;
1069       case otNone:
1070         cout << "  No log output" << endl;
1071         break;
1072       }
1073
1074       if (SubSystems & ssSimulation)      cout << "    Simulation parameters logged" << endl;
1075       if (SubSystems & ssAerosurfaces)    cout << "    Aerosurface parameters logged" << endl;
1076       if (SubSystems & ssRates)           cout << "    Rate parameters logged" << endl;
1077       if (SubSystems & ssVelocities)      cout << "    Velocity parameters logged" << endl;
1078       if (SubSystems & ssForces)          cout << "    Force parameters logged" << endl;
1079       if (SubSystems & ssMoments)         cout << "    Moments parameters logged" << endl;
1080       if (SubSystems & ssAtmosphere)      cout << "    Atmosphere parameters logged" << endl;
1081       if (SubSystems & ssMassProps)       cout << "    Mass parameters logged" << endl;
1082       if (SubSystems & ssCoefficients)    cout << "    Coefficient parameters logged" << endl;
1083       if (SubSystems & ssPropagate)       cout << "    Propagate parameters logged" << endl;
1084       if (SubSystems & ssGroundReactions) cout << "    Ground parameters logged" << endl;
1085       if (SubSystems & ssFCS)             cout << "    FCS parameters logged" << endl;
1086       if (SubSystems & ssPropulsion)      cout << "    Propulsion parameters logged" << endl;
1087       if (OutputProperties.size() > 0)    cout << "    Properties logged:" << endl;
1088       for (unsigned int i=0;i<OutputProperties.size();i++) {
1089         cout << "      - " << OutputProperties[i]->GetName() << endl;
1090       }
1091     }
1092   }
1093   if (debug_lvl & 2 ) { // Instantiation/Destruction notification
1094     if (from == 0) cout << "Instantiated: FGOutput" << endl;
1095     if (from == 1) cout << "Destroyed:    FGOutput" << endl;
1096   }
1097   if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
1098   }
1099   if (debug_lvl & 8 ) { // Runtime state variables
1100   }
1101   if (debug_lvl & 16) { // Sanity checking
1102   }
1103   if (debug_lvl & 64) {
1104     if (from == 0) { // Constructor
1105       cout << IdSrc << endl;
1106       cout << IdHdr << endl;
1107     }
1108   }
1109 }
1110 }