MCPcopy Create free account
hub / github.com/JSBSim-Team/jsbsim / Load

Method Load

src/models/propulsion/FGEngine.cpp:177–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
176
177bool FGEngine::Load(FGFDMExec *exec, Element *engine_element)
178{
179 Element* parent_element = engine_element->GetParent();
180 Element* local_element;
181 FGColumnVector3 location, orientation;
182
183 auto PropertyManager = exec->GetPropertyManager();
184
185 Name = engine_element->GetAttributeValue("name");
186
187 // Call ModelFunctions loader
188 FGModelFunctions::Load(engine_element, exec, to_string((int)EngineNumber));
189
190 // If engine location and/or orientation is supplied issue a warning since they
191 // are ignored. What counts is the location and orientation of the thruster.
192 local_element = parent_element->FindElement("location");
193 if (local_element) {
194 FGLogging log(LogLevel::WARN);
195 log << "Engine location ignored, only thruster location is used.\n";
196 }
197
198 local_element = parent_element->FindElement("orient");
199 if (local_element) {
200 FGLogging log(LogLevel::WARN);
201 log << "Engine orientation ignored, only thruster orientation is used.\n";
202 }
203
204 // Load thruster
205 local_element = parent_element->FindElement("thruster");
206 if (local_element) {
207 try {
208 LoadThruster(exec, local_element);
209 } catch (std::string& str) {
210 XMLLogException err(local_element);
211 err << "Error loading engine " << Name << ". " << str << "\n";
212 throw err;
213 } catch (LogException &e) {
214 XMLLogException err(e, local_element);
215 throw err;
216 }
217 } else {
218 FGLogging log(LogLevel::ERROR);
219 log << "No thruster definition supplied with engine definition.\n";
220 }
221
222 ResetToIC(); // initialize dynamic terms
223
224 // Load feed tank[s] references
225 local_element = parent_element->FindElement("feed");
226 while (local_element) {
227 int tankID = (int)local_element->GetDataAsNumber();
228 SourceTanks.push_back(tankID);
229 local_element = parent_element->FindNextElement("feed");
230 }
231
232 string property_name, base_property_name;
233 base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber);
234

Callers

nothing calls this directly

Calls 6

GetAttributeValueMethod · 0.80
FindElementMethod · 0.80
GetDataAsNumberMethod · 0.80
FindNextElementMethod · 0.80
c_strMethod · 0.80
LoadFunction · 0.50

Tested by

no test coverage detected