]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/FGFCS.h
Updates from JSBSim, including new turbine engine model from David Culp
[flightgear.git] / src / FDM / JSBSim / FGFCS.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3  Header:       FGGFCS.h
4  Author:       Jon S. Berndt
5  Date started: 12/12/98
6  
7  ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
8  
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13  
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
17  details.
18  
19  You should have received a copy of the GNU General Public License along with
20  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21  Place - Suite 330, Boston, MA  02111-1307, USA.
22  
23  Further information about the GNU General Public License can also be found on
24  the world wide web at http://www.gnu.org.
25  
26 HISTORY
27 --------------------------------------------------------------------------------
28 12/12/98   JSB   Created
29  
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGFCS_H
35 #define FGFCS_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #ifdef FGFS
42 #  include <simgear/compiler.h>
43 #  ifdef SG_HAVE_STD_INCLUDES
44 #    include <vector>
45 #  else
46 #    include <vector.h>
47 #  endif
48 #else
49 #  include <vector>
50 #endif
51
52 #include <string>
53 #include "filtersjb/FGFCSComponent.h"
54 #include "FGModel.h"
55 #include "FGLGear.h"
56 #include "FGConfigFile.h"
57
58 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 DEFINITIONS
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61
62 #define ID_FCS "$Id$"
63
64 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
65 FORWARD DECLARATIONS
66 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
67
68 namespace JSBSim {
69
70 typedef enum { iDe=0, iDaL, iDaR, iDr, iDsb, iDsp, iDf, NNorm } FcIdx;
71 typedef enum { ofRad=0, ofNorm, ofMag , NForms} OutputForm;
72
73 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
76
77 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
78 CLASS DOCUMENTATION
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
80
81 /** Encapsulates the Flight Control System (FCS) functionality.
82     <ul><li>\URL[Source Code]{FGFCS.cpp.html}</li>
83     <li>\URL[Header File]{FGFCS.h.html}</li></ul>
84     This class owns and contains the list of \URL[components]{FGFCSComponent.html}
85     that define the control system for this aircraft. The config file for the
86     aircraft contains a description of the control path that starts at an input
87     or command and ends at an effector, e.g. an aerosurface. The FCS components
88     which comprise the control laws for an axis are defined sequentially in
89     the configuration file. For instance, for the X-15:
90     
91     <pre>
92     &lt FLIGHT_CONTROL NAME="X-15 SAS"&gt
93
94     &lt COMPONENT NAME="Pitch Trim Sum" TYPE="SUMMER"&gt
95       ID            0
96       INPUT        FG_ELEVATOR_CMD
97       INPUT        FG_PITCH_TRIM_CMD
98       CLIPTO       -1 1
99     &lt/COMPONENT&gt
100
101     &lt COMPONENT NAME="Pitch Command Scale" TYPE="AEROSURFACE_SCALE"&gt
102       ID           1
103       INPUT        0
104       MIN         -50
105       MAX          50
106     &lt/COMPONENT&gt
107
108     &lt COMPONENT NAME="Pitch Gain 1" TYPE="PURE_GAIN"&gt
109       ID           2
110       INPUT        1
111       GAIN         -0.36
112     &lt/COMPONENT&gt
113
114     &lt COMPONENT NAME="Pitch Scheduled Gain 1" TYPE="SCHEDULED_GAIN"&gt
115       ID           3
116       INPUT        2
117       GAIN         0.017
118       SCHEDULED_BY FG_ELEVATOR_POS
119       -0.35  -6.0
120       -0.17  -3.0
121        0.00  -2.0
122        0.09  -3.0
123        0.17  -5.0
124        0.60 -12.0
125     &lt/COMPONENT&gt
126
127     ... etc.
128     </pre>
129     
130     In the above case we can see the first few components of the pitch channel
131     defined. The input to the first component, as can be seen in the "Pitch trim
132     sum" component, is really the sum of two parameters: elevator command (from
133     the stick - a pilot input), and pitch trim. The type of this component is
134     "Summer". Its ID is 0 - the ID is used by other components to reference it.
135     The next component created is an aerosurface scale component - a type of
136     gain (see the LoadFCS() method for insight on how the various types of
137     components map into the actual component classes). You can see the input of
138     the "Pitch Command Scale" component takes "0" as input. When a number is
139     specified as an input, it refers to the ID of another FCS component. In this
140     case, ID 0 refers to the previously defined and discussed "Pitch Trim Sum"
141     component. This continues until the final component for an axis when the
142     OUTPUT keyword specifies where the output is supposed to go. See the
143     individual components for more information on how they are mechanized.
144     
145     @author Jon S. Berndt
146     @version $Id$
147     @see FGFCSComponent
148     @see FGConfigFile
149     @see FGGain
150     @see FGSummer
151     @see FGSwitch
152     @see FGGradient
153     @see FGFilter
154     @see FGDeadBand
155     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFCS.h?rev=HEAD&content-type=text/vnd.viewcvs-markup">
156          Header File </a>
157     @see <a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jsbsim/JSBSim/FGFCS.cpp?rev=HEAD&content-type=text/vnd.viewcvs-markup">
158          Source File </a>
159 */
160
161 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
162 CLASS DECLARATION
163 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
164
165 class FGFCS : public FGModel {
166
167 public:
168   /** Constructor
169       @param Executive a pointer to the parent executive object */
170   FGFCS(FGFDMExec*);
171   /// Destructor
172   ~FGFCS();
173
174   /** Runs the Flight Controls model; called by the Executive
175       @return false if no error */
176   bool Run(void);
177
178   /// @name Pilot input command retrieval
179   //@{
180   /** Gets the aileron command.
181       @return aileron command in percent */
182   inline double GetDaCmd(void) const { return DaCmd; }
183   
184   /** Gets the elevator command.
185       @return elevator command in percent */
186   inline double GetDeCmd(void) const { return DeCmd; }
187
188   /** Gets the rudder command.
189       @return rudder command in percent */
190   inline double GetDrCmd(void) const { return DrCmd; }
191
192   /** Gets the flaps command.
193       @return flaps command in percent */
194   inline double GetDfCmd(void) const { return DfCmd; }
195
196   /** Gets the speedbrake command.
197       @return speedbrake command in percent */
198   inline double GetDsbCmd(void) const { return DsbCmd; }
199
200   /** Gets the spoiler command.
201       @return spoiler command in percent */
202   inline double GetDspCmd(void) const { return DspCmd; }
203
204   /** Gets the throttle command.
205       @param engine engine ID number
206       @return throttle command in percent ( 0 - 100) for the given engine */
207   double GetThrottleCmd(int engine) const;
208
209   /** Gets the mixture command.
210       @param engine engine ID number
211       @return mixture command in percent ( 0 - 100) for the given engine */
212   inline double GetMixtureCmd(int engine) const { return MixtureCmd[engine]; }
213
214   /** Gets the prop pitch command.
215       @param engine engine ID number
216       @return pitch command in percent ( 0.0 - 1.0) for the given engine */
217   inline double GetPropAdvanceCmd(int engine) const { return PropAdvanceCmd[engine]; }
218
219   /** Gets the pitch trim command.
220       @return pitch trim command in percent */
221   inline double GetPitchTrimCmd(void) const { return PTrimCmd; }
222   
223   /** Gets the rudder trim command.
224       @return rudder trim command in percent */
225   inline double GetYawTrimCmd(void) const { return YTrimCmd; }
226   
227   /** Gets the aileron trim command.
228       @return aileron trim command in percent */
229   inline double GetRollTrimCmd(void) const { return RTrimCmd; }
230   
231   /** Get the gear extend/retract command. 0 commands gear up, 1 down.
232       defaults to down.
233       @return the current value of the gear extend/retract command*/
234   inline double GetGearCmd(void) const { return GearCmd; }    
235   //@}
236
237   /// @name AUTOPilot -> FCS effectors command retrieval
238   //@{
239   /** Gets the AUTOPilot aileron command.
240       @return aileron command in radians */
241   inline double GetAPDaCmd(void) const { return AP_DaCmd; }
242   
243   /** Gets the AUTOPilot elevator command.
244       @return elevator command in radians */
245   inline double GetAPDeCmd(void) const { return AP_DeCmd; }
246
247   /** Gets the AUTOPilot rudder command.
248       @return rudder command in radians */
249   inline double GetAPDrCmd(void) const { return AP_DrCmd; }
250   
251   /** Gets the AUTOPilot throttle (all engines) command.
252       @return throttle command in percent */
253   inline double GetAPThrottleCmd(void) const { return AP_ThrottleCmd; }
254   //@}
255
256   /// @name AUTOPilot setpoint retrieval
257   //@{
258   /** Gets the autopilot pitch attitude setpoint
259       @return Pitch attitude setpoint in radians */
260   inline double GetAPAttitudeSetPt(void) const {return APAttitudeSetPt;}
261
262   /** Gets the autopilot altitude setpoint
263       @return Altitude setpoint in feet */
264   inline double GetAPAltitudeSetPt(void) const {return APAltitudeSetPt;}
265
266   /** Gets the autopilot heading setpoint
267       @return Heading setpoint in radians */
268   inline double GetAPHeadingSetPt(void) const {return APHeadingSetPt;}
269
270   /** Gets the autopilot airspeed setpoint
271       @return Airspeed setpoint in fps */
272   inline double GetAPAirspeedSetPt(void) const {return APAirspeedSetPt;}
273   //@}
274
275   /// @name AUTOPilot setpoint setting
276   //@{
277   /// Sets the autopilot pitch attitude setpoint
278   inline void SetAPAttitudeSetPt(double set) {APAttitudeSetPt = set;}
279
280   /// Sets the autopilot altitude setpoint
281   inline void SetAPAltitudeSetPt(double set) {APAltitudeSetPt = set;}
282
283   /// Sets the autopilot heading setpoint
284   inline void SetAPHeadingSetPt(double set) {APHeadingSetPt = set;}
285
286   /// Sets the autopilot airspeed setpoint
287   inline void SetAPAirspeedSetPt(double set) {APAirspeedSetPt = set;}
288   //@}
289
290
291     /// @name AUTOPilot mode setting
292   //@{
293   /** Turns on/off the attitude-seeking autopilot.
294       @param set true turns the mode on, false turns it off  **/
295   inline void SetAPAcquireAttitude(bool set) {APAcquireAttitude = set;}
296   
297   /** Turns on/off the altitude-seeking autopilot.
298       @param set true turns the mode on, false turns it off  **/
299   inline void SetAPAcquireAltitude(bool set) {APAcquireAltitude = set;}
300   
301   /** Turns on/off the heading-seeking autopilot.
302       @param set true turns the mode on, false turns it off  **/
303   inline void SetAPAcquireHeading(bool set) {APAcquireHeading = set;}
304   
305   /** Turns on/off the airspeed-seeking autopilot.
306       @param set true turns the mode on, false turns it off  **/
307   inline void SetAPAcquireAirspeed(bool set) {APAcquireAirspeed = set;}
308   
309   /** Turns on/off the attitude-holding autopilot.
310       @param set true turns the mode on, false turns it off  **/
311   inline void SetAPAttitudeHold(bool set) {APAttitudeHold = set;}
312
313   /** Turns on/off the altitude-holding autopilot.
314       @param set true turns the mode on, false turns it off  **/
315   inline void SetAPAltitudeHold(bool set) {APAltitudeHold = set;}
316
317   /** Turns on/off the heading-holding autopilot.
318       @param set true turns the mode on, false turns it off  **/
319   inline void SetAPHeadingHold(bool set) {APHeadingHold = set;}
320
321   /** Turns on/off the airspeed-holding autopilot.
322       @param set true turns the mode on, false turns it off  **/
323   inline void SetAPAirspeedHold(bool set) {APAirspeedHold = set;}
324
325   /** Turns on/off the wing-leveler autopilot.
326       @param set true turns the mode on, false turns it off  **/
327   inline void SetAPWingsLevelHold(bool set) {APWingsLevelHold = set;}
328   //@}
329   
330   /// @name AUTOPilot mode retrieval
331   //@{
332   /** Retrieves the on/off mode of the autopilot AcquireAttitude mode
333       @return true if on, false if off */
334   inline bool GetAPAcquireAttitude(void) const {return APAcquireAttitude;}
335
336   /** Retrieves the on/off mode of the autopilot AcquireAltitude mode
337       @return true if on, false if off */
338   inline bool GetAPAcquireAltitude(void) const {return APAcquireAltitude;}
339
340   /** Retrieves the on/off mode of the autopilot AcquireHeading mode
341       @return true if on, false if off */
342   inline bool GetAPAcquireHeading(void) const {return APAcquireHeading;}
343
344   /** Retrieves the on/off mode of the autopilot AcquireAirspeed mode
345       @return true if on, false if off */
346   inline bool GetAPAcquireAirspeed(void) const {return APAcquireAirspeed;}
347
348   /** Retrieves the on/off mode of the autopilot AttitudeHold mode
349       @return true if on, false if off */
350   inline bool GetAPAttitudeHold(void) const {return APAttitudeHold;}
351
352   /** Retrieves the on/off mode of the autopilot AltitudeHold mode
353       @return true if on, false if off */
354   inline bool GetAPAltitudeHold(void) const {return APAltitudeHold;}
355
356   /** Retrieves the on/off mode of the autopilot HeadingHold mode
357       @return true if on, false if off */
358   inline bool GetAPHeadingHold(void) const {return APHeadingHold;}
359
360   /** Retrieves the on/off mode of the autopilot AirspeedHold mode
361       @return true if on, false if off */
362   inline bool GetAPAirspeedHold(void) const {return APAirspeedHold;}
363
364   /** Retrieves the on/off mode of the autopilot WingsLevelHold mode
365       @return true if on, false if off */
366   inline bool GetAPWingsLevelHold(void) const {return APWingsLevelHold;}
367   //@}
368
369   /// @name Aerosurface position retrieval
370   //@{
371   /** Gets the left aileron position.
372       @return aileron position in radians */
373   inline double GetDaLPos( int form = ofRad ) 
374                          const { return DaLPos[form]; }
375
376   /// @name Aerosurface position retrieval
377   //@{
378   /** Gets the right aileron position.
379       @return aileron position in radians */
380   inline double GetDaRPos( int form = ofRad ) 
381                          const { return DaRPos[form]; }
382
383   /** Gets the elevator position.
384       @return elevator position in radians */
385   inline double GetDePos( int form = ofRad ) 
386                          const { return DePos[form]; }
387  
388   /** Gets the rudder position.
389       @return rudder position in radians */
390   inline double GetDrPos( int form = ofRad ) 
391                          const { return DrPos[form]; }
392
393   /** Gets the speedbrake position.
394       @return speedbrake position in radians */
395   inline double GetDsbPos( int form = ofRad ) 
396                          const { return DsbPos[form]; }
397
398   /** Gets the spoiler position.
399       @return spoiler position in radians */
400   inline double GetDspPos( int form = ofRad ) 
401                          const { return DspPos[form]; }
402   
403   /** Gets the flaps position.
404       @return flaps position in radians */
405   inline double GetDfPos( int form = ofRad ) 
406                          const { return DfPos[form]; }
407                          
408   /** Gets the throttle position.
409       @param engine engine ID number
410       @return throttle position for the given engine in percent ( 0 - 100)*/
411   double GetThrottlePos(int engine) const;
412
413   /** Gets the mixture position.
414       @param engine engine ID number
415       @return mixture position for the given engine in percent ( 0 - 100)*/
416   inline double GetMixturePos(int engine) const { return MixturePos[engine]; }
417   
418   /** Gets the gear position (0 up, 1 down), defaults to down
419       @return gear position (0 up, 1 down) */
420   inline double GetGearPos(void) const { return GearPos; }    
421
422   /** Gets the prop pitch position.
423       @param engine engine ID number
424       @return prop pitch position for the given engine in percent ( 0.0-1.0)*/
425   inline double GetPropAdvance(int engine) const { return PropAdvance[engine]; }
426   //@}
427
428   /** Retrieves the State object pointer.
429       This is used by the FGFCS-owned components.
430       @return pointer to the State object */
431   inline FGState* GetState(void) { return State; }
432
433   /** Retrieves a components output value
434       @param idx the index of the component (the component ID)
435       @return output value from the component */
436   double GetComponentOutput(int idx);
437
438   /** Retrieves the component name
439       @param idx the index of the component (the component ID)
440       @return name of the component */
441   string GetComponentName(int idx);
442
443   /** Retrieves all component names for inclusion in output stream */
444   string GetComponentStrings(void);
445
446   /** Retrieves all component outputs for inclusion in output stream */
447   string GetComponentValues(void);
448
449   /// @name Pilot input command setting
450   //@{
451   /** Sets the aileron command
452       @param cmd aileron command in percent*/
453   inline void SetDaCmd( double cmd ) { DaCmd = cmd; }
454
455   /** Sets the elevator command
456       @param cmd elevator command in percent*/
457   inline void SetDeCmd(double cmd ) { DeCmd = cmd; }
458
459   /** Sets the rudder command
460       @param cmd rudder command in percent*/
461   inline void SetDrCmd(double cmd) { DrCmd = cmd; }
462
463   /** Sets the flaps command
464       @param cmd flaps command in percent*/
465   inline void SetDfCmd(double cmd) { DfCmd = cmd; }
466
467   /** Sets the speedbrake command
468       @param cmd speedbrake command in percent*/
469   inline void SetDsbCmd(double cmd) { DsbCmd = cmd; }
470
471   /** Sets the spoilers command
472       @param cmd spoilers command in percent*/
473   inline void SetDspCmd(double cmd) { DspCmd = cmd; }
474
475   /** Sets the pitch trim command
476       @param cmd pitch trim command in percent*/
477   inline void SetPitchTrimCmd(double cmd) { PTrimCmd = cmd; }
478
479   /** Sets the rudder trim command
480       @param cmd rudder trim command in percent*/
481   inline void SetYawTrimCmd(double cmd) { YTrimCmd = cmd; }
482
483   /** Sets the aileron trim command
484       @param cmd aileron trim command in percent*/
485   inline void SetRollTrimCmd(double cmd) { RTrimCmd = cmd; }
486
487   /** Sets the throttle command for the specified engine
488       @param engine engine ID number
489       @param cmd throttle command in percent (0 - 100)*/
490   void SetThrottleCmd(int engine, double cmd);
491
492   /** Sets the mixture command for the specified engine
493       @param engine engine ID number
494       @param cmd mixture command in percent (0 - 100)*/
495   void SetMixtureCmd(int engine, double cmd);
496   
497   /** Set the gear extend/retract command, defaults to down
498       @param gear command 0 for up, 1 for down */
499    void SetGearCmd(double gearcmd) { GearCmd = gearcmd; }   
500
501   /** Sets the propeller pitch command for the specified engine
502       @param engine engine ID number
503       @param cmd mixture command in percent (0.0 - 1.0)*/
504   void SetPropAdvanceCmd(int engine, double cmd);
505   //@}
506
507   /// @name AUTOPilot -> FCS effector command setting
508   //@{
509   /** Sets the AUTOPilot aileron command
510       @param cmd AUTOPilot aileron command in radians*/
511   inline void SetAPDaCmd( double cmd ) { AP_DaCmd = cmd; }
512
513   /** Sets the AUTOPilot elevator command
514       @param cmd AUTOPilot elevator command in radians*/
515   inline void SetAPDeCmd(double cmd ) { AP_DeCmd = cmd; }
516
517   /** Sets the AUTOPilot rudder command
518       @param cmd AUTOPilot rudder command in radians*/
519   inline void SetAPDrCmd(double cmd) { AP_DrCmd = cmd; }
520
521   /** Sets the AUTOPilot throttle command
522       @param cmd AUTOPilot throttle command in percent*/
523   inline void SetAPThrottleCmd(double cmd) { AP_ThrottleCmd = cmd; }
524   //@}
525
526   /// @name Aerosurface position setting
527   //@{
528   /** Sets the left aileron position
529       @param cmd left aileron position in radians*/
530   inline void SetDaLPos( int form , double pos ) 
531                                       { DaLPos[form] = pos; }
532
533   /** Sets the right aileron position
534       @param cmd right aileron position in radians*/
535   inline void SetDaRPos( int form , double pos ) 
536                                       { DaRPos[form] = pos; }
537
538   /** Sets the elevator position
539       @param cmd elevator position in radians*/
540   inline void SetDePos( int form , double pos ) 
541                                       { DePos[form] = pos; }
542
543   /** Sets the rudder position
544       @param cmd rudder position in radians*/
545   inline void SetDrPos( int form , double pos ) 
546                                       { DrPos[form] = pos; }
547  
548    /** Sets the flaps position
549       @param cmd flaps position in radians*/
550   inline void SetDfPos( int form , double pos ) 
551                                       { DfPos[form] = pos; }
552   
553   /** Sets the speedbrake position
554       @param cmd speedbrake position in radians*/
555   inline void SetDsbPos( int form , double pos ) 
556                                       { DsbPos[form] = pos; }
557
558   /** Sets the spoiler position
559       @param cmd spoiler position in radians*/
560   inline void SetDspPos( int form , double pos ) 
561                                       { DspPos[form] = pos; }
562  
563   /** Sets the actual throttle setting for the specified engine
564       @param engine engine ID number
565       @param cmd throttle setting in percent (0 - 100)*/
566   void SetThrottlePos(int engine, double cmd);
567
568   /** Sets the actual mixture setting for the specified engine
569       @param engine engine ID number
570       @param cmd mixture setting in percent (0 - 100)*/
571   void SetMixturePos(int engine, double cmd);
572   
573   /** Set the gear extend/retract position, defaults to down
574       @param gear position 0 up, 1 down       */
575    void SetGearPos(double gearpos) { GearPos = gearpos; }   
576
577
578   /** Sets the actual prop pitch setting for the specified engine
579       @param engine engine ID number
580       @param cmd prop pitch setting in percent (0.0 - 1.0)*/
581   void SetPropAdvance(int engine, double cmd);
582   //@}
583
584     /// @name Landing Gear brakes
585   //@{
586   /** Sets the left brake group
587       @param cmd brake setting in percent (0.0 - 1.0) */
588   void SetLBrake(double cmd) {LeftBrake = cmd;}
589
590   /** Sets the right brake group
591       @param cmd brake setting in percent (0.0 - 1.0) */
592   void SetRBrake(double cmd) {RightBrake = cmd;}
593
594   /** Sets the center brake group
595       @param cmd brake setting in percent (0.0 - 1.0) */
596   void SetCBrake(double cmd) {CenterBrake = cmd;}
597
598   /** Gets the brake for a specified group.
599       @param bg which brakegroup to retrieve the command for
600       @return the brake setting for the supplied brake group argument */
601   double GetBrake(FGLGear::BrakeGroup bg);
602   //@}
603
604   /** Loads the Flight Control System.
605       The FGAircraft instance is actually responsible for reading the config file
606       and calling the various Loadxx() methods of the other systems, passing in
607       the config file instance pointer. LoadFCS() is called from FGAircraft.
608       @param AC_cfg pointer to the config file instance
609       @return true if succesful */
610   bool Load(FGConfigFile* AC_cfg);
611
612   void AddThrottle(void);
613   
614   FGPropertyManager* GetPropertyManager(void) { return PropertyManager; }
615   
616   void bind(void);
617   void bindModel(void);
618   void unbind(FGPropertyManager *node);
619   
620 private:
621   double DaCmd, DeCmd, DrCmd, DfCmd, DsbCmd, DspCmd;
622   double AP_DaCmd, AP_DeCmd, AP_DrCmd, AP_ThrottleCmd;
623   double DePos[NForms], DaLPos[NForms], DaRPos[NForms], DrPos[NForms];  
624   double DfPos[NForms], DsbPos[NForms], DspPos[NForms];
625   double PTrimCmd, YTrimCmd, RTrimCmd;
626   vector <double> ThrottleCmd;
627   vector <double> ThrottlePos;
628   vector <double> MixtureCmd;
629   vector <double> MixturePos;
630   vector <double> PropAdvanceCmd;
631   vector <double> PropAdvance;
632   double LeftBrake, RightBrake, CenterBrake; // Brake settings
633   double GearCmd,GearPos;
634
635   enum Mode {mAP, mFCS, mNone} eMode;
636
637   double APAttitudeSetPt, APAltitudeSetPt, APHeadingSetPt, APAirspeedSetPt;
638   bool APAcquireAttitude, APAcquireAltitude, APAcquireHeading, APAcquireAirspeed;
639   bool APAttitudeHold, APAltitudeHold, APHeadingHold, APAirspeedHold, APWingsLevelHold;
640
641   bool DoNormalize;
642   void Normalize(void);
643
644   vector <FGFCSComponent*> FCSComponents;
645   vector <FGFCSComponent*> APComponents;
646   int ToNormalize[NNorm];
647   void Debug(int from);
648 };
649 }
650
651 #endif
652