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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
41 #include "FGFDMExec.h"
42 #include "FGPropertyManager.h"
44 #include "filtersjb/FGFilter.h"
45 #include "filtersjb/FGDeadBand.h"
46 #include "filtersjb/FGGain.h"
47 #include "filtersjb/FGGradient.h"
48 #include "filtersjb/FGSwitch.h"
49 #include "filtersjb/FGSummer.h"
50 #include "filtersjb/FGKinemat.h"
54 static const char *IdSrc = "$Id$";
55 static const char *IdHdr = ID_FCS;
57 #if defined(WIN32) && !defined(__CYGWIN__)
58 #define snprintf _snprintf
61 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
65 FGFCS::FGFCS(FGFDMExec* fdmex) : FGModel(fdmex)
70 DaCmd = DeCmd = DrCmd = DfCmd = DsbCmd = DspCmd = 0.0;
71 AP_DaCmd = AP_DeCmd = AP_DrCmd = AP_ThrottleCmd = 0.0;
72 PTrimCmd = YTrimCmd = RTrimCmd = 0.0;
73 GearCmd = GearPos = 1; // default to gear down
74 LeftBrake = RightBrake = CenterBrake = 0.0;
75 APAttitudeSetPt = APAltitudeSetPt = APHeadingSetPt = APAirspeedSetPt = 0.0;
81 for (i=0;i<=NForms;i++) {
82 DePos[i] = DaLPos[i] = DaRPos[i] = DrPos[i] = 0.0;
83 DfPos[i] = DsbPos[i] = DspPos[i] = 0.0;
86 for (i=0;i<NNorm;i++) { ToNormalize[i]=-1;}
90 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
94 unbind( PropertyManager->GetNode("fcs") );
95 unbind( PropertyManager->GetNode("ap") );
96 PropertyManager->Untie( "gear/gear-cmd-norm" );
97 PropertyManager->Untie( "gear/gear-pos-norm" );
103 PropAdvanceCmd.clear();
108 for (i=0;i<APComponents.size();i++) delete APComponents[i];
109 for (i=0;i<FCSComponents.size();i++) delete FCSComponents[i];
114 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
116 bool FGFCS::Run(void)
120 if (!FGModel::Run()) {
121 for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = ThrottleCmd[i];
122 for (i=0; i<MixturePos.size(); i++) MixturePos[i] = MixtureCmd[i];
123 for (i=0; i<PropAdvance.size(); i++) PropAdvance[i] = PropAdvanceCmd[i];
124 for (i=0; i<APComponents.size(); i++) {
126 APComponents[i]->Run();
129 for (i=0; i<FCSComponents.size(); i++) {
131 FCSComponents[i]->Run();
134 if (DoNormalize) Normalize();
142 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
144 void FGFCS::SetThrottleCmd(int engineNum, double setting)
148 if (engineNum < (int)ThrottlePos.size()) {
150 for (ctr=0;ctr<ThrottleCmd.size();ctr++) ThrottleCmd[ctr] = setting;
152 ThrottleCmd[engineNum] = setting;
155 cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
156 << " engines exist, but attempted throttle command is for engine "
157 << engineNum << endl;
161 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
163 void FGFCS::SetThrottlePos(int engineNum, double setting)
167 if (engineNum < (int)ThrottlePos.size()) {
169 for (ctr=0;ctr<ThrottlePos.size();ctr++) ThrottlePos[ctr] = setting;
171 ThrottlePos[engineNum] = setting;
174 cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
175 << " engines exist, but attempted throttle position setting is for engine "
176 << engineNum << endl;
180 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
182 double FGFCS::GetThrottleCmd(int engineNum) const
184 if (engineNum < (int)ThrottlePos.size()) {
186 cerr << "Cannot get throttle value for ALL engines" << endl;
188 return ThrottleCmd[engineNum];
191 cerr << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
192 << " engines exist, but throttle setting for engine " << engineNum
193 << " is selected" << endl;
198 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
200 double FGFCS::GetThrottlePos(int engineNum) const
202 if (engineNum < (int)ThrottlePos.size()) {
204 cerr << "Cannot get throttle value for ALL engines" << endl;
206 return ThrottlePos[engineNum];
209 cerr << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
210 << " engines exist, but attempted throttle position setting is for engine "
211 << engineNum << endl;
216 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
218 void FGFCS::SetMixtureCmd(int engineNum, double setting)
222 if (engineNum < (int)ThrottlePos.size()) {
224 for (ctr=0;ctr<MixtureCmd.size();ctr++) MixtureCmd[ctr] = setting;
226 MixtureCmd[engineNum] = setting;
231 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
233 void FGFCS::SetMixturePos(int engineNum, double setting)
237 if (engineNum < (int)ThrottlePos.size()) {
239 for (ctr=0;ctr<=MixtureCmd.size();ctr++) MixturePos[ctr] = MixtureCmd[ctr];
241 MixturePos[engineNum] = setting;
246 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
248 void FGFCS::SetPropAdvanceCmd(int engineNum, double setting)
252 if (engineNum < (int)ThrottlePos.size()) {
254 for (ctr=0;ctr<PropAdvanceCmd.size();ctr++) PropAdvanceCmd[ctr] = setting;
256 PropAdvanceCmd[engineNum] = setting;
261 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263 void FGFCS::SetPropAdvance(int engineNum, double setting)
267 if (engineNum < (int)ThrottlePos.size()) {
269 for (ctr=0;ctr<=PropAdvanceCmd.size();ctr++) PropAdvance[ctr] = PropAdvanceCmd[ctr];
271 PropAdvance[engineNum] = setting;
276 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
278 bool FGFCS::Load(FGConfigFile* AC_cfg)
280 string token, delimiter;
281 string name, file, fname;
283 vector <FGFCSComponent*> *Components;
284 FGConfigFile *FCS_cfg;
287 // Determine if the FCS/Autopilot is defined inline in the aircraft configuration
288 // file or in a separate file. Set up the config file class as appropriate.
290 delimiter = AC_cfg->GetValue();
291 name = AC_cfg->GetValue("NAME");
292 fname = AC_cfg->GetValue("FILE");
294 if ( AC_cfg->GetValue("NORMALIZE") == "FALSE") {
296 cout << " Automatic Control Surface Normalization Disabled" << endl;
300 file = "control/" + fname + ".xml";
302 file = "control;" + fname + ".xml";
308 cerr << "FCS/Autopilot does not appear to be defined inline nor in a file" << endl;
310 FCS_cfg = new FGConfigFile(file);
311 if (!FCS_cfg->IsOpen()) {
312 cerr << "Could not open " << delimiter << " file: " << file << endl;
315 AC_cfg = FCS_cfg; // set local config file object pointer to FCS config
316 // file object pointer
320 AC_cfg->GetNextConfigLine();
323 if (delimiter == "AUTOPILOT") {
324 Components = &APComponents;
326 Name = "Autopilot: " + name;
327 } else if (delimiter == "FLIGHT_CONTROL") {
328 Components = &FCSComponents;
330 Name = "FCS: " + name;
332 cerr << endl << "Unknown FCS delimiter" << endl << endl;
335 if (debug_lvl > 0) cout << " Control System Name: " << Name << endl;
337 while ((token = AC_cfg->GetValue()) != string("/" + delimiter)) {
338 if (token == "COMPONENT") {
339 token = AC_cfg->GetValue("TYPE");
340 if (debug_lvl > 0) cout << endl << " Loading Component \""
341 << AC_cfg->GetValue("NAME")
342 << "\" of type: " << token << endl;
343 if ((token == "LAG_FILTER") ||
344 (token == "LEAD_LAG_FILTER") ||
345 (token == "SECOND_ORDER_FILTER") ||
346 (token == "WASHOUT_FILTER") ||
347 (token == "INTEGRATOR") ) {
348 Components->push_back(new FGFilter(this, AC_cfg));
349 } else if ((token == "PURE_GAIN") ||
350 (token == "SCHEDULED_GAIN") ||
351 (token == "AEROSURFACE_SCALE") ) {
353 Components->push_back(new FGGain(this, AC_cfg));
355 } else if (token == "SUMMER") {
356 Components->push_back(new FGSummer(this, AC_cfg));
357 } else if (token == "DEADBAND") {
358 Components->push_back(new FGDeadBand(this, AC_cfg));
359 } else if (token == "GRADIENT") {
360 Components->push_back(new FGGradient(this, AC_cfg));
361 } else if (token == "SWITCH") {
362 Components->push_back(new FGSwitch(this, AC_cfg));
363 } else if (token == "KINEMAT") {
364 Components->push_back(new FGKinemat(this, AC_cfg));
366 cerr << "Unknown token [" << token << "] in FCS portion of config file" << endl;
369 if (AC_cfg->GetNextConfigLine() == "EOF") break;
373 //collect information for normalizing control surfaces
376 for (i=0; i<Components->size(); i++) {
378 if ( (((*Components)[i])->GetType() == "AEROSURFACE_SCALE"
379 || ((*Components)[i])->GetType() == "KINEMAT")
380 && ((*Components)[i])->GetOutputNode() ) {
381 nodeName = ((*Components)[i])->GetOutputNode()->GetName();
382 if ( nodeName == "elevator-pos-rad" ) {
384 } else if ( nodeName == "left-aileron-pos-rad"
385 || nodeName == "aileron-pos-rad" ) {
387 } else if ( nodeName == "right-aileron-pos-rad" ) {
389 } else if ( nodeName == "rudder-pos-rad" ) {
391 } else if ( nodeName == "speedbrake-pos-rad" ) {
393 } else if ( nodeName == "spoiler-pos-rad" ) {
395 } else if ( nodeName == "flap-pos-deg" ) {
401 if (delimiter == "FLIGHT_CONTROL") bindModel();
408 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
410 double FGFCS::GetComponentOutput(int idx)
414 return FCSComponents[idx]->GetOutput();
416 return APComponents[idx]->GetOutput();
418 cerr << "Unknown FCS mode" << endl;
424 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
426 string FGFCS::GetComponentName(int idx)
430 return FCSComponents[idx]->GetName();
432 return APComponents[idx]->GetName();
434 cerr << "Unknown FCS mode" << endl;
440 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
442 double FGFCS::GetBrake(FGLGear::BrakeGroup bg)
445 case FGLGear::bgLeft:
447 case FGLGear::bgRight:
449 case FGLGear::bgCenter:
452 cerr << "GetBrake asked to return a bogus brake value" << endl;
457 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
459 string FGFCS::GetComponentStrings(void)
462 string CompStrings = "";
463 bool firstime = true;
465 for (comp = 0; comp < FCSComponents.size(); comp++) {
466 if (firstime) firstime = false;
467 else CompStrings += ", ";
469 CompStrings += FCSComponents[comp]->GetName();
472 for (comp = 0; comp < APComponents.size(); comp++)
475 CompStrings += APComponents[comp]->GetName();
481 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
483 string FGFCS::GetComponentValues(void)
486 string CompValues = "";
488 bool firstime = true;
490 for (comp = 0; comp < FCSComponents.size(); comp++) {
491 if (firstime) firstime = false;
492 else CompValues += ", ";
494 sprintf(buffer, "%9.6f", FCSComponents[comp]->GetOutput());
495 CompValues += string(buffer);
498 for (comp = 0; comp < APComponents.size(); comp++) {
499 sprintf(buffer, ", %9.6f", APComponents[comp]->GetOutput());
500 CompValues += string(buffer);
506 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
508 void FGFCS::AddThrottle(void)
510 ThrottleCmd.push_back(0.0);
511 ThrottlePos.push_back(0.0);
512 MixtureCmd.push_back(0.0); // assume throttle and mixture are coupled
513 MixturePos.push_back(0.0);
514 PropAdvanceCmd.push_back(0.0); // assume throttle and prop pitch are coupled
515 PropAdvance.push_back(0.0);
518 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520 void FGFCS::Normalize(void) {
522 //not all of these are guaranteed to be defined for every model
523 //those that are have an index >=0 in the ToNormalize array
524 //ToNormalize is filled in Load()
526 if ( ToNormalize[iDe] > -1 ) {
527 DePos[ofNorm] = FCSComponents[ToNormalize[iDe]]->GetOutputPct();
530 if ( ToNormalize[iDaL] > -1 ) {
531 DaLPos[ofNorm] = FCSComponents[ToNormalize[iDaL]]->GetOutputPct();
534 if ( ToNormalize[iDaR] > -1 ) {
535 DaRPos[ofNorm] = FCSComponents[ToNormalize[iDaR]]->GetOutputPct();
538 if ( ToNormalize[iDr] > -1 ) {
539 DrPos[ofNorm] = FCSComponents[ToNormalize[iDr]]->GetOutputPct();
542 if ( ToNormalize[iDsb] > -1 ) {
543 DsbPos[ofNorm] = FCSComponents[ToNormalize[iDsb]]->GetOutputPct();
546 if ( ToNormalize[iDsp] > -1 ) {
547 DspPos[ofNorm] = FCSComponents[ToNormalize[iDsp]]->GetOutputPct();
550 if ( ToNormalize[iDf] > -1 ) {
551 DfPos[ofNorm] = FCSComponents[ToNormalize[iDf]]->GetOutputPct();
554 DePos[ofMag] = fabs(DePos[ofRad]);
555 DaLPos[ofMag] = fabs(DaLPos[ofRad]);
556 DaRPos[ofMag] = fabs(DaRPos[ofRad]);
557 DrPos[ofMag] = fabs(DrPos[ofRad]);
558 DsbPos[ofMag] = fabs(DsbPos[ofRad]);
559 DspPos[ofMag] = fabs(DspPos[ofRad]);
560 DfPos[ofMag] = fabs(DfPos[ofRad]);
564 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
566 void FGFCS::bind(void)
568 PropertyManager->Tie("fcs/aileron-cmd-norm", this,
572 PropertyManager->Tie("fcs/elevator-cmd-norm", this,
576 PropertyManager->Tie("fcs/rudder-cmd-norm", this,
580 PropertyManager->Tie("fcs/flap-cmd-norm", this,
584 PropertyManager->Tie("fcs/speedbrake-cmd-norm", this,
588 PropertyManager->Tie("fcs/spoiler-cmd-norm", this,
592 PropertyManager->Tie("fcs/pitch-trim-cmd-norm", this,
593 &FGFCS::GetPitchTrimCmd,
594 &FGFCS::SetPitchTrimCmd,
596 PropertyManager->Tie("fcs/roll-trim-cmd-norm", this,
597 &FGFCS::GetRollTrimCmd,
598 &FGFCS::SetRollTrimCmd,
600 PropertyManager->Tie("fcs/yaw-trim-cmd-norm", this,
601 &FGFCS::GetYawTrimCmd,
602 &FGFCS::SetYawTrimCmd,
604 PropertyManager->Tie("gear/gear-cmd-norm", this,
609 PropertyManager->Tie("fcs/left-aileron-pos-rad", this,ofRad,
613 PropertyManager->Tie("fcs/left-aileron-pos-norm", this,ofNorm,
617 PropertyManager->Tie("fcs/mag-left-aileron-pos-rad", this,ofMag,
622 PropertyManager->Tie("fcs/right-aileron-pos-rad", this,ofRad,
626 PropertyManager->Tie("fcs/right-aileron-pos-norm", this,ofNorm,
630 PropertyManager->Tie("fcs/mag-right-aileron-pos-rad", this,ofMag,
635 PropertyManager->Tie("fcs/elevator-pos-rad", this, ofRad,
639 PropertyManager->Tie("fcs/elevator-pos-norm", this,ofNorm,
643 PropertyManager->Tie("fcs/mag-elevator-pos-rad", this,ofMag,
648 PropertyManager->Tie("fcs/rudder-pos-rad", this,ofRad,
652 PropertyManager->Tie("fcs/rudder-pos-norm", this,ofNorm,
656 PropertyManager->Tie("fcs/mag-rudder-pos-rad", this,ofMag,
661 PropertyManager->Tie("fcs/flap-pos-deg", this,ofRad,
665 PropertyManager->Tie("fcs/flap-pos-norm", this,ofNorm,
670 PropertyManager->Tie("fcs/speedbrake-pos-rad", this,ofRad,
674 PropertyManager->Tie("fcs/speedbrake-pos-norm", this,ofNorm,
678 PropertyManager->Tie("fcs/mag-speedbrake-pos-rad", this,ofMag,
683 PropertyManager->Tie("fcs/spoiler-pos-rad", this,ofRad,
687 PropertyManager->Tie("fcs/spoiler-pos-norm", this,ofNorm,
691 PropertyManager->Tie("fcs/mag-spoiler-pos-rad", this,ofMag,
696 PropertyManager->Tie("gear/gear-pos-norm", this,
701 PropertyManager->Tie("ap/elevator_cmd", this,
706 PropertyManager->Tie("ap/aileron_cmd", this,
711 PropertyManager->Tie("ap/rudder_cmd", this,
716 PropertyManager->Tie("ap/throttle_cmd", this,
717 &FGFCS::GetAPThrottleCmd,
718 &FGFCS::SetAPThrottleCmd,
721 PropertyManager->Tie("ap/attitude_setpoint", this,
722 &FGFCS::GetAPAttitudeSetPt,
723 &FGFCS::SetAPAttitudeSetPt,
726 PropertyManager->Tie("ap/altitude_setpoint", this,
727 &FGFCS::GetAPAltitudeSetPt,
728 &FGFCS::SetAPAltitudeSetPt,
731 PropertyManager->Tie("ap/heading_setpoint", this,
732 &FGFCS::GetAPHeadingSetPt,
733 &FGFCS::SetAPHeadingSetPt,
736 PropertyManager->Tie("ap/airspeed_setpoint", this,
737 &FGFCS::GetAPAirspeedSetPt,
738 &FGFCS::SetAPAirspeedSetPt,
741 PropertyManager->Tie("ap/acquire_attitude", this,
742 &FGFCS::GetAPAcquireAttitude,
743 &FGFCS::SetAPAcquireAttitude,
746 PropertyManager->Tie("ap/acquire_altitude", this,
747 &FGFCS::GetAPAcquireAltitude,
748 &FGFCS::SetAPAcquireAltitude,
751 PropertyManager->Tie("ap/acquire_heading", this,
752 &FGFCS::GetAPAcquireHeading,
753 &FGFCS::SetAPAcquireHeading,
756 PropertyManager->Tie("ap/acquire_airspeed", this,
757 &FGFCS::GetAPAcquireAirspeed,
758 &FGFCS::SetAPAcquireAirspeed,
761 PropertyManager->Tie("ap/attitude_hold", this,
762 &FGFCS::GetAPAttitudeHold,
763 &FGFCS::SetAPAttitudeHold,
766 PropertyManager->Tie("ap/altitude_hold", this,
767 &FGFCS::GetAPAltitudeHold,
768 &FGFCS::SetAPAltitudeHold,
771 PropertyManager->Tie("ap/heading_hold", this,
772 &FGFCS::GetAPHeadingHold,
773 &FGFCS::SetAPHeadingHold,
776 PropertyManager->Tie("ap/airspeed_hold", this,
777 &FGFCS::GetAPAirspeedHold,
778 &FGFCS::SetAPAirspeedHold,
781 PropertyManager->Tie("ap/wingslevel_hold", this,
782 &FGFCS::GetAPWingsLevelHold,
783 &FGFCS::SetAPWingsLevelHold,
787 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
789 void FGFCS::bindModel(void)
795 for (i=0; i<ThrottleCmd.size(); i++) {
796 snprintf(tmp,80,"fcs/throttle-cmd-norm[%u]",i);
797 PropertyManager->Tie( tmp,this,i,
798 &FGFCS::GetThrottleCmd,
799 &FGFCS::SetThrottleCmd,
801 snprintf(tmp,80,"fcs/throttle-pos-norm[%u]",i);
802 PropertyManager->Tie( tmp,this,i,
803 &FGFCS::GetThrottlePos,
804 &FGFCS::SetThrottlePos,
806 if ( MixtureCmd.size() > i ) {
807 snprintf(tmp,80,"fcs/mixture-cmd-norm[%u]",i);
808 PropertyManager->Tie( tmp,this,i,
809 &FGFCS::GetMixtureCmd,
810 &FGFCS::SetMixtureCmd,
812 snprintf(tmp,80,"fcs/mixture-pos-norm[%u]",i);
813 PropertyManager->Tie( tmp,this,i,
814 &FGFCS::GetMixturePos,
815 &FGFCS::SetMixturePos,
818 if ( PropAdvanceCmd.size() > i ) {
819 snprintf(tmp,80,"fcs/advance-cmd-norm[%u]",i);
820 PropertyManager->Tie( tmp,this,i,
821 &FGFCS::GetPropAdvanceCmd,
822 &FGFCS::SetPropAdvanceCmd,
824 snprintf(tmp,80,"fcs/advance-pos-norm[%u]",i);
825 PropertyManager->Tie( tmp,this,i,
826 &FGFCS::GetPropAdvance,
827 &FGFCS::SetPropAdvance,
833 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
835 void FGFCS::unbind(FGPropertyManager *node)
837 int N = node->nChildren();
838 for(int i=0;i<N;i++) {
839 if(node->getChild(i)->nChildren() ) {
840 unbind( (FGPropertyManager*)node->getChild(i) );
841 } else if( node->getChild(i)->isTied() ) {
842 node->getChild(i)->untie();
847 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
848 // The bitmasked value choices are as follows:
849 // unset: In this case (the default) JSBSim would only print
850 // out the normally expected messages, essentially echoing
851 // the config files as they are read. If the environment
852 // variable is not set, debug_lvl is set to 1 internally
853 // 0: This requests JSBSim not to output any messages
855 // 1: This value explicity requests the normal JSBSim
857 // 2: This value asks for a message to be printed out when
858 // a class is instantiated
859 // 4: When this value is set, a message is displayed when a
860 // FGModel object executes its Run() method
861 // 8: When this value is set, various runtime state variables
862 // are printed out periodically
863 // 16: When set various parameters are sanity checked and
864 // a message is printed out when they go out of bounds
866 void FGFCS::Debug(int from)
868 if (debug_lvl <= 0) return;
870 if (debug_lvl & 1) { // Standard console startup message output
871 if (from == 0) { // Constructor
875 if (debug_lvl & 2 ) { // Instantiation/Destruction notification
876 if (from == 0) cout << "Instantiated: FGFCS" << endl;
877 if (from == 1) cout << "Destroyed: FGFCS" << endl;
879 if (debug_lvl & 4 ) { // Run() method entry print for FGModel-derived objects
881 if (debug_lvl & 8 ) { // Runtime state variables
883 if (debug_lvl & 16) { // Sanity checking
885 if (debug_lvl & 64) {
886 if (from == 0) { // Constructor
887 cout << IdSrc << endl;
888 cout << IdHdr << endl;