JSBSim Flight Dynamics Model 1.3.3 (16 Oct 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGFCS Class Reference

Detailed Description

Encapsulates the Flight Control System (FCS) functionality.

This class also encapsulates the identical "system" and "autopilot" capability. FGFCS owns and contains the list of FGFCSComponents that define a system or systems for the modeled aircraft. The config file for the aircraft contains a description of the control path that starts at an input or command and ends at an effector, e.g. an aerosurface. The FCS components which comprise the control laws for an axis are defined sequentially in the configuration file. For instance, for the X-15:

<flight_control name="X-15 SAS">
<channel>
<summer name="Pitch Trim Sum">
<input> fcs/elevator-cmd-norm </input>
<input> fcs/pitch-trim-cmd-norm </input>
<clipto>
<min>-1</min>
<max>1</max>
</clipto>
</summer>
<aerosurface_scale name="Pitch Command Scale">
<input> fcs/pitch-trim-sum </input>
<range>
<min> -50 </min>
<max> 50 </max>
</range>
</aerosurface_scale>
... etc.

In the above case we can see the first few components of the pitch channel defined. The input to the first component (a summer), as can be seen in the "Pitch trim sum" component, is really the sum of two parameters: elevator command (from the stick - a pilot input), and pitch trim. The next component created is an aerosurface scale component - a type of gain (see the LoadFCS() method for insight on how the various types of components map into the actual component classes). This continues until the final component for an axis when the <output> element is usually used to specify where the output is supposed to go. See the individual components for more information on how they are mechanized.

Another option for the flight controls portion of the config file is that in addition to using the "NAME" attribute in,

<flight_control name="X-15 SAS">

one can also supply a filename:

<flight_control name="X-15 SAS" file="X15.xml">
</flight_control>

In this case, the FCS would be read in from another file.

Properties

  • fcs/aileron-cmd-norm normalized aileron command
  • fcs/elevator-cmd-norm normalized elevator command
  • fcs/rudder-cmd-norm
  • fcs/steer-cmd-norm
  • fcs/flap-cmd-norm
  • fcs/speedbrake-cmd-norm
  • fcs/spoiler-cmd-norm
  • fcs/pitch-trim-cmd-norm
  • fcs/roll-trim-cmd-norm
  • fcs/yaw-trim-cmd-norm
  • gear/gear-cmd-norm
  • fcs/left-aileron-pos-rad
  • fcs/left-aileron-pos-deg
  • fcs/left-aileron-pos-norm
  • fcs/mag-left-aileron-pos-rad
  • fcs/right-aileron-pos-rad
  • fcs/right-aileron-pos-deg
  • fcs/right-aileron-pos-norm
  • fcs/mag-right-aileron-pos-rad
  • fcs/elevator-pos-rad
  • fcs/elevator-pos-deg
  • fcs/elevator-pos-norm
  • fcs/mag-elevator-pos-rad
  • fcs/rudder-pos-rad
  • fcs/rudder-pos-deg
  • fcs/rudder-pos-norm
  • fcs/mag-rudder-pos-rad
  • fcs/flap-pos-rad
  • fcs/flap-pos-deg
  • fcs/flap-pos-norm
  • fcs/speedbrake-pos-rad
  • fcs/speedbrake-pos-deg
  • fcs/speedbrake-pos-norm
  • fcs/mag-speedbrake-pos-rad
  • fcs/spoiler-pos-rad
  • fcs/spoiler-pos-deg
  • fcs/spoiler-pos-norm
  • fcs/mag-spoiler-pos-rad
  • fcs/wing-fold-pos-norm
  • gear/gear-pos-norm
  • gear/tailhook-pos-norm
Author
Jon S. Berndt
Version
Revision
1.55
See also
FGActuator
FGDeadBand
FGFCSFunction
FGFilter
FGGain
FGKinemat
FGPID
FGSensor
FGSummer
FGSwitch
FGWaypoint
FGAngles
FGFCSComponent
Element
FGDistributor

Definition at line 188 of file FGFCS.h.

#include <FGFCS.h>

+ Inheritance diagram for FGFCS:
+ Collaboration diagram for FGFCS:

Public Member Functions

 FGFCS (FGFDMExec *)
 Constructor.
 
 ~FGFCS () override
 Destructor.
 
bool InitModel (void) override
 
bool Run (bool Holding) override
 Runs the Flight Controls model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold.
 
Pilot input command retrieval
double GetDaCmd (void) const
 Gets the aileron command.
 
double GetDeCmd (void) const
 Gets the elevator command.
 
double GetDrCmd (void) const
 Gets the rudder command.
 
double GetDsCmd (void) const
 Gets the steering command.
 
double GetDfCmd (void) const
 Gets the flaps command.
 
double GetDsbCmd (void) const
 Gets the speedbrake command.
 
double GetDspCmd (void) const
 Gets the spoiler command.
 
double GetThrottleCmd (int engine) const
 Gets the throttle command.
 
const std::vector< double > & GetThrottleCmd () const
 
double GetMixtureCmd (int engine) const
 Gets the mixture command.
 
const std::vector< double > & GetMixtureCmd () const
 
double GetPropAdvanceCmd (int engine) const
 Gets the prop pitch command.
 
bool GetFeatherCmd (int engine) const
 Gets the prop feather command.
 
double GetPitchTrimCmd (void) const
 Gets the pitch trim command.
 
double GetYawTrimCmd (void) const
 Gets the rudder trim command.
 
double GetRollTrimCmd (void) const
 Gets the aileron trim command.
 
double GetGearCmd (void) const
 Get the gear extend/retract command.
 
Aerosurface position retrieval
double GetDaLPos (int form=ofRad) const
 Gets the left aileron position.
 
double GetDaRPos (int form=ofRad) const
 Gets the right aileron position.
 
double GetDePos (int form=ofRad) const
 Gets the elevator position.
 
double GetDrPos (int form=ofRad) const
 Gets the rudder position.
 
double GetDsbPos (int form=ofRad) const
 Gets the speedbrake position.
 
double GetDspPos (int form=ofRad) const
 Gets the spoiler position.
 
double GetDfPos (int form=ofRad) const
 Gets the flaps position.
 
double GetThrottlePos (int engine) const
 Gets the throttle position.
 
const std::vector< double > & GetThrottlePos () const
 
double GetMixturePos (int engine) const
 Gets the mixture position.
 
const std::vector< double > & GetMixturePos () const
 
double GetGearPos (void) const
 Gets the gear position (0 up, 1 down), defaults to down.
 
double GetTailhookPos (void) const
 Gets the tailhook position (0 up, 1 down)
 
double GetWingFoldPos (void) const
 Gets the wing fold position (0 unfolded, 1 folded)
 
double GetPropAdvance (int engine) const
 Gets the prop pitch position.
 
const std::vector< double > & GetPropAdvance () const
 
bool GetPropFeather (int engine) const
 Gets the prop feather position.
 
const std::vector< bool > & GetPropFeather () const
 
std::string GetComponentStrings (const std::string &delimiter) const
 Retrieves all component names for inclusion in output stream.
 
std::string GetComponentValues (const std::string &delimiter) const
 Retrieves all component outputs for inclusion in output stream.
 
Pilot input command setting
void SetDaCmd (double cmd)
 Sets the aileron command.
 
void SetDeCmd (double cmd)
 Sets the elevator command.
 
void SetDrCmd (double cmd)
 Sets the rudder command.
 
void SetDsCmd (double cmd)
 Sets the steering command.
 
void SetDfCmd (double cmd)
 Sets the flaps command.
 
void SetDsbCmd (double cmd)
 Sets the speedbrake command.
 
void SetDspCmd (double cmd)
 Sets the spoilers command.
 
void SetPitchTrimCmd (double cmd)
 Sets the pitch trim command.
 
void SetYawTrimCmd (double cmd)
 Sets the rudder trim command.
 
void SetRollTrimCmd (double cmd)
 Sets the aileron trim command.
 
void SetThrottleCmd (int engine, double cmd)
 Sets the throttle command for the specified engine.
 
void SetMixtureCmd (int engine, double cmd)
 Sets the mixture command for the specified engine.
 
void SetGearCmd (double gearcmd)
 Set the gear extend/retract command, defaults to down.
 
void SetPropAdvanceCmd (int engine, double cmd)
 Sets the propeller pitch command for the specified engine.
 
void SetFeatherCmd (int engine, bool cmd)
 Sets the propeller feather command for the specified engine.
 
Aerosurface position setting
void SetDaLPos (int form, double pos)
 Sets the left aileron position.
 
void SetDaRPos (int form, double pos)
 Sets the right aileron position.
 
void SetDePos (int form, double pos)
 Sets the elevator position.
 
void SetDrPos (int form, double pos)
 Sets the rudder position.
 
void SetDfPos (int form, double pos)
 Sets the flaps position.
 
void SetDsbPos (int form, double pos)
 Sets the speedbrake position.
 
void SetDspPos (int form, double pos)
 Sets the spoiler position.
 
void SetThrottlePos (int engine, double cmd)
 Sets the actual throttle setting for the specified engine.
 
void SetMixturePos (int engine, double cmd)
 Sets the actual mixture setting for the specified engine.
 
void SetGearPos (double gearpos)
 Set the gear extend/retract position, defaults to down.
 
void SetTailhookPos (double hookpos)
 Set the tailhook position.
 
void SetWingFoldPos (double foldpos)
 Set the wing fold position.
 
void SetPropAdvance (int engine, double cmd)
 Sets the actual prop pitch setting for the specified engine.
 
void SetPropFeather (int engine, bool cmd)
 Sets the actual prop feather setting for the specified engine.
 
- Public Member Functions inherited from FGModel
 FGModel (FGFDMExec *, const std::string &name)
 Constructor.
 
 ~FGModel () override
 Destructor.
 
FGFDMExec * GetExec (void) const
 
const std::string & GetName (void) const
 
unsigned int GetRate (void) const
 Get the output rate for the model in frames.
 
bool InitModel (void) override
 
void SetPropertyManager (std::shared_ptr< FGPropertyManager > fgpm)
 
void SetRate (unsigned int tt)
 Set the ouput rate for the model in frames.
 
- Public Member Functions inherited from FGModelFunctions
std::string GetFunctionStrings (const std::string &delimeter) const
 Gets the strings for the current set of functions.
 
std::string GetFunctionValues (const std::string &delimeter) const
 Gets the function values.
 
std::shared_ptr< FGFunction > GetPreFunction (const std::string &name)
 Get one of the "pre" function.
 
bool Load (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PostLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void PreLoad (Element *el, FGFDMExec *fdmex, std::string prefix="")
 
void RunPostFunctions (void)
 
void RunPreFunctions (void)
 
- Public Member Functions inherited from FGJSBBase
 FGJSBBase ()
 Constructor for FGJSBBase.
 
virtual ~FGJSBBase ()
 Destructor for FGJSBBase.
 

Landing Gear brakes

enum  SystemType { stFCS , stSystem , stAutoPilot }
 
void SetLBrake (double cmd)
 Sets the left brake group.
 
void SetRBrake (double cmd)
 Sets the right brake group.
 
void SetCBrake (double cmd)
 Sets the center brake group.
 
double GetBrake (FGLGear::BrakeGroup bg)
 Gets the brake for a specified group.
 
const std::vector< double > & GetBrakePos () const
 
double GetLBrake (void) const
 Gets the left brake.
 
double GetRBrake (void) const
 Gets the right brake.
 
double GetCBrake (void) const
 Gets the center brake.
 
bool Load (Element *el) override
 Loads the Flight Control System.
 
SGPath FindFullPathName (const SGPath &path) const override
 
void AddThrottle (void)
 
double GetDt (void) const
 
std::shared_ptr< FGPropertyManager > GetPropertyManager (void)
 
bool GetTrimStatus (void) const
 
double GetChannelDeltaT (void) const
 

Additional Inherited Members

- Public Types inherited from FGJSBBase
enum  { eL = 1 , eM , eN }
 Moments L, M, N. More...
 
enum  { eP = 1 , eQ , eR }
 Rates P, Q, R. More...
 
enum  { eU = 1 , eV , eW }
 Velocities U, V, W. More...
 
enum  { eX = 1 , eY , eZ }
 Positions X, Y, Z. More...
 
enum  { ePhi = 1 , eTht , ePsi }
 Euler angles Phi, Theta, Psi. More...
 
enum  { eDrag = 1 , eSide , eLift }
 Stability axis forces, Drag, Side force, Lift. More...
 
enum  { eRoll = 1 , ePitch , eYaw }
 Local frame orientation Roll, Pitch, Yaw. More...
 
enum  { eNorth = 1 , eEast , eDown }
 Local frame position North, East, Down. More...
 
enum  { eLat = 1 , eLong , eRad }
 Locations Radius, Latitude, Longitude. More...
 
enum  {
  inNone = 0 , inDegrees , inRadians , inMeters ,
  inFeet
}
 Conversion specifiers. More...
 
- Static Public Member Functions inherited from FGJSBBase
static constexpr double CelsiusToFahrenheit (double celsius)
 Converts from degrees Celsius to degrees Fahrenheit.
 
static constexpr double CelsiusToKelvin (double celsius)
 Converts from degrees Celsius to degrees Kelvin.
 
static constexpr double CelsiusToRankine (double celsius)
 Converts from degrees Celsius to degrees Rankine.
 
static constexpr double Constrain (double min, double value, double max)
 Constrain a value between a minimum and a maximum value.
 
static bool EqualToRoundoff (double a, double b)
 Finite precision comparison.
 
static bool EqualToRoundoff (double a, float b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, double b)
 Finite precision comparison.
 
static bool EqualToRoundoff (float a, float b)
 Finite precision comparison.
 
static constexpr double FahrenheitToCelsius (double fahrenheit)
 Converts from degrees Fahrenheit to degrees Celsius.
 
static constexpr double FeetToMeters (double measure)
 Converts from feet to meters.
 
static const std::string & GetVersion (void)
 Returns the version number of JSBSim.
 
static constexpr double KelvinToCelsius (double kelvin)
 Converts from degrees Kelvin to degrees Celsius.
 
static constexpr double KelvinToFahrenheit (double kelvin)
 Converts from degrees Kelvin to degrees Fahrenheit.
 
static constexpr double KelvinToRankine (double kelvin)
 Converts from degrees Kelvin to degrees Rankine.
 
static constexpr double RankineToCelsius (double rankine)
 Converts from degrees Rankine to degrees Celsius.
 
static constexpr double RankineToKelvin (double rankine)
 Converts from degrees Rankine to degrees Kelvin.
 
static constexpr double sign (double num)
 
- Static Public Attributes inherited from FGJSBBase
static short debug_lvl = 1
 
- Protected Member Functions inherited from FGModel
bool Upload (Element *el, bool preLoad)
 Uploads this model in memory.
 
- Static Protected Member Functions inherited from FGJSBBase
static std::string CreateIndexedPropertyName (const std::string &Property, int index)
 
- Protected Attributes inherited from FGModel
bool enabled = true
 
unsigned int exe_ctr
 
FGFDMExec * FDMExec
 
std::string Name
 
std::shared_ptr< FGPropertyManager > PropertyManager
 
unsigned int rate
 
- Protected Attributes inherited from FGModelFunctions
FGPropertyReader LocalProperties
 
std::vector< std::shared_ptr< FGFunction > > PostFunctions
 
std::vector< std::shared_ptr< FGFunction > > PreFunctions
 
- Static Protected Attributes inherited from FGJSBBase
static constexpr double degtorad = M_PI / 180.
 
static constexpr double fpstokts = 1.0 / ktstofps
 
static constexpr double fttom = 0.3048
 
static constexpr double hptoftlbssec = 550.0
 
static constexpr double in3tom3 = inchtoft*inchtoft*inchtoft/m3toft3
 
static constexpr double inchtoft = 1.0/12.0
 
static constexpr double inhgtopa = 3386.38
 
static const std::string JSBSim_version = JSBSIM_VERSION " " __DATE__ " " __TIME__
 
static constexpr double kgtolb = 2.20462
 
static constexpr double kgtoslug = 0.06852168
 
static constexpr double ktstofps = 1852./(3600*fttom)
 
static constexpr double lbtoslug = 1.0/slugtolb
 
static constexpr double m3toft3 = 1.0/(fttom*fttom*fttom)
 
static const std::string needed_cfg_version = "2.0"
 
static constexpr double psftoinhg = 0.014138
 
static constexpr double psftopa = 47.88
 
static constexpr double radtodeg = 180. / M_PI
 
static constexpr double slugtolb = 32.174049
 Note that definition of lbtoslug by the inverse of slugtolb and not to a different constant you can also get from some tables will make lbtoslug*slugtolb == 1 up to the magnitude of roundoff.
 

Member Enumeration Documentation

◆ SystemType

enum SystemType

Definition at line 553 of file FGFCS.h.

553{ stFCS, stSystem, stAutoPilot };

Constructor & Destructor Documentation

◆ FGFCS()

FGFCS ( FGFDMExec *  fdm)

Constructor.

Parameters
Executivea pointer to the parent executive object

Definition at line 74 of file FGFCS.cpp.

74 : FGModel(fdm, "FGFCS"), ChannelRate(1)
75{
76 int i;
77 systype = stFCS;
78
79 DaCmd = DeCmd = DrCmd = DfCmd = DsbCmd = DspCmd = 0;
80 PTrimCmd = YTrimCmd = RTrimCmd = 0.0;
81 GearCmd = GearPos = 1; // default to gear down
82 BrakePos.resize(FGLGear::bgNumBrakeGroups);
83 TailhookPos = WingFoldPos = 0.0;
84
85 bind();
86 for (i=0;i<NForms;i++) {
87 DePos[i] = DaLPos[i] = DaRPos[i] = DrPos[i] = 0.0;
88 DfPos[i] = DsbPos[i] = DspPos[i] = 0.0;
89 }
90
91 Debug(0);
92}
FGModel(FGFDMExec *, const std::string &name)
Constructor.
Definition FGModel.cpp:59

◆ ~FGFCS()

~FGFCS ( )
override

Destructor.

Definition at line 96 of file FGFCS.cpp.

97{
98 ThrottleCmd.clear();
99 ThrottlePos.clear();
100 MixtureCmd.clear();
101 MixturePos.clear();
102 PropAdvanceCmd.clear();
103 PropAdvance.clear();
104 PropFeatherCmd.clear();
105 PropFeather.clear();
106
107 unsigned int i;
108
109 for (i=0;i<SystemChannels.size();i++) delete SystemChannels[i];
110 SystemChannels.clear();
111
112 Debug(1);
113}

Member Function Documentation

◆ AddThrottle()

void AddThrottle ( void  )

Definition at line 695 of file FGFCS.cpp.

696{
697 ThrottleCmd.push_back(0.0);
698 ThrottlePos.push_back(0.0);
699 MixtureCmd.push_back(0.0); // assume throttle and mixture are coupled
700 MixturePos.push_back(0.0);
701 PropAdvanceCmd.push_back(0.0); // assume throttle and prop pitch are coupled
702 PropAdvance.push_back(0.0);
703 PropFeatherCmd.push_back(false);
704 PropFeather.push_back(false);
705
706 unsigned int num = (unsigned int)ThrottleCmd.size()-1;
707 bindThrottle(num);
708}

◆ FindFullPathName()

SGPath FindFullPathName ( const SGPath &  path) const
overridevirtual

Reimplemented from FGModel.

Definition at line 626 of file FGFCS.cpp.

627{
628 SGPath name = FGModel::FindFullPathName(path);
629 if (systype != stSystem || !name.isNull()) return name;
630
631#ifdef _WIN32
632 const array<string, 1> dir_names = {"Systems"};
633#else
634 // Check alternative capitalization for case sensitive OSes.
635 const array<string, 2> dir_names = {"Systems", "systems"};
636#endif
637
638 for(const string& dir_name: dir_names) {
639 name = CheckPathName(FDMExec->GetFullAircraftPath()/dir_name, path);
640 if (!name.isNull()) return name;
641 }
642
643 return CheckPathName(FDMExec->GetSystemsPath(), path);
644}
const SGPath & GetFullAircraftPath(void)
Retrieves the full aircraft path name.
Definition FGFDMExec.h:402
const SGPath & GetSystemsPath(void)
Retrieves the systems path.
Definition FGFDMExec.h:400

◆ GetBrake()

double GetBrake ( FGLGear::BrakeGroup  bg)

Gets the brake for a specified group.

Parameters
bgwhich brakegroup to retrieve the command for
Returns
the brake setting for the supplied brake group argument

Definition at line 619 of file FGFCS.cpp.

620{
621 return BrakePos[bg];
622}

◆ GetBrakePos()

const std::vector< double > & GetBrakePos ( ) const
inline

Definition at line 538 of file FGFCS.h.

538{return BrakePos;}

◆ GetCBrake()

double GetCBrake ( void  ) const
inline

Gets the center brake.

Returns
the center brake setting.

Definition at line 550 of file FGFCS.h.

550{return BrakePos[FGLGear::bgCenter];}

◆ GetChannelDeltaT()

double GetChannelDeltaT ( void  ) const
inline

Definition at line 569 of file FGFCS.h.

569{ return GetDt() * ChannelRate; }

◆ GetComponentStrings()

string GetComponentStrings ( const std::string &  delimiter) const

Retrieves all component names for inclusion in output stream.

Parameters
delimitereither a tab or comma string depending on output type
Returns
a string containing the descriptive names for all components

Definition at line 648 of file FGFCS.cpp.

649{
650 string CompStrings = "";
651 bool firstime = true;
652 int total_count=0;
653
654 for (unsigned int i=0; i<SystemChannels.size(); i++)
655 {
656 for (unsigned int c=0; c<SystemChannels[i]->GetNumComponents(); c++)
657 {
658 if (firstime) firstime = false;
659 else CompStrings += delimiter;
660
661 CompStrings += SystemChannels[i]->GetComponent(c)->GetName();
662 total_count++;
663 }
664 }
665
666 return CompStrings;
667}

◆ GetComponentValues()

string GetComponentValues ( const std::string &  delimiter) const

Retrieves all component outputs for inclusion in output stream.

Parameters
delimitereither a tab or comma string depending on output type
Returns
a string containing the numeric values for the current set of component outputs

Definition at line 671 of file FGFCS.cpp.

672{
673 std::ostringstream buf;
674
675 bool firstime = true;
676 int total_count=0;
677
678 for (unsigned int i=0; i<SystemChannels.size(); i++)
679 {
680 for (unsigned int c=0; c<SystemChannels[i]->GetNumComponents(); c++)
681 {
682 if (firstime) firstime = false;
683 else buf << delimiter;
684
685 buf << setprecision(9) << SystemChannels[i]->GetComponent(c)->GetOutput();
686 total_count++;
687 }
688 }
689
690 return buf.str();
691}

◆ GetDaCmd()

double GetDaCmd ( void  ) const
inline

Gets the aileron command.

Returns
aileron command in range from -1.0 - 1.0

Definition at line 213 of file FGFCS.h.

213{ return DaCmd; }

◆ GetDaLPos()

double GetDaLPos ( int  form = ofRad) const
inline

Gets the left aileron position.

Returns
aileron position in radians

Definition at line 289 of file FGFCS.h.

290 { return DaLPos[form]; }

◆ GetDaRPos()

double GetDaRPos ( int  form = ofRad) const
inline

Gets the right aileron position.

Returns
aileron position in radians

Definition at line 294 of file FGFCS.h.

295 { return DaRPos[form]; }

◆ GetDeCmd()

double GetDeCmd ( void  ) const
inline

Gets the elevator command.

Returns
elevator command in range from -1.0 - 1.0

Definition at line 217 of file FGFCS.h.

217{ return DeCmd; }

◆ GetDePos()

double GetDePos ( int  form = ofRad) const
inline

Gets the elevator position.

Returns
elevator position in radians

Definition at line 299 of file FGFCS.h.

300 { return DePos[form]; }

◆ GetDfCmd()

double GetDfCmd ( void  ) const
inline

Gets the flaps command.

Returns
flaps command in range from 0 to 1.0

Definition at line 229 of file FGFCS.h.

229{ return DfCmd; }

◆ GetDfPos()

double GetDfPos ( int  form = ofRad) const
inline

Gets the flaps position.

Returns
flaps position in radians

Definition at line 319 of file FGFCS.h.

320 { return DfPos[form]; }

◆ GetDrCmd()

double GetDrCmd ( void  ) const
inline

Gets the rudder command.

Returns
rudder command in range from -1.0 - 1.0

Definition at line 221 of file FGFCS.h.

221{ return DrCmd; }

◆ GetDrPos()

double GetDrPos ( int  form = ofRad) const
inline

Gets the rudder position.

Returns
rudder position in radians

Definition at line 304 of file FGFCS.h.

305 { return DrPos[form]; }

◆ GetDsbCmd()

double GetDsbCmd ( void  ) const
inline

Gets the speedbrake command.

Returns
speedbrake command in range from 0 to 1.0

Definition at line 233 of file FGFCS.h.

233{ return DsbCmd; }

◆ GetDsbPos()

double GetDsbPos ( int  form = ofRad) const
inline

Gets the speedbrake position.

Returns
speedbrake position in radians

Definition at line 309 of file FGFCS.h.

310 { return DsbPos[form]; }

◆ GetDsCmd()

double GetDsCmd ( void  ) const
inline

Gets the steering command.

Returns
steering command in range from -1.0 - 1.0

Definition at line 225 of file FGFCS.h.

225{ return FDMExec->GetGroundReactions()->GetDsCmd(); }
std::shared_ptr< FGGroundReactions > GetGroundReactions(void) const
Returns the FGGroundReactions pointer.
+ Here is the call graph for this function:

◆ GetDspCmd()

double GetDspCmd ( void  ) const
inline

Gets the spoiler command.

Returns
spoiler command in range from 0 to 1.0

Definition at line 237 of file FGFCS.h.

237{ return DspCmd; }

◆ GetDspPos()

double GetDspPos ( int  form = ofRad) const
inline

Gets the spoiler position.

Returns
spoiler position in radians

Definition at line 314 of file FGFCS.h.

315 { return DspPos[form]; }

◆ GetDt()

double GetDt ( void  ) const

Definition at line 712 of file FGFCS.cpp.

713{
714 return FDMExec->GetDeltaT()*rate;
715}
double GetDeltaT(void) const
Returns the simulation delta T.
Definition FGFDMExec.h:557

◆ GetFeatherCmd()

bool GetFeatherCmd ( int  engine) const
inline

Gets the prop feather command.

Parameters
engineengine ID number
Returns
feather command for the given engine (on / off)

Definition at line 265 of file FGFCS.h.

265{ return PropFeatherCmd[engine]; }

◆ GetGearCmd()

double GetGearCmd ( void  ) const
inline

Get the gear extend/retract command.

0 commands gear up, 1 down. defaults to down.

Returns
the current value of the gear extend/retract command

Definition at line 282 of file FGFCS.h.

282{ return GearCmd; }

◆ GetGearPos()

double GetGearPos ( void  ) const
inline

Gets the gear position (0 up, 1 down), defaults to down.

Returns
gear position (0 up, 1 down)

Definition at line 342 of file FGFCS.h.

342{ return GearPos; }

◆ GetLBrake()

double GetLBrake ( void  ) const
inline

Gets the left brake.

Returns
the left brake setting.

Definition at line 542 of file FGFCS.h.

542{return BrakePos[FGLGear::bgLeft];}

◆ GetMixtureCmd() [1/2]

const std::vector< double > & GetMixtureCmd ( ) const
inline

Definition at line 255 of file FGFCS.h.

255{return MixtureCmd;}

◆ GetMixtureCmd() [2/2]

double GetMixtureCmd ( int  engine) const
inline

Gets the mixture command.

Parameters
engineengine ID number
Returns
mixture command for the given engine
Note
The mixture command is generally in range from 0 - 1.0, but some models might set it to a value above 1.0.
JSBSim does not check nor enforce the value to be within 0.0-1.0.

Definition at line 253 of file FGFCS.h.

253{ return MixtureCmd[engine]; }

◆ GetMixturePos() [1/2]

const std::vector< double > & GetMixturePos ( ) const
inline

Definition at line 338 of file FGFCS.h.

338{return MixturePos;}

◆ GetMixturePos() [2/2]

double GetMixturePos ( int  engine) const
inline

Gets the mixture position.

Parameters
engineengine ID number
Returns
mixture position for the given engine
Note
The mixture position is generally in range from 0 - 1.0, but some models might set it to a value above 1.0.
JSBSim does not check nor enforce the value to be within 0.0-1.0.

Definition at line 336 of file FGFCS.h.

336{ return MixturePos[engine]; }

◆ GetPitchTrimCmd()

double GetPitchTrimCmd ( void  ) const
inline

Gets the pitch trim command.

Returns
pitch trim command in range from -1.0 to 1.0

Definition at line 269 of file FGFCS.h.

269{ return PTrimCmd; }

◆ GetPropAdvance() [1/2]

const std::vector< double > & GetPropAdvance ( ) const
inline

Definition at line 357 of file FGFCS.h.

357{ return PropAdvance; }

◆ GetPropAdvance() [2/2]

double GetPropAdvance ( int  engine) const
inline

Gets the prop pitch position.

Parameters
engineengine ID number
Returns
prop pitch position for the given engine in range from 0 - 1.0

Definition at line 355 of file FGFCS.h.

355{ return PropAdvance[engine]; }

◆ GetPropAdvanceCmd()

double GetPropAdvanceCmd ( int  engine) const
inline

Gets the prop pitch command.

Parameters
engineengine ID number
Returns
pitch command in range from 0.0 - 1.0 for the given engine

Definition at line 260 of file FGFCS.h.

260{ return PropAdvanceCmd[engine]; }

◆ GetPropertyManager()

std::shared_ptr< FGPropertyManager > GetPropertyManager ( void  )
inline

Definition at line 566 of file FGFCS.h.

566{ return PropertyManager; }

◆ GetPropFeather() [1/2]

const std::vector< bool > & GetPropFeather ( ) const
inline

Definition at line 364 of file FGFCS.h.

364{ return PropFeather; }

◆ GetPropFeather() [2/2]

bool GetPropFeather ( int  engine) const
inline

Gets the prop feather position.

Parameters
engineengine ID number
Returns
prop fether for the given engine (on / off)

Definition at line 362 of file FGFCS.h.

362{ return PropFeather[engine]; }

◆ GetRBrake()

double GetRBrake ( void  ) const
inline

Gets the right brake.

Returns
the right brake setting.

Definition at line 546 of file FGFCS.h.

546{return BrakePos[FGLGear::bgRight];}

◆ GetRollTrimCmd()

double GetRollTrimCmd ( void  ) const
inline

Gets the aileron trim command.

Returns
aileron trim command in range from -1.0 - 1.0

Definition at line 277 of file FGFCS.h.

277{ return RTrimCmd; }

◆ GetTailhookPos()

double GetTailhookPos ( void  ) const
inline

Gets the tailhook position (0 up, 1 down)

Returns
tailhook position (0 up, 1 down)

Definition at line 346 of file FGFCS.h.

346{ return TailhookPos; }

◆ GetThrottleCmd() [1/2]

const std::vector< double > & GetThrottleCmd ( ) const
inline

Definition at line 244 of file FGFCS.h.

244{return ThrottleCmd;}

◆ GetThrottleCmd() [2/2]

double GetThrottleCmd ( int  engine) const

Gets the throttle command.

Parameters
engineengine ID number
Returns
throttle command in range from 0 - 1.0 for the given engine

Definition at line 356 of file FGFCS.cpp.

357{
358 if (engineNum < (int)ThrottleCmd.size()) {
359 if (engineNum < 0) {
360 FGLogging log(LogLevel::ERROR);
361 log << "Cannot get throttle value for ALL engines" << endl;
362 } else {
363 return ThrottleCmd[engineNum];
364 }
365 } else {
366 FGLogging log(LogLevel::ERROR);
367 log << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
368 << " engines exist, but throttle setting for engine " << engineNum
369 << " is selected" << endl;
370 }
371 return 0.0;
372}

◆ GetThrottlePos() [1/2]

const std::vector< double > & GetThrottlePos ( ) const
inline

Definition at line 327 of file FGFCS.h.

327{return ThrottlePos;}

◆ GetThrottlePos() [2/2]

double GetThrottlePos ( int  engine) const

Gets the throttle position.

Parameters
engineengine ID number
Returns
throttle position for the given engine in range from 0 - 1.0

Definition at line 376 of file FGFCS.cpp.

377{
378 if (engineNum < (int)ThrottlePos.size()) {
379 if (engineNum < 0) {
380 FGLogging log(LogLevel::ERROR);
381 log << "Cannot get throttle value for ALL engines" << endl;
382 } else {
383 return ThrottlePos[engineNum];
384 }
385 } else {
386 FGLogging log(LogLevel::ERROR);
387 log << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
388 << " engines exist, but attempted throttle position setting is for engine "
389 << engineNum << endl;
390 }
391 return 0.0;
392}

◆ GetTrimStatus()

bool GetTrimStatus ( void  ) const
inline

Definition at line 568 of file FGFCS.h.

568{ return FDMExec->GetTrimStatus(); }

◆ GetWingFoldPos()

double GetWingFoldPos ( void  ) const
inline

Gets the wing fold position (0 unfolded, 1 folded)

Returns
wing fold position (0 unfolded, 1 folded)

Definition at line 350 of file FGFCS.h.

350{ return WingFoldPos; }

◆ GetYawTrimCmd()

double GetYawTrimCmd ( void  ) const
inline

Gets the rudder trim command.

Returns
rudder trim command in range from -1.0 - 1.0

Definition at line 273 of file FGFCS.h.

273{ return YTrimCmd; }

◆ InitModel()

bool InitModel ( void  )
overridevirtual

Reimplemented from FGModelFunctions.

Definition at line 117 of file FGFCS.cpp.

118{
119 if (!FGModel::InitModel()) return false;
120
121 unsigned int i;
122
123 for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = 0.0;
124 for (i=0; i<MixturePos.size(); i++) MixturePos[i] = 0.0;
125 for (i=0; i<ThrottleCmd.size(); i++) ThrottleCmd[i] = 0.0;
126 for (i=0; i<MixtureCmd.size(); i++) MixtureCmd[i] = 0.0;
127 for (i=0; i<PropAdvance.size(); i++) PropAdvance[i] = 0.0;
128 for (i=0; i<PropFeather.size(); i++) PropFeather[i] = 0.0;
129
130 DaCmd = DeCmd = DrCmd = DfCmd = DsbCmd = DspCmd = 0;
131 PTrimCmd = YTrimCmd = RTrimCmd = 0.0;
132 TailhookPos = WingFoldPos = 0.0;
133
134 for (i=0;i<NForms;i++) {
135 DePos[i] = DaLPos[i] = DaRPos[i] = DrPos[i] = 0.0;
136 DfPos[i] = DsbPos[i] = DspPos[i] = 0.0;
137 }
138
139 // Reset the channels components.
140 for (unsigned int i=0; i<SystemChannels.size(); i++) SystemChannels[i]->Reset();
141
142 return true;
143}

◆ Load()

bool Load ( Element *  el)
overridevirtual

Loads the Flight Control System.

Load() is called from FGFDMExec.

Parameters
elpointer to the Element instance
Returns
true if succesful

Reimplemented from FGModel.

Definition at line 480 of file FGFCS.cpp.

481{
482 if (document->GetName() == "autopilot") {
483 Name = "Autopilot: ";
484 systype = stAutoPilot;
485 } else if (document->GetName() == "flight_control") {
486 Name = "FCS: ";
487 systype = stFCS;
488 } else if (document->GetName() == "system") {
489 Name = "System: ";
490 systype = stSystem;
491 }
492
493 // Load interface properties from document
494 if (!FGModel::Upload(document, true))
495 return false;
496
497 Name += document->GetAttributeValue("name");
498
499 Debug(2);
500
501 Element* channel_element = document->FindElement("channel");
502
503 while (channel_element) {
504
505 FGFCSChannel* newChannel = 0;
506
507 string sOnOffProperty = channel_element->GetAttributeValue("execute");
508 string sChannelName = channel_element->GetAttributeValue("name");
509
510 if (!channel_element->GetAttributeValue("execrate").empty())
511 ChannelRate = channel_element->GetAttributeValueAsNumber("execrate");
512 else
513 ChannelRate = 1;
514
515 if (sOnOffProperty.length() > 0) {
516 SGPropertyNode* OnOffPropertyNode = PropertyManager->GetNode(sOnOffProperty);
517 if (OnOffPropertyNode == nullptr) {
518 XMLLogException err(channel_element);
519 err << LogFormat::BOLD << LogFormat::RED
520 << "The On/Off property, " << sOnOffProperty << " specified for channel "
521 << channel_element->GetAttributeValue("name") << " is undefined or not "
522 << "understood. The simulation will abort" << LogFormat::RESET << endl;
523 throw err;
524 } else
525 newChannel = new FGFCSChannel(this, sChannelName, ChannelRate,
526 OnOffPropertyNode);
527 } else
528 newChannel = new FGFCSChannel(this, sChannelName, ChannelRate);
529
530 SystemChannels.push_back(newChannel);
531
532 if (debug_lvl > 0) {
533 FGLogging log(LogLevel::DEBUG);
534 log << endl << LogFormat::BOLD << LogFormat::BLUE << " Channel "
535 << LogFormat::NORMAL << channel_element->GetAttributeValue("name") << LogFormat::RESET << endl;
536 }
537
538 Element* component_element = channel_element->GetElement();
539 while (component_element) {
540 try {
541 if ((component_element->GetName() == string("lag_filter")) ||
542 (component_element->GetName() == string("lead_lag_filter")) ||
543 (component_element->GetName() == string("washout_filter")) ||
544 (component_element->GetName() == string("second_order_filter")) )
545 {
546 newChannel->Add(new FGFilter(this, component_element));
547 } else if ((component_element->GetName() == string("pure_gain")) ||
548 (component_element->GetName() == string("scheduled_gain")) ||
549 (component_element->GetName() == string("aerosurface_scale")))
550 {
551 newChannel->Add(new FGGain(this, component_element));
552 } else if (component_element->GetName() == string("summer")) {
553 newChannel->Add(new FGSummer(this, component_element));
554 } else if (component_element->GetName() == string("deadband")) {
555 newChannel->Add(new FGDeadBand(this, component_element));
556 } else if (component_element->GetName() == string("switch")) {
557 newChannel->Add(new FGSwitch(this, component_element));
558 } else if (component_element->GetName() == string("kinematic")) {
559 newChannel->Add(new FGKinemat(this, component_element));
560 } else if (component_element->GetName() == string("fcs_function")) {
561 newChannel->Add(new FGFCSFunction(this, component_element));
562 } else if (component_element->GetName() == string("pid")) {
563 newChannel->Add(new FGPID(this, component_element));
564 } else if (component_element->GetName() == string("integrator")) {
565 // <integrator> is equivalent to <pid type="trap">
566 Element* c1_el = component_element->FindElement("c1");
567 if (!c1_el) {
568 XMLLogException err(component_element);
569 err << "INTEGRATOR component " << component_element->GetAttributeValue("name")
570 << " does not provide the parameter <c1>" << endl;
571 throw err;
572 }
573 c1_el->ChangeName("ki");
574 if (!c1_el->HasAttribute("type"))
575 c1_el->AddAttribute("type", "trap");
576 newChannel->Add(new FGPID(this, component_element));
577 } else if (component_element->GetName() == string("actuator")) {
578 newChannel->Add(new FGActuator(this, component_element));
579 } else if (component_element->GetName() == string("sensor")) {
580 newChannel->Add(new FGSensor(this, component_element));
581 } else if (component_element->GetName() == string("accelerometer")) {
582 newChannel->Add(new FGAccelerometer(this, component_element));
583 } else if (component_element->GetName() == string("magnetometer")) {
584 newChannel->Add(new FGMagnetometer(this, component_element));
585 } else if (component_element->GetName() == string("gyro")) {
586 newChannel->Add(new FGGyro(this, component_element));
587 } else if ((component_element->GetName() == string("waypoint_heading")) ||
588 (component_element->GetName() == string("waypoint_distance")))
589 {
590 newChannel->Add(new FGWaypoint(this, component_element));
591 } else if (component_element->GetName() == string("angle")) {
592 newChannel->Add(new FGAngles(this, component_element));
593 } else if (component_element->GetName() == string("distributor")) {
594 newChannel->Add(new FGDistributor(this, component_element));
595 } else if (component_element->GetName() == string("linear_actuator")) {
596 newChannel->Add(new FGLinearActuator(this, component_element));
597 } else {
598 FGXMLLogging log(component_element, LogLevel::ERROR);
599 log << "Unknown FCS component: " << component_element->GetName() << endl;
600 }
601 } catch(string& s) {
602 FGXMLLogging log(component_element, LogLevel::ERROR);
603 log << LogFormat::BOLD << LogFormat::RED << endl << " " << s << endl;
604 log << LogFormat::RESET << endl;
605 return false;
606 }
607 component_element = channel_element->GetNextElement();
608 }
609 channel_element = document->FindNextElement("channel");
610 }
611
612 PostLoad(document, FDMExec);
613
614 return true;
615}
bool Upload(Element *el, bool preLoad)
Uploads this model in memory.
Definition FGModel.cpp:123
A node in a property tree.
Definition props.hxx:747
+ Here is the call graph for this function:

◆ Run()

bool Run ( bool  Holding)
overridevirtual

Runs the Flight Controls model; called by the Executive Can pass in a value indicating if the executive is directing the simulation to Hold.

Parameters
Holdingif true, the executive has been directed to hold the sim from advancing time. Some models may ignore this flag, such as the Input model, which may need to be active to listen on a socket for the "Resume" command to be given.
Returns
false if no error

Reimplemented from FGModel.

Definition at line 153 of file FGFCS.cpp.

154{
155 unsigned int i;
156
157 if (FGModel::Run(Holding)) return true; // fast exit if nothing to do
158 if (Holding) return false;
159
160 RunPreFunctions();
161
162 for (i=0; i<ThrottlePos.size(); i++) ThrottlePos[i] = ThrottleCmd[i];
163 for (i=0; i<MixturePos.size(); i++) MixturePos[i] = MixtureCmd[i];
164 for (i=0; i<PropAdvance.size(); i++) PropAdvance[i] = PropAdvanceCmd[i];
165 for (i=0; i<PropFeather.size(); i++) PropFeather[i] = PropFeatherCmd[i];
166
167 // Execute system channels in order
168 for (i=0; i<SystemChannels.size(); i++) {
169 if (debug_lvl & 4) {
170 FGLogging log(LogLevel::DEBUG);
171 log << " Executing System Channel: " << SystemChannels[i]->GetName() << endl;
172 }
173 ChannelRate = SystemChannels[i]->GetRate();
174 SystemChannels[i]->Execute();
175 }
176 ChannelRate = 1;
177
178 RunPostFunctions();
179
180 return false;
181}
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
Definition FGModel.cpp:101
+ Here is the call graph for this function:

◆ SetCBrake()

void SetCBrake ( double  cmd)
inline

Sets the center brake group.

Parameters
cmdbrake setting in percent (0.0 - 1.0)

Definition at line 531 of file FGFCS.h.

531{BrakePos[FGLGear::bgCenter] = cmd;}

◆ SetDaCmd()

void SetDaCmd ( double  cmd)
inline

Sets the aileron command.

Parameters
cmdaileron command

Definition at line 382 of file FGFCS.h.

382{ DaCmd = cmd; }

◆ SetDaLPos()

void SetDaLPos ( int  form,
double  pos 
)

Sets the left aileron position.

Parameters
cmdleft aileron position in radians

Definition at line 185 of file FGFCS.cpp.

186{
187 switch(form) {
188 case ofRad:
189 DaLPos[ofRad] = pos;
190 DaLPos[ofDeg] = pos*radtodeg;
191 break;
192 case ofDeg:
193 DaLPos[ofRad] = pos*degtorad;
194 DaLPos[ofDeg] = pos;
195 break;
196 case ofNorm:
197 DaLPos[ofNorm] = pos;
198 }
199 DaLPos[ofMag] = fabs(DaLPos[ofRad]);
200}

◆ SetDaRPos()

void SetDaRPos ( int  form,
double  pos 
)

Sets the right aileron position.

Parameters
cmdright aileron position in radians

Definition at line 204 of file FGFCS.cpp.

205{
206 switch(form) {
207 case ofRad:
208 DaRPos[ofRad] = pos;
209 DaRPos[ofDeg] = pos*radtodeg;
210 break;
211 case ofDeg:
212 DaRPos[ofRad] = pos*degtorad;
213 DaRPos[ofDeg] = pos;
214 break;
215 case ofNorm:
216 DaRPos[ofNorm] = pos;
217 }
218 DaRPos[ofMag] = fabs(DaRPos[ofRad]);
219}

◆ SetDeCmd()

void SetDeCmd ( double  cmd)
inline

Sets the elevator command.

Parameters
cmdelevator command in percent

Definition at line 386 of file FGFCS.h.

386{ DeCmd = cmd; }

◆ SetDePos()

void SetDePos ( int  form,
double  pos 
)

Sets the elevator position.

Parameters
cmdelevator position in radians

Definition at line 223 of file FGFCS.cpp.

224{
225 switch(form) {
226 case ofRad:
227 DePos[ofRad] = pos;
228 DePos[ofDeg] = pos*radtodeg;
229 break;
230 case ofDeg:
231 DePos[ofRad] = pos*degtorad;
232 DePos[ofDeg] = pos;
233 break;
234 case ofNorm:
235 DePos[ofNorm] = pos;
236 }
237 DePos[ofMag] = fabs(DePos[ofRad]);
238}

◆ SetDfCmd()

void SetDfCmd ( double  cmd)
inline

Sets the flaps command.

Parameters
cmdflaps command in percent

Definition at line 398 of file FGFCS.h.

398{ DfCmd = cmd; }

◆ SetDfPos()

void SetDfPos ( int  form,
double  pos 
)

Sets the flaps position.

Parameters
cmdflaps position in radians

Definition at line 261 of file FGFCS.cpp.

262{
263 switch(form) {
264 case ofRad:
265 DfPos[ofRad] = pos;
266 DfPos[ofDeg] = pos*radtodeg;
267 break;
268 case ofDeg:
269 DfPos[ofRad] = pos*degtorad;
270 DfPos[ofDeg] = pos;
271 break;
272 case ofNorm:
273 DfPos[ofNorm] = pos;
274 }
275 DfPos[ofMag] = fabs(DfPos[ofRad]);
276}

◆ SetDrCmd()

void SetDrCmd ( double  cmd)
inline

Sets the rudder command.

Parameters
cmdrudder command in percent

Definition at line 390 of file FGFCS.h.

390{ DrCmd = cmd; }

◆ SetDrPos()

void SetDrPos ( int  form,
double  pos 
)

Sets the rudder position.

Parameters
cmdrudder position in radians

Definition at line 242 of file FGFCS.cpp.

243{
244 switch(form) {
245 case ofRad:
246 DrPos[ofRad] = pos;
247 DrPos[ofDeg] = pos*radtodeg;
248 break;
249 case ofDeg:
250 DrPos[ofRad] = pos*degtorad;
251 DrPos[ofDeg] = pos;
252 break;
253 case ofNorm:
254 DrPos[ofNorm] = pos;
255 }
256 DrPos[ofMag] = fabs(DrPos[ofRad]);
257}

◆ SetDsbCmd()

void SetDsbCmd ( double  cmd)
inline

Sets the speedbrake command.

Parameters
cmdspeedbrake command in percent

Definition at line 402 of file FGFCS.h.

402{ DsbCmd = cmd; }

◆ SetDsbPos()

void SetDsbPos ( int  form,
double  pos 
)

Sets the speedbrake position.

Parameters
cmdspeedbrake position in radians

Definition at line 280 of file FGFCS.cpp.

281{
282 switch(form) {
283 case ofRad:
284 DsbPos[ofRad] = pos;
285 DsbPos[ofDeg] = pos*radtodeg;
286 break;
287 case ofDeg:
288 DsbPos[ofRad] = pos*degtorad;
289 DsbPos[ofDeg] = pos;
290 break;
291 case ofNorm:
292 DsbPos[ofNorm] = pos;
293 }
294 DsbPos[ofMag] = fabs(DsbPos[ofRad]);
295}

◆ SetDsCmd()

void SetDsCmd ( double  cmd)
inline

Sets the steering command.

Parameters
cmdsteering command in percent

Definition at line 394 of file FGFCS.h.

394{ FDMExec->GetGroundReactions()->SetDsCmd( cmd ); }
+ Here is the call graph for this function:

◆ SetDspCmd()

void SetDspCmd ( double  cmd)
inline

Sets the spoilers command.

Parameters
cmdspoilers command in percent

Definition at line 406 of file FGFCS.h.

406{ DspCmd = cmd; }

◆ SetDspPos()

void SetDspPos ( int  form,
double  pos 
)

Sets the spoiler position.

Parameters
cmdspoiler position in radians

Definition at line 299 of file FGFCS.cpp.

300{
301 switch(form) {
302 case ofRad:
303 DspPos[ofRad] = pos;
304 DspPos[ofDeg] = pos*radtodeg;
305 break;
306 case ofDeg:
307 DspPos[ofRad] = pos*degtorad;
308 DspPos[ofDeg] = pos;
309 break;
310 case ofNorm:
311 DspPos[ofNorm] = pos;
312 }
313 DspPos[ofMag] = fabs(DspPos[ofRad]);
314}

◆ SetFeatherCmd()

void SetFeatherCmd ( int  engine,
bool  cmd 
)

Sets the propeller feather command for the specified engine.

Parameters
engineengine ID number
cmdfeather (bool)

Definition at line 452 of file FGFCS.cpp.

453{
454 if (engineNum < (int)PropFeatherCmd.size()) {
455 if (engineNum < 0) {
456 for (unsigned int ctr=0; ctr<PropFeatherCmd.size(); ctr++)
457 PropFeatherCmd[ctr] = setting;
458 } else {
459 PropFeatherCmd[engineNum] = setting;
460 }
461 }
462}

◆ SetGearCmd()

void SetGearCmd ( double  gearcmd)
inline

Set the gear extend/retract command, defaults to down.

Parameters
gearcommand 0 for up, 1 for down

Definition at line 436 of file FGFCS.h.

436{ GearCmd = gearcmd; }

◆ SetGearPos()

void SetGearPos ( double  gearpos)
inline

Set the gear extend/retract position, defaults to down.

Parameters
gearposition 0 up, 1 down

Definition at line 498 of file FGFCS.h.

498{ GearPos = gearpos; }

◆ SetLBrake()

void SetLBrake ( double  cmd)
inline

Sets the left brake group.

Parameters
cmdbrake setting in percent (0.0 - 1.0)

Definition at line 523 of file FGFCS.h.

523{BrakePos[FGLGear::bgLeft] = cmd;}

◆ SetMixtureCmd()

void SetMixtureCmd ( int  engine,
double  cmd 
)

Sets the mixture command for the specified engine.

Parameters
engineengine ID number
cmdnormalized mixture command
Note
The mixture command is generally in range from 0 - 1.0, but some models handle values above 1.0.
JSBSim does not check nor enforce the value to be within 0.0-1.0.

Definition at line 396 of file FGFCS.cpp.

397{
398 if (engineNum < (int)MixtureCmd.size()) {
399 if (engineNum < 0) {
400 for (unsigned int ctr=0; ctr<MixtureCmd.size(); ctr++)
401 MixtureCmd[ctr] = setting;
402 } else {
403 MixtureCmd[engineNum] = setting;
404 }
405 }
406}

◆ SetMixturePos()

void SetMixturePos ( int  engine,
double  cmd 
)

Sets the actual mixture setting for the specified engine.

Parameters
engineengine ID number
cmdnormalized mixture setting
Note
The mixture position is typically within the range of 0 to 1.0, but some models can handle values above 1.0. In the default piston engine model, a mixture position of 1.0 corresponds to the full power setting, and the full rich setting is reached at a value higher than 1.0.
JSBSim does not check nor enforce the value to be within 0.0-1.0.

Definition at line 410 of file FGFCS.cpp.

411{
412 if (engineNum < (int)MixturePos.size()) {
413 if (engineNum < 0) {
414 for (unsigned int ctr=0; ctr<MixtureCmd.size(); ctr++)
415 MixturePos[ctr] = MixtureCmd[ctr];
416 } else {
417 MixturePos[engineNum] = setting;
418 }
419 }
420}

◆ SetPitchTrimCmd()

void SetPitchTrimCmd ( double  cmd)
inline

Sets the pitch trim command.

Parameters
cmdpitch trim command in percent

Definition at line 410 of file FGFCS.h.

410{ PTrimCmd = cmd; }

◆ SetPropAdvance()

void SetPropAdvance ( int  engine,
double  cmd 
)

Sets the actual prop pitch setting for the specified engine.

Parameters
engineengine ID number
cmdprop pitch setting in percent (0.0 - 1.0)

Definition at line 438 of file FGFCS.cpp.

439{
440 if (engineNum < (int)PropAdvance.size()) {
441 if (engineNum < 0) {
442 for (unsigned int ctr=0; ctr<PropAdvanceCmd.size(); ctr++)
443 PropAdvance[ctr] = PropAdvanceCmd[ctr];
444 } else {
445 PropAdvance[engineNum] = setting;
446 }
447 }
448}

◆ SetPropAdvanceCmd()

void SetPropAdvanceCmd ( int  engine,
double  cmd 
)

Sets the propeller pitch command for the specified engine.

Parameters
engineengine ID number
cmdpitch command in percent (0.0 - 1.0)

Definition at line 424 of file FGFCS.cpp.

425{
426 if (engineNum < (int)PropAdvanceCmd.size()) {
427 if (engineNum < 0) {
428 for (unsigned int ctr=0; ctr<PropAdvanceCmd.size(); ctr++)
429 PropAdvanceCmd[ctr] = setting;
430 } else {
431 PropAdvanceCmd[engineNum] = setting;
432 }
433 }
434}

◆ SetPropFeather()

void SetPropFeather ( int  engine,
bool  cmd 
)

Sets the actual prop feather setting for the specified engine.

Parameters
engineengine ID number
cmdprop fether setting (bool)

Definition at line 466 of file FGFCS.cpp.

467{
468 if (engineNum < (int)PropFeather.size()) {
469 if (engineNum < 0) {
470 for (unsigned int ctr=0; ctr<PropFeatherCmd.size(); ctr++)
471 PropFeather[ctr] = PropFeatherCmd[ctr];
472 } else {
473 PropFeather[engineNum] = setting;
474 }
475 }
476}

◆ SetRBrake()

void SetRBrake ( double  cmd)
inline

Sets the right brake group.

Parameters
cmdbrake setting in percent (0.0 - 1.0)

Definition at line 527 of file FGFCS.h.

527{BrakePos[FGLGear::bgRight] = cmd;}

◆ SetRollTrimCmd()

void SetRollTrimCmd ( double  cmd)
inline

Sets the aileron trim command.

Parameters
cmdaileron trim command in percent

Definition at line 418 of file FGFCS.h.

418{ RTrimCmd = cmd; }

◆ SetTailhookPos()

void SetTailhookPos ( double  hookpos)
inline

Set the tailhook position.

Parameters
tailhookposition 0 up, 1 down

Definition at line 502 of file FGFCS.h.

502{ TailhookPos = hookpos; }

◆ SetThrottleCmd()

void SetThrottleCmd ( int  engine,
double  cmd 
)

Sets the throttle command for the specified engine.

Parameters
engineengine ID number
cmdnormalized throttle command (0.0 - 1.0)

Definition at line 318 of file FGFCS.cpp.

319{
320 if (engineNum < (int)ThrottleCmd.size()) {
321 if (engineNum < 0) {
322 for (unsigned int ctr=0; ctr<ThrottleCmd.size(); ctr++)
323 ThrottleCmd[ctr] = setting;
324 } else {
325 ThrottleCmd[engineNum] = setting;
326 }
327 } else {
328 FGLogging log(LogLevel::ERROR);
329 log << "Throttle " << engineNum << " does not exist! " << ThrottleCmd.size()
330 << " engines exist, but attempted throttle command is for engine "
331 << engineNum << endl;
332 }
333}

◆ SetThrottlePos()

void SetThrottlePos ( int  engine,
double  cmd 
)

Sets the actual throttle setting for the specified engine.

Parameters
engineengine ID number
cmdnormalized throttle setting (0.0 - 1.0)

Definition at line 337 of file FGFCS.cpp.

338{
339 if (engineNum < (int)ThrottlePos.size()) {
340 if (engineNum < 0) {
341 for (unsigned int ctr=0; ctr<ThrottlePos.size(); ctr++)
342 ThrottlePos[ctr] = setting;
343 } else {
344 ThrottlePos[engineNum] = setting;
345 }
346 } else {
347 FGLogging log(LogLevel::ERROR);
348 log << "Throttle " << engineNum << " does not exist! " << ThrottlePos.size()
349 << " engines exist, but attempted throttle position setting is for engine "
350 << engineNum << endl;
351 }
352}

◆ SetWingFoldPos()

void SetWingFoldPos ( double  foldpos)
inline

Set the wing fold position.

Parameters
wingfold position 0 unfolded, 1 folded

Definition at line 506 of file FGFCS.h.

506{ WingFoldPos = foldpos; }

◆ SetYawTrimCmd()

void SetYawTrimCmd ( double  cmd)
inline

Sets the rudder trim command.

Parameters
cmdrudder trim command in percent

Definition at line 414 of file FGFCS.h.

414{ YTrimCmd = cmd; }

The documentation for this class was generated from the following files: