JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
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, SGPropertyNode *node=nullptr)
 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,
SGPropertyNode node = nullptr 
)
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 118 of file FGFCSChannel.h.

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

◆ 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 return FCSComponents[i];
102 } else {
103 FGLogging log(LogLevel::ERROR);
104 log << "Tried to get nonexistent component\n";
105 return nullptr;
106 }
107 }
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 140 of file FGFCSChannel.h.

140{ return ExecRate; }

◆ Reset()

void Reset ( )
inline

Reset the components that can be reset.

Definition at line 109 of file FGFCSChannel.h.

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

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