34 #ifndef FGFCSCHANNEL_H 35 #define FGFCSCHANNEL_H 47 #define ID_FCSCHANNEL "$Id: FGFCSChannel.h,v 1.10 2016/04/16 11:00:11 bcoconni Exp $" 76 typedef std::vector <FGFCSComponent*> FCSCompVec;
83 : fcs(FCS), OnOffNode(node), Name(name)
85 ExecRate = execRate < 1 ? 1 : execRate;
87 ExecFrameCountSinceLastRun = ExecRate;
92 for (
unsigned int i=0; i<FCSComponents.size(); i++)
delete FCSComponents[i];
93 FCSComponents.clear();
100 FCSComponents.push_back(comp);
101 comp->SetDtForFrameCount(ExecRate);
108 std::cerr <<
"Tried to get nonexistent component" << std::endl;
111 return FCSComponents[i];
116 for (
unsigned int i=0; i<FCSComponents.size(); i++)
117 FCSComponents[i]->ResetPastStates();
121 ExecFrameCountSinceLastRun = ExecRate;
128 if (OnOffNode && !OnOffNode->getBoolValue())
return;
130 if (fcs->GetDt() != 0.0) {
131 if (ExecFrameCountSinceLastRun >= ExecRate) {
132 ExecFrameCountSinceLastRun = 0;
135 ++ExecFrameCountSinceLastRun;
140 if (fcs->GetTrimStatus() || ExecFrameCountSinceLastRun >= ExecRate) {
141 for (
unsigned int i=0; i<FCSComponents.size(); i++)
142 FCSComponents[i]->Run();
150 FCSCompVec FCSComponents;
151 FGConstPropertyNode_ptr OnOffNode;
155 int ExecFrameCountSinceLastRun;
FGFCSChannel(FGFCS *FCS, const std::string &name, int execRate, FGPropertyNode *node=0)
Constructor.
std::string GetName()
Retrieves the name of the channel.
void Execute()
Executes all the components in a channel.
FGFCSComponent * GetComponent(unsigned int i)
Retrieves a specific component.
Class wrapper for property handling.
void Reset()
Reset the components that can be reset.
~FGFCSChannel()
Destructor.
void Add(FGFCSComponent *comp)
Adds a component to a channel.
Encapsulates the Flight Control System (FCS) functionality.
int GetRate(void) const
Get the channel rate.
Base class for JSBSim Flight Control System Components.
size_t GetNumComponents()
Returns the number of components in the channel.