Loading [MathJax]/extensions/tex2jax.js
JSBSim Flight Dynamics Model 1.2.2 (22 Mar 2025)
An Open Source Flight Dynamics and Control Software Library in C++
All Classes Functions Variables Enumerations Enumerator Friends Pages
FGFCSChannel Class Reference

Detailed Description

Definition at line 72 of file FGFCSChannel.h.

Public Member Functions

 FGFCSChannel (FGFCS *FCS, const std::string &name, int execRate, FGPropertyNode *node=0)
 Constructor.
 
 ~FGFCSChannel ()
 Destructor.
 
void Add (FGFCSComponent *comp)
 Adds a component to a channel.
 
void Execute ()
 Executes all the components in a channel.
 
FGFCSComponentGetComponent (unsigned int i)
 Retrieves a specific component.
 
std::string GetName ()
 Retrieves the name of the channel.
 
size_t GetNumComponents ()
 Returns the number of components in the channel.
 
int GetRate (void) const
 Get the channel rate.
 
void Reset ()
 Reset the components that can be reset.
 

Constructor & Destructor Documentation

◆ FGFCSChannel()

FGFCSChannel ( FGFCS FCS,
const std::string &  name,
int  execRate,
FGPropertyNode node = 0 
)
inline

Constructor.

Definition at line 75 of file FGFCSChannel.h.

77 : fcs(FCS), OnOffNode(node), Name(name)
78 {
79 ExecRate = execRate < 1 ? 1 : execRate;
80 // Set ExecFrameCountSinceLastRun so that each components are initialized
81 ExecFrameCountSinceLastRun = ExecRate;
82 }

◆ ~FGFCSChannel()

~FGFCSChannel ( )
inline

Destructor.

Definition at line 85 of file FGFCSChannel.h.

85 {
86 for (unsigned int i=0; i<FCSComponents.size(); i++) delete FCSComponents[i];
87 FCSComponents.clear();
88 }

Member Function Documentation

◆ Add()

void Add ( FGFCSComponent comp)
inline

Adds a component to a channel.

Definition at line 93 of file FGFCSChannel.h.

93 {
94 FCSComponents.push_back(comp);
95 }
+ Here is the caller graph for this function:

◆ Execute()

void Execute ( )
inline

Executes all the components in a channel.

Definition at line 117 of file FGFCSChannel.h.

117 {
118 // If there is an on/off property supplied for this channel, check
119 // the value. If it is true, permit execution to continue. If not, return
120 // and do not execute the channel.
121 if (OnOffNode && !OnOffNode->getBoolValue()) return;
122
123 if (fcs->GetDt() != 0.0) {
124 if (ExecFrameCountSinceLastRun >= ExecRate) {
125 ExecFrameCountSinceLastRun = 0;
126 }
127
128 ++ExecFrameCountSinceLastRun;
129 }
130
131 // channel will be run at rate 1 if trimming, or when the next execrate
132 // frame is reached
133 if (fcs->GetTrimStatus() || ExecFrameCountSinceLastRun >= ExecRate) {
134 for (unsigned int i=0; i<FCSComponents.size(); i++)
135 FCSComponents[i]->Run();
136 }
137 }

◆ GetComponent()

FGFCSComponent * GetComponent ( unsigned int  i)
inline

Retrieves a specific component.

Definition at line 99 of file FGFCSChannel.h.

99 {
100 if (i >= GetNumComponents()) {
101 std::cerr << "Tried to get nonexistent component" << std::endl;
102 return 0;
103 } else {
104 return FCSComponents[i];
105 }
106 }
size_t GetNumComponents()
Returns the number of components in the channel.
+ Here is the call graph for this function:

◆ GetName()

std::string GetName ( )
inline

Retrieves the name of the channel.

Definition at line 90 of file FGFCSChannel.h.

90{return Name;}

◆ GetNumComponents()

size_t GetNumComponents ( )
inline

Returns the number of components in the channel.

Definition at line 97 of file FGFCSChannel.h.

97{return FCSComponents.size();}
+ Here is the caller graph for this function:

◆ GetRate()

int GetRate ( void  ) const
inline

Get the channel rate.

Definition at line 139 of file FGFCSChannel.h.

139{ return ExecRate; }

◆ Reset()

void Reset ( )
inline

Reset the components that can be reset.

Definition at line 108 of file FGFCSChannel.h.

108 {
109 for (unsigned int i=0; i<FCSComponents.size(); i++)
110 FCSComponents[i]->ResetPastStates();
111
112 // Set ExecFrameCountSinceLastRun so that each components are initialized
113 // after a reset.
114 ExecFrameCountSinceLastRun = ExecRate;
115 }

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