| 116 | //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 117 | |
| 118 | bool FGAircraft::Load(Element* el) |
| 119 | { |
| 120 | string element_name; |
| 121 | Element* element; |
| 122 | |
| 123 | if (!FGModel::Upload(el, true)) return false; |
| 124 | |
| 125 | if (el->FindElement("wingarea")) |
| 126 | WingArea = el->FindElementValueAsNumberConvertTo("wingarea", "FT2"); |
| 127 | if (el->FindElement("wingspan")) |
| 128 | WingSpan = el->FindElementValueAsNumberConvertTo("wingspan", "FT"); |
| 129 | if (el->FindElement("chord")) |
| 130 | cbar = el->FindElementValueAsNumberConvertTo("chord", "FT"); |
| 131 | if (el->FindElement("wing_incidence")) |
| 132 | WingIncidence = el->FindElementValueAsNumberConvertTo("wing_incidence", "RAD"); |
| 133 | if (el->FindElement("htailarea")) |
| 134 | HTailArea = el->FindElementValueAsNumberConvertTo("htailarea", "FT2"); |
| 135 | if (el->FindElement("htailarm")) |
| 136 | HTailArm = el->FindElementValueAsNumberConvertTo("htailarm", "FT"); |
| 137 | if (el->FindElement("vtailarea")) |
| 138 | VTailArea = el->FindElementValueAsNumberConvertTo("vtailarea", "FT2"); |
| 139 | if (el->FindElement("vtailarm")) |
| 140 | VTailArm = el->FindElementValueAsNumberConvertTo("vtailarm", "FT"); |
| 141 | |
| 142 | // Find all LOCATION elements that descend from this METRICS branch of the |
| 143 | // config file. This would be CG location, eyepoint, etc. |
| 144 | |
| 145 | element = el->FindElement("location"); |
| 146 | while (element) { |
| 147 | element_name = element->GetAttributeValue("name"); |
| 148 | |
| 149 | if (element_name == "AERORP") vXYZrp = element->FindElementTripletConvertTo("IN"); |
| 150 | else if (element_name == "EYEPOINT") vXYZep = element->FindElementTripletConvertTo("IN"); |
| 151 | else if (element_name == "VRP") vXYZvrp = element->FindElementTripletConvertTo("IN"); |
| 152 | |
| 153 | element = el->FindNextElement("location"); |
| 154 | } |
| 155 | |
| 156 | // calculate some derived parameters |
| 157 | if (cbar != 0.0) { |
| 158 | lbarh = HTailArm/cbar; |
| 159 | lbarv = VTailArm/cbar; |
| 160 | if (WingArea != 0.0) { |
| 161 | vbarh = HTailArm*HTailArea / (cbar*WingArea); |
| 162 | vbarv = VTailArm*VTailArea / (WingSpan*WingArea); |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | PostLoad(el, FDMExec); |
| 167 | |
| 168 | Debug(2); |
| 169 | |
| 170 | return true; |
| 171 | } |
| 172 | |
| 173 | //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 174 |
nothing calls this directly
no test coverage detected