1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6 Purpose: Model the flight controls
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 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 General Public License for more
21 You should have received a copy of the GNU 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 General Public License can also be found on
26 the world wide web at http://www.gnu.org.
28 FUNCTIONAL DESCRIPTION
29 --------------------------------------------------------------------------------
30 This class models the flight controls for a specific airplane
33 --------------------------------------------------------------------------------
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42 #include "FGFDMExec.h"
43 #include "FGAtmosphere.h"
44 #include "FGAircraft.h"
45 #include "FGTranslation.h"
46 #include "FGRotation.h"
47 #include "FGPosition.h"
48 #include "FGAuxiliary.h"
50 #include "FGPropertyManager.h"
52 #include "filtersjb/FGFilter.h"
53 #include "filtersjb/FGDeadBand.h"
54 #include "filtersjb/FGGain.h"
55 #include "filtersjb/FGGradient.h"
56 #include "filtersjb/FGSwitch.h"
57 #include "filtersjb/FGSummer.h"
58 #include "filtersjb/FGKinemat.h"
60 static const char *IdSrc = "$Id$";
61 static const char *IdHdr = ID_FCS;
63 #if defined(WIN32) && !defined(__CYGWIN__)
64 #define snprintf _snprintf
67 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
69 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
71 FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex)
76 DaCmd = DeCmd = DrCmd = DfCmd = DsbCmd = DspCmd = 0.0;
77 PTrimCmd = YTrimCmd = RTrimCmd = 0.0;
78 GearCmd = GearPos = 1; // default to gear down
79 LeftBrake = RightBrake = CenterBrake = 0.0;
83 for (i=0;i<=NForms;i++) {
84 DePos[i] = DaLPos[i] = DaRPos[i] = DrPos[i] = 0.0;
85 DfPos[i] = DsbPos[i] = DspPos[i] = 0.0;
88 for (i=0;i<NNorm;i++) { ToNormalize[i]=-1;}
92 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
100 PropAdvanceCmd.clear();
107 for (i=0;i<Components.size();i++) delete Components[i];
111 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
113 bool FGFCS::Run(void)
117 if (!FGModel::Run()) {
118 for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = ThrottleCmd[i];
119 for (i=0; i<MixturePos.size(); i++) MixturePos[i] = MixtureCmd[i];
120 for (i=0; i<PropAdvance.size(); i++) PropAdvance[i] = PropAdvanceCmd[i];
121 for (i=0; i<Components.size(); i++) Components[i]->Run();
122 if (DoNormalize) Normalize();
130 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 void FGFCS::SetThrottleCmd(int engineNum, double setting)
136 if (engineNum < (int)ThrottlePos.size()) {
138 for (ctr=0;ctr<ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting;
140 ThrottleCmd[engineNum] = setting;
143 cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
144 << " engines exist, but attempted throttle command is for engine "
145 << engineNum << endl;
149 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
151 void FGFCS::SetThrottlePos(int engineNum, double setting)
155 if (engineNum < (int)ThrottlePos.size()) {
157 for (ctr=0;ctr<ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting;
159 ThrottlePos[engineNum] = setting;
162 cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
163 << " engines exist, but attempted throttle position setting is for engine "
164 << engineNum << endl;
168 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
170 double FGFCS::GetThrottleCmd(int engineNum) const
172 if (engineNum < (int)ThrottlePos.size()) {
174 cerr << "Cannot get throttle value for ALL engines" << endl;
176 return ThrottleCmd[engineNum];
179 cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
180 << " engines exist, but throttle setting for engine " << engineNum
181 << " is selected" << endl;
186 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
188 double FGFCS::GetThrottlePos(int engineNum) const
190 if (engineNum < (int)ThrottlePos.size()) {
192 cerr << "Cannot get throttle value for ALL engines" << endl;
194 return ThrottlePos[engineNum];
197 cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
198 << " engines exist, but attempted throttle position setting is for engine "
199 << engineNum << endl;
204 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
206 void FGFCS::SetMixtureCmd(int engineNum, double setting)
210 if (engineNum < (int)ThrottlePos.size()) {
212 for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting;
214 MixtureCmd[engineNum] = setting;
219 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
221 void FGFCS::SetMixturePos(int engineNum, double setting)
225 if (engineNum < (int)ThrottlePos.size()) {
227 for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr];
229 MixturePos[engineNum] = setting;
234 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
236 void FGFCS::SetPropAdvanceCmd(int engineNum, double setting)
240 if (engineNum < (int)ThrottlePos.size()) {
242 for (ctr=0;ctr<PropAdvanceCmd.size();ctr++) PropAdvanceCmd[ctr] = setting;
244 PropAdvanceCmd[engineNum] = setting;
249 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
251 void FGFCS::SetPropAdvance(int engineNum, double setting)
255 if (engineNum < (int)ThrottlePos.size()) {
257 for (ctr=0;ctr<=PropAdvanceCmd.size();ctr++) PropAdvance[ctr] = PropAdvanceCmd[ctr];
259 PropAdvance[engineNum] = setting;
264 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
266 bool FGFCS::Load(FGConfigFile* AC_cfg)
271 Name = Name + ":" + AC_cfg->GetValue("NAME");
272 if (debug_lvl > 0) cout << " Control System Name: " << Name << endl;
273 if ( AC_cfg->GetValue("NORMALIZE") == "FALSE") {
275 cout << " Automatic Control Surface Normalization Disabled" << endl;
277 AC_cfg->GetNextConfigLine();
278 while ((token = AC_cfg->GetValue()) != string("/FLIGHT_CONTROL")) {
279 if (token == "COMPONENT") {
280 token = AC_cfg->GetValue("TYPE");
281 if (debug_lvl > 0) cout << endl << " Loading Component \""
282 << AC_cfg->GetValue("NAME")
283 << "\" of type: " << token << endl;
284 if ((token == "LAG_FILTER") ||
285 (token == "LEAD_LAG_FILTER") ||
286 (token == "SECOND_ORDER_FILTER") ||
287 (token == "WASHOUT_FILTER") ||
288 (token == "INTEGRATOR") ) {
289 Components.push_back(new FGFilter(this, AC_cfg));
290 } else if ((token == "PURE_GAIN") ||
291 (token == "SCHEDULED_GAIN") ||
292 (token == "AEROSURFACE_SCALE") ) {
294 Components.push_back(new FGGain(this, AC_cfg));
296 } else if (token == "SUMMER") {
297 Components.push_back(new FGSummer(this, AC_cfg));
298 } else if (token == "DEADBAND") {
299 Components.push_back(new FGDeadBand(this, AC_cfg));
300 } else if (token == "GRADIENT") {
301 Components.push_back(new FGGradient(this, AC_cfg));
302 } else if (token == "SWITCH") {
303 Components.push_back(new FGSwitch(this, AC_cfg));
304 } else if (token == "KINEMAT") {
305 Components.push_back(new FGKinemat(this, AC_cfg));
307 cerr << "Unknown token [" << token << "] in FCS portion of config file" << endl;
310 AC_cfg->GetNextConfigLine();
313 //collect information for normalizing control surfaces
315 for (i=0;i<Components.size();i++) {
317 if ( (Components[i]->GetType() == "AEROSURFACE_SCALE"
318 || Components[i]->GetType() == "KINEMAT")
319 && Components[i]->GetOutputNode() ) {
320 nodeName= Components[i]->GetOutputNode()->GetName();
321 if ( nodeName == "elevator-pos-rad" ) {
323 } else if ( nodeName == "left-aileron-pos-rad"
324 || nodeName == "aileron-pos-rad" ) {
326 } else if ( nodeName == "right-aileron-pos-rad" ) {
328 } else if ( nodeName == "rudder-pos-rad" ) {
330 } else if ( nodeName == "speedbrake-pos-rad" ) {
332 } else if ( nodeName == "spoiler-pos-rad" ) {
334 } else if ( nodeName == "flap-pos-deg" ) {
345 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
347 double FGFCS::GetComponentOutput(int idx) {
348 return Components[idx]->GetOutput();
351 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
353 string FGFCS::GetComponentName(int idx) {
354 return Components[idx]->GetName();
357 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
359 double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
362 case FGLGear::bgLeft:
364 case FGLGear::bgRight:
366 case FGLGear::bgCenter:
369 cerr << "GetBrake asked to return a bogus brake value" << endl;
374 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
376 string FGFCS::GetComponentStrings(void)
379 string CompStrings = "";
380 bool firstime = true;
382 for (comp = 0; comp < Components.size(); comp++) {
383 if (firstime) firstime = false;
384 else CompStrings += ", ";
386 CompStrings += Components[comp]->GetName();
392 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
394 string FGFCS::GetComponentValues(void)
397 string CompValues = "";
399 bool firstime = true;
401 for (comp = 0; comp < Components.size(); comp++) {
402 if (firstime) firstime = false;
403 else CompValues += ", ";
405 sprintf(buffer, "%9.6f", Components[comp]->GetOutput());
406 CompValues += string(buffer);
412 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
414 void FGFCS::AddThrottle(void)
416 ThrottleCmd.push_back(0.0);
417 ThrottlePos.push_back(0.0);
418 MixtureCmd.push_back(0.0); // assume throttle and mixture are coupled
419 MixturePos.push_back(0.0);
420 PropAdvanceCmd.push_back(0.0); // assume throttle and prop pitch are coupled
421 PropAdvance.push_back(0.0);
424 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426 void FGFCS::Normalize(void) {
428 //not all of these are guaranteed to be defined for every model
429 //those that are have an index >=0 in the ToNormalize array
430 //ToNormalize is filled in Load()
432 if ( ToNormalize[iDe] > -1 ) {
433 DePos[ofNorm] = Components[ToNormalize[iDe]]->GetOutputPct();
436 if ( ToNormalize[iDaL] > -1 ) {
437 DaLPos[ofNorm] = Components[ToNormalize[iDaL]]->GetOutputPct();
440 if ( ToNormalize[iDaR] > -1 ) {
441 DaRPos[ofNorm] = Components[ToNormalize[iDaR]]->GetOutputPct();
444 if ( ToNormalize[iDr] > -1 ) {
445 DrPos[ofNorm] = Components[ToNormalize[iDr]]->GetOutputPct();
448 if ( ToNormalize[iDsb] > -1 ) {
449 DsbPos[ofNorm] = Components[ToNormalize[iDsb]]->GetOutputPct();
452 if ( ToNormalize[iDsp] > -1 ) {
453 DspPos[ofNorm] = Components[ToNormalize[iDsp]]->GetOutputPct();
456 if ( ToNormalize[iDf] > -1 ) {
457 DfPos[ofNorm] = Components[ToNormalize[iDf]]->GetOutputPct();
460 DePos[ofMag] = fabs(DePos[ofRad]);
461 DaLPos[ofMag] = fabs(DaLPos[ofRad]);
462 DaRPos[ofMag] = fabs(DaRPos[ofRad]);
463 DrPos[ofMag] = fabs(DrPos[ofRad]);
464 DsbPos[ofMag] = fabs(DsbPos[ofRad]);
465 DspPos[ofMag] = fabs(DspPos[ofRad]);
466 DfPos[ofMag] = fabs(DfPos[ofRad]);
470 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
472 void FGFCS::bind(void)
474 PropertyManager->Tie("fcs/aileron-cmd-norm", this,
478 PropertyManager->Tie("fcs/elevator-cmd-norm", this,
482 PropertyManager->Tie("fcs/rudder-cmd-norm", this,
486 PropertyManager->Tie("fcs/flap-cmd-norm", this,
490 PropertyManager->Tie("fcs/speedbrake-cmd-norm", this,
494 PropertyManager->Tie("fcs/spoiler-cmd-norm", this,
498 PropertyManager->Tie("fcs/pitch-trim-cmd-norm", this,
499 &FGFCS::GetPitchTrimCmd,
500 &FGFCS::SetPitchTrimCmd,
502 PropertyManager->Tie("fcs/roll-trim-cmd-norm", this,
503 &FGFCS::GetYawTrimCmd,
504 &FGFCS::SetYawTrimCmd,
506 PropertyManager->Tie("fcs/yaw-trim-cmd-norm", this,
507 &FGFCS::GetRollTrimCmd,
508 &FGFCS::SetRollTrimCmd,
510 PropertyManager->Tie("gear/gear-cmd-norm", this,
515 PropertyManager->Tie("fcs/left-aileron-pos-rad", this,ofRad,
519 PropertyManager->Tie("fcs/left-aileron-pos-norm", this,ofNorm,
523 PropertyManager->Tie("fcs/mag-left-aileron-pos-rad", this,ofMag,
528 PropertyManager->Tie("fcs/right-aileron-pos-rad", this,ofRad,
532 PropertyManager->Tie("fcs/right-aileron-pos-norm", this,ofNorm,
536 PropertyManager->Tie("fcs/mag-right-aileron-pos-rad", this,ofMag,
541 PropertyManager->Tie("fcs/elevator-pos-rad", this, ofRad,
545 PropertyManager->Tie("fcs/elevator-pos-norm", this,ofNorm,
549 PropertyManager->Tie("fcs/mag-elevator-pos-rad", this,ofMag,
554 PropertyManager->Tie("fcs/rudder-pos-rad", this,ofRad,
558 PropertyManager->Tie("fcs/rudder-pos-norm", this,ofNorm,
562 PropertyManager->Tie("fcs/mag-rudder-pos-rad", this,ofMag,
567 PropertyManager->Tie("fcs/flap-pos-deg", this,ofRad,
571 PropertyManager->Tie("fcs/flap-pos-norm", this,ofNorm,
576 PropertyManager->Tie("fcs/speedbrake-pos-rad", this,ofRad,
580 PropertyManager->Tie("fcs/speedbrake-pos-norm", this,ofNorm,
584 PropertyManager->Tie("fcs/mag-speedbrake-pos-rad", this,ofMag,
589 PropertyManager->Tie("fcs/spoiler-pos-rad", this,ofRad,
593 PropertyManager->Tie("fcs/spoiler-pos-norm", this,ofNorm,
597 PropertyManager->Tie("fcs/mag-spoiler-pos-rad", this,ofMag,
602 PropertyManager->Tie("gear/gear-pos-norm", this,
608 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
610 void FGFCS::bindModel(void)
615 for (i=0; i<ThrottleCmd.size(); i++) {
616 snprintf(tmp,80,"fcs/throttle-cmd-norm[%u]",i);
617 PropertyManager->Tie( tmp,this,i,
618 &FGFCS::GetThrottleCmd,
619 &FGFCS::SetThrottleCmd,
621 snprintf(tmp,80,"fcs/throttle-pos-norm[%u]",i);
622 PropertyManager->Tie( tmp,this,i,
623 &FGFCS::GetThrottlePos,
624 &FGFCS::SetThrottlePos,
626 if ( MixtureCmd.size() > i ) {
627 snprintf(tmp,80,"fcs/mixture-cmd-norm[%u]",i);
628 PropertyManager->Tie( tmp,this,i,
629 &FGFCS::GetMixtureCmd,
630 &FGFCS::SetMixtureCmd,
632 snprintf(tmp,80,"fcs/mixture-pos-norm[%u]",i);
633 PropertyManager->Tie( tmp,this,i,
634 &FGFCS::GetMixturePos,
635 &FGFCS::SetMixturePos,
638 if ( PropAdvanceCmd.size() > i ) {
639 snprintf(tmp,80,"fcs/advance-cmd-norm[%u]",i);
640 PropertyManager->Tie( tmp,this,i,
641 &FGFCS::GetPropAdvanceCmd,
642 &FGFCS::SetPropAdvanceCmd,
644 snprintf(tmp,80,"fcs/advance-pos-norm[%u]",i);
645 PropertyManager->Tie( tmp,this,i,
646 &FGFCS::GetPropAdvance,
647 &FGFCS::SetPropAdvance,
653 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
655 void FGFCS::unbind(void)
657 PropertyManager->Untie("fcs/aileron-cmd-norm");
658 PropertyManager->Untie("fcs/elevator-cmd-norm");
659 PropertyManager->Untie("fcs/rudder-cmd-norm");
660 PropertyManager->Untie("fcs/flap-cmd-norm");
661 PropertyManager->Untie("fcs/speedbrake-cmd-norm");
662 PropertyManager->Untie("fcs/spoiler-cmd-norm");
663 PropertyManager->Untie("fcs/pitch-trim-cmd-norm");
664 PropertyManager->Untie("fcs/roll-trim-cmd-norm");
665 PropertyManager->Untie("fcs/yaw-trim-cmd-norm");
666 PropertyManager->Untie("gear/gear-cmd-norm");
667 PropertyManager->Untie("fcs/left-aileron-pos-rad");
668 PropertyManager->Untie("fcs/mag-left-aileron-pos-rad");
669 PropertyManager->Untie("fcs/left-aileron-pos-norm");
670 PropertyManager->Untie("fcs/right-aileron-pos-rad");
671 PropertyManager->Untie("fcs/mag-right-aileron-pos-rad");
672 PropertyManager->Untie("fcs/right-aileron-pos-norm");
673 PropertyManager->Untie("fcs/elevator-pos-rad");
674 PropertyManager->Untie("fcs/mag-elevator-pos-rad");
675 PropertyManager->Untie("fcs/elevator-pos-norm");
676 PropertyManager->Untie("fcs/rudder-pos-rad");
677 PropertyManager->Untie("fcs/mag-rudder-pos-rad");
678 PropertyManager->Untie("fcs/rudder-pos-norm");
679 PropertyManager->Untie("fcs/flap-pos-deg");
680 PropertyManager->Untie("fcs/flap-pos-norm");
681 PropertyManager->Untie("fcs/speedbrake-pos-rad");
682 PropertyManager->Untie("fcs/mag-speedbrake-pos-rad");
683 PropertyManager->Untie("fcs/speedbrake-pos-norm");
684 PropertyManager->Untie("fcs/spoiler-pos-rad");
685 PropertyManager->Untie("fcs/mag-spoiler-pos-rad");
686 PropertyManager->Untie("fcs/spoiler-pos-norm");
687 PropertyManager->Untie("gear/gear-pos-norm");
690 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
691 // The bitmasked value choices are as follows:
692 // unset: In this case (the default) JSBSim would only print
693 // out the normally expected messages, essentially echoing
694 // the config files as they are read. If the environment
695 // variable is not set, debug_lvl is set to 1 internally
696 // 0: This requests JSBSim not to output any messages
698 // 1: This value explicity requests the normal JSBSim
700 // 2: This value asks for a message to be printed out when
701 // a class is instantiated
702 // 4: When this value is set, a message is displayed when a
703 // FGModel object executes its Run() method
704 // 8: When this value is set, various runtime state variables
705 // are printed out periodically
706 // 16: When set various parameters are sanity checked and
707 // a message is printed out when they go out of bounds
709 void FGFCS::Debug(int from)
711 if (debug_lvl <= 0) return;
713 if (debug_lvl & 1) { // Standard console startup message output
714 if (from == 0) { // Constructor
718 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
719 if (from == 0) cout << "Instantiated: FGFCS" << endl;
720 if (from == 1) cout << "Destroyed: FGFCS" << endl;
722 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
724 if (debug_lvl & 8 ) { // Runtime state variables
726 if (debug_lvl & 16) { // Sanity checking
728 if (debug_lvl & 64) {
729 if (from == 0) { // Constructor
730 cout << IdSrc << endl;
731 cout << IdHdr << endl;