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