1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 Purpose: Manage output of sim parameters to file or stdout
9 ------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
11 This program is free software; you can redistribute it and/or modify it under
12 the terms of the GNU 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 --------------------------------------------------------------------------------
37 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
43 #include "FGFDMExec.h"
44 #include "FGAtmosphere.h"
46 #include "FGAerodynamics.h"
47 #include "FGGroundReactions.h"
48 #include "FGAircraft.h"
49 #include "FGMassBalance.h"
50 #include "FGPropagate.h"
51 #include "FGAuxiliary.h"
52 #include "FGInertial.h"
59 static const char *IdSrc = "$Id$";
60 static const char *IdHdr = ID_OUTPUT;
62 using std::setprecision;
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
68 FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
71 sFirstPass = dFirstPass = true;
83 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88 OutputProperties.clear();
92 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 bool FGOutput::Run(void)
96 if (FGModel::Run()) return true;
98 if (enabled && !State->IntegrationSuspended()&& !FDMExec->Holding()) {
99 if (Type == otSocket) {
101 } else if (Type == otCSV || Type == otTab) {
102 DelimitedOutput(Filename);
103 } else if (Type == otTerminal) {
105 } else if (Type == otNone) {
108 // Not a valid type of output
114 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
116 void FGOutput::SetType(string type)
121 } else if (type == "TABULAR") {
124 } else if (type == "SOCKET") {
126 } else if (type == "TERMINAL") {
128 } else if (type != string("NONE")) {
130 cerr << "Unknown type of output specified in config file" << endl;
134 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
136 void FGOutput::DelimitedOutput(string fname)
141 if (fname == "COUT" || fname == "cout") {
142 buffer = cout.rdbuf();
144 datafile.open(fname.c_str());
145 buffer = datafile.rdbuf();
148 ostream outstream(buffer);
150 outstream.precision(10);
154 if (SubSystems & ssSimulation) {
157 if (SubSystems & ssAerosurfaces) {
158 outstream << delimeter;
159 outstream << "Aileron Command (norm)" + delimeter;
160 outstream << "Elevator Command (norm)" + delimeter;
161 outstream << "Rudder Command (norm)" + delimeter;
162 outstream << "Flap Command (norm)" + delimeter;
163 outstream << "Left Aileron Position (deg)" + delimeter;
164 outstream << "Right Aileron Position (deg)" + delimeter;
165 outstream << "Elevator Position (deg)" + delimeter;
166 outstream << "Rudder Position (deg)" + delimeter;
167 outstream << "Flap Position (deg)";
169 if (SubSystems & ssRates) {
170 outstream << delimeter;
171 outstream << "P (deg/s)" + delimeter + "Q (deg/s)" + delimeter + "R (deg/s)" + delimeter;
172 outstream << "P dot (deg/s^2)" + delimeter + "Q dot (deg/s^2)" + delimeter + "R dot (deg/s^2)";
174 if (SubSystems & ssVelocities) {
175 outstream << delimeter;
176 outstream << "q bar (psf)" + delimeter;
177 outstream << "V_{Total} (ft/s)" + delimeter;
178 outstream << "UBody" + delimeter + "VBody" + delimeter + "WBody" + delimeter;
179 outstream << "Aero V_{X Body} (ft/s)" + delimeter + "Aero V_{Y Body} (ft/s)" + delimeter + "Aero V_{Z Body} (ft/s)" + delimeter;
180 outstream << "V_{North} (ft/s)" + delimeter + "V_{East} (ft/s)" + delimeter + "V_{Down} (ft/s)";
182 if (SubSystems & ssForces) {
183 outstream << delimeter;
184 outstream << "F_{Drag} (lbs)" + delimeter + "F_{Side} (lbs)" + delimeter + "F_{Lift} (lbs)" + delimeter;
185 outstream << "L/D" + delimeter;
186 outstream << "F_X (lbs)" + delimeter + "F_Y (lbs)" + delimeter + "F_Z (lbs)";
188 if (SubSystems & ssMoments) {
189 outstream << delimeter;
190 outstream << "L (ft-lbs)" + delimeter + "M (ft-lbs)" + delimeter + "N (ft-lbs)";
192 if (SubSystems & ssAtmosphere) {
193 outstream << delimeter;
194 outstream << "Rho (slugs/ft^3)" + delimeter;
195 outstream << "P_{SL} (psf)" + delimeter;
196 outstream << "P_{Ambient} (psf)" + delimeter;
197 outstream << "Wind V_{North} (ft/s)" + delimeter + "Wind V_{East} (ft/s)" + delimeter + "Wind V_{Down} (ft/s)";
199 if (SubSystems & ssMassProps) {
200 outstream << delimeter;
201 outstream << "I_xx" + delimeter;
202 outstream << "I_xy" + delimeter;
203 outstream << "I_xz" + delimeter;
204 outstream << "I_yx" + delimeter;
205 outstream << "I_yy" + delimeter;
206 outstream << "I_yz" + delimeter;
207 outstream << "I_zx" + delimeter;
208 outstream << "I_zy" + delimeter;
209 outstream << "I_zz" + delimeter;
210 outstream << "Mass" + delimeter;
211 outstream << "X_cg" + delimeter + "Y_cg" + delimeter + "Z_cg";
213 if (SubSystems & ssPropagate) {
214 outstream << delimeter;
215 outstream << "Altitude (ft)" + delimeter;
216 outstream << "Phi (deg)" + delimeter + "Theta (deg)" + delimeter + "Psi (deg)" + delimeter;
217 outstream << "Alpha (deg)" + delimeter;
218 outstream << "Beta (deg)" + delimeter;
219 outstream << "Latitude (deg)" + delimeter;
220 outstream << "Longitude (deg)" + delimeter;
221 outstream << "Distance AGL (ft)" + delimeter;
222 outstream << "Runway Radius (ft)";
224 if (SubSystems & ssCoefficients) {
225 scratch = Aerodynamics->GetCoefficientStrings(delimeter);
226 if (scratch.length() != 0) outstream << delimeter << scratch;
228 if (SubSystems & ssFCS) {
229 scratch = FCS->GetComponentStrings(delimeter);
230 if (scratch.length() != 0) outstream << delimeter << scratch;
232 if (SubSystems & ssGroundReactions) {
233 outstream << delimeter;
234 outstream << GroundReactions->GetGroundReactionStrings(delimeter);
236 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
237 outstream << delimeter;
238 outstream << Propulsion->GetPropulsionStrings(delimeter);
240 if (OutputProperties.size() > 0) {
241 for (unsigned int i=0;i<OutputProperties.size();i++) {
242 outstream << delimeter << OutputProperties[i]->GetPrintableName();
250 outstream << State->Getsim_time();
251 if (SubSystems & ssSimulation) {
253 if (SubSystems & ssAerosurfaces) {
254 outstream << delimeter;
255 outstream << FCS->GetDaCmd() << delimeter;
256 outstream << FCS->GetDeCmd() << delimeter;
257 outstream << FCS->GetDrCmd() << delimeter;
258 outstream << FCS->GetDfCmd() << delimeter;
259 outstream << FCS->GetDaLPos(ofDeg) << delimeter;
260 outstream << FCS->GetDaRPos(ofDeg) << delimeter;
261 outstream << FCS->GetDePos(ofDeg) << delimeter;
262 outstream << FCS->GetDrPos(ofDeg) << delimeter;
263 outstream << FCS->GetDfPos(ofDeg);
265 if (SubSystems & ssRates) {
266 outstream << delimeter;
267 outstream << (radtodeg*Propagate->GetPQR()).Dump(delimeter) << delimeter;
268 outstream << (radtodeg*Propagate->GetPQRdot()).Dump(delimeter);
270 if (SubSystems & ssVelocities) {
271 outstream << delimeter;
272 outstream << Auxiliary->Getqbar() << delimeter;
273 outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
274 outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
275 outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
276 outstream << Propagate->GetVel().Dump(delimeter);
278 if (SubSystems & ssForces) {
279 outstream << delimeter;
280 outstream << Aerodynamics->GetvFs() << delimeter;
281 outstream << Aerodynamics->GetLoD() << delimeter;
282 outstream << Aircraft->GetForces().Dump(delimeter);
284 if (SubSystems & ssMoments) {
285 outstream << delimeter;
286 outstream << Aircraft->GetMoments().Dump(delimeter);
288 if (SubSystems & ssAtmosphere) {
289 outstream << delimeter;
290 outstream << Atmosphere->GetDensity() << delimeter;
291 outstream << Atmosphere->GetPressureSL() << delimeter;
292 outstream << Atmosphere->GetPressure() << delimeter;
293 outstream << Atmosphere->GetWindNED().Dump(delimeter);
295 if (SubSystems & ssMassProps) {
296 outstream << delimeter;
297 outstream << MassBalance->GetJ() << delimeter;
298 outstream << MassBalance->GetMass() << delimeter;
299 outstream << MassBalance->GetXYZcg();
301 if (SubSystems & ssPropagate) {
302 outstream << delimeter;
303 outstream << Propagate->Geth() << delimeter;
304 outstream << (radtodeg*Propagate->GetEuler()).Dump(delimeter) << delimeter;
305 outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
306 outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
307 outstream << Propagate->GetLocation().GetLatitudeDeg() << delimeter;
308 outstream << Propagate->GetLocation().GetLongitudeDeg() << delimeter;
309 outstream << Propagate->GetDistanceAGL() << delimeter;
310 outstream << Propagate->GetRunwayRadius();
312 if (SubSystems & ssCoefficients) {
313 scratch = Aerodynamics->GetCoefficientValues(delimeter);
314 if (scratch.length() != 0) outstream << delimeter << scratch;
316 if (SubSystems & ssFCS) {
317 scratch = FCS->GetComponentValues(delimeter);
318 if (scratch.length() != 0) outstream << delimeter << scratch;
320 if (SubSystems & ssGroundReactions) {
321 outstream << delimeter;
322 outstream << GroundReactions->GetGroundReactionValues(delimeter);
324 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
325 outstream << delimeter;
326 outstream << Propulsion->GetPropulsionValues(delimeter);
329 for (unsigned int i=0;i<OutputProperties.size();i++) {
330 outstream << delimeter << OutputProperties[i]->getDoubleValue();
337 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
339 void FGOutput::SocketOutput(void)
341 string asciiData, scratch;
343 if (socket == NULL) return;
344 if (!socket->GetConnectStatus()) return;
348 socket->Clear("<LABELS>");
349 socket->Append("Time");
351 if (SubSystems & ssAerosurfaces) {
352 socket->Append("Aileron Command");
353 socket->Append("Elevator Command");
354 socket->Append("Rudder Command");
355 socket->Append("Flap Command");
356 socket->Append("Left Aileron Position");
357 socket->Append("Right Aileron Position");
358 socket->Append("Elevator Position");
359 socket->Append("Rudder Position");
360 socket->Append("Flap Position");
363 if (SubSystems & ssRates) {
367 socket->Append("PDot");
368 socket->Append("QDot");
369 socket->Append("RDot");
372 if (SubSystems & ssVelocities) {
373 socket->Append("QBar");
374 socket->Append("Vtotal");
375 socket->Append("UBody");
376 socket->Append("VBody");
377 socket->Append("WBody");
378 socket->Append("UAero");
379 socket->Append("VAero");
380 socket->Append("WAero");
381 socket->Append("Vn");
382 socket->Append("Ve");
383 socket->Append("Vd");
385 if (SubSystems & ssForces) {
386 socket->Append("F_Drag");
387 socket->Append("F_Side");
388 socket->Append("F_Lift");
389 socket->Append("LoD");
390 socket->Append("Fx");
391 socket->Append("Fy");
392 socket->Append("Fz");
394 if (SubSystems & ssMoments) {
399 if (SubSystems & ssAtmosphere) {
400 socket->Append("Rho");
401 socket->Append("SL pressure");
402 socket->Append("Ambient pressure");
403 socket->Append("NWind");
404 socket->Append("EWind");
405 socket->Append("DWind");
407 if (SubSystems & ssMassProps) {
408 socket->Append("Ixx");
409 socket->Append("Ixy");
410 socket->Append("Ixz");
411 socket->Append("Iyx");
412 socket->Append("Iyy");
413 socket->Append("Iyz");
414 socket->Append("Izx");
415 socket->Append("Izy");
416 socket->Append("Izz");
417 socket->Append("Mass");
418 socket->Append("Xcg");
419 socket->Append("Ycg");
420 socket->Append("Zcg");
422 if (SubSystems & ssPropagate) {
423 socket->Append("Altitude");
424 socket->Append("Phi (deg)");
425 socket->Append("Tht (deg)");
426 socket->Append("Psi (deg)");
427 socket->Append("Alpha (deg)");
428 socket->Append("Beta (deg)");
429 socket->Append("Latitude (deg)");
430 socket->Append("Longitude (deg)");
432 if (SubSystems & ssCoefficients) {
433 scratch = Aerodynamics->GetCoefficientStrings(",");
434 if (scratch.length() != 0) socket->Append(scratch);
436 if (SubSystems & ssFCS) {
437 scratch = FCS->GetComponentStrings(",");
438 if (scratch.length() != 0) socket->Append(scratch);
440 if (SubSystems & ssGroundReactions) {
441 socket->Append(GroundReactions->GetGroundReactionStrings(","));
443 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
444 socket->Append(Propulsion->GetPropulsionStrings(","));
446 if (OutputProperties.size() > 0) {
447 for (unsigned int i=0;i<OutputProperties.size();i++) {
448 socket->Append(OutputProperties[i]->GetPrintableName());
457 socket->Append(State->Getsim_time());
459 if (SubSystems & ssAerosurfaces) {
460 socket->Append(FCS->GetDaCmd());
461 socket->Append(FCS->GetDeCmd());
462 socket->Append(FCS->GetDrCmd());
463 socket->Append(FCS->GetDfCmd());
464 socket->Append(FCS->GetDaLPos());
465 socket->Append(FCS->GetDaRPos());
466 socket->Append(FCS->GetDePos());
467 socket->Append(FCS->GetDrPos());
468 socket->Append(FCS->GetDfPos());
470 if (SubSystems & ssRates) {
471 socket->Append(radtodeg*Propagate->GetPQR(eP));
472 socket->Append(radtodeg*Propagate->GetPQR(eQ));
473 socket->Append(radtodeg*Propagate->GetPQR(eR));
474 socket->Append(radtodeg*Propagate->GetPQRdot(eP));
475 socket->Append(radtodeg*Propagate->GetPQRdot(eQ));
476 socket->Append(radtodeg*Propagate->GetPQRdot(eR));
478 if (SubSystems & ssVelocities) {
479 socket->Append(Auxiliary->Getqbar());
480 socket->Append(Auxiliary->GetVt());
481 socket->Append(Propagate->GetUVW(eU));
482 socket->Append(Propagate->GetUVW(eV));
483 socket->Append(Propagate->GetUVW(eW));
484 socket->Append(Auxiliary->GetAeroUVW(eU));
485 socket->Append(Auxiliary->GetAeroUVW(eV));
486 socket->Append(Auxiliary->GetAeroUVW(eW));
487 socket->Append(Propagate->GetVel(eNorth));
488 socket->Append(Propagate->GetVel(eEast));
489 socket->Append(Propagate->GetVel(eDown));
491 if (SubSystems & ssForces) {
492 socket->Append(Aerodynamics->GetvFs()(eDrag));
493 socket->Append(Aerodynamics->GetvFs()(eSide));
494 socket->Append(Aerodynamics->GetvFs()(eLift));
495 socket->Append(Aerodynamics->GetLoD());
496 socket->Append(Aircraft->GetForces(eX));
497 socket->Append(Aircraft->GetForces(eY));
498 socket->Append(Aircraft->GetForces(eZ));
500 if (SubSystems & ssMoments) {
501 socket->Append(Aircraft->GetMoments(eL));
502 socket->Append(Aircraft->GetMoments(eM));
503 socket->Append(Aircraft->GetMoments(eN));
505 if (SubSystems & ssAtmosphere) {
506 socket->Append(Atmosphere->GetDensity());
507 socket->Append(Atmosphere->GetPressureSL());
508 socket->Append(Atmosphere->GetPressure());
509 socket->Append(Atmosphere->GetWindNED().Dump(","));
511 if (SubSystems & ssMassProps) {
512 socket->Append(MassBalance->GetJ()(1,1));
513 socket->Append(MassBalance->GetJ()(1,2));
514 socket->Append(MassBalance->GetJ()(1,3));
515 socket->Append(MassBalance->GetJ()(2,1));
516 socket->Append(MassBalance->GetJ()(2,2));
517 socket->Append(MassBalance->GetJ()(2,3));
518 socket->Append(MassBalance->GetJ()(3,1));
519 socket->Append(MassBalance->GetJ()(3,2));
520 socket->Append(MassBalance->GetJ()(3,3));
521 socket->Append(MassBalance->GetMass());
522 socket->Append(MassBalance->GetXYZcg()(eX));
523 socket->Append(MassBalance->GetXYZcg()(eY));
524 socket->Append(MassBalance->GetXYZcg()(eZ));
526 if (SubSystems & ssPropagate) {
527 socket->Append(Propagate->Geth());
528 socket->Append(radtodeg*Propagate->GetEuler(ePhi));
529 socket->Append(radtodeg*Propagate->GetEuler(eTht));
530 socket->Append(radtodeg*Propagate->GetEuler(ePsi));
531 socket->Append(Auxiliary->Getalpha(inDegrees));
532 socket->Append(Auxiliary->Getbeta(inDegrees));
533 socket->Append(Propagate->GetLocation().GetLatitudeDeg());
534 socket->Append(Propagate->GetLocation().GetLongitudeDeg());
536 if (SubSystems & ssCoefficients) {
537 scratch = Aerodynamics->GetCoefficientValues(",");
538 if (scratch.length() != 0) socket->Append(scratch);
540 if (SubSystems & ssFCS) {
541 scratch = FCS->GetComponentValues(",");
542 if (scratch.length() != 0) socket->Append(scratch);
544 if (SubSystems & ssGroundReactions) {
545 socket->Append(GroundReactions->GetGroundReactionValues(","));
547 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
548 socket->Append(Propulsion->GetPropulsionValues(","));
551 for (unsigned int i=0;i<OutputProperties.size();i++) {
552 socket->Append(OutputProperties[i]->getDoubleValue());
558 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
560 void FGOutput::SocketStatusOutput(string out_str)
564 if (socket == NULL) return;
567 asciiData = string("<STATUS>") + out_str;
568 socket->Append(asciiData.c_str());
572 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
574 bool FGOutput::Load(Element* element)
576 string type="", parameter="";
577 string name="", fname="";
581 Element *property_element;
583 string separator = "/";
588 if (!DirectivesFile.empty()) { // A directives filename from the command line overrides
589 fname = DirectivesFile; // one found in the config file.
591 fname = element->GetAttributeValue("file");
594 if (!fname.empty()) {
595 int len = fname.size();
596 if (fname.find(".xml") != string::npos) {
597 output_file_name = fname; // Use supplied name if last four letters are ".xml"
599 output_file_name = FDMExec->GetFullAircraftPath() + separator + fname + ".xml";
601 document = LoadXMLDocument(output_file_name);
606 name = document->GetAttributeValue("name");
607 type = document->GetAttributeValue("type");
609 if (!document->GetAttributeValue("port").empty() && type == string("SOCKET")) {
610 port = atoi(document->GetAttributeValue("port").c_str());
611 socket = new FGfdmSocket(name, port);
615 if (!document->GetAttributeValue("rate").empty()) {
616 OutRate = (int)document->GetAttributeValueAsNumber("rate");
621 if (document->FindElementValue("simulation") == string("ON"))
622 SubSystems += ssSimulation;
623 if (document->FindElementValue("aerosurfaces") == string("ON"))
624 SubSystems += ssAerosurfaces;
625 if (document->FindElementValue("rates") == string("ON"))
626 SubSystems += ssRates;
627 if (document->FindElementValue("velocities") == string("ON"))
628 SubSystems += ssVelocities;
629 if (document->FindElementValue("forces") == string("ON"))
630 SubSystems += ssForces;
631 if (document->FindElementValue("moments") == string("ON"))
632 SubSystems += ssMoments;
633 if (document->FindElementValue("atmosphere") == string("ON"))
634 SubSystems += ssAtmosphere;
635 if (document->FindElementValue("massprops") == string("ON"))
636 SubSystems += ssMassProps;
637 if (document->FindElementValue("position") == string("ON"))
638 SubSystems += ssPropagate;
639 if (document->FindElementValue("coefficients") == string("ON"))
640 SubSystems += ssCoefficients;
641 if (document->FindElementValue("ground_reactions") == string("ON"))
642 SubSystems += ssGroundReactions;
643 if (document->FindElementValue("fcs") == string("ON"))
645 if (document->FindElementValue("propulsion") == string("ON"))
646 SubSystems += ssPropulsion;
647 property_element = document->FindElement("property");
648 while (property_element) {
649 string property = property_element->GetDataLine();
650 OutputProperties.push_back(PropertyManager->GetNode(property));
651 property_element = document->FindNextElement("property");
654 OutRate = OutRate>1000?1000:(OutRate<0?0:OutRate);
655 rate = (int)(0.5 + 1.0/(State->Getdt()*OutRate));
662 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
663 // The bitmasked value choices are as follows:
664 // unset: In this case (the default) JSBSim would only print
665 // out the normally expected messages, essentially echoing
666 // the config files as they are read. If the environment
667 // variable is not set, debug_lvl is set to 1 internally
668 // 0: This requests JSBSim not to output any messages
670 // 1: This value explicity requests the normal JSBSim
672 // 2: This value asks for a message to be printed out when
673 // a class is instantiated
674 // 4: When this value is set, a message is displayed when a
675 // FGModel object executes its Run() method
676 // 8: When this value is set, various runtime state variables
677 // are printed out periodically
678 // 16: When set various parameters are sanity checked and
679 // a message is printed out when they go out of bounds
681 void FGOutput::Debug(int from)
685 if (debug_lvl <= 0) return;
687 if (debug_lvl & 1) { // Standard console startup message output
688 if (from == 0) { // Constructor
692 if (output_file_name.empty())
693 cout << " " << "Output parameters read inline" << endl;
695 cout << " Output parameters read from file: " << output_file_name << endl;
697 if (Filename == "cout" || Filename == "COUT") {
698 scratch = " Log output goes to screen console";
699 } else if (!Filename.empty()) {
700 scratch = " Log output goes to file: " + Filename;
704 cout << scratch << " in CSV format output at rate " << 1/(State->Getdt()*rate) << " Hz" << endl;
707 cout << " No log output" << endl;
711 if (SubSystems & ssSimulation) cout << " Simulation parameters logged" << endl;
712 if (SubSystems & ssAerosurfaces) cout << " Aerosurface parameters logged" << endl;
713 if (SubSystems & ssRates) cout << " Rate parameters logged" << endl;
714 if (SubSystems & ssVelocities) cout << " Velocity parameters logged" << endl;
715 if (SubSystems & ssForces) cout << " Force parameters logged" << endl;
716 if (SubSystems & ssMoments) cout << " Moments parameters logged" << endl;
717 if (SubSystems & ssAtmosphere) cout << " Atmosphere parameters logged" << endl;
718 if (SubSystems & ssMassProps) cout << " Mass parameters logged" << endl;
719 if (SubSystems & ssCoefficients) cout << " Coefficient parameters logged" << endl;
720 if (SubSystems & ssPropagate) cout << " Propagate parameters logged" << endl;
721 if (SubSystems & ssGroundReactions) cout << " Ground parameters logged" << endl;
722 if (SubSystems & ssFCS) cout << " FCS parameters logged" << endl;
723 if (SubSystems & ssPropulsion) cout << " Propulsion parameters logged" << endl;
724 if (OutputProperties.size() > 0) cout << " Properties logged:" << endl;
725 for (unsigned int i=0;i<OutputProperties.size();i++) {
726 cout << " - " << OutputProperties[i]->GetName() << endl;
730 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
731 if (from == 0) cout << "Instantiated: FGOutput" << endl;
732 if (from == 1) cout << "Destroyed: FGOutput" << endl;
734 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
736 if (debug_lvl & 8 ) { // Runtime state variables
738 if (debug_lvl & 16) { // Sanity checking
740 if (debug_lvl & 64) {
741 if (from == 0) { // Constructor
742 cout << IdSrc << endl;
743 cout << IdHdr << endl;