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 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
66 FGOutput::FGOutput(FGFDMExec* fdmex) : FGModel(fdmex)
69 sFirstPass = dFirstPass = true;
81 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
86 OutputProperties.clear();
90 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 bool FGOutput::Run(void)
94 if (FGModel::Run()) return true;
96 if (enabled && !State->IntegrationSuspended()&& !FDMExec->Holding()) {
97 if (Type == otSocket) {
99 } else if (Type == otCSV || Type == otTab) {
100 DelimitedOutput(Filename);
101 } else if (Type == otTerminal) {
103 } else if (Type == otNone) {
106 // Not a valid type of output
112 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114 void FGOutput::SetType(string type)
119 } else if (type == "TABULAR") {
122 } else if (type == "SOCKET") {
124 } else if (type == "TERMINAL") {
126 } else if (type != string("NONE")) {
128 cerr << "Unknown type of output specified in config file" << endl;
132 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
134 void FGOutput::DelimitedOutput(string fname)
139 if (fname == "COUT" || fname == "cout") {
140 buffer = cout.rdbuf();
142 datafile.open(fname.c_str());
143 buffer = datafile.rdbuf();
146 ostream outstream(buffer);
148 outstream.precision(10);
152 if (SubSystems & ssSimulation) {
155 if (SubSystems & ssAerosurfaces) {
156 outstream << delimeter;
157 outstream << "Aileron Command (norm)" + delimeter;
158 outstream << "Elevator Command (norm)" + delimeter;
159 outstream << "Rudder Command (norm)" + delimeter;
160 outstream << "Flap Command (norm)" + delimeter;
161 outstream << "Left Aileron Position (deg)" + delimeter;
162 outstream << "Right Aileron Position (deg)" + delimeter;
163 outstream << "Elevator Position (deg)" + delimeter;
164 outstream << "Rudder Position (deg)" + delimeter;
165 outstream << "Flap Position (deg)";
167 if (SubSystems & ssRates) {
168 outstream << delimeter;
169 outstream << "P (deg/s)" + delimeter + "Q (deg/s)" + delimeter + "R (deg/s)" + delimeter;
170 outstream << "P dot (deg/s^2)" + delimeter + "Q dot (deg/s^2)" + delimeter + "R dot (deg/s^2)";
172 if (SubSystems & ssVelocities) {
173 outstream << delimeter;
174 outstream << "q bar (psf)" + delimeter;
175 outstream << "V_{Total} (ft/s)" + delimeter;
176 outstream << "UBody" + delimeter + "VBody" + delimeter + "WBody" + delimeter;
177 outstream << "Aero V_{X Body} (ft/s)" + delimeter + "Aero V_{Y Body} (ft/s)" + delimeter + "Aero V_{Z Body} (ft/s)" + delimeter;
178 outstream << "V_{North} (ft/s)" + delimeter + "V_{East} (ft/s)" + delimeter + "V_{Down} (ft/s)";
180 if (SubSystems & ssForces) {
181 outstream << delimeter;
182 outstream << "F_{Drag} (lbs)" + delimeter + "F_{Side} (lbs)" + delimeter + "F_{Lift} (lbs)" + delimeter;
183 outstream << "L/D" + delimeter;
184 outstream << "F_X (lbs)" + delimeter + "F_Y (lbs)" + delimeter + "F_Z (lbs)";
186 if (SubSystems & ssMoments) {
187 outstream << delimeter;
188 outstream << "L (ft-lbs)" + delimeter + "M (ft-lbs)" + delimeter + "N (ft-lbs)";
190 if (SubSystems & ssAtmosphere) {
191 outstream << delimeter;
192 outstream << "Rho (slugs/ft^3)" + delimeter;
193 outstream << "P_{SL} (psf)" + delimeter;
194 outstream << "P_{Ambient} (psf)" + delimeter;
195 outstream << "Wind V_{North} (ft/s)" + delimeter + "Wind V_{East} (ft/s)" + delimeter + "Wind V_{Down} (ft/s)";
197 if (SubSystems & ssMassProps) {
198 outstream << delimeter;
199 outstream << "I_xx" + delimeter;
200 outstream << "I_xy" + delimeter;
201 outstream << "I_xz" + delimeter;
202 outstream << "I_yx" + delimeter;
203 outstream << "I_yy" + delimeter;
204 outstream << "I_yz" + delimeter;
205 outstream << "I_zx" + delimeter;
206 outstream << "I_zy" + delimeter;
207 outstream << "I_zz" + delimeter;
208 outstream << "Mass" + delimeter;
209 outstream << "X_cg" + delimeter + "Y_cg" + delimeter + "Z_cg";
211 if (SubSystems & ssPropagate) {
212 outstream << delimeter;
213 outstream << "Altitude (ft)" + delimeter;
214 outstream << "Phi (deg)" + delimeter + "Theta (deg)" + delimeter + "Psi (deg)" + delimeter;
215 outstream << "Alpha (deg)" + delimeter;
216 outstream << "Beta (deg)" + delimeter;
217 outstream << "Latitude (deg)" + delimeter;
218 outstream << "Longitude (deg)" + delimeter;
219 outstream << "Distance AGL (ft)" + delimeter;
220 outstream << "Runway Radius (ft)";
222 if (SubSystems & ssCoefficients) {
223 scratch = Aerodynamics->GetCoefficientStrings(delimeter);
224 if (scratch.length() != 0) outstream << delimeter << scratch;
226 if (SubSystems & ssFCS) {
227 scratch = FCS->GetComponentStrings(delimeter);
228 if (scratch.length() != 0) outstream << delimeter << scratch;
230 if (SubSystems & ssGroundReactions) {
231 outstream << delimeter;
232 outstream << GroundReactions->GetGroundReactionStrings(delimeter);
234 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
235 outstream << delimeter;
236 outstream << Propulsion->GetPropulsionStrings(delimeter);
238 if (OutputProperties.size() > 0) {
239 for (unsigned int i=0;i<OutputProperties.size();i++) {
240 outstream << delimeter << OutputProperties[i]->GetPrintableName();
248 outstream << State->Getsim_time();
249 if (SubSystems & ssSimulation) {
251 if (SubSystems & ssAerosurfaces) {
252 outstream << delimeter;
253 outstream << FCS->GetDaCmd() << delimeter;
254 outstream << FCS->GetDeCmd() << delimeter;
255 outstream << FCS->GetDrCmd() << delimeter;
256 outstream << FCS->GetDfCmd() << delimeter;
257 outstream << FCS->GetDaLPos(ofDeg) << delimeter;
258 outstream << FCS->GetDaRPos(ofDeg) << delimeter;
259 outstream << FCS->GetDePos(ofDeg) << delimeter;
260 outstream << FCS->GetDrPos(ofDeg) << delimeter;
261 outstream << FCS->GetDfPos(ofDeg);
263 if (SubSystems & ssRates) {
264 outstream << delimeter;
265 outstream << (radtodeg*Propagate->GetPQR()).Dump(delimeter) << delimeter;
266 outstream << (radtodeg*Propagate->GetPQRdot()).Dump(delimeter);
268 if (SubSystems & ssVelocities) {
269 outstream << delimeter;
270 outstream << Auxiliary->Getqbar() << delimeter;
271 outstream << setprecision(12) << Auxiliary->GetVt() << delimeter;
272 outstream << setprecision(12) << Propagate->GetUVW().Dump(delimeter) << delimeter;
273 outstream << Auxiliary->GetAeroUVW().Dump(delimeter) << delimeter;
274 outstream << Propagate->GetVel().Dump(delimeter);
276 if (SubSystems & ssForces) {
277 outstream << delimeter;
278 outstream << Aerodynamics->GetvFs() << delimeter;
279 outstream << Aerodynamics->GetLoD() << delimeter;
280 outstream << Aircraft->GetForces().Dump(delimeter);
282 if (SubSystems & ssMoments) {
283 outstream << delimeter;
284 outstream << Aircraft->GetMoments().Dump(delimeter);
286 if (SubSystems & ssAtmosphere) {
287 outstream << delimeter;
288 outstream << Atmosphere->GetDensity() << delimeter;
289 outstream << Atmosphere->GetPressureSL() << delimeter;
290 outstream << Atmosphere->GetPressure() << delimeter;
291 outstream << Atmosphere->GetWindNED().Dump(delimeter);
293 if (SubSystems & ssMassProps) {
294 outstream << delimeter;
295 outstream << MassBalance->GetJ() << delimeter;
296 outstream << MassBalance->GetMass() << delimeter;
297 outstream << MassBalance->GetXYZcg();
299 if (SubSystems & ssPropagate) {
300 outstream << delimeter;
301 outstream << Propagate->Geth() << delimeter;
302 outstream << (radtodeg*Propagate->GetEuler()).Dump(delimeter) << delimeter;
303 outstream << Auxiliary->Getalpha(inDegrees) << delimeter;
304 outstream << Auxiliary->Getbeta(inDegrees) << delimeter;
305 outstream << Propagate->GetLocation().GetLatitudeDeg() << delimeter;
306 outstream << Propagate->GetLocation().GetLongitudeDeg() << delimeter;
307 outstream << Propagate->GetDistanceAGL() << delimeter;
308 outstream << Propagate->GetRunwayRadius();
310 if (SubSystems & ssCoefficients) {
311 scratch = Aerodynamics->GetCoefficientValues(delimeter);
312 if (scratch.length() != 0) outstream << delimeter << scratch;
314 if (SubSystems & ssFCS) {
315 scratch = FCS->GetComponentValues(delimeter);
316 if (scratch.length() != 0) outstream << delimeter << scratch;
318 if (SubSystems & ssGroundReactions) {
319 outstream << delimeter;
320 outstream << GroundReactions->GetGroundReactionValues(delimeter);
322 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
323 outstream << delimeter;
324 outstream << Propulsion->GetPropulsionValues(delimeter);
327 for (unsigned int i=0;i<OutputProperties.size();i++) {
328 outstream << delimeter << OutputProperties[i]->getDoubleValue();
335 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
337 void FGOutput::SocketOutput(void)
339 string asciiData, scratch;
341 if (socket == NULL) return;
342 if (!socket->GetConnectStatus()) return;
346 socket->Clear("<LABELS>");
347 socket->Append("Time");
349 if (SubSystems & ssAerosurfaces) {
350 socket->Append("Aileron Command");
351 socket->Append("Elevator Command");
352 socket->Append("Rudder Command");
353 socket->Append("Flap Command");
354 socket->Append("Left Aileron Position");
355 socket->Append("Right Aileron Position");
356 socket->Append("Elevator Position");
357 socket->Append("Rudder Position");
358 socket->Append("Flap Position");
361 if (SubSystems & ssRates) {
365 socket->Append("PDot");
366 socket->Append("QDot");
367 socket->Append("RDot");
370 if (SubSystems & ssVelocities) {
371 socket->Append("QBar");
372 socket->Append("Vtotal");
373 socket->Append("UBody");
374 socket->Append("VBody");
375 socket->Append("WBody");
376 socket->Append("UAero");
377 socket->Append("VAero");
378 socket->Append("WAero");
379 socket->Append("Vn");
380 socket->Append("Ve");
381 socket->Append("Vd");
383 if (SubSystems & ssForces) {
384 socket->Append("F_Drag");
385 socket->Append("F_Side");
386 socket->Append("F_Lift");
387 socket->Append("LoD");
388 socket->Append("Fx");
389 socket->Append("Fy");
390 socket->Append("Fz");
392 if (SubSystems & ssMoments) {
397 if (SubSystems & ssAtmosphere) {
398 socket->Append("Rho");
399 socket->Append("SL pressure");
400 socket->Append("Ambient pressure");
401 socket->Append("NWind");
402 socket->Append("EWind");
403 socket->Append("DWind");
405 if (SubSystems & ssMassProps) {
406 socket->Append("Ixx");
407 socket->Append("Ixy");
408 socket->Append("Ixz");
409 socket->Append("Iyx");
410 socket->Append("Iyy");
411 socket->Append("Iyz");
412 socket->Append("Izx");
413 socket->Append("Izy");
414 socket->Append("Izz");
415 socket->Append("Mass");
416 socket->Append("Xcg");
417 socket->Append("Ycg");
418 socket->Append("Zcg");
420 if (SubSystems & ssPropagate) {
421 socket->Append("Altitude");
422 socket->Append("Phi (deg)");
423 socket->Append("Tht (deg)");
424 socket->Append("Psi (deg)");
425 socket->Append("Alpha (deg)");
426 socket->Append("Beta (deg)");
427 socket->Append("Latitude (deg)");
428 socket->Append("Longitude (deg)");
430 if (SubSystems & ssCoefficients) {
431 scratch = Aerodynamics->GetCoefficientStrings(",");
432 if (scratch.length() != 0) socket->Append(scratch);
434 if (SubSystems & ssFCS) {
435 scratch = FCS->GetComponentStrings(",");
436 if (scratch.length() != 0) socket->Append(scratch);
438 if (SubSystems & ssGroundReactions) {
439 socket->Append(GroundReactions->GetGroundReactionStrings(","));
441 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
442 socket->Append(Propulsion->GetPropulsionStrings(","));
444 if (OutputProperties.size() > 0) {
445 for (unsigned int i=0;i<OutputProperties.size();i++) {
446 socket->Append(OutputProperties[i]->GetPrintableName());
455 socket->Append(State->Getsim_time());
457 if (SubSystems & ssAerosurfaces) {
458 socket->Append(FCS->GetDaCmd());
459 socket->Append(FCS->GetDeCmd());
460 socket->Append(FCS->GetDrCmd());
461 socket->Append(FCS->GetDfCmd());
462 socket->Append(FCS->GetDaLPos());
463 socket->Append(FCS->GetDaRPos());
464 socket->Append(FCS->GetDePos());
465 socket->Append(FCS->GetDrPos());
466 socket->Append(FCS->GetDfPos());
468 if (SubSystems & ssRates) {
469 socket->Append(radtodeg*Propagate->GetPQR(eP));
470 socket->Append(radtodeg*Propagate->GetPQR(eQ));
471 socket->Append(radtodeg*Propagate->GetPQR(eR));
472 socket->Append(radtodeg*Propagate->GetPQRdot(eP));
473 socket->Append(radtodeg*Propagate->GetPQRdot(eQ));
474 socket->Append(radtodeg*Propagate->GetPQRdot(eR));
476 if (SubSystems & ssVelocities) {
477 socket->Append(Auxiliary->Getqbar());
478 socket->Append(Auxiliary->GetVt());
479 socket->Append(Propagate->GetUVW(eU));
480 socket->Append(Propagate->GetUVW(eV));
481 socket->Append(Propagate->GetUVW(eW));
482 socket->Append(Auxiliary->GetAeroUVW(eU));
483 socket->Append(Auxiliary->GetAeroUVW(eV));
484 socket->Append(Auxiliary->GetAeroUVW(eW));
485 socket->Append(Propagate->GetVel(eNorth));
486 socket->Append(Propagate->GetVel(eEast));
487 socket->Append(Propagate->GetVel(eDown));
489 if (SubSystems & ssForces) {
490 socket->Append(Aerodynamics->GetvFs()(eDrag));
491 socket->Append(Aerodynamics->GetvFs()(eSide));
492 socket->Append(Aerodynamics->GetvFs()(eLift));
493 socket->Append(Aerodynamics->GetLoD());
494 socket->Append(Aircraft->GetForces(eX));
495 socket->Append(Aircraft->GetForces(eY));
496 socket->Append(Aircraft->GetForces(eZ));
498 if (SubSystems & ssMoments) {
499 socket->Append(Aircraft->GetMoments(eL));
500 socket->Append(Aircraft->GetMoments(eM));
501 socket->Append(Aircraft->GetMoments(eN));
503 if (SubSystems & ssAtmosphere) {
504 socket->Append(Atmosphere->GetDensity());
505 socket->Append(Atmosphere->GetPressureSL());
506 socket->Append(Atmosphere->GetPressure());
507 socket->Append(Atmosphere->GetWindNED().Dump(","));
509 if (SubSystems & ssMassProps) {
510 socket->Append(MassBalance->GetJ()(1,1));
511 socket->Append(MassBalance->GetJ()(1,2));
512 socket->Append(MassBalance->GetJ()(1,3));
513 socket->Append(MassBalance->GetJ()(2,1));
514 socket->Append(MassBalance->GetJ()(2,2));
515 socket->Append(MassBalance->GetJ()(2,3));
516 socket->Append(MassBalance->GetJ()(3,1));
517 socket->Append(MassBalance->GetJ()(3,2));
518 socket->Append(MassBalance->GetJ()(3,3));
519 socket->Append(MassBalance->GetMass());
520 socket->Append(MassBalance->GetXYZcg()(eX));
521 socket->Append(MassBalance->GetXYZcg()(eY));
522 socket->Append(MassBalance->GetXYZcg()(eZ));
524 if (SubSystems & ssPropagate) {
525 socket->Append(Propagate->Geth());
526 socket->Append(radtodeg*Propagate->GetEuler(ePhi));
527 socket->Append(radtodeg*Propagate->GetEuler(eTht));
528 socket->Append(radtodeg*Propagate->GetEuler(ePsi));
529 socket->Append(Auxiliary->Getalpha(inDegrees));
530 socket->Append(Auxiliary->Getbeta(inDegrees));
531 socket->Append(Propagate->GetLocation().GetLatitudeDeg());
532 socket->Append(Propagate->GetLocation().GetLongitudeDeg());
534 if (SubSystems & ssCoefficients) {
535 scratch = Aerodynamics->GetCoefficientValues(",");
536 if (scratch.length() != 0) socket->Append(scratch);
538 if (SubSystems & ssFCS) {
539 scratch = FCS->GetComponentValues(",");
540 if (scratch.length() != 0) socket->Append(scratch);
542 if (SubSystems & ssGroundReactions) {
543 socket->Append(GroundReactions->GetGroundReactionValues(","));
545 if (SubSystems & ssPropulsion && Propulsion->GetNumEngines() > 0) {
546 socket->Append(Propulsion->GetPropulsionValues(","));
549 for (unsigned int i=0;i<OutputProperties.size();i++) {
550 socket->Append(OutputProperties[i]->getDoubleValue());
556 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
558 void FGOutput::SocketStatusOutput(string out_str)
562 if (socket == NULL) return;
565 asciiData = string("<STATUS>") + out_str;
566 socket->Append(asciiData.c_str());
570 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
572 bool FGOutput::Load(Element* element)
574 string type="", parameter="";
575 string name="", fname="";
579 Element *property_element;
581 string separator = "/";
586 if (!DirectivesFile.empty()) { // A directives filename from the command line overrides
587 fname = DirectivesFile; // one found in the config file.
589 fname = element->GetAttributeValue("file");
592 if (!fname.empty()) {
593 int len = fname.size();
594 if (fname.find(".xml") != string::npos) {
595 output_file_name = fname; // Use supplied name if last four letters are ".xml"
597 output_file_name = FDMExec->GetFullAircraftPath() + separator + fname + ".xml";
599 document = LoadXMLDocument(output_file_name);
604 name = document->GetAttributeValue("name");
605 type = document->GetAttributeValue("type");
607 if (!document->GetAttributeValue("port").empty() && type == string("SOCKET")) {
608 port = atoi(document->GetAttributeValue("port").c_str());
609 socket = new FGfdmSocket(name, port);
613 if (!document->GetAttributeValue("rate").empty()) {
614 OutRate = (int)document->GetAttributeValueAsNumber("rate");
619 if (document->FindElementValue("simulation") == string("ON"))
620 SubSystems += ssSimulation;
621 if (document->FindElementValue("aerosurfaces") == string("ON"))
622 SubSystems += ssAerosurfaces;
623 if (document->FindElementValue("rates") == string("ON"))
624 SubSystems += ssRates;
625 if (document->FindElementValue("velocities") == string("ON"))
626 SubSystems += ssVelocities;
627 if (document->FindElementValue("forces") == string("ON"))
628 SubSystems += ssForces;
629 if (document->FindElementValue("moments") == string("ON"))
630 SubSystems += ssMoments;
631 if (document->FindElementValue("atmosphere") == string("ON"))
632 SubSystems += ssAtmosphere;
633 if (document->FindElementValue("massprops") == string("ON"))
634 SubSystems += ssMassProps;
635 if (document->FindElementValue("position") == string("ON"))
636 SubSystems += ssPropagate;
637 if (document->FindElementValue("coefficients") == string("ON"))
638 SubSystems += ssCoefficients;
639 if (document->FindElementValue("ground_reactions") == string("ON"))
640 SubSystems += ssGroundReactions;
641 if (document->FindElementValue("fcs") == string("ON"))
643 if (document->FindElementValue("propulsion") == string("ON"))
644 SubSystems += ssPropulsion;
645 property_element = document->FindElement("property");
646 while (property_element) {
647 string property = property_element->GetDataLine();
648 OutputProperties.push_back(PropertyManager->GetNode(property));
649 property_element = document->FindNextElement("property");
652 OutRate = OutRate>1000?1000:(OutRate<0?0:OutRate);
653 rate = (int)(0.5 + 1.0/(State->Getdt()*OutRate));
660 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
661 // The bitmasked value choices are as follows:
662 // unset: In this case (the default) JSBSim would only print
663 // out the normally expected messages, essentially echoing
664 // the config files as they are read. If the environment
665 // variable is not set, debug_lvl is set to 1 internally
666 // 0: This requests JSBSim not to output any messages
668 // 1: This value explicity requests the normal JSBSim
670 // 2: This value asks for a message to be printed out when
671 // a class is instantiated
672 // 4: When this value is set, a message is displayed when a
673 // FGModel object executes its Run() method
674 // 8: When this value is set, various runtime state variables
675 // are printed out periodically
676 // 16: When set various parameters are sanity checked and
677 // a message is printed out when they go out of bounds
679 void FGOutput::Debug(int from)
683 if (debug_lvl <= 0) return;
685 if (debug_lvl & 1) { // Standard console startup message output
686 if (from == 0) { // Constructor
690 if (output_file_name.empty())
691 cout << " " << "Output parameters read inline" << endl;
693 cout << " Output parameters read from file: " << output_file_name << endl;
695 if (Filename == "cout" || Filename == "COUT") {
696 scratch = " Log output goes to screen console";
697 } else if (!Filename.empty()) {
698 scratch = " Log output goes to file: " + Filename;
702 cout << scratch << " in CSV format output at rate " << 1/(State->Getdt()*rate) << " Hz" << endl;
705 cout << " No log output" << endl;
709 if (SubSystems & ssSimulation) cout << " Simulation parameters logged" << endl;
710 if (SubSystems & ssAerosurfaces) cout << " Aerosurface parameters logged" << endl;
711 if (SubSystems & ssRates) cout << " Rate parameters logged" << endl;
712 if (SubSystems & ssVelocities) cout << " Velocity parameters logged" << endl;
713 if (SubSystems & ssForces) cout << " Force parameters logged" << endl;
714 if (SubSystems & ssMoments) cout << " Moments parameters logged" << endl;
715 if (SubSystems & ssAtmosphere) cout << " Atmosphere parameters logged" << endl;
716 if (SubSystems & ssMassProps) cout << " Mass parameters logged" << endl;
717 if (SubSystems & ssCoefficients) cout << " Coefficient parameters logged" << endl;
718 if (SubSystems & ssPropagate) cout << " Propagate parameters logged" << endl;
719 if (SubSystems & ssGroundReactions) cout << " Ground parameters logged" << endl;
720 if (SubSystems & ssFCS) cout << " FCS parameters logged" << endl;
721 if (SubSystems & ssPropulsion) cout << " Propulsion parameters logged" << endl;
722 if (OutputProperties.size() > 0) cout << " Properties logged:" << endl;
723 for (unsigned int i=0;i<OutputProperties.size();i++) {
724 cout << " - " << OutputProperties[i]->GetName() << endl;
728 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
729 if (from == 0) cout << "Instantiated: FGOutput" << endl;
730 if (from == 1) cout << "Destroyed: FGOutput" << endl;
732 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
734 if (debug_lvl & 8 ) { // Runtime state variables
736 if (debug_lvl & 16) { // Sanity checking
738 if (debug_lvl & 64) {
739 if (from == 0) { // Constructor
740 cout << IdSrc << endl;
741 cout << IdHdr << endl;