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();
129 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 void FGFCS::SetThrottleCmd(int engineNum, double setting)
135 if (engineNum < (int)ThrottlePos.size()) {
137 for (ctr=0;ctr<ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting;
139 ThrottleCmd[engineNum] = setting;
142 cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
143 << " engines exist, but attempted throttle command is for engine "
144 << engineNum << endl;
148 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
150 void FGFCS::SetThrottlePos(int engineNum, double setting)
154 if (engineNum < (int)ThrottlePos.size()) {
156 for (ctr=0;ctr<ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting;
158 ThrottlePos[engineNum] = setting;
161 cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
162 << " engines exist, but attempted throttle position setting is for engine "
163 << engineNum << endl;
167 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
169 double FGFCS::GetThrottleCmd(int engineNum) const
171 if (engineNum < (int)ThrottlePos.size()) {
173 cerr << "Cannot get throttle value for ALL engines" << endl;
175 return ThrottleCmd[engineNum];
178 cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
179 << " engines exist, but throttle setting for engine " << engineNum
180 << " is selected" << endl;
185 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187 double FGFCS::GetThrottlePos(int engineNum) const
189 if (engineNum < (int)ThrottlePos.size()) {
191 cerr << "Cannot get throttle value for ALL engines" << endl;
193 return ThrottlePos[engineNum];
196 cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
197 << " engines exist, but attempted throttle position setting is for engine "
198 << engineNum << endl;
203 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
205 void FGFCS::SetMixtureCmd(int engineNum, double setting)
209 if (engineNum < (int)ThrottlePos.size()) {
211 for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting;
213 MixtureCmd[engineNum] = setting;
218 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
220 void FGFCS::SetMixturePos(int engineNum, double setting)
224 if (engineNum < (int)ThrottlePos.size()) {
226 for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr];
228 MixturePos[engineNum] = setting;
233 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
235 void FGFCS::SetPropAdvanceCmd(int engineNum, double setting)
239 if (engineNum < (int)ThrottlePos.size()) {
241 for (ctr=0;ctr<PropAdvanceCmd.size();ctr++) PropAdvanceCmd[ctr] = setting;
243 PropAdvanceCmd[engineNum] = setting;
248 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
250 void FGFCS::SetPropAdvance(int engineNum, double setting)
254 if (engineNum < (int)ThrottlePos.size()) {
256 for (ctr=0;ctr<=PropAdvanceCmd.size();ctr++) PropAdvance[ctr] = PropAdvanceCmd[ctr];
258 PropAdvance[engineNum] = setting;
263 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
265 bool FGFCS::Load(FGConfigFile* AC_cfg)
270 Name = Name + ":" + AC_cfg->GetValue("NAME");
271 if (debug_lvl > 0) cout << " Control System Name: " << Name << endl;
272 if ( AC_cfg->GetValue("NORMALIZE") == "FALSE") {
274 cout << " Automatic Control Surface Normalization Disabled" << endl;
276 AC_cfg->GetNextConfigLine();
277 while ((token = AC_cfg->GetValue()) != string("/FLIGHT_CONTROL")) {
278 if (token == "COMPONENT") {
279 token = AC_cfg->GetValue("TYPE");
280 if (debug_lvl > 0) cout << endl << " Loading Component \""
281 << AC_cfg->GetValue("NAME")
282 << "\" of type: " << token << endl;
283 if ((token == "LAG_FILTER") ||
284 (token == "LEAD_LAG_FILTER") ||
285 (token == "SECOND_ORDER_FILTER") ||
286 (token == "WASHOUT_FILTER") ||
287 (token == "INTEGRATOR") ) {
288 Components.push_back(new FGFilter(this, AC_cfg));
289 } else if ((token == "PURE_GAIN") ||
290 (token == "SCHEDULED_GAIN") ||
291 (token == "AEROSURFACE_SCALE") ) {
293 Components.push_back(new FGGain(this, AC_cfg));
295 } else if (token == "SUMMER") {
296 Components.push_back(new FGSummer(this, AC_cfg));
297 } else if (token == "DEADBAND") {
298 Components.push_back(new FGDeadBand(this, AC_cfg));
299 } else if (token == "GRADIENT") {
300 Components.push_back(new FGGradient(this, AC_cfg));
301 } else if (token == "SWITCH") {
302 Components.push_back(new FGSwitch(this, AC_cfg));
303 } else if (token == "KINEMAT") {
304 Components.push_back(new FGKinemat(this, AC_cfg));
306 cerr << "Unknown token [" << token << "] in FCS portion of config file" << endl;
309 AC_cfg->GetNextConfigLine();
312 //collect information for normalizing control surfaces
314 for (i=0;i<Components.size();i++) {
316 if ( (Components[i]->GetType() == "AEROSURFACE_SCALE"
317 || Components[i]->GetType() == "KINEMAT")
318 && Components[i]->GetOutputNode() ) {
319 nodeName= Components[i]->GetOutputNode()->GetName();
320 if ( nodeName == "elevator-pos-rad" ) {
322 } else if ( nodeName == "left-aileron-pos-rad"
323 || nodeName == "aileron-pos-rad" ) {
325 } else if ( nodeName == "right-aileron-pos-rad" ) {
327 } else if ( nodeName == "rudder-pos-rad" ) {
329 } else if ( nodeName == "speedbrake-pos-rad" ) {
331 } else if ( nodeName == "spoiler-pos-rad" ) {
333 } else if ( nodeName == "flap-pos-deg" ) {
344 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
346 double FGFCS::GetComponentOutput(int idx) {
347 return Components[idx]->GetOutput();
350 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
352 string FGFCS::GetComponentName(int idx) {
353 return Components[idx]->GetName();
356 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
358 double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
361 case FGLGear::bgLeft:
363 case FGLGear::bgRight:
365 case FGLGear::bgCenter:
368 cerr << "GetBrake asked to return a bogus brake value" << endl;
373 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
375 string FGFCS::GetComponentStrings(void)
378 string CompStrings = "";
379 bool firstime = true;
381 for (comp = 0; comp < Components.size(); comp++) {
382 if (firstime) firstime = false;
383 else CompStrings += ", ";
385 CompStrings += Components[comp]->GetName();
391 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
393 string FGFCS::GetComponentValues(void)
396 string CompValues = "";
398 bool firstime = true;
400 for (comp = 0; comp < Components.size(); comp++) {
401 if (firstime) firstime = false;
402 else CompValues += ", ";
404 sprintf(buffer, "%9.6f", Components[comp]->GetOutput());
405 CompValues += string(buffer);
411 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
413 void FGFCS::AddThrottle(void)
415 ThrottleCmd.push_back(0.0);
416 ThrottlePos.push_back(0.0);
417 MixtureCmd.push_back(0.0); // assume throttle and mixture are coupled
418 MixturePos.push_back(0.0);
419 PropAdvanceCmd.push_back(0.0); // assume throttle and prop pitch are coupled
420 PropAdvance.push_back(0.0);
423 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425 void FGFCS::Normalize(void) {
427 //not all of these are guaranteed to be defined for every model
428 //those that are have an index >=0 in the ToNormalize array
429 //ToNormalize is filled in Load()
431 if ( ToNormalize[iDe] > -1 ) {
432 DePos[ofNorm] = Components[ToNormalize[iDe]]->GetOutputPct();
435 if ( ToNormalize[iDaL] > -1 ) {
436 DaLPos[ofNorm] = Components[ToNormalize[iDaL]]->GetOutputPct();
439 if ( ToNormalize[iDaR] > -1 ) {
440 DaRPos[ofNorm] = Components[ToNormalize[iDaR]]->GetOutputPct();
443 if ( ToNormalize[iDr] > -1 ) {
444 DrPos[ofNorm] = Components[ToNormalize[iDr]]->GetOutputPct();
447 if ( ToNormalize[iDsb] > -1 ) {
448 DsbPos[ofNorm] = Components[ToNormalize[iDsb]]->GetOutputPct();
451 if ( ToNormalize[iDsp] > -1 ) {
452 DspPos[ofNorm] = Components[ToNormalize[iDsp]]->GetOutputPct();
455 if ( ToNormalize[iDf] > -1 ) {
456 DfPos[ofNorm] = Components[ToNormalize[iDf]]->GetOutputPct();
459 DePos[ofMag] = fabs(DePos[ofRad]);
460 DaLPos[ofMag] = fabs(DaLPos[ofRad]);
461 DaRPos[ofMag] = fabs(DaRPos[ofRad]);
462 DrPos[ofMag] = fabs(DrPos[ofRad]);
463 DsbPos[ofMag] = fabs(DsbPos[ofRad]);
464 DspPos[ofMag] = fabs(DspPos[ofRad]);
465 DfPos[ofMag] = fabs(DfPos[ofRad]);
469 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
471 void FGFCS::bind(void)
473 PropertyManager->Tie("fcs/aileron-cmd-norm", this,
477 PropertyManager->Tie("fcs/elevator-cmd-norm", this,
481 PropertyManager->Tie("fcs/rudder-cmd-norm", this,
485 PropertyManager->Tie("fcs/flap-cmd-norm", this,
489 PropertyManager->Tie("fcs/speedbrake-cmd-norm", this,
493 PropertyManager->Tie("fcs/spoiler-cmd-norm", this,
497 PropertyManager->Tie("fcs/pitch-trim-cmd-norm", this,
498 &FGFCS::GetPitchTrimCmd,
499 &FGFCS::SetPitchTrimCmd,
501 PropertyManager->Tie("fcs/roll-trim-cmd-norm", this,
502 &FGFCS::GetYawTrimCmd,
503 &FGFCS::SetYawTrimCmd,
505 PropertyManager->Tie("fcs/yaw-trim-cmd-norm", this,
506 &FGFCS::GetRollTrimCmd,
507 &FGFCS::SetRollTrimCmd,
509 PropertyManager->Tie("gear/gear-cmd-norm", this,
514 PropertyManager->Tie("fcs/left-aileron-pos-rad", this,ofRad,
518 PropertyManager->Tie("fcs/left-aileron-pos-norm", this,ofNorm,
522 PropertyManager->Tie("fcs/mag-left-aileron-pos-rad", this,ofMag,
527 PropertyManager->Tie("fcs/right-aileron-pos-rad", this,ofRad,
531 PropertyManager->Tie("fcs/right-aileron-pos-norm", this,ofNorm,
535 PropertyManager->Tie("fcs/mag-right-aileron-pos-rad", this,ofMag,
540 PropertyManager->Tie("fcs/elevator-pos-rad", this, ofRad,
544 PropertyManager->Tie("fcs/elevator-pos-norm", this,ofNorm,
548 PropertyManager->Tie("fcs/mag-elevator-pos-rad", this,ofMag,
553 PropertyManager->Tie("fcs/rudder-pos-rad", this,ofRad,
557 PropertyManager->Tie("fcs/rudder-pos-norm", this,ofNorm,
561 PropertyManager->Tie("fcs/mag-rudder-pos-rad", this,ofMag,
566 PropertyManager->Tie("fcs/flap-pos-deg", this,ofRad,
570 PropertyManager->Tie("fcs/flap-pos-norm", this,ofNorm,
575 PropertyManager->Tie("fcs/speedbrake-pos-rad", this,ofRad,
579 PropertyManager->Tie("fcs/speedbrake-pos-norm", this,ofNorm,
583 PropertyManager->Tie("fcs/mag-speedbrake-pos-rad", this,ofMag,
588 PropertyManager->Tie("fcs/spoiler-pos-rad", this,ofRad,
592 PropertyManager->Tie("fcs/spoiler-pos-norm", this,ofNorm,
596 PropertyManager->Tie("fcs/mag-spoiler-pos-rad", this,ofMag,
601 PropertyManager->Tie("gear/gear-pos-norm", this,
607 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
609 void FGFCS::bindModel(void)
614 for (i=0; i<ThrottleCmd.size(); i++) {
615 snprintf(tmp,80,"fcs/throttle-cmd-norm[%u]",i);
616 PropertyManager->Tie( tmp,this,i,
617 &FGFCS::GetThrottleCmd,
618 &FGFCS::SetThrottleCmd,
620 snprintf(tmp,80,"fcs/throttle-pos-norm[%u]",i);
621 PropertyManager->Tie( tmp,this,i,
622 &FGFCS::GetThrottlePos,
623 &FGFCS::SetThrottlePos,
625 if ( MixtureCmd.size() > i ) {
626 snprintf(tmp,80,"fcs/mixture-cmd-norm[%u]",i);
627 PropertyManager->Tie( tmp,this,i,
628 &FGFCS::GetMixtureCmd,
629 &FGFCS::SetMixtureCmd,
631 snprintf(tmp,80,"fcs/mixture-pos-norm[%u]",i);
632 PropertyManager->Tie( tmp,this,i,
633 &FGFCS::GetMixturePos,
634 &FGFCS::SetMixturePos,
637 if ( PropAdvanceCmd.size() > i ) {
638 snprintf(tmp,80,"fcs/advance-cmd-norm[%u]",i);
639 PropertyManager->Tie( tmp,this,i,
640 &FGFCS::GetPropAdvanceCmd,
641 &FGFCS::SetPropAdvanceCmd,
643 snprintf(tmp,80,"fcs/advance-pos-norm[%u]",i);
644 PropertyManager->Tie( tmp,this,i,
645 &FGFCS::GetPropAdvance,
646 &FGFCS::SetPropAdvance,
652 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
654 void FGFCS::unbind(void)
656 PropertyManager->Untie("fcs/aileron-cmd-norm");
657 PropertyManager->Untie("fcs/elevator-cmd-norm");
658 PropertyManager->Untie("fcs/rudder-cmd-norm");
659 PropertyManager->Untie("fcs/flap-cmd-norm");
660 PropertyManager->Untie("fcs/speedbrake-cmd-norm");
661 PropertyManager->Untie("fcs/spoiler-cmd-norm");
662 PropertyManager->Untie("fcs/pitch-trim-cmd-norm");
663 PropertyManager->Untie("fcs/roll-trim-cmd-norm");
664 PropertyManager->Untie("fcs/yaw-trim-cmd-norm");
665 PropertyManager->Untie("gear/gear-cmd-norm");
666 PropertyManager->Untie("fcs/left-aileron-pos-rad");
667 PropertyManager->Untie("fcs/mag-left-aileron-pos-rad");
668 PropertyManager->Untie("fcs/left-aileron-pos-norm");
669 PropertyManager->Untie("fcs/right-aileron-pos-rad");
670 PropertyManager->Untie("fcs/mag-right-aileron-pos-rad");
671 PropertyManager->Untie("fcs/right-aileron-pos-norm");
672 PropertyManager->Untie("fcs/elevator-pos-rad");
673 PropertyManager->Untie("fcs/mag-elevator-pos-rad");
674 PropertyManager->Untie("fcs/elevator-pos-norm");
675 PropertyManager->Untie("fcs/rudder-pos-rad");
676 PropertyManager->Untie("fcs/mag-rudder-pos-rad");
677 PropertyManager->Untie("fcs/rudder-pos-norm");
678 PropertyManager->Untie("fcs/flap-pos-deg");
679 PropertyManager->Untie("fcs/flap-pos-norm");
680 PropertyManager->Untie("fcs/speedbrake-pos-rad");
681 PropertyManager->Untie("fcs/mag-speedbrake-pos-rad");
682 PropertyManager->Untie("fcs/speedbrake-pos-norm");
683 PropertyManager->Untie("fcs/spoiler-pos-rad");
684 PropertyManager->Untie("fcs/mag-spoiler-pos-rad");
685 PropertyManager->Untie("fcs/spoiler-pos-norm");
686 PropertyManager->Untie("gear/gear-pos-norm");
689 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
690 // The bitmasked value choices are as follows:
691 // unset: In this case (the default) JSBSim would only print
692 // out the normally expected messages, essentially echoing
693 // the config files as they are read. If the environment
694 // variable is not set, debug_lvl is set to 1 internally
695 // 0: This requests JSBSim not to output any messages
697 // 1: This value explicity requests the normal JSBSim
699 // 2: This value asks for a message to be printed out when
700 // a class is instantiated
701 // 4: When this value is set, a message is displayed when a
702 // FGModel object executes its Run() method
703 // 8: When this value is set, various runtime state variables
704 // are printed out periodically
705 // 16: When set various parameters are sanity checked and
706 // a message is printed out when they go out of bounds
708 void FGFCS::Debug(int from)
710 if (debug_lvl <= 0) return;
712 if (debug_lvl & 1) { // Standard console startup message output
713 if (from == 0) { // Constructor
717 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
718 if (from == 0) cout << "Instantiated: FGFCS" << endl;
719 if (from == 1) cout << "Destroyed: FGFCS" << endl;
721 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
723 if (debug_lvl & 8 ) { // Runtime state variables
725 if (debug_lvl & 16) { // Sanity checking
727 if (debug_lvl & 64) {
728 if (from == 0) { // Constructor
729 cout << IdSrc << endl;
730 cout << IdHdr << endl;