 |
JSBSim Flight Dynamics Model
1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
|
42 #include "FGFDMExec.h"
43 #include "input_output/FGUDPInputSocket.h"
44 #include "input_output/FGXMLFileRead.h"
45 #include "input_output/FGModelLoader.h"
55 FGInput::FGInput(FGFDMExec* fdmex) : FGModel(fdmex)
67 vector<FGInputType*>::iterator it;
68 for (it = InputTypes.begin(); it != InputTypes.end(); ++it)
84 Element* element = ModelLoader.Open(el);
86 if (!element)
return false;
88 FGModel::PreLoad(element, FDMExec);
90 size_t idx = InputTypes.size();
94 if (debug_lvl > 0) cout << endl <<
" Input data set: " << idx <<
" " << endl;
96 type = to_upper(type);
98 if (type.empty() || type ==
"SOCKET") {
100 }
else if (type ==
"QTJSBSIM") {
102 }
else if (type !=
string(
"NONE")) {
104 <<
"Unknown type of input specified in config file" << endl;
107 if (!Input)
return false;
110 Input->
Load(element);
111 PostLoad(element, FDMExec);
113 InputTypes.push_back(Input);
125 if (!FGModel::InitModel())
return false;
127 vector<FGInputType*>::iterator it;
128 for (it = InputTypes.begin(); it != InputTypes.end(); ++it)
129 ret &= (*it)->InitModel();
138 if (FDMExec->GetTrimStatus())
return true;
140 if (!enabled)
return true;
142 vector<FGInputType*>::iterator it;
143 for (it = InputTypes.begin(); it != InputTypes.end(); ++it)
157 s <<
"Could not read directive file: " << fname;
160 bool result =
Load(document);
163 cerr << endl <<
"Aircraft input element has problems in file " << fname << endl;
172 if (idx >= (
int)0 && idx < (
int)InputTypes.size())
173 return InputTypes[idx]->Toggle();
182 if (idx >= InputTypes.size())
return false;
184 InputTypes[idx]->SetInputName(name);
194 if (idx < InputTypes.size())
195 name = InputTypes[idx]->GetInputName();
219 void FGInput::Debug(
int from)
223 if (debug_lvl <= 0)
return;
231 if (debug_lvl & 2 ) {
232 if (from == 0) cout <<
"Instantiated: FGInput" << endl;
233 if (from == 1) cout <<
"Destroyed: FGInput" << endl;
235 if (debug_lvl & 4 ) {
237 if (debug_lvl & 8 ) {
239 if (debug_lvl & 16) {
241 if (debug_lvl & 64) {
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
virtual bool Run(bool Holding)
Runs the model; called by the Executive.
This class is solely for the purpose of determining what type of file is given on the command line.
std::string ReadFrom(void) const
Return a string that contains a description of the location where the current XML element was read fr...