88 datafile.open(Filename);
90 cerr << endl <<
fgred <<
highint <<
"ERROR: unable to open the file "
91 <<
reset << Filename.c_str() << endl
92 <<
fgred <<
highint <<
" => Output to this file is disabled."
93 <<
reset << endl << endl;
99 streambuf* buffer = datafile.rdbuf();
100 ostream outstream(buffer);
102 outstream.precision(10);
109 outstream << delimeter;
110 outstream <<
"Aileron Command (norm)" + delimeter;
111 outstream <<
"Elevator Command (norm)" + delimeter;
112 outstream <<
"Rudder Command (norm)" + delimeter;
113 outstream <<
"Flap Command (norm)" + delimeter;
114 outstream <<
"Left Aileron Position (deg)" + delimeter;
115 outstream <<
"Right Aileron Position (deg)" + delimeter;
116 outstream <<
"Elevator Position (deg)" + delimeter;
117 outstream <<
"Rudder Position (deg)" + delimeter;
118 outstream <<
"Flap Position (deg)";
121 outstream << delimeter;
122 outstream <<
"P (deg/s)" + delimeter +
"Q (deg/s)" + delimeter +
"R (deg/s)" + delimeter;
123 outstream <<
"P dot (deg/s^2)" + delimeter +
"Q dot (deg/s^2)" + delimeter +
"R dot (deg/s^2)" + delimeter;
124 outstream <<
"P_{inertial} (deg/s)" + delimeter +
"Q_{inertial} (deg/s)" + delimeter +
"R_{inertial} (deg/s)";
127 outstream << delimeter;
128 outstream <<
"q bar (psf)" + delimeter;
129 outstream <<
"Reynolds Number" + delimeter;
130 outstream <<
"V_{Total} (ft/s)" + delimeter;
131 outstream <<
"V_{Inertial} (ft/s)" + delimeter;
132 outstream <<
"UBody" + delimeter +
"VBody" + delimeter +
"WBody" + delimeter;
133 outstream <<
"UdotBody" + delimeter +
"VdotBody" + delimeter +
"WdotBody" + delimeter;
134 outstream <<
"UdotBody_i" + delimeter +
"VdotBody_i" + delimeter +
"WdotBody_i" + delimeter;
135 outstream <<
"BodyAccel_X" + delimeter +
"BodyAccel_Y" + delimeter +
"BodyAccel_Z" + delimeter;
136 outstream <<
"Aero V_{X Body} (ft/s)" + delimeter +
"Aero V_{Y Body} (ft/s)" + delimeter +
"Aero V_{Z Body} (ft/s)" + delimeter;
137 outstream <<
"V_{X_{inertial}} (ft/s)" + delimeter +
"V_{Y_{inertial}} (ft/s)" + delimeter +
"V_{Z_{inertial}} (ft/s)" + delimeter;
138 outstream <<
"V_{X_{ecef}} (ft/s)" + delimeter +
"V_{Y_{ecef}} (ft/s)" + delimeter +
"V_{Z_{ecef}} (ft/s)" + delimeter;
139 outstream <<
"V_{North} (ft/s)" + delimeter +
"V_{East} (ft/s)" + delimeter +
"V_{Down} (ft/s)";
142 outstream << delimeter;
143 outstream <<
"F_{Drag} (lbs)" + delimeter +
"F_{Side} (lbs)" + delimeter +
"F_{Lift} (lbs)" + delimeter;
144 outstream <<
"L/D" + delimeter;
145 outstream <<
"F_{Aero x} (lbs)" + delimeter +
"F_{Aero y} (lbs)" + delimeter +
"F_{Aero z} (lbs)" + delimeter;
146 outstream <<
"F_{Prop x} (lbs)" + delimeter +
"F_{Prop y} (lbs)" + delimeter +
"F_{Prop z} (lbs)" + delimeter;
147 outstream <<
"F_{Gear x} (lbs)" + delimeter +
"F_{Gear y} (lbs)" + delimeter +
"F_{Gear z} (lbs)" + delimeter;
148 outstream <<
"F_{Ext x} (lbs)" + delimeter +
"F_{Ext y} (lbs)" + delimeter +
"F_{Ext z} (lbs)" + delimeter;
149 outstream <<
"F_{Buoyant x} (lbs)" + delimeter +
"F_{Buoyant y} (lbs)" + delimeter +
"F_{Buoyant z} (lbs)" + delimeter;
150 outstream <<
"F_{Weight x} (lbs)" + delimeter +
"F_{Weight y} (lbs)" + delimeter +
"F_{Weight z} (lbs)" + delimeter;
151 outstream <<
"F_{Total x} (lbs)" + delimeter +
"F_{Total y} (lbs)" + delimeter +
"F_{Total z} (lbs)";
154 outstream << delimeter;
155 outstream <<
"L_{Aero} (ft-lbs)" + delimeter +
"M_{Aero} (ft-lbs)" + delimeter +
"N_{Aero} (ft-lbs)" + delimeter;
156 outstream <<
"L_{Aero MRC} (ft-lbs)" + delimeter +
"M_{Aero MRC} (ft-lbs)" + delimeter +
"N_{Aero MRC} (ft-lbs)" + delimeter;
157 outstream <<
"L_{Prop} (ft-lbs)" + delimeter +
"M_{Prop} (ft-lbs)" + delimeter +
"N_{Prop} (ft-lbs)" + delimeter;
158 outstream <<
"L_{Gear} (ft-lbs)" + delimeter +
"M_{Gear} (ft-lbs)" + delimeter +
"N_{Gear} (ft-lbs)" + delimeter;
159 outstream <<
"L_{ext} (ft-lbs)" + delimeter +
"M_{ext} (ft-lbs)" + delimeter +
"N_{ext} (ft-lbs)" + delimeter;
160 outstream <<
"L_{Buoyant} (ft-lbs)" + delimeter +
"M_{Buoyant} (ft-lbs)" + delimeter +
"N_{Buoyant} (ft-lbs)" + delimeter;
161 outstream <<
"L_{Total} (ft-lbs)" + delimeter +
"M_{Total} (ft-lbs)" + delimeter +
"N_{Total} (ft-lbs)";
164 outstream << delimeter;
165 outstream <<
"Rho (slugs/ft^3)" + delimeter;
166 outstream <<
"Absolute Viscosity" + delimeter;
167 outstream <<
"Kinematic Viscosity" + delimeter;
168 outstream <<
"Temperature (R)" + delimeter;
169 outstream <<
"P_{SL} (psf)" + delimeter;
170 outstream <<
"P_{Ambient} (psf)" + delimeter;
171 outstream <<
"Turbulence Magnitude (ft/sec)" + delimeter;
172 outstream <<
"Turbulence X Direction (deg)" + delimeter;
173 outstream <<
"Wind V_{North} (ft/s)" + delimeter +
"Wind V_{East} (ft/s)" + delimeter +
"Wind V_{Down} (ft/s)" + delimeter;
174 outstream <<
"Roll Turbulence (deg/sec)" + delimeter +
"Pitch Turbulence (deg/sec)" + delimeter +
"Yaw Turbulence (deg/sec)";
177 outstream << delimeter;
178 outstream <<
"I_{xx}" + delimeter;
179 outstream <<
"I_{xy}" + delimeter;
180 outstream <<
"I_{xz}" + delimeter;
181 outstream <<
"I_{yx}" + delimeter;
182 outstream <<
"I_{yy}" + delimeter;
183 outstream <<
"I_{yz}" + delimeter;
184 outstream <<
"I_{zx}" + delimeter;
185 outstream <<
"I_{zy}" + delimeter;
186 outstream <<
"I_{zz}" + delimeter;
187 outstream <<
"Mass" + delimeter;
188 outstream <<
"Weight" + delimeter;
189 outstream <<
"X_{cg}" + delimeter +
"Y_{cg}" + delimeter +
"Z_{cg}";
192 outstream << delimeter;
193 outstream <<
"Altitude ASL (ft)" + delimeter;
194 outstream <<
"Altitude AGL (ft)" + delimeter;
195 outstream <<
"Phi (deg)" + delimeter +
"Theta (deg)" + delimeter +
"Psi (deg)" + delimeter;
196 outstream <<
"Q(1)_{LOCAL}" + delimeter +
"Q(2)_{LOCAL}" + delimeter +
"Q(3)_{LOCAL}" + delimeter +
"Q(4)_{LOCAL}" + delimeter;
197 outstream <<
"Q(1)_{ECEF}" + delimeter +
"Q(2)_{ECEF}" + delimeter +
"Q(3)_{ECEF}" + delimeter +
"Q(4)_{ECEF}" + delimeter;
198 outstream <<
"Q(1)_{ECI}" + delimeter +
"Q(2)_{ECI}" + delimeter +
"Q(3)_{ECI}" + delimeter +
"Q(4)_{ECI}" + delimeter;
199 outstream <<
"Alpha (deg)" + delimeter;
200 outstream <<
"Beta (deg)" + delimeter;
201 outstream <<
"Latitude (deg)" + delimeter;
202 outstream <<
"Latitude Geodetic (deg)" + delimeter;
203 outstream <<
"Longitude (deg)" + delimeter;
204 outstream <<
"X_{ECI} (ft)" + delimeter +
"Y_{ECI} (ft)" + delimeter +
"Z_{ECI} (ft)" + delimeter;
205 outstream <<
"X_{ECEF} (ft)" + delimeter +
"Y_{ECEF} (ft)" + delimeter +
"Z_{ECEF} (ft)" + delimeter;
206 outstream <<
"Earth Position Angle (deg)" + delimeter;
207 outstream <<
"Distance AGL (ft)" + delimeter;
208 outstream <<
"Terrain Elevation (ft)";
211 scratch = Aerodynamics->GetAeroFunctionStrings(delimeter);
212 if (scratch.length() != 0) outstream << delimeter << scratch;
214 if (SubSystems &
ssFCS) {
215 scratch = FCS->GetComponentStrings(delimeter);
216 if (scratch.length() != 0) outstream << delimeter << scratch;
219 outstream << delimeter;
220 outstream << GroundReactions->GetGroundReactionStrings(delimeter);
222 if (SubSystems &
ssPropulsion && Propulsion->GetNumEngines() > 0) {
223 outstream << delimeter;
224 outstream << Propulsion->GetPropulsionStrings(delimeter);
227 for (
unsigned int i=0;i<OutputParameters.size();++i) {
228 if (!OutputCaptions[i].empty())
229 outstream << delimeter << OutputCaptions[i];
231 outstream << delimeter << OutputParameters[i]->GetFullyQualifiedName();
234 if (!PreFunctions.empty()) {
235 for (
unsigned int i=0;i<PreFunctions.size();i++) {
236 outstream << delimeter << PreFunctions[i]->GetName();
251 string scratch = Filename.utf8Str();
253 if (to_upper(scratch) ==
"COUT") {
254 buffer = cout.rdbuf();
256 buffer = datafile.rdbuf();
259 ostream outstream(buffer);
261 outstream.precision(10);
267 outstream << delimeter;
268 outstream << FCS->GetDaCmd() << delimeter;
269 outstream << FCS->GetDeCmd() << delimeter;
270 outstream << FCS->GetDrCmd() << delimeter;
271 outstream << FCS->GetDfCmd() << delimeter;
272 outstream << FCS->GetDaLPos(ofDeg) << delimeter;
273 outstream << FCS->GetDaRPos(ofDeg) << delimeter;
274 outstream << FCS->GetDePos(ofDeg) << delimeter;
275 outstream << FCS->GetDrPos(ofDeg) << delimeter;
276 outstream << FCS->GetDfPos(ofDeg);
279 outstream << delimeter;
280 outstream << (radtodeg*Propagate->GetPQR()).Dump(delimeter) << delimeter;
281 outstream << (radtodeg*Accelerations->GetPQRdot()).Dump(delimeter) << delimeter;
282 outstream << (radtodeg*Propagate->GetPQRi()).Dump(delimeter);
285 outstream << delimeter;
286 outstream << Auxiliary->Getqbar() << delimeter;
287 outstream << Auxiliary->GetReynoldsNumber() << delimeter;
288 outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
289 outstream << Propagate->GetInertialVelocityMagnitude() << delimeter;
290 outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
291 outstream << setprecision(12) << Accelerations->GetUVWdot().Dump(delimeter) << delimeter;
292 outstream << setprecision(12) << Accelerations->GetUVWidot().Dump(delimeter) << delimeter;
293 outstream << setprecision(12) << Accelerations->GetBodyAccel().Dump(delimeter) << delimeter;
294 outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
295 outstream << Propagate->GetInertialVelocity().Dump(delimeter) << delimeter;
296 outstream << Propagate->GetECEFVelocity().Dump(delimeter) << delimeter;
297 outstream << Propagate->GetVel().Dump(delimeter);
298 outstream.precision(10);
301 outstream << delimeter;
302 outstream << Aerodynamics->GetvFw().Dump(delimeter) << delimeter;
303 outstream << Aerodynamics->GetLoD() << delimeter;
304 outstream << Aerodynamics->GetForces().Dump(delimeter) << delimeter;
305 outstream << Propulsion->GetForces().Dump(delimeter) << delimeter;
306 outstream << Accelerations->GetGroundForces().Dump(delimeter) << delimeter;
307 outstream << ExternalReactions->GetForces().Dump(delimeter) << delimeter;
308 outstream << BuoyantForces->GetForces().Dump(delimeter) << delimeter;
309 outstream << Accelerations->GetWeight().Dump(delimeter) << delimeter;
310 outstream << Accelerations->GetForces().Dump(delimeter);
313 outstream << delimeter;
314 outstream << Aerodynamics->GetMoments().Dump(delimeter) << delimeter;
315 outstream << Aerodynamics->GetMomentsMRC().Dump(delimeter) << delimeter;
316 outstream << Propulsion->GetMoments().Dump(delimeter) << delimeter;
317 outstream << Accelerations->GetGroundMoments().Dump(delimeter) << delimeter;
318 outstream << ExternalReactions->GetMoments().Dump(delimeter) << delimeter;
319 outstream << BuoyantForces->GetMoments().Dump(delimeter) << delimeter;
320 outstream << Accelerations->GetMoments().Dump(delimeter);
323 const auto Atmosphere = FDMExec->GetAtmosphere();
324 outstream << delimeter;
325 outstream << Atmosphere->GetDensity() << delimeter;
326 outstream << Atmosphere->GetAbsoluteViscosity() << delimeter;
327 outstream << Atmosphere->GetKinematicViscosity() << delimeter;
328 outstream << Atmosphere->GetTemperature() << delimeter;
329 outstream << Atmosphere->GetPressureSL() << delimeter;
330 outstream << Atmosphere->GetPressure() << delimeter;
331 outstream << Winds->GetTurbMagnitude() << delimeter;
332 outstream << Winds->GetTurbDirection() << delimeter;
333 outstream << Winds->GetTotalWindNED().Dump(delimeter) << delimeter;
334 outstream << (Winds->GetTurbPQR()*radtodeg).Dump(delimeter);
337 outstream << delimeter;
338 outstream << MassBalance->GetJ().Dump(delimeter) << delimeter;
339 outstream << MassBalance->GetMass() << delimeter;
340 outstream << MassBalance->GetWeight() << delimeter;
341 outstream << MassBalance->GetXYZcg().Dump(delimeter);
344 outstream.precision(14);
345 outstream << delimeter;
346 outstream << Propagate->GetAltitudeASL() << delimeter;
347 outstream << Propagate->GetDistanceAGL() << delimeter;
348 outstream << (radtodeg*Propagate->GetEuler()).Dump(delimeter) << delimeter;
349 outstream << Propagate->GetQuaternion().Dump(delimeter) << delimeter;
351 outstream << Qec.Dump(delimeter) << delimeter;
352 outstream << Propagate->GetQuaternionECI().Dump(delimeter) << delimeter;
353 outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
354 outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
355 outstream << Propagate->GetLatitudeDeg() << delimeter;
356 outstream << Propagate->GetGeodLatitudeDeg() << delimeter;
357 outstream << Propagate->GetLongitudeDeg() << delimeter;
358 outstream.precision(18);
359 outstream << ((
FGColumnVector3)Propagate->GetInertialPosition()).Dump(delimeter) << delimeter;
360 outstream << ((
FGColumnVector3)Propagate->GetLocation()).Dump(delimeter) << delimeter;
361 outstream.precision(14);
362 outstream << Propagate->GetEarthPositionAngleDeg() << delimeter;
363 outstream << Propagate->GetDistanceAGL() << delimeter;
364 outstream << Propagate->GetTerrainElevation();
365 outstream.precision(10);
368 scratch = Aerodynamics->GetAeroFunctionValues(delimeter);
369 if (scratch.length() != 0) outstream << delimeter << scratch;
371 if (SubSystems &
ssFCS) {
372 scratch = FCS->GetComponentValues(delimeter);
373 if (scratch.length() != 0) outstream << delimeter << scratch;
376 outstream << delimeter;
377 outstream << GroundReactions->GetGroundReactionValues(delimeter);
379 if (SubSystems &
ssPropulsion && Propulsion->GetNumEngines() > 0) {
380 outstream << delimeter;
381 outstream << Propulsion->GetPropulsionValues(delimeter);
384 outstream.precision(18);
385 for (
unsigned int i=0;i<OutputParameters.size();++i) {
386 outstream << delimeter << OutputParameters[i]->GetValue();
388 for (
unsigned int i=0;i<PreFunctions.size();i++) {
389 outstream << delimeter << PreFunctions[i]->getDoubleValue();
391 outstream.precision(10);