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

Method Load

src/models/FGAerodynamics.cpp:331–398  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
330
331bool FGAerodynamics::Load(Element *document)
332{
333 string axis;
334 string scratch_unit="";
335 Element *temp_element, *axis_element, *function_element;
336
337 Name = "Aerodynamics Model: " + document->GetAttributeValue("name");
338
339 // Perform base class Pre-Load
340 if (!FGModel::Upload(document, true))
341 return false;
342
343 DetermineAxisSystem(document); // Determine if Lift/Side/Drag, etc. is used.
344
345 Debug(2);
346
347 if ((temp_element = document->FindElement("alphalimits"))) {
348 scratch_unit = temp_element->GetAttributeValue("unit");
349 if (scratch_unit.empty()) scratch_unit = "RAD";
350 alphaclmin0 = temp_element->FindElementValueAsNumberConvertFromTo("min", scratch_unit, "RAD");
351 alphaclmax0 = temp_element->FindElementValueAsNumberConvertFromTo("max", scratch_unit, "RAD");
352 alphaclmin = alphaclmin0;
353 alphaclmax = alphaclmax0;
354 }
355
356 if ((temp_element = document->FindElement("hysteresis_limits"))) {
357 scratch_unit = temp_element->GetAttributeValue("unit");
358 if (scratch_unit.empty()) scratch_unit = "RAD";
359 alphahystmin = temp_element->FindElementValueAsNumberConvertFromTo("min", scratch_unit, "RAD");
360 alphahystmax = temp_element->FindElementValueAsNumberConvertFromTo("max", scratch_unit, "RAD");
361 }
362
363 if ((temp_element = document->FindElement("aero_ref_pt_shift_x"))) {
364 function_element = temp_element->FindElement("function");
365 AeroRPShift = new FGFunction(FDMExec, function_element);
366 }
367
368 axis_element = document->FindElement("axis");
369 while (axis_element) {
370 AeroFunctionArray ca;
371 AeroFunctionArray ca_atCG;
372 axis = axis_element->GetAttributeValue("name");
373 function_element = axis_element->FindElement("function");
374 while (function_element) {
375 try {
376 if (function_element->HasAttribute("apply_at_cg") &&
377 function_element->GetAttributeValue("apply_at_cg") == "true")
378 ca_atCG.push_back(new FGFunction(FDMExec, function_element));
379 else
380 ca.push_back(new FGFunction(FDMExec, function_element));
381 } catch (BaseException& e) {
382 string current_func_name = function_element->GetAttributeValue("name");
383 FGXMLLogging log(axis_element, LogLevel::ERROR);
384 log << LogFormat::RED << "\nError loading aerodynamic function in "
385 << current_func_name << ":" << e.what() << " Aborting.\n" << LogFormat::RESET;
386 return false;
387 }
388 function_element = axis_element->FindNextElement("function");

Callers

nothing calls this directly

Calls 6

GetAttributeValueMethod · 0.80
FindElementMethod · 0.80
emptyMethod · 0.80
FindNextElementMethod · 0.80
whatMethod · 0.45

Tested by

no test coverage detected