8 #include <Main/fg_props.hxx>
12 #include "SimpleJet.hpp"
15 #include "Launchbar.hpp"
16 #include "Atmosphere.hpp"
17 #include "PropEngine.hpp"
18 #include "Propeller.hpp"
19 #include "PistonEngine.hpp"
20 #include "TurbineEngine.hpp"
22 #include "Rotorpart.hpp"
29 // Some conversion factors
30 static const float KTS2MPS = 0.514444444444;
31 static const float FT2M = 0.3048;
32 static const float DEG2RAD = 0.0174532925199;
33 static const float RPM2RAD = 0.10471975512;
34 static const float LBS2N = 4.44822;
35 static const float LBS2KG = 0.45359237;
36 static const float KG2LBS = 2.2046225;
37 static const float CM2GALS = 264.172037284;
38 static const float HP2W = 745.700;
39 static const float INHG2PA = 3386.389;
40 static const float K2DEGF = 1.8;
41 static const float K2DEGFOFFSET = -459.4;
42 static const float CIN2CM = 1.6387064e-5;
43 static const float YASIM_PI = 3.14159265358979323846;
45 static const float NM2FTLB = (1/(LBS2N*FT2M));
47 // Stubs, so that this can be compiled without the FlightGear
48 // binary. What's the best way to handle this?
50 // float fgGetFloat(char* name, float def) { return 0; }
51 // void fgSetFloat(char* name, float val) {}
55 _vehicle_radius = 0.0f;
59 // Map /controls/flight/elevator to the approach elevator control. This
60 // should probably be settable, but there are very few aircraft
61 // who trim their approaches using things other than elevator.
62 _airplane.setElevatorControl(parseAxis("/controls/flight/elevator-trim"));
64 // FIXME: read seed from somewhere?
66 _turb = new Turbulence(10, seed);
71 for(int i=0; i<_axes.size(); i++) {
72 AxisRec* a = (AxisRec*)_axes.get(i);
77 for(int i=0; i<_thrusters.size(); i++) {
78 EngRec* er = (EngRec*)_thrusters.get(i);
84 for(int i=0; i<_weights.size(); i++) {
85 WeightRec* wr = (WeightRec*)_weights.get(i);
90 for(int i=0; i<_controlProps.size(); i++)
91 delete (PropOut*)_controlProps.get(i);
96 void FGFDM::iterate(float dt)
99 _airplane.iterate(dt);
102 for(int i=0; i<_airplane.numThrusters(); i++) {
103 Thruster* t = _airplane.getThruster(i);
105 bool out_of_fuel = _fuel_props[i]._out_of_fuel->getBoolValue();
106 t->setFuelState(!out_of_fuel);
108 double consumed = _fuel_props[i]._fuel_consumed_lbs->getDoubleValue();
109 _fuel_props[i]._fuel_consumed_lbs->setDoubleValue(
110 consumed + dt * KG2LBS * t->getFuelFlow());
112 for(int i=0; i<_airplane.numTanks(); i++) {
113 _airplane.setFuel(i, LBS2KG * _tank_level_lbs[i]->getFloatValue());
115 _airplane.calcFuelWeights();
117 setOutputProperties(dt);
120 Airplane* FGFDM::getAirplane()
127 _turb_magnitude_norm = fgGetNode("/environment/turbulence/magnitude-norm", true);
128 _turb_rate_hz = fgGetNode("/environment/turbulence/rate-hz", true);
129 _gross_weight_lbs = fgGetNode("/yasim/gross-weight-lbs", true);
131 // Allows the user to start with something other than full fuel
132 _airplane.setFuelFraction(fgGetFloat("/sim/fuel-fraction", 1));
134 // stash engine/thruster properties
135 _thrust_props.clear();
136 for (int i=0; i<_thrusters.size(); i++) {
137 SGPropertyNode_ptr node = fgGetNode("engines/engine", i, true);
138 Thruster* t = ((EngRec*)_thrusters.get(i))->eng;
141 tp._running = node->getChild("running", 0, true);
142 tp._cranking = node->getChild("cranking", 0, true);
143 tp._prop_thrust = node->getChild("prop-thrust", 0, true); // Deprecated name
144 tp._thrust_lbs = node->getChild("thrust-lbs", 0, true);
145 tp._fuel_flow_gph = node->getChild("fuel-flow-gph", 0, true);
147 if(t->getPropEngine())
149 tp._rpm = node->getChild("rpm", 0, true);
150 tp._torque_ftlb = node->getChild("torque-ftlb", 0, true);
152 PropEngine* p = t->getPropEngine();
153 if(p->getEngine()->isPistonEngine())
155 tp._mp_osi = node->getChild("mp-osi", 0, true);
156 tp._mp_inhg = node->getChild("mp-inhg", 0, true);
157 tp._egt_degf = node->getChild("egt-degf", 0, true);
159 tp._oil_temperature_degf = node->getChild("oil-temperature-degf", 0, true);
160 tp._boost_gauge_inhg = node->getChild("boost-gauge-inhg", 0, true);
161 } else if(p->getEngine()->isTurbineEngine()) {
162 tp._n2 = node->getChild("n2", 0, true);
168 tp._n1 = node->getChild("n1", 0, true);
169 tp._n2 = node->getChild("n2", 0, true);
170 tp._epr = node->getChild("epr", 0, true);
171 tp._egt_degf = node->getChild("egt-degf", 0, true);
173 _thrust_props.push_back(tp);
176 // stash properties for fuel state
178 for(int i=0; i<_airplane.numThrusters(); i++) {
179 SGPropertyNode_ptr e = fgGetNode("engines/engine", i, true);
181 f._out_of_fuel = e->getChild("out-of-fuel", 0, true);
182 f._fuel_consumed_lbs = e->getChild("fuel-consumed-lbs", 0, true);
183 _fuel_props.push_back(f);
186 // initialize tanks and stash properties for tank level
187 _tank_level_lbs.clear();
188 for(int i=0; i<_airplane.numTanks(); i++) {
190 sprintf(buf, "/consumables/fuel/tank[%d]/level-lbs", i);
191 fgSetDouble(buf, _airplane.getFuel(i) * KG2LBS);
192 _tank_level_lbs.push_back(fgGetNode(buf, true));
194 double density = _airplane.getFuelDensity(i);
195 sprintf(buf, "/consumables/fuel/tank[%d]/density-ppg", i);
196 fgSetDouble(buf, density * (KG2LBS/CM2GALS));
198 // set in TankProperties class
199 // sprintf(buf, "/consumables/fuel/tank[%d]/level-gal_us", i);
200 // fgSetDouble(buf, _airplane.getFuel(i) * CM2GALS / density);
202 sprintf(buf, "/consumables/fuel/tank[%d]/capacity-gal_us", i);
203 fgSetDouble(buf, CM2GALS * _airplane.getTankCapacity(i)/density);
206 // This has a nasty habit of being false at startup. That's not
208 fgSetBool("/controls/gear/gear-down", true);
210 _airplane.getModel()->setTurbulence(_turb);
213 // Not the worlds safest parser. But it's short & sweet.
214 void FGFDM::startElement(const char* name, const XMLAttributes &atts)
216 XMLAttributes* a = (XMLAttributes*)&atts;
220 if(eq(name, "airplane")) {
221 _airplane.setWeight(attrf(a, "mass") * LBS2KG);
222 if(a->hasAttribute("version")) {
223 _airplane.setVersion( a->getValue("version") );
225 #if defined(ENABLE_DEV_WARNINGS)
226 if( !_airplane.isVersionOrNewer( Version::YASIM_VERSION_CURRENT ) ) {
227 SG_LOG(SG_FLIGHT,SG_ALERT, "This aircraft does not use the latest yasim configuration version.");
230 } else if(eq(name, "approach")) {
231 float spd = attrf(a, "speed") * KTS2MPS;
232 float alt = attrf(a, "alt", 0) * FT2M;
233 float aoa = attrf(a, "aoa", 0) * DEG2RAD;
234 float gla = attrf(a, "glide-angle", 0) * DEG2RAD;
235 _airplane.setApproach(spd, alt, aoa, attrf(a, "fuel", 0.2),gla);
237 } else if(eq(name, "cruise")) {
238 float spd = attrf(a, "speed") * KTS2MPS;
239 float alt = attrf(a, "alt") * FT2M;
240 float gla = attrf(a, "glide-angle", 0) * DEG2RAD;
241 _airplane.setCruise(spd, alt, attrf(a, "fuel", 0.5),gla);
243 } else if(eq(name, "solve-weight")) {
244 int idx = attri(a, "idx");
245 float wgt = attrf(a, "weight") * LBS2KG;
246 _airplane.addSolutionWeight(!_cruiseCurr, idx, wgt);
247 } else if(eq(name, "cockpit")) {
248 v[0] = attrf(a, "x");
249 v[1] = attrf(a, "y");
250 v[2] = attrf(a, "z");
251 _airplane.setPilotPos(v);
252 } else if(eq(name, "rotor")) {
253 _airplane.getModel()->getRotorgear()->addRotor(parseRotor(a, name));
254 } else if(eq(name, "rotorgear")) {
255 Rotorgear* r = _airplane.getModel()->getRotorgear();
257 #define p(x) if (a->hasAttribute(#x)) r->setParameter((char *)#x,attrf(a,#x) );
258 #define p2(x,y) if (a->hasAttribute(y)) r->setParameter((char *)#x,attrf(a,y) );
259 p2(max_power_engine,"max-power-engine")
260 p2(engine_prop_factor,"engine-prop-factor")
263 p2(max_power_rotor_brake,"max-power-rotor-brake")
264 p2(rotorgear_friction,"rotorgear-friction")
265 p2(engine_accel_limit,"engine-accel-limit")
269 } else if(eq(name, "wing")) {
270 _airplane.setWing(parseWing(a, name, &_airplane));
271 } else if(eq(name, "hstab")) {
272 _airplane.setTail(parseWing(a, name, &_airplane));
273 } else if(eq(name, "vstab") || eq(name, "mstab")) {
274 _airplane.addVStab(parseWing(a, name, &_airplane));
275 } else if(eq(name, "piston-engine")) {
276 parsePistonEngine(a);
277 } else if(eq(name, "turbine-engine")) {
278 parseTurbineEngine(a);
279 } else if(eq(name, "propeller")) {
281 } else if(eq(name, "thruster")) {
282 SimpleJet* j = new SimpleJet();
284 v[0] = attrf(a, "x"); v[1] = attrf(a, "y"); v[2] = attrf(a, "z");
286 _airplane.addThruster(j, 0, v);
287 v[0] = attrf(a, "vx"); v[1] = attrf(a, "vy"); v[2] = attrf(a, "vz");
289 j->setThrust(attrf(a, "thrust") * LBS2N);
290 } else if(eq(name, "jet")) {
293 v[0] = attrf(a, "x");
294 v[1] = attrf(a, "y");
295 v[2] = attrf(a, "z");
296 float mass = attrf(a, "mass") * LBS2KG;
297 j->setMaxThrust(attrf(a, "thrust") * LBS2N,
298 attrf(a, "afterburner", 0) * LBS2N);
299 j->setVectorAngle(attrf(a, "rotate", 0) * DEG2RAD);
300 j->setReverseThrust(attrf(a, "reverse", 0.2));
302 float n1min = attrf(a, "n1-idle", 55);
303 float n1max = attrf(a, "n1-max", 102);
304 float n2min = attrf(a, "n2-idle", 73);
305 float n2max = attrf(a, "n2-max", 103);
306 j->setRPMs(n1min, n1max, n2min, n2max);
308 j->setTSFC(attrf(a, "tsfc", 0.8));
309 if(a->hasAttribute("egt")) j->setEGT(attrf(a, "egt"));
310 if(a->hasAttribute("epr")) j->setEPR(attrf(a, "epr"));
311 if(a->hasAttribute("exhaust-speed"))
312 j->setVMax(attrf(a, "exhaust-speed") * KTS2MPS);
313 if(a->hasAttribute("spool-time"))
314 j->setSpooling(attrf(a, "spool-time"));
317 _airplane.addThruster(j, mass, v);
318 sprintf(buf, "/engines/engine[%d]", _nextEngine++);
319 EngRec* er = new EngRec();
321 er->prefix = dup(buf);
323 } else if(eq(name, "hitch")) {
324 Hitch* h = new Hitch(a->getValue("name"));
326 v[0] = attrf(a, "x");
327 v[1] = attrf(a, "y");
328 v[2] = attrf(a, "z");
330 if(a->hasAttribute("force-is-calculated-by-other")) h->setForceIsCalculatedByOther(attrb(a,"force-is-calculated-by-other"));
331 _airplane.addHitch(h);
332 } else if(eq(name, "tow")) {
333 Hitch* h = (Hitch*)_currObj;
334 if(a->hasAttribute("length"))
335 h->setTowLength(attrf(a, "length"));
336 if(a->hasAttribute("elastic-constant"))
337 h->setTowElasticConstant(attrf(a, "elastic-constant"));
338 if(a->hasAttribute("break-force"))
339 h->setTowBreakForce(attrf(a, "break-force"));
340 if(a->hasAttribute("weight-per-meter"))
341 h->setTowWeightPerM(attrf(a, "weight-per-meter"));
342 if(a->hasAttribute("mp-auto-connect-period"))
343 h->setMpAutoConnectPeriod(attrf(a, "mp-auto-connect-period"));
344 } else if(eq(name, "winch")) {
345 Hitch* h = (Hitch*)_currObj;
347 pos[0] = attrd(a, "x",0);
348 pos[1] = attrd(a, "y",0);
349 pos[2] = attrd(a, "z",0);
350 h->setWinchPosition(pos);
351 if(a->hasAttribute("max-speed"))
352 h->setWinchMaxSpeed(attrf(a, "max-speed"));
353 if(a->hasAttribute("power"))
354 h->setWinchPower(attrf(a, "power") * 1000);
355 if(a->hasAttribute("max-force"))
356 h->setWinchMaxForce(attrf(a, "max-force"));
357 if(a->hasAttribute("initial-tow-length"))
358 h->setWinchInitialTowLength(attrf(a, "initial-tow-length"));
359 if(a->hasAttribute("max-tow-length"))
360 h->setWinchMaxTowLength(attrf(a, "max-tow-length"));
361 if(a->hasAttribute("min-tow-length"))
362 h->setWinchMinTowLength(attrf(a, "min-tow-length"));
363 } else if(eq(name, "gear")) {
364 Gear* g = new Gear();
366 v[0] = attrf(a, "x");
367 v[1] = attrf(a, "y");
368 v[2] = attrf(a, "z");
370 float nrm = Math::mag3(v);
371 if (_vehicle_radius < nrm)
372 _vehicle_radius = nrm;
373 if(a->hasAttribute("upx")) {
374 v[0] = attrf(a, "upx");
375 v[1] = attrf(a, "upy");
376 v[2] = attrf(a, "upz");
383 for(int i=0; i<3; i++)
384 v[i] *= attrf(a, "compression", 1);
385 g->setCompression(v);
386 g->setBrake(attrf(a, "skid", 0));
387 g->setInitialLoad(attrf(a, "initial-load", 0));
388 g->setStaticFriction(attrf(a, "sfric", 0.8));
389 g->setDynamicFriction(attrf(a, "dfric", 0.7));
390 g->setSpring(attrf(a, "spring", 1));
391 g->setDamping(attrf(a, "damp", 1));
392 if(a->hasAttribute("on-water")) g->setOnWater(attrb(a,"on-water"));
393 if(a->hasAttribute("on-solid")) g->setOnSolid(attrb(a,"on-solid"));
394 if(a->hasAttribute("ignored-by-solver")) g->setIgnoreWhileSolving(attrb(a,"ignored-by-solver"));
395 g->setSpringFactorNotPlaning(attrf(a, "spring-factor-not-planing", 1));
396 g->setSpeedPlaning(attrf(a, "speed-planing", 0) * KTS2MPS);
397 g->setReduceFrictionByExtension(attrf(a, "reduce-friction-by-extension", 0));
398 _airplane.addGear(g);
399 } else if(eq(name, "hook")) {
400 Hook* h = new Hook();
402 v[0] = attrf(a, "x");
403 v[1] = attrf(a, "y");
404 v[2] = attrf(a, "z");
406 float length = attrf(a, "length", 1.0);
407 h->setLength(length);
408 float nrm = length+Math::mag3(v);
409 if (_vehicle_radius < nrm)
410 _vehicle_radius = nrm;
411 h->setDownAngle(attrf(a, "down-angle", 70) * DEG2RAD);
412 h->setUpAngle(attrf(a, "up-angle", 0) * DEG2RAD);
413 _airplane.addHook(h);
414 } else if(eq(name, "launchbar")) {
415 Launchbar* l = new Launchbar();
417 v[0] = attrf(a, "x");
418 v[1] = attrf(a, "y");
419 v[2] = attrf(a, "z");
420 l->setLaunchbarMount(v);
421 v[0] = attrf(a, "holdback-x", v[0]);
422 v[1] = attrf(a, "holdback-y", v[1]);
423 v[2] = attrf(a, "holdback-z", v[2]);
424 l->setHoldbackMount(v);
425 float length = attrf(a, "length", 1.0);
426 l->setLength(length);
427 l->setDownAngle(attrf(a, "down-angle", 45) * DEG2RAD);
428 l->setUpAngle(attrf(a, "up-angle", -45) * DEG2RAD);
429 l->setHoldbackLength(attrf(a, "holdback-length", 2.0));
430 _airplane.addLaunchbar(l);
431 } else if(eq(name, "fuselage")) {
433 v[0] = attrf(a, "ax");
434 v[1] = attrf(a, "ay");
435 v[2] = attrf(a, "az");
436 b[0] = attrf(a, "bx");
437 b[1] = attrf(a, "by");
438 b[2] = attrf(a, "bz");
439 float taper = attrf(a, "taper", 1);
440 float mid = attrf(a, "midpoint", 0.5);
441 if (_airplane.isVersionOrNewer(Version::YASIM_VERSION_32)) {
442 // A fuselage's "midpoint" XML attribute is defined from the
443 // fuselage's front end, but the Fuselage object's internal
444 // "mid" attribute is actually defined from the rear end.
445 // Thus YASim's original interpretation of "midpoint" was wrong.
446 // Complement the "midpoint" value to ensure the fuselage
447 // points the right way.
450 float cx = attrf(a, "cx", 1);
451 float cy = attrf(a, "cy", 1);
452 float cz = attrf(a, "cz", 1);
453 float idrag = attrf(a, "idrag", 1);
454 _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid,
456 } else if(eq(name, "tank")) {
457 v[0] = attrf(a, "x");
458 v[1] = attrf(a, "y");
459 v[2] = attrf(a, "z");
460 float density = 6.0; // gasoline, in lbs/gal
461 if(a->hasAttribute("jet")) density = 6.72;
462 density *= LBS2KG*CM2GALS;
463 _airplane.addTank(v, attrf(a, "capacity") * LBS2KG, density);
464 } else if(eq(name, "ballast")) {
465 v[0] = attrf(a, "x");
466 v[1] = attrf(a, "y");
467 v[2] = attrf(a, "z");
468 _airplane.addBallast(v, attrf(a, "mass") * LBS2KG);
469 } else if(eq(name, "weight")) {
471 } else if(eq(name, "stall")) {
472 Wing* w = (Wing*)_currObj;
473 w->setStall(attrf(a, "aoa") * DEG2RAD);
474 w->setStallWidth(attrf(a, "width", 2) * DEG2RAD);
475 w->setStallPeak(attrf(a, "peak", 1.5));
476 } else if(eq(name, "flap0")) {
477 ((Wing*)_currObj)->setFlap0(attrf(a, "start"), attrf(a, "end"),
478 attrf(a, "lift"), attrf(a, "drag"));
479 } else if(eq(name, "flap1")) {
480 ((Wing*)_currObj)->setFlap1(attrf(a, "start"), attrf(a, "end"),
481 attrf(a, "lift"), attrf(a, "drag"));
482 } else if(eq(name, "slat")) {
483 ((Wing*)_currObj)->setSlat(attrf(a, "start"), attrf(a, "end"),
484 attrf(a, "aoa"), attrf(a, "drag"));
485 } else if(eq(name, "spoiler")) {
486 ((Wing*)_currObj)->setSpoiler(attrf(a, "start"), attrf(a, "end"),
487 attrf(a, "lift"), attrf(a, "drag"));
488 /* } else if(eq(name, "collective")) {
489 ((Rotor*)_currObj)->setcollective(attrf(a, "min"), attrf(a, "max"));
490 } else if(eq(name, "cyclic")) {
491 ((Rotor*)_currObj)->setcyclic(attrf(a, "ail"), attrf(a, "ele"));
493 } else if(eq(name, "actionpt")) {
494 v[0] = attrf(a, "x");
495 v[1] = attrf(a, "y");
496 v[2] = attrf(a, "z");
497 ((Thruster*)_currObj)->setPosition(v);
498 } else if(eq(name, "dir")) {
499 v[0] = attrf(a, "x");
500 v[1] = attrf(a, "y");
501 v[2] = attrf(a, "z");
502 ((Thruster*)_currObj)->setDirection(v);
503 } else if(eq(name, "control-setting")) {
504 // A cruise or approach control setting
505 const char* axis = a->getValue("axis");
506 float value = attrf(a, "value", 0);
508 _airplane.addCruiseControl(parseAxis(axis), value);
510 _airplane.addApproachControl(parseAxis(axis), value);
511 } else if(eq(name, "control-input")) {
513 // A mapping of input property to a control
514 int axis = parseAxis(a->getValue("axis"));
515 int control = parseOutput(a->getValue("control"));
517 opt |= a->hasAttribute("split") ? ControlMap::OPT_SPLIT : 0;
518 opt |= a->hasAttribute("invert") ? ControlMap::OPT_INVERT : 0;
519 opt |= a->hasAttribute("square") ? ControlMap::OPT_SQUARE : 0;
521 ControlMap* cm = _airplane.getControlMap();
522 if(a->hasAttribute("src0")) {
523 cm->addMapping(axis, control, _currObj, opt,
524 attrf(a, "src0"), attrf(a, "src1"),
525 attrf(a, "dst0"), attrf(a, "dst1"));
527 cm->addMapping(axis, control, _currObj, opt);
529 } else if(eq(name, "control-output")) {
530 // A property output for a control on the current object
531 ControlMap* cm = _airplane.getControlMap();
532 int type = parseOutput(a->getValue("control"));
533 int handle = cm->getOutputHandle(_currObj, type);
535 PropOut* p = new PropOut();
536 p->prop = fgGetNode(a->getValue("prop"), true);
539 p->left = !(a->hasAttribute("side") &&
540 eq("right", a->getValue("side")));
541 p->min = attrf(a, "min", cm->rangeMin(type));
542 p->max = attrf(a, "max", cm->rangeMax(type));
543 _controlProps.add(p);
545 } else if(eq(name, "control-speed")) {
546 ControlMap* cm = _airplane.getControlMap();
547 int type = parseOutput(a->getValue("control"));
548 int handle = cm->getOutputHandle(_currObj, type);
549 float time = attrf(a, "transition-time", 0);
551 cm->setTransitionTime(handle, time);
553 SG_LOG(SG_FLIGHT,SG_ALERT,"Unexpected tag '"
554 << name << "' found in YASim aircraft description");
559 void FGFDM::getExternalInput(float dt)
563 _turb->setMagnitude(_turb_magnitude_norm->getFloatValue());
564 _turb->update(dt, _turb_rate_hz->getFloatValue());
567 ControlMap* cm = _airplane.getControlMap();
570 for(int i=0; i<_axes.size(); i++) {
571 AxisRec* a = (AxisRec*)_axes.get(i);
572 float val = fgGetFloat(a->name, 0);
573 cm->setInput(a->handle, val);
575 cm->applyControls(dt);
578 for(int i=0; i<_weights.size(); i++) {
579 WeightRec* wr = (WeightRec*)_weights.get(i);
580 _airplane.setWeight(wr->handle, LBS2KG * fgGetFloat(wr->prop));
583 for(int i=0; i<_thrusters.size(); i++) {
584 EngRec* er = (EngRec*)_thrusters.get(i);
585 Thruster* t = er->eng;
587 if(t->getPropEngine()) {
588 PropEngine* p = t->getPropEngine();
589 sprintf(buf, "%s/rpm", er->prefix);
590 p->setOmega(fgGetFloat(buf, 500) * RPM2RAD);
595 // Linearly "seeks" a property by the specified fraction of the way to
596 // the target value. Used to emulate "slowly changing" output values.
597 static void moveprop(SGPropertyNode* node, const char* prop,
598 float target, float frac)
600 float val = node->getFloatValue(prop);
601 if(frac > 1) frac = 1;
602 if(frac < 0) frac = 0;
603 val += (target - val) * frac;
604 node->setFloatValue(prop, val);
607 void FGFDM::setOutputProperties(float dt)
609 float grossWgt = _airplane.getModel()->getBody()->getTotalMass() * KG2LBS;
610 _gross_weight_lbs->setFloatValue(grossWgt);
612 ControlMap* cm = _airplane.getControlMap();
613 for(int i=0; i<_controlProps.size(); i++) {
614 PropOut* p = (PropOut*)_controlProps.get(i);
616 ? cm->getOutput(p->handle)
617 : cm->getOutputR(p->handle));
618 float rmin = cm->rangeMin(p->type);
619 float rmax = cm->rangeMax(p->type);
620 float frac = (val - rmin) / (rmax - rmin);
621 val = frac*(p->max - p->min) + p->min;
622 p->prop->setFloatValue(val);
625 for(int i=0; i<_airplane.getRotorgear()->getNumRotors(); i++) {
626 Rotor*r=(Rotor*)_airplane.getRotorgear()->getRotor(i);
630 while((j = r->getValueforFGSet(j, b, &f)))
631 if(b[0]) fgSetFloat(b,f);
633 while((j = _airplane.getRotorgear()->getValueforFGSet(j, b, &f)))
634 if(b[0]) fgSetFloat(b,f);
635 for(j=0; j < r->numRotorparts(); j+=r->numRotorparts()>>2) {
636 Rotorpart* s = (Rotorpart*)r->getRotorpart(j);
640 b=s->getAlphaoutput(k);
641 if(b[0]) fgSetFloat(b, s->getAlpha(k));
646 // Use the density of the first tank, or a dummy value if no tanks
647 float fuelDensity = 1.0;
648 if(_airplane.numTanks())
649 fuelDensity = _airplane.getFuelDensity(0);
650 for(int i=0; i<_thrusters.size(); i++) {
651 EngRec* er = (EngRec*)_thrusters.get(i);
652 Thruster* t = er->eng;
653 SGPropertyNode * node = fgGetNode("engines/engine", i, true);
655 ThrusterProps& tp = _thrust_props[i];
657 // Set: running, cranking, prop-thrust, max-hp, power-pct
658 tp._running->setBoolValue(t->isRunning());
659 tp._cranking->setBoolValue(t->isCranking());
663 float lbs = Math::mag3(tmp) * (KG2LBS/9.8);
664 tp._prop_thrust->setFloatValue(lbs); // Deprecated name
665 tp._thrust_lbs->setFloatValue(lbs);
666 tp._fuel_flow_gph->setFloatValue(
667 (t->getFuelFlow()/fuelDensity) * 3600 * CM2GALS);
669 if(t->getPropEngine()) {
670 PropEngine* p = t->getPropEngine();
671 tp._rpm->setFloatValue(p->getOmega() * (1/RPM2RAD));
672 tp._torque_ftlb->setFloatValue(
673 p->getEngine()->getTorque() * NM2FTLB);
675 if(p->getEngine()->isPistonEngine()) {
676 PistonEngine* pe = p->getEngine()->isPistonEngine();
677 tp._mp_osi->setFloatValue(pe->getMP() * (1/INHG2PA));
678 tp._mp_inhg->setFloatValue(pe->getMP() * (1/INHG2PA));
679 tp._egt_degf->setFloatValue(
680 pe->getEGT() * K2DEGF + K2DEGFOFFSET);
681 tp._oil_temperature_degf->setFloatValue(
682 pe->getOilTemp() * K2DEGF + K2DEGFOFFSET);
683 tp._boost_gauge_inhg->setFloatValue(
684 pe->getBoost() * (1/INHG2PA));
685 } else if(p->getEngine()->isTurbineEngine()) {
686 TurbineEngine* te = p->getEngine()->isTurbineEngine();
687 tp._n2->setFloatValue(te->getN2());
692 Jet* j = t->getJet();
693 tp._n1->setFloatValue(j->getN1());
694 tp._n2->setFloatValue(j->getN2());
695 tp._epr->setFloatValue(j->getEPR());
696 tp._egt_degf->setFloatValue(
697 j->getEGT() * K2DEGF + K2DEGFOFFSET);
699 // These are "unmodeled" values that are still needed for
700 // many cockpits. Tie them all to the N1 speed, but
701 // normalize the numbers to the range [0:1] so the
702 // cockpit code can scale them to the right values.
703 float pnorm = j->getPerfNorm();
704 moveprop(node, "oilp-norm", pnorm, dt/3); // 3s seek time
705 moveprop(node, "oilt-norm", pnorm, dt/30); // 30s
706 moveprop(node, "itt-norm", pnorm, dt/1); // 1s
711 Wing* FGFDM::parseWing(XMLAttributes* a, const char* type, Version * version)
713 Wing* w = new Wing(version);
716 if(eq(type, "vstab"))
722 pos[0] = attrf(a, "x");
723 pos[1] = attrf(a, "y");
724 pos[2] = attrf(a, "z");
727 w->setLength(attrf(a, "length"));
728 w->setChord(attrf(a, "chord"));
729 w->setSweep(attrf(a, "sweep", 0) * DEG2RAD);
730 w->setTaper(attrf(a, "taper", 1));
731 w->setDihedral(attrf(a, "dihedral", defDihed) * DEG2RAD);
732 w->setCamber(attrf(a, "camber", 0));
734 // These come in with positive indicating positive AoA, but the
735 // internals expect a rotation about the left-pointing Y axis, so
737 w->setIncidence(attrf(a, "incidence", 0) * DEG2RAD * -1);
738 w->setTwist(attrf(a, "twist", 0) * DEG2RAD * -1);
740 // The 70% is a magic number that sorta kinda seems to match known
741 // throttle settings to approach speed.
742 w->setInducedDrag(0.7*attrf(a, "idrag", 1));
744 float effect = attrf(a, "effectiveness", 1);
745 w->setDragScale(w->getDragScale()*effect);
751 Rotor* FGFDM::parseRotor(XMLAttributes* a, const char* type)
753 Rotor* w = new Rotor();
755 // float defDihed = 0;
758 pos[0] = attrf(a, "x");
759 pos[1] = attrf(a, "y");
760 pos[2] = attrf(a, "z");
764 normal[0] = attrf(a, "nx");
765 normal[1] = attrf(a, "ny");
766 normal[2] = attrf(a, "nz");
767 w->setNormal(normal);
770 forward[0] = attrf(a, "fx");
771 forward[1] = attrf(a, "fy");
772 forward[2] = attrf(a, "fz");
773 w->setForward(forward);
775 w->setMaxCyclicail(attrf(a, "maxcyclicail", 7.6));
776 w->setMaxCyclicele(attrf(a, "maxcyclicele", 4.94));
777 w->setMinCyclicail(attrf(a, "mincyclicail", -7.6));
778 w->setMinCyclicele(attrf(a, "mincyclicele", -4.94));
779 w->setMaxCollective(attrf(a, "maxcollective", 15.8));
780 w->setMinCollective(attrf(a, "mincollective", -0.2));
781 w->setDiameter(attrf(a, "diameter", 10.2));
782 w->setWeightPerBlade(attrf(a, "weightperblade", 44));
783 w->setNumberOfBlades(attrf(a, "numblades", 4));
784 w->setRelBladeCenter(attrf(a, "relbladecenter", 0.7));
785 w->setDynamic(attrf(a, "dynamic", 0.7));
786 w->setDelta3(attrf(a, "delta3", 0));
787 w->setDelta(attrf(a, "delta", 0));
788 w->setTranslift(attrf(a, "translift", 0.05));
789 w->setC2(attrf(a, "dragfactor", 1));
790 w->setStepspersecond(attrf(a, "stepspersecond", 120));
791 w->setPhiNull((attrf(a, "phi0", 0))*YASIM_PI/180);
792 w->setRPM(attrf(a, "rpm", 424));
793 w->setRelLenHinge(attrf(a, "rellenflaphinge", 0.07));
794 w->setAlpha0((attrf(a, "flap0", -5))*YASIM_PI/180);
795 w->setAlphamin((attrf(a, "flapmin", -15))/180*YASIM_PI);
796 w->setAlphamax((attrf(a, "flapmax", 15))*YASIM_PI/180);
797 w->setAlpha0factor(attrf(a, "flap0factor", 1));
798 w->setTeeterdamp(attrf(a,"teeterdamp",.0001));
799 w->setMaxteeterdamp(attrf(a,"maxteeterdamp",1000));
800 w->setRelLenTeeterHinge(attrf(a,"rellenteeterhinge",0.01));
801 w->setBalance(attrf(a,"balance",1.0));
802 w->setMinTiltYaw(attrf(a,"mintiltyaw",0.0));
803 w->setMinTiltPitch(attrf(a,"mintiltpitch",0.0));
804 w->setMinTiltRoll(attrf(a,"mintiltroll",0.0));
805 w->setMaxTiltYaw(attrf(a,"maxtiltyaw",0.0));
806 w->setMaxTiltPitch(attrf(a,"maxtiltpitch",0.0));
807 w->setMaxTiltRoll(attrf(a,"maxtiltroll",0.0));
808 w->setTiltCenterX(attrf(a,"tiltcenterx",0.0));
809 w->setTiltCenterY(attrf(a,"tiltcentery",0.0));
810 w->setTiltCenterZ(attrf(a,"tiltcenterz",0.0));
811 w->setDownwashFactor(attrf(a, "downwashfactor", 1));
814 if(attrb(a,"sharedflaphinge"))
815 w->setSharedFlapHinge(true);
817 if(a->hasAttribute("name"))
818 w->setName(a->getValue("name") );
819 if(a->hasAttribute("alphaout0"))
820 w->setAlphaoutput(0,a->getValue("alphaout0") );
821 if(a->hasAttribute("alphaout1")) w->setAlphaoutput(1,a->getValue("alphaout1") );
822 if(a->hasAttribute("alphaout2")) w->setAlphaoutput(2,a->getValue("alphaout2") );
823 if(a->hasAttribute("alphaout3")) w->setAlphaoutput(3,a->getValue("alphaout3") );
824 if(a->hasAttribute("coneout")) w->setAlphaoutput(4,a->getValue("coneout") );
825 if(a->hasAttribute("yawout")) w->setAlphaoutput(5,a->getValue("yawout") );
826 if(a->hasAttribute("rollout")) w->setAlphaoutput(6,a->getValue("rollout") );
828 w->setPitchA(attrf(a, "pitch-a", 10));
829 w->setPitchB(attrf(a, "pitch-b", 10));
830 w->setForceAtPitchA(attrf(a, "forceatpitch-a", 3000));
831 w->setPowerAtPitch0(attrf(a, "poweratpitch-0", 300));
832 w->setPowerAtPitchB(attrf(a, "poweratpitch-b", 3000));
833 if(attrb(a,"notorque"))
836 #define p(x) if (a->hasAttribute(#x)) w->setParameter((char *)#x,attrf(a,#x) );
837 #define p2(x,y) if (a->hasAttribute(y)) w->setParameter((char *)#x,attrf(a,y) );
838 p2(translift_ve,"translift-ve")
839 p2(translift_maxfactor,"translift-maxfactor")
840 p2(ground_effect_constant,"ground-effect-constant")
841 p2(vortex_state_lift_factor,"vortex-state-lift-factor")
842 p2(vortex_state_c1,"vortex-state-c1")
843 p2(vortex_state_c2,"vortex-state-c2")
844 p2(vortex_state_c3,"vortex-state_c3")
845 p2(vortex_state_e1,"vortex-state-e1")
846 p2(vortex_state_e2,"vortex-state-e2")
848 p2(number_of_segments,"number-of-segments")
849 p2(number_of_parts,"number-of-parts")
850 p2(rel_len_where_incidence_is_measured,"rel-len-where-incidence-is-measured")
853 p2(airfoil_incidence_no_lift,"airfoil-incidence-no-lift")
854 p2(rel_len_blade_start,"rel-len-blade-start")
855 p2(incidence_stall_zero_speed,"incidence-stall-zero-speed")
856 p2(incidence_stall_half_sonic_speed,"incidence-stall-half-sonic-speed")
857 p2(lift_factor_stall,"lift-factor-stall")
858 p2(stall_change_over,"stall-change-over")
859 p2(drag_factor_stall,"drag-factor-stall")
860 p2(airfoil_lift_coefficient,"airfoil-lift-coefficient")
861 p2(airfoil_drag_coefficient0,"airfoil-drag-coefficient0")
862 p2(airfoil_drag_coefficient1,"airfoil-drag-coefficient1")
863 p2(cyclic_factor,"cyclic-factor")
864 p2(rotor_correction_factor,"rotor-correction-factor")
871 void FGFDM::parsePistonEngine(XMLAttributes* a)
873 float engP = attrf(a, "eng-power") * HP2W;
874 float engS = attrf(a, "eng-rpm") * RPM2RAD;
876 PistonEngine* eng = new PistonEngine(engP, engS);
878 if(a->hasAttribute("displacement"))
879 eng->setDisplacement(attrf(a, "displacement") * CIN2CM);
881 if(a->hasAttribute("compression"))
882 eng->setCompression(attrf(a, "compression"));
884 if(a->hasAttribute("min-throttle"))
885 eng->setMinThrottle(attrf(a, "min-throttle"));
887 if(a->hasAttribute("turbo-mul")) {
888 float mul = attrf(a, "turbo-mul");
889 float mp = attrf(a, "wastegate-mp", 1e6) * INHG2PA;
890 eng->setTurboParams(mul, mp);
891 eng->setTurboLag(attrf(a, "turbo-lag", 2));
894 if(a->hasAttribute("supercharger"))
895 eng->setSupercharger(attrb(a, "supercharger"));
897 ((PropEngine*)_currObj)->setEngine(eng);
900 void FGFDM::parseTurbineEngine(XMLAttributes* a)
902 float power = attrf(a, "eng-power") * HP2W;
903 float omega = attrf(a, "eng-rpm") * RPM2RAD;
904 float alt = attrf(a, "alt") * FT2M;
905 float flatRating = attrf(a, "flat-rating") * HP2W;
906 TurbineEngine* eng = new TurbineEngine(power, omega, alt, flatRating);
908 if(a->hasAttribute("n2-low-idle"))
909 eng->setN2Range(attrf(a, "n2-low-idle"), attrf(a, "n2-high-idle"),
912 // Nasty units conversion: lbs/hr per hp -> kg/s per watt
913 if(a->hasAttribute("bsfc"))
914 eng->setFuelConsumption(attrf(a, "bsfc") * (LBS2KG/(3600*HP2W)));
916 ((PropEngine*)_currObj)->setEngine(eng);
919 void FGFDM::parsePropeller(XMLAttributes* a)
921 // Legacy Handling for the old engines syntax:
922 PistonEngine* eng = 0;
923 if(a->hasAttribute("eng-power")) {
924 SG_LOG(SG_FLIGHT,SG_ALERT, "WARNING: "
925 << "Legacy engine definition in YASim configuration file. "
927 float engP = attrf(a, "eng-power") * HP2W;
928 float engS = attrf(a, "eng-rpm") * RPM2RAD;
929 eng = new PistonEngine(engP, engS);
930 if(a->hasAttribute("displacement"))
931 eng->setDisplacement(attrf(a, "displacement") * CIN2CM);
932 if(a->hasAttribute("compression"))
933 eng->setCompression(attrf(a, "compression"));
934 if(a->hasAttribute("turbo-mul")) {
935 float mul = attrf(a, "turbo-mul");
936 float mp = attrf(a, "wastegate-mp", 1e6) * INHG2PA;
937 eng->setTurboParams(mul, mp);
941 // Now parse the actual propeller definition:
943 cg[0] = attrf(a, "x");
944 cg[1] = attrf(a, "y");
945 cg[2] = attrf(a, "z");
946 float mass = attrf(a, "mass") * LBS2KG;
947 float moment = attrf(a, "moment");
948 float radius = attrf(a, "radius");
949 float speed = attrf(a, "cruise-speed") * KTS2MPS;
950 float omega = attrf(a, "cruise-rpm") * RPM2RAD;
951 float power = attrf(a, "cruise-power") * HP2W;
952 float rho = Atmosphere::getStdDensity(attrf(a, "cruise-alt") * FT2M);
954 Propeller* prop = new Propeller(radius, speed, omega, rho, power);
955 PropEngine* thruster = new PropEngine(prop, eng, moment);
956 _airplane.addThruster(thruster, mass, cg);
958 // Set the stops (fine = minimum pitch, coarse = maximum pitch)
959 float fine_stop = attrf(a, "fine-stop", 0.25f);
960 float coarse_stop = attrf(a, "coarse-stop", 4.0f);
961 prop->setStops(fine_stop, coarse_stop);
963 if(a->hasAttribute("takeoff-power")) {
964 float power0 = attrf(a, "takeoff-power") * HP2W;
965 float omega0 = attrf(a, "takeoff-rpm") * RPM2RAD;
966 prop->setTakeoff(omega0, power0);
969 if(a->hasAttribute("max-rpm")) {
970 float max = attrf(a, "max-rpm") * RPM2RAD;
971 float min = attrf(a, "min-rpm") * RPM2RAD;
972 thruster->setVariableProp(min, max);
975 if(attrb(a, "contra"))
976 thruster->setContraPair(true);
978 if(a->hasAttribute("manual-pitch")) {
979 prop->setManualPitch();
982 thruster->setGearRatio(attrf(a, "gear-ratio", 1));
985 sprintf(buf, "/engines/engine[%d]", _nextEngine++);
986 EngRec* er = new EngRec();
988 er->prefix = dup(buf);
994 // Turns a string axis name into an integer for use by the
995 // ControlMap. Creates a new axis if this one hasn't been defined
997 int FGFDM::parseAxis(const char* name)
999 for(int i=0; i<_axes.size(); i++) {
1000 AxisRec* a = (AxisRec*)_axes.get(i);
1001 if(eq(a->name, name))
1005 // Not there, make a new one.
1006 AxisRec* a = new AxisRec();
1007 a->name = dup(name);
1008 fgGetNode( a->name, true ); // make sure the property name exists
1009 a->handle = _airplane.getControlMap()->newInput();
1014 int FGFDM::parseOutput(const char* name)
1016 if(eq(name, "THROTTLE")) return ControlMap::THROTTLE;
1017 if(eq(name, "MIXTURE")) return ControlMap::MIXTURE;
1018 if(eq(name, "CONDLEVER")) return ControlMap::CONDLEVER;
1019 if(eq(name, "STARTER")) return ControlMap::STARTER;
1020 if(eq(name, "MAGNETOS")) return ControlMap::MAGNETOS;
1021 if(eq(name, "ADVANCE")) return ControlMap::ADVANCE;
1022 if(eq(name, "REHEAT")) return ControlMap::REHEAT;
1023 if(eq(name, "BOOST")) return ControlMap::BOOST;
1024 if(eq(name, "VECTOR")) return ControlMap::VECTOR;
1025 if(eq(name, "PROP")) return ControlMap::PROP;
1026 if(eq(name, "BRAKE")) return ControlMap::BRAKE;
1027 if(eq(name, "STEER")) return ControlMap::STEER;
1028 if(eq(name, "EXTEND")) return ControlMap::EXTEND;
1029 if(eq(name, "HEXTEND")) return ControlMap::HEXTEND;
1030 if(eq(name, "LEXTEND")) return ControlMap::LEXTEND;
1031 if(eq(name, "LACCEL")) return ControlMap::LACCEL;
1032 if(eq(name, "INCIDENCE")) return ControlMap::INCIDENCE;
1033 if(eq(name, "FLAP0")) return ControlMap::FLAP0;
1034 if(eq(name, "FLAP0EFFECTIVENESS")) return ControlMap::FLAP0EFFECTIVENESS;
1035 if(eq(name, "FLAP1")) return ControlMap::FLAP1;
1036 if(eq(name, "FLAP1EFFECTIVENESS")) return ControlMap::FLAP1EFFECTIVENESS;
1037 if(eq(name, "SLAT")) return ControlMap::SLAT;
1038 if(eq(name, "SPOILER")) return ControlMap::SPOILER;
1039 if(eq(name, "CASTERING")) return ControlMap::CASTERING;
1040 if(eq(name, "PROPPITCH")) return ControlMap::PROPPITCH;
1041 if(eq(name, "PROPFEATHER")) return ControlMap::PROPFEATHER;
1042 if(eq(name, "COLLECTIVE")) return ControlMap::COLLECTIVE;
1043 if(eq(name, "CYCLICAIL")) return ControlMap::CYCLICAIL;
1044 if(eq(name, "CYCLICELE")) return ControlMap::CYCLICELE;
1045 if(eq(name, "TILTROLL")) return ControlMap::TILTROLL;
1046 if(eq(name, "TILTPITCH")) return ControlMap::TILTPITCH;
1047 if(eq(name, "TILTYAW")) return ControlMap::TILTYAW;
1048 if(eq(name, "ROTORGEARENGINEON")) return ControlMap::ROTORENGINEON;
1049 if(eq(name, "ROTORBRAKE")) return ControlMap::ROTORBRAKE;
1050 if(eq(name, "ROTORENGINEMAXRELTORQUE"))
1051 return ControlMap::ROTORENGINEMAXRELTORQUE;
1052 if(eq(name, "ROTORRELTARGET")) return ControlMap::ROTORRELTARGET;
1053 if(eq(name, "ROTORBALANCE")) return ControlMap::ROTORBALANCE;
1054 if(eq(name, "REVERSE_THRUST")) return ControlMap::REVERSE_THRUST;
1055 if(eq(name, "WASTEGATE")) return ControlMap::WASTEGATE;
1056 if(eq(name, "WINCHRELSPEED")) return ControlMap::WINCHRELSPEED;
1057 if(eq(name, "HITCHOPEN")) return ControlMap::HITCHOPEN;
1058 if(eq(name, "PLACEWINCH")) return ControlMap::PLACEWINCH;
1059 if(eq(name, "FINDAITOW")) return ControlMap::FINDAITOW;
1061 SG_LOG(SG_FLIGHT,SG_ALERT,"Unrecognized control type '"
1062 << name << "' in YASim aircraft description.");
1067 void FGFDM::parseWeight(XMLAttributes* a)
1069 WeightRec* wr = new WeightRec();
1072 v[0] = attrf(a, "x");
1073 v[1] = attrf(a, "y");
1074 v[2] = attrf(a, "z");
1076 wr->prop = dup(a->getValue("mass-prop"));
1077 wr->size = attrf(a, "size", 0);
1078 wr->handle = _airplane.addWeight(v, wr->size);
1083 bool FGFDM::eq(const char* a, const char* b)
1085 // Figure it out for yourself. :)
1086 while(*a && *b && *a == *b) { a++; b++; }
1090 char* FGFDM::dup(const char* s)
1094 char* s2 = new char[len+1];
1096 while((*p++ = *s++));
1101 int FGFDM::attri(XMLAttributes* atts, const char* attr)
1103 if(!atts->hasAttribute(attr)) {
1104 SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr <<
1105 "' in YASim aircraft description");
1108 return attri(atts, attr, 0);
1111 int FGFDM::attri(XMLAttributes* atts, const char* attr, int def)
1113 const char* val = atts->getValue(attr);
1114 if(val == 0) return def;
1115 else return atol(val);
1118 float FGFDM::attrf(XMLAttributes* atts, const char* attr)
1120 if(!atts->hasAttribute(attr)) {
1121 SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr <<
1122 "' in YASim aircraft description");
1125 return attrf(atts, attr, 0);
1128 float FGFDM::attrf(XMLAttributes* atts, const char* attr, float def)
1130 const char* val = atts->getValue(attr);
1131 if(val == 0) return def;
1132 else return (float)atof(val);
1135 double FGFDM::attrd(XMLAttributes* atts, const char* attr)
1137 if(!atts->hasAttribute(attr)) {
1138 SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr <<
1139 "' in YASim aircraft description");
1142 return attrd(atts, attr, 0);
1145 double FGFDM::attrd(XMLAttributes* atts, const char* attr, double def)
1147 const char* val = atts->getValue(attr);
1148 if(val == 0) return def;
1149 else return atof(val);
1152 // ACK: the dreaded ambiguous string boolean. Remind me to shoot Maik
1153 // when I have a chance. :). Unless you have a parser that can check
1154 // symbol constants (we don't), this kind of coding is just a Bad
1155 // Idea. This implementation, for example, silently returns a boolean
1156 // falsehood for values of "1", "yes", "True", and "TRUE". Which is
1157 // especially annoying preexisting boolean attributes in the same
1158 // parser want to see "1" and will choke on a "true"...
1160 // Unfortunately, this usage creeped into existing configuration files
1161 // while I wasn't active, and it's going to be hard to remove. Issue
1162 // a warning to nag people into changing their ways for now...
1163 bool FGFDM::attrb(XMLAttributes* atts, const char* attr)
1165 const char* val = atts->getValue(attr);
1166 if(val == 0) return false;
1168 if(eq(val,"true")) {
1169 SG_LOG(SG_FLIGHT, SG_ALERT, "Warning: " <<
1170 "deprecated 'true' boolean in YASim configuration file. " <<
1171 "Use numeric booleans (attribute=\"1\") instead");
1174 return attri(atts, attr, 0) ? true : false;
1177 }; // namespace yasim