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( !_airplane.isVersionOrNewer( Version::YASIM_VERSION_CURRENT ) ) {
226 SG_LOG(SG_FLIGHT,SG_ALERT, "This aircraft does not use the latest yasim configuration version.");
228 } else if(eq(name, "approach")) {
229 float spd = attrf(a, "speed") * KTS2MPS;
230 float alt = attrf(a, "alt", 0) * FT2M;
231 float aoa = attrf(a, "aoa", 0) * DEG2RAD;
232 float gla = attrf(a, "glide-angle", 0) * DEG2RAD;
233 _airplane.setApproach(spd, alt, aoa, attrf(a, "fuel", 0.2),gla);
235 } else if(eq(name, "cruise")) {
236 float spd = attrf(a, "speed") * KTS2MPS;
237 float alt = attrf(a, "alt") * FT2M;
238 float gla = attrf(a, "glide-angle", 0) * DEG2RAD;
239 _airplane.setCruise(spd, alt, attrf(a, "fuel", 0.5),gla);
241 } else if(eq(name, "solve-weight")) {
242 int idx = attri(a, "idx");
243 float wgt = attrf(a, "weight") * LBS2KG;
244 _airplane.addSolutionWeight(!_cruiseCurr, idx, wgt);
245 } else if(eq(name, "cockpit")) {
246 v[0] = attrf(a, "x");
247 v[1] = attrf(a, "y");
248 v[2] = attrf(a, "z");
249 _airplane.setPilotPos(v);
250 } else if(eq(name, "rotor")) {
251 _airplane.getModel()->getRotorgear()->addRotor(parseRotor(a, name));
252 } else if(eq(name, "rotorgear")) {
253 Rotorgear* r = _airplane.getModel()->getRotorgear();
255 #define p(x) if (a->hasAttribute(#x)) r->setParameter((char *)#x,attrf(a,#x) );
256 #define p2(x,y) if (a->hasAttribute(y)) r->setParameter((char *)#x,attrf(a,y) );
257 p2(max_power_engine,"max-power-engine")
258 p2(engine_prop_factor,"engine-prop-factor")
261 p2(max_power_rotor_brake,"max-power-rotor-brake")
262 p2(rotorgear_friction,"rotorgear-friction")
263 p2(engine_accel_limit,"engine-accel-limit")
267 } else if(eq(name, "wing")) {
268 _airplane.setWing(parseWing(a, name, &_airplane));
269 } else if(eq(name, "hstab")) {
270 _airplane.setTail(parseWing(a, name, &_airplane));
271 } else if(eq(name, "vstab") || eq(name, "mstab")) {
272 _airplane.addVStab(parseWing(a, name, &_airplane));
273 } else if(eq(name, "piston-engine")) {
274 parsePistonEngine(a);
275 } else if(eq(name, "turbine-engine")) {
276 parseTurbineEngine(a);
277 } else if(eq(name, "propeller")) {
279 } else if(eq(name, "thruster")) {
280 SimpleJet* j = new SimpleJet();
282 v[0] = attrf(a, "x"); v[1] = attrf(a, "y"); v[2] = attrf(a, "z");
284 _airplane.addThruster(j, 0, v);
285 v[0] = attrf(a, "vx"); v[1] = attrf(a, "vy"); v[2] = attrf(a, "vz");
287 j->setThrust(attrf(a, "thrust") * LBS2N);
288 } else if(eq(name, "jet")) {
291 v[0] = attrf(a, "x");
292 v[1] = attrf(a, "y");
293 v[2] = attrf(a, "z");
294 float mass = attrf(a, "mass") * LBS2KG;
295 j->setMaxThrust(attrf(a, "thrust") * LBS2N,
296 attrf(a, "afterburner", 0) * LBS2N);
297 j->setVectorAngle(attrf(a, "rotate", 0) * DEG2RAD);
298 j->setReverseThrust(attrf(a, "reverse", 0.2));
300 float n1min = attrf(a, "n1-idle", 55);
301 float n1max = attrf(a, "n1-max", 102);
302 float n2min = attrf(a, "n2-idle", 73);
303 float n2max = attrf(a, "n2-max", 103);
304 j->setRPMs(n1min, n1max, n2min, n2max);
306 j->setTSFC(attrf(a, "tsfc", 0.8));
307 if(a->hasAttribute("egt")) j->setEGT(attrf(a, "egt"));
308 if(a->hasAttribute("epr")) j->setEPR(attrf(a, "epr"));
309 if(a->hasAttribute("exhaust-speed"))
310 j->setVMax(attrf(a, "exhaust-speed") * KTS2MPS);
311 if(a->hasAttribute("spool-time"))
312 j->setSpooling(attrf(a, "spool-time"));
315 _airplane.addThruster(j, mass, v);
316 sprintf(buf, "/engines/engine[%d]", _nextEngine++);
317 EngRec* er = new EngRec();
319 er->prefix = dup(buf);
321 } else if(eq(name, "hitch")) {
322 Hitch* h = new Hitch(a->getValue("name"));
324 v[0] = attrf(a, "x");
325 v[1] = attrf(a, "y");
326 v[2] = attrf(a, "z");
328 if(a->hasAttribute("force-is-calculated-by-other")) h->setForceIsCalculatedByOther(attrb(a,"force-is-calculated-by-other"));
329 _airplane.addHitch(h);
330 } else if(eq(name, "tow")) {
331 Hitch* h = (Hitch*)_currObj;
332 if(a->hasAttribute("length"))
333 h->setTowLength(attrf(a, "length"));
334 if(a->hasAttribute("elastic-constant"))
335 h->setTowElasticConstant(attrf(a, "elastic-constant"));
336 if(a->hasAttribute("break-force"))
337 h->setTowBreakForce(attrf(a, "break-force"));
338 if(a->hasAttribute("weight-per-meter"))
339 h->setTowWeightPerM(attrf(a, "weight-per-meter"));
340 if(a->hasAttribute("mp-auto-connect-period"))
341 h->setMpAutoConnectPeriod(attrf(a, "mp-auto-connect-period"));
342 } else if(eq(name, "winch")) {
343 Hitch* h = (Hitch*)_currObj;
345 pos[0] = attrd(a, "x",0);
346 pos[1] = attrd(a, "y",0);
347 pos[2] = attrd(a, "z",0);
348 h->setWinchPosition(pos);
349 if(a->hasAttribute("max-speed"))
350 h->setWinchMaxSpeed(attrf(a, "max-speed"));
351 if(a->hasAttribute("power"))
352 h->setWinchPower(attrf(a, "power") * 1000);
353 if(a->hasAttribute("max-force"))
354 h->setWinchMaxForce(attrf(a, "max-force"));
355 if(a->hasAttribute("initial-tow-length"))
356 h->setWinchInitialTowLength(attrf(a, "initial-tow-length"));
357 if(a->hasAttribute("max-tow-length"))
358 h->setWinchMaxTowLength(attrf(a, "max-tow-length"));
359 if(a->hasAttribute("min-tow-length"))
360 h->setWinchMinTowLength(attrf(a, "min-tow-length"));
361 } else if(eq(name, "gear")) {
362 Gear* g = new Gear();
364 v[0] = attrf(a, "x");
365 v[1] = attrf(a, "y");
366 v[2] = attrf(a, "z");
368 float nrm = Math::mag3(v);
369 if (_vehicle_radius < nrm)
370 _vehicle_radius = nrm;
371 if(a->hasAttribute("upx")) {
372 v[0] = attrf(a, "upx");
373 v[1] = attrf(a, "upy");
374 v[2] = attrf(a, "upz");
381 for(int i=0; i<3; i++)
382 v[i] *= attrf(a, "compression", 1);
383 g->setCompression(v);
384 g->setBrake(attrf(a, "skid", 0));
385 g->setInitialLoad(attrf(a, "initial-load", 0));
386 g->setStaticFriction(attrf(a, "sfric", 0.8));
387 g->setDynamicFriction(attrf(a, "dfric", 0.7));
388 g->setSpring(attrf(a, "spring", 1));
389 g->setDamping(attrf(a, "damp", 1));
390 if(a->hasAttribute("on-water")) g->setOnWater(attrb(a,"on-water"));
391 if(a->hasAttribute("on-solid")) g->setOnSolid(attrb(a,"on-solid"));
392 if(a->hasAttribute("ignored-by-solver")) g->setIgnoreWhileSolving(attrb(a,"ignored-by-solver"));
393 g->setSpringFactorNotPlaning(attrf(a, "spring-factor-not-planing", 1));
394 g->setSpeedPlaning(attrf(a, "speed-planing", 0) * KTS2MPS);
395 g->setReduceFrictionByExtension(attrf(a, "reduce-friction-by-extension", 0));
396 _airplane.addGear(g);
397 } else if(eq(name, "hook")) {
398 Hook* h = new Hook();
400 v[0] = attrf(a, "x");
401 v[1] = attrf(a, "y");
402 v[2] = attrf(a, "z");
404 float length = attrf(a, "length", 1.0);
405 h->setLength(length);
406 float nrm = length+Math::mag3(v);
407 if (_vehicle_radius < nrm)
408 _vehicle_radius = nrm;
409 h->setDownAngle(attrf(a, "down-angle", 70) * DEG2RAD);
410 h->setUpAngle(attrf(a, "up-angle", 0) * DEG2RAD);
411 _airplane.addHook(h);
412 } else if(eq(name, "launchbar")) {
413 Launchbar* l = new Launchbar();
415 v[0] = attrf(a, "x");
416 v[1] = attrf(a, "y");
417 v[2] = attrf(a, "z");
418 l->setLaunchbarMount(v);
419 v[0] = attrf(a, "holdback-x", v[0]);
420 v[1] = attrf(a, "holdback-y", v[1]);
421 v[2] = attrf(a, "holdback-z", v[2]);
422 l->setHoldbackMount(v);
423 float length = attrf(a, "length", 1.0);
424 l->setLength(length);
425 l->setDownAngle(attrf(a, "down-angle", 45) * DEG2RAD);
426 l->setUpAngle(attrf(a, "up-angle", -45) * DEG2RAD);
427 l->setHoldbackLength(attrf(a, "holdback-length", 2.0));
428 _airplane.addLaunchbar(l);
429 } else if(eq(name, "fuselage")) {
431 v[0] = attrf(a, "ax");
432 v[1] = attrf(a, "ay");
433 v[2] = attrf(a, "az");
434 b[0] = attrf(a, "bx");
435 b[1] = attrf(a, "by");
436 b[2] = attrf(a, "bz");
437 float taper = attrf(a, "taper", 1);
438 float mid = attrf(a, "midpoint", 0.5);
439 if (_airplane.isVersionOrNewer(Version::YASIM_VERSION_32)) {
440 // A fuselage's "midpoint" XML attribute is defined from the
441 // fuselage's front end, but the Fuselage object's internal
442 // "mid" attribute is actually defined from the rear end.
443 // Thus YASim's original interpretation of "midpoint" was wrong.
444 // Complement the "midpoint" value to ensure the fuselage
445 // points the right way.
448 float cx = attrf(a, "cx", 1);
449 float cy = attrf(a, "cy", 1);
450 float cz = attrf(a, "cz", 1);
451 float idrag = attrf(a, "idrag", 1);
452 _airplane.addFuselage(v, b, attrf(a, "width"), taper, mid,
454 } else if(eq(name, "tank")) {
455 v[0] = attrf(a, "x");
456 v[1] = attrf(a, "y");
457 v[2] = attrf(a, "z");
458 float density = 6.0; // gasoline, in lbs/gal
459 if(a->hasAttribute("jet")) density = 6.72;
460 density *= LBS2KG*CM2GALS;
461 _airplane.addTank(v, attrf(a, "capacity") * LBS2KG, density);
462 } else if(eq(name, "ballast")) {
463 v[0] = attrf(a, "x");
464 v[1] = attrf(a, "y");
465 v[2] = attrf(a, "z");
466 _airplane.addBallast(v, attrf(a, "mass") * LBS2KG);
467 } else if(eq(name, "weight")) {
469 } else if(eq(name, "stall")) {
470 Wing* w = (Wing*)_currObj;
471 w->setStall(attrf(a, "aoa") * DEG2RAD);
472 w->setStallWidth(attrf(a, "width", 2) * DEG2RAD);
473 w->setStallPeak(attrf(a, "peak", 1.5));
474 } else if(eq(name, "flap0")) {
475 ((Wing*)_currObj)->setFlap0(attrf(a, "start"), attrf(a, "end"),
476 attrf(a, "lift"), attrf(a, "drag"));
477 } else if(eq(name, "flap1")) {
478 ((Wing*)_currObj)->setFlap1(attrf(a, "start"), attrf(a, "end"),
479 attrf(a, "lift"), attrf(a, "drag"));
480 } else if(eq(name, "slat")) {
481 ((Wing*)_currObj)->setSlat(attrf(a, "start"), attrf(a, "end"),
482 attrf(a, "aoa"), attrf(a, "drag"));
483 } else if(eq(name, "spoiler")) {
484 ((Wing*)_currObj)->setSpoiler(attrf(a, "start"), attrf(a, "end"),
485 attrf(a, "lift"), attrf(a, "drag"));
486 /* } else if(eq(name, "collective")) {
487 ((Rotor*)_currObj)->setcollective(attrf(a, "min"), attrf(a, "max"));
488 } else if(eq(name, "cyclic")) {
489 ((Rotor*)_currObj)->setcyclic(attrf(a, "ail"), attrf(a, "ele"));
491 } else if(eq(name, "actionpt")) {
492 v[0] = attrf(a, "x");
493 v[1] = attrf(a, "y");
494 v[2] = attrf(a, "z");
495 ((Thruster*)_currObj)->setPosition(v);
496 } else if(eq(name, "dir")) {
497 v[0] = attrf(a, "x");
498 v[1] = attrf(a, "y");
499 v[2] = attrf(a, "z");
500 ((Thruster*)_currObj)->setDirection(v);
501 } else if(eq(name, "control-setting")) {
502 // A cruise or approach control setting
503 const char* axis = a->getValue("axis");
504 float value = attrf(a, "value", 0);
506 _airplane.addCruiseControl(parseAxis(axis), value);
508 _airplane.addApproachControl(parseAxis(axis), value);
509 } else if(eq(name, "control-input")) {
511 // A mapping of input property to a control
512 int axis = parseAxis(a->getValue("axis"));
513 int control = parseOutput(a->getValue("control"));
515 opt |= a->hasAttribute("split") ? ControlMap::OPT_SPLIT : 0;
516 opt |= a->hasAttribute("invert") ? ControlMap::OPT_INVERT : 0;
517 opt |= a->hasAttribute("square") ? ControlMap::OPT_SQUARE : 0;
519 ControlMap* cm = _airplane.getControlMap();
520 if(a->hasAttribute("src0")) {
521 cm->addMapping(axis, control, _currObj, opt,
522 attrf(a, "src0"), attrf(a, "src1"),
523 attrf(a, "dst0"), attrf(a, "dst1"));
525 cm->addMapping(axis, control, _currObj, opt);
527 } else if(eq(name, "control-output")) {
528 // A property output for a control on the current object
529 ControlMap* cm = _airplane.getControlMap();
530 int type = parseOutput(a->getValue("control"));
531 int handle = cm->getOutputHandle(_currObj, type);
533 PropOut* p = new PropOut();
534 p->prop = fgGetNode(a->getValue("prop"), true);
537 p->left = !(a->hasAttribute("side") &&
538 eq("right", a->getValue("side")));
539 p->min = attrf(a, "min", cm->rangeMin(type));
540 p->max = attrf(a, "max", cm->rangeMax(type));
541 _controlProps.add(p);
543 } else if(eq(name, "control-speed")) {
544 ControlMap* cm = _airplane.getControlMap();
545 int type = parseOutput(a->getValue("control"));
546 int handle = cm->getOutputHandle(_currObj, type);
547 float time = attrf(a, "transition-time", 0);
549 cm->setTransitionTime(handle, time);
551 SG_LOG(SG_FLIGHT,SG_ALERT,"Unexpected tag '"
552 << name << "' found in YASim aircraft description");
557 void FGFDM::getExternalInput(float dt)
561 _turb->setMagnitude(_turb_magnitude_norm->getFloatValue());
562 _turb->update(dt, _turb_rate_hz->getFloatValue());
565 ControlMap* cm = _airplane.getControlMap();
568 for(int i=0; i<_axes.size(); i++) {
569 AxisRec* a = (AxisRec*)_axes.get(i);
570 float val = fgGetFloat(a->name, 0);
571 cm->setInput(a->handle, val);
573 cm->applyControls(dt);
576 for(int i=0; i<_weights.size(); i++) {
577 WeightRec* wr = (WeightRec*)_weights.get(i);
578 _airplane.setWeight(wr->handle, LBS2KG * fgGetFloat(wr->prop));
581 for(int i=0; i<_thrusters.size(); i++) {
582 EngRec* er = (EngRec*)_thrusters.get(i);
583 Thruster* t = er->eng;
585 if(t->getPropEngine()) {
586 PropEngine* p = t->getPropEngine();
587 sprintf(buf, "%s/rpm", er->prefix);
588 p->setOmega(fgGetFloat(buf, 500) * RPM2RAD);
593 // Linearly "seeks" a property by the specified fraction of the way to
594 // the target value. Used to emulate "slowly changing" output values.
595 static void moveprop(SGPropertyNode* node, const char* prop,
596 float target, float frac)
598 float val = node->getFloatValue(prop);
599 if(frac > 1) frac = 1;
600 if(frac < 0) frac = 0;
601 val += (target - val) * frac;
602 node->setFloatValue(prop, val);
605 void FGFDM::setOutputProperties(float dt)
607 float grossWgt = _airplane.getModel()->getBody()->getTotalMass() * KG2LBS;
608 _gross_weight_lbs->setFloatValue(grossWgt);
610 ControlMap* cm = _airplane.getControlMap();
611 for(int i=0; i<_controlProps.size(); i++) {
612 PropOut* p = (PropOut*)_controlProps.get(i);
614 ? cm->getOutput(p->handle)
615 : cm->getOutputR(p->handle));
616 float rmin = cm->rangeMin(p->type);
617 float rmax = cm->rangeMax(p->type);
618 float frac = (val - rmin) / (rmax - rmin);
619 val = frac*(p->max - p->min) + p->min;
620 p->prop->setFloatValue(val);
623 for(int i=0; i<_airplane.getRotorgear()->getNumRotors(); i++) {
624 Rotor*r=(Rotor*)_airplane.getRotorgear()->getRotor(i);
628 while((j = r->getValueforFGSet(j, b, &f)))
629 if(b[0]) fgSetFloat(b,f);
631 while((j = _airplane.getRotorgear()->getValueforFGSet(j, b, &f)))
632 if(b[0]) fgSetFloat(b,f);
633 for(j=0; j < r->numRotorparts(); j+=r->numRotorparts()>>2) {
634 Rotorpart* s = (Rotorpart*)r->getRotorpart(j);
638 b=s->getAlphaoutput(k);
639 if(b[0]) fgSetFloat(b, s->getAlpha(k));
644 // Use the density of the first tank, or a dummy value if no tanks
645 float fuelDensity = 1.0;
646 if(_airplane.numTanks())
647 fuelDensity = _airplane.getFuelDensity(0);
648 for(int i=0; i<_thrusters.size(); i++) {
649 EngRec* er = (EngRec*)_thrusters.get(i);
650 Thruster* t = er->eng;
651 SGPropertyNode * node = fgGetNode("engines/engine", i, true);
653 ThrusterProps& tp = _thrust_props[i];
655 // Set: running, cranking, prop-thrust, max-hp, power-pct
656 tp._running->setBoolValue(t->isRunning());
657 tp._cranking->setBoolValue(t->isCranking());
661 float lbs = Math::mag3(tmp) * (KG2LBS/9.8);
662 tp._prop_thrust->setFloatValue(lbs); // Deprecated name
663 tp._thrust_lbs->setFloatValue(lbs);
664 tp._fuel_flow_gph->setFloatValue(
665 (t->getFuelFlow()/fuelDensity) * 3600 * CM2GALS);
667 if(t->getPropEngine()) {
668 PropEngine* p = t->getPropEngine();
669 tp._rpm->setFloatValue(p->getOmega() * (1/RPM2RAD));
670 tp._torque_ftlb->setFloatValue(
671 p->getEngine()->getTorque() * NM2FTLB);
673 if(p->getEngine()->isPistonEngine()) {
674 PistonEngine* pe = p->getEngine()->isPistonEngine();
675 tp._mp_osi->setFloatValue(pe->getMP() * (1/INHG2PA));
676 tp._mp_inhg->setFloatValue(pe->getMP() * (1/INHG2PA));
677 tp._egt_degf->setFloatValue(
678 pe->getEGT() * K2DEGF + K2DEGFOFFSET);
679 tp._oil_temperature_degf->setFloatValue(
680 pe->getOilTemp() * K2DEGF + K2DEGFOFFSET);
681 tp._boost_gauge_inhg->setFloatValue(
682 pe->getBoost() * (1/INHG2PA));
683 } else if(p->getEngine()->isTurbineEngine()) {
684 TurbineEngine* te = p->getEngine()->isTurbineEngine();
685 tp._n2->setFloatValue(te->getN2());
690 Jet* j = t->getJet();
691 tp._n1->setFloatValue(j->getN1());
692 tp._n2->setFloatValue(j->getN2());
693 tp._epr->setFloatValue(j->getEPR());
694 tp._egt_degf->setFloatValue(
695 j->getEGT() * K2DEGF + K2DEGFOFFSET);
697 // These are "unmodeled" values that are still needed for
698 // many cockpits. Tie them all to the N1 speed, but
699 // normalize the numbers to the range [0:1] so the
700 // cockpit code can scale them to the right values.
701 float pnorm = j->getPerfNorm();
702 moveprop(node, "oilp-norm", pnorm, dt/3); // 3s seek time
703 moveprop(node, "oilt-norm", pnorm, dt/30); // 30s
704 moveprop(node, "itt-norm", pnorm, dt/1); // 1s
709 Wing* FGFDM::parseWing(XMLAttributes* a, const char* type, Version * version)
711 Wing* w = new Wing(version);
714 if(eq(type, "vstab"))
720 pos[0] = attrf(a, "x");
721 pos[1] = attrf(a, "y");
722 pos[2] = attrf(a, "z");
725 w->setLength(attrf(a, "length"));
726 w->setChord(attrf(a, "chord"));
727 w->setSweep(attrf(a, "sweep", 0) * DEG2RAD);
728 w->setTaper(attrf(a, "taper", 1));
729 w->setDihedral(attrf(a, "dihedral", defDihed) * DEG2RAD);
730 w->setCamber(attrf(a, "camber", 0));
732 // These come in with positive indicating positive AoA, but the
733 // internals expect a rotation about the left-pointing Y axis, so
735 w->setIncidence(attrf(a, "incidence", 0) * DEG2RAD * -1);
736 w->setTwist(attrf(a, "twist", 0) * DEG2RAD * -1);
738 // The 70% is a magic number that sorta kinda seems to match known
739 // throttle settings to approach speed.
740 w->setInducedDrag(0.7*attrf(a, "idrag", 1));
742 float effect = attrf(a, "effectiveness", 1);
743 w->setDragScale(w->getDragScale()*effect);
749 Rotor* FGFDM::parseRotor(XMLAttributes* a, const char* type)
751 Rotor* w = new Rotor();
753 // float defDihed = 0;
756 pos[0] = attrf(a, "x");
757 pos[1] = attrf(a, "y");
758 pos[2] = attrf(a, "z");
762 normal[0] = attrf(a, "nx");
763 normal[1] = attrf(a, "ny");
764 normal[2] = attrf(a, "nz");
765 w->setNormal(normal);
768 forward[0] = attrf(a, "fx");
769 forward[1] = attrf(a, "fy");
770 forward[2] = attrf(a, "fz");
771 w->setForward(forward);
773 w->setMaxCyclicail(attrf(a, "maxcyclicail", 7.6));
774 w->setMaxCyclicele(attrf(a, "maxcyclicele", 4.94));
775 w->setMinCyclicail(attrf(a, "mincyclicail", -7.6));
776 w->setMinCyclicele(attrf(a, "mincyclicele", -4.94));
777 w->setMaxCollective(attrf(a, "maxcollective", 15.8));
778 w->setMinCollective(attrf(a, "mincollective", -0.2));
779 w->setDiameter(attrf(a, "diameter", 10.2));
780 w->setWeightPerBlade(attrf(a, "weightperblade", 44));
781 w->setNumberOfBlades(attrf(a, "numblades", 4));
782 w->setRelBladeCenter(attrf(a, "relbladecenter", 0.7));
783 w->setDynamic(attrf(a, "dynamic", 0.7));
784 w->setDelta3(attrf(a, "delta3", 0));
785 w->setDelta(attrf(a, "delta", 0));
786 w->setTranslift(attrf(a, "translift", 0.05));
787 w->setC2(attrf(a, "dragfactor", 1));
788 w->setStepspersecond(attrf(a, "stepspersecond", 120));
789 w->setPhiNull((attrf(a, "phi0", 0))*YASIM_PI/180);
790 w->setRPM(attrf(a, "rpm", 424));
791 w->setRelLenHinge(attrf(a, "rellenflaphinge", 0.07));
792 w->setAlpha0((attrf(a, "flap0", -5))*YASIM_PI/180);
793 w->setAlphamin((attrf(a, "flapmin", -15))/180*YASIM_PI);
794 w->setAlphamax((attrf(a, "flapmax", 15))*YASIM_PI/180);
795 w->setAlpha0factor(attrf(a, "flap0factor", 1));
796 w->setTeeterdamp(attrf(a,"teeterdamp",.0001));
797 w->setMaxteeterdamp(attrf(a,"maxteeterdamp",1000));
798 w->setRelLenTeeterHinge(attrf(a,"rellenteeterhinge",0.01));
799 w->setBalance(attrf(a,"balance",1.0));
800 w->setMinTiltYaw(attrf(a,"mintiltyaw",0.0));
801 w->setMinTiltPitch(attrf(a,"mintiltpitch",0.0));
802 w->setMinTiltRoll(attrf(a,"mintiltroll",0.0));
803 w->setMaxTiltYaw(attrf(a,"maxtiltyaw",0.0));
804 w->setMaxTiltPitch(attrf(a,"maxtiltpitch",0.0));
805 w->setMaxTiltRoll(attrf(a,"maxtiltroll",0.0));
806 w->setTiltCenterX(attrf(a,"tiltcenterx",0.0));
807 w->setTiltCenterY(attrf(a,"tiltcentery",0.0));
808 w->setTiltCenterZ(attrf(a,"tiltcenterz",0.0));
809 w->setDownwashFactor(attrf(a, "downwashfactor", 1));
812 if(attrb(a,"sharedflaphinge"))
813 w->setSharedFlapHinge(true);
815 if(a->hasAttribute("name"))
816 w->setName(a->getValue("name") );
817 if(a->hasAttribute("alphaout0"))
818 w->setAlphaoutput(0,a->getValue("alphaout0") );
819 if(a->hasAttribute("alphaout1")) w->setAlphaoutput(1,a->getValue("alphaout1") );
820 if(a->hasAttribute("alphaout2")) w->setAlphaoutput(2,a->getValue("alphaout2") );
821 if(a->hasAttribute("alphaout3")) w->setAlphaoutput(3,a->getValue("alphaout3") );
822 if(a->hasAttribute("coneout")) w->setAlphaoutput(4,a->getValue("coneout") );
823 if(a->hasAttribute("yawout")) w->setAlphaoutput(5,a->getValue("yawout") );
824 if(a->hasAttribute("rollout")) w->setAlphaoutput(6,a->getValue("rollout") );
826 w->setPitchA(attrf(a, "pitch-a", 10));
827 w->setPitchB(attrf(a, "pitch-b", 10));
828 w->setForceAtPitchA(attrf(a, "forceatpitch-a", 3000));
829 w->setPowerAtPitch0(attrf(a, "poweratpitch-0", 300));
830 w->setPowerAtPitchB(attrf(a, "poweratpitch-b", 3000));
831 if(attrb(a,"notorque"))
834 #define p(x) if (a->hasAttribute(#x)) w->setParameter((char *)#x,attrf(a,#x) );
835 #define p2(x,y) if (a->hasAttribute(y)) w->setParameter((char *)#x,attrf(a,y) );
836 p2(translift_ve,"translift-ve")
837 p2(translift_maxfactor,"translift-maxfactor")
838 p2(ground_effect_constant,"ground-effect-constant")
839 p2(vortex_state_lift_factor,"vortex-state-lift-factor")
840 p2(vortex_state_c1,"vortex-state-c1")
841 p2(vortex_state_c2,"vortex-state-c2")
842 p2(vortex_state_c3,"vortex-state_c3")
843 p2(vortex_state_e1,"vortex-state-e1")
844 p2(vortex_state_e2,"vortex-state-e2")
846 p2(number_of_segments,"number-of-segments")
847 p2(number_of_parts,"number-of-parts")
848 p2(rel_len_where_incidence_is_measured,"rel-len-where-incidence-is-measured")
851 p2(airfoil_incidence_no_lift,"airfoil-incidence-no-lift")
852 p2(rel_len_blade_start,"rel-len-blade-start")
853 p2(incidence_stall_zero_speed,"incidence-stall-zero-speed")
854 p2(incidence_stall_half_sonic_speed,"incidence-stall-half-sonic-speed")
855 p2(lift_factor_stall,"lift-factor-stall")
856 p2(stall_change_over,"stall-change-over")
857 p2(drag_factor_stall,"drag-factor-stall")
858 p2(airfoil_lift_coefficient,"airfoil-lift-coefficient")
859 p2(airfoil_drag_coefficient0,"airfoil-drag-coefficient0")
860 p2(airfoil_drag_coefficient1,"airfoil-drag-coefficient1")
861 p2(cyclic_factor,"cyclic-factor")
862 p2(rotor_correction_factor,"rotor-correction-factor")
869 void FGFDM::parsePistonEngine(XMLAttributes* a)
871 float engP = attrf(a, "eng-power") * HP2W;
872 float engS = attrf(a, "eng-rpm") * RPM2RAD;
874 PistonEngine* eng = new PistonEngine(engP, engS);
876 if(a->hasAttribute("displacement"))
877 eng->setDisplacement(attrf(a, "displacement") * CIN2CM);
879 if(a->hasAttribute("compression"))
880 eng->setCompression(attrf(a, "compression"));
882 if(a->hasAttribute("min-throttle"))
883 eng->setMinThrottle(attrf(a, "min-throttle"));
885 if(a->hasAttribute("turbo-mul")) {
886 float mul = attrf(a, "turbo-mul");
887 float mp = attrf(a, "wastegate-mp", 1e6) * INHG2PA;
888 eng->setTurboParams(mul, mp);
889 eng->setTurboLag(attrf(a, "turbo-lag", 2));
892 if(a->hasAttribute("supercharger"))
893 eng->setSupercharger(attrb(a, "supercharger"));
895 ((PropEngine*)_currObj)->setEngine(eng);
898 void FGFDM::parseTurbineEngine(XMLAttributes* a)
900 float power = attrf(a, "eng-power") * HP2W;
901 float omega = attrf(a, "eng-rpm") * RPM2RAD;
902 float alt = attrf(a, "alt") * FT2M;
903 float flatRating = attrf(a, "flat-rating") * HP2W;
904 TurbineEngine* eng = new TurbineEngine(power, omega, alt, flatRating);
906 if(a->hasAttribute("n2-low-idle"))
907 eng->setN2Range(attrf(a, "n2-low-idle"), attrf(a, "n2-high-idle"),
910 // Nasty units conversion: lbs/hr per hp -> kg/s per watt
911 if(a->hasAttribute("bsfc"))
912 eng->setFuelConsumption(attrf(a, "bsfc") * (LBS2KG/(3600*HP2W)));
914 ((PropEngine*)_currObj)->setEngine(eng);
917 void FGFDM::parsePropeller(XMLAttributes* a)
919 // Legacy Handling for the old engines syntax:
920 PistonEngine* eng = 0;
921 if(a->hasAttribute("eng-power")) {
922 SG_LOG(SG_FLIGHT,SG_ALERT, "WARNING: "
923 << "Legacy engine definition in YASim configuration file. "
925 float engP = attrf(a, "eng-power") * HP2W;
926 float engS = attrf(a, "eng-rpm") * RPM2RAD;
927 eng = new PistonEngine(engP, engS);
928 if(a->hasAttribute("displacement"))
929 eng->setDisplacement(attrf(a, "displacement") * CIN2CM);
930 if(a->hasAttribute("compression"))
931 eng->setCompression(attrf(a, "compression"));
932 if(a->hasAttribute("turbo-mul")) {
933 float mul = attrf(a, "turbo-mul");
934 float mp = attrf(a, "wastegate-mp", 1e6) * INHG2PA;
935 eng->setTurboParams(mul, mp);
939 // Now parse the actual propeller definition:
941 cg[0] = attrf(a, "x");
942 cg[1] = attrf(a, "y");
943 cg[2] = attrf(a, "z");
944 float mass = attrf(a, "mass") * LBS2KG;
945 float moment = attrf(a, "moment");
946 float radius = attrf(a, "radius");
947 float speed = attrf(a, "cruise-speed") * KTS2MPS;
948 float omega = attrf(a, "cruise-rpm") * RPM2RAD;
949 float power = attrf(a, "cruise-power") * HP2W;
950 float rho = Atmosphere::getStdDensity(attrf(a, "cruise-alt") * FT2M);
952 Propeller* prop = new Propeller(radius, speed, omega, rho, power);
953 PropEngine* thruster = new PropEngine(prop, eng, moment);
954 _airplane.addThruster(thruster, mass, cg);
956 // Set the stops (fine = minimum pitch, coarse = maximum pitch)
957 float fine_stop = attrf(a, "fine-stop", 0.25f);
958 float coarse_stop = attrf(a, "coarse-stop", 4.0f);
959 prop->setStops(fine_stop, coarse_stop);
961 if(a->hasAttribute("takeoff-power")) {
962 float power0 = attrf(a, "takeoff-power") * HP2W;
963 float omega0 = attrf(a, "takeoff-rpm") * RPM2RAD;
964 prop->setTakeoff(omega0, power0);
967 if(a->hasAttribute("max-rpm")) {
968 float max = attrf(a, "max-rpm") * RPM2RAD;
969 float min = attrf(a, "min-rpm") * RPM2RAD;
970 thruster->setVariableProp(min, max);
973 if(attrb(a, "contra"))
974 thruster->setContraPair(true);
976 if(a->hasAttribute("manual-pitch")) {
977 prop->setManualPitch();
980 thruster->setGearRatio(attrf(a, "gear-ratio", 1));
983 sprintf(buf, "/engines/engine[%d]", _nextEngine++);
984 EngRec* er = new EngRec();
986 er->prefix = dup(buf);
992 // Turns a string axis name into an integer for use by the
993 // ControlMap. Creates a new axis if this one hasn't been defined
995 int FGFDM::parseAxis(const char* name)
997 for(int i=0; i<_axes.size(); i++) {
998 AxisRec* a = (AxisRec*)_axes.get(i);
999 if(eq(a->name, name))
1003 // Not there, make a new one.
1004 AxisRec* a = new AxisRec();
1005 a->name = dup(name);
1006 fgGetNode( a->name, true ); // make sure the property name exists
1007 a->handle = _airplane.getControlMap()->newInput();
1012 int FGFDM::parseOutput(const char* name)
1014 if(eq(name, "THROTTLE")) return ControlMap::THROTTLE;
1015 if(eq(name, "MIXTURE")) return ControlMap::MIXTURE;
1016 if(eq(name, "CONDLEVER")) return ControlMap::CONDLEVER;
1017 if(eq(name, "STARTER")) return ControlMap::STARTER;
1018 if(eq(name, "MAGNETOS")) return ControlMap::MAGNETOS;
1019 if(eq(name, "ADVANCE")) return ControlMap::ADVANCE;
1020 if(eq(name, "REHEAT")) return ControlMap::REHEAT;
1021 if(eq(name, "BOOST")) return ControlMap::BOOST;
1022 if(eq(name, "VECTOR")) return ControlMap::VECTOR;
1023 if(eq(name, "PROP")) return ControlMap::PROP;
1024 if(eq(name, "BRAKE")) return ControlMap::BRAKE;
1025 if(eq(name, "STEER")) return ControlMap::STEER;
1026 if(eq(name, "EXTEND")) return ControlMap::EXTEND;
1027 if(eq(name, "HEXTEND")) return ControlMap::HEXTEND;
1028 if(eq(name, "LEXTEND")) return ControlMap::LEXTEND;
1029 if(eq(name, "LACCEL")) return ControlMap::LACCEL;
1030 if(eq(name, "INCIDENCE")) return ControlMap::INCIDENCE;
1031 if(eq(name, "FLAP0")) return ControlMap::FLAP0;
1032 if(eq(name, "FLAP0EFFECTIVENESS")) return ControlMap::FLAP0EFFECTIVENESS;
1033 if(eq(name, "FLAP1")) return ControlMap::FLAP1;
1034 if(eq(name, "FLAP1EFFECTIVENESS")) return ControlMap::FLAP1EFFECTIVENESS;
1035 if(eq(name, "SLAT")) return ControlMap::SLAT;
1036 if(eq(name, "SPOILER")) return ControlMap::SPOILER;
1037 if(eq(name, "CASTERING")) return ControlMap::CASTERING;
1038 if(eq(name, "PROPPITCH")) return ControlMap::PROPPITCH;
1039 if(eq(name, "PROPFEATHER")) return ControlMap::PROPFEATHER;
1040 if(eq(name, "COLLECTIVE")) return ControlMap::COLLECTIVE;
1041 if(eq(name, "CYCLICAIL")) return ControlMap::CYCLICAIL;
1042 if(eq(name, "CYCLICELE")) return ControlMap::CYCLICELE;
1043 if(eq(name, "TILTROLL")) return ControlMap::TILTROLL;
1044 if(eq(name, "TILTPITCH")) return ControlMap::TILTPITCH;
1045 if(eq(name, "TILTYAW")) return ControlMap::TILTYAW;
1046 if(eq(name, "ROTORGEARENGINEON")) return ControlMap::ROTORENGINEON;
1047 if(eq(name, "ROTORBRAKE")) return ControlMap::ROTORBRAKE;
1048 if(eq(name, "ROTORENGINEMAXRELTORQUE"))
1049 return ControlMap::ROTORENGINEMAXRELTORQUE;
1050 if(eq(name, "ROTORRELTARGET")) return ControlMap::ROTORRELTARGET;
1051 if(eq(name, "ROTORBALANCE")) return ControlMap::ROTORBALANCE;
1052 if(eq(name, "REVERSE_THRUST")) return ControlMap::REVERSE_THRUST;
1053 if(eq(name, "WASTEGATE")) return ControlMap::WASTEGATE;
1054 if(eq(name, "WINCHRELSPEED")) return ControlMap::WINCHRELSPEED;
1055 if(eq(name, "HITCHOPEN")) return ControlMap::HITCHOPEN;
1056 if(eq(name, "PLACEWINCH")) return ControlMap::PLACEWINCH;
1057 if(eq(name, "FINDAITOW")) return ControlMap::FINDAITOW;
1059 SG_LOG(SG_FLIGHT,SG_ALERT,"Unrecognized control type '"
1060 << name << "' in YASim aircraft description.");
1065 void FGFDM::parseWeight(XMLAttributes* a)
1067 WeightRec* wr = new WeightRec();
1070 v[0] = attrf(a, "x");
1071 v[1] = attrf(a, "y");
1072 v[2] = attrf(a, "z");
1074 wr->prop = dup(a->getValue("mass-prop"));
1075 wr->size = attrf(a, "size", 0);
1076 wr->handle = _airplane.addWeight(v, wr->size);
1081 bool FGFDM::eq(const char* a, const char* b)
1083 // Figure it out for yourself. :)
1084 while(*a && *b && *a == *b) { a++; b++; }
1088 char* FGFDM::dup(const char* s)
1092 char* s2 = new char[len+1];
1094 while((*p++ = *s++));
1099 int FGFDM::attri(XMLAttributes* atts, const char* attr)
1101 if(!atts->hasAttribute(attr)) {
1102 SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr <<
1103 "' in YASim aircraft description");
1106 return attri(atts, attr, 0);
1109 int FGFDM::attri(XMLAttributes* atts, const char* attr, int def)
1111 const char* val = atts->getValue(attr);
1112 if(val == 0) return def;
1113 else return atol(val);
1116 float FGFDM::attrf(XMLAttributes* atts, const char* attr)
1118 if(!atts->hasAttribute(attr)) {
1119 SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr <<
1120 "' in YASim aircraft description");
1123 return attrf(atts, attr, 0);
1126 float FGFDM::attrf(XMLAttributes* atts, const char* attr, float def)
1128 const char* val = atts->getValue(attr);
1129 if(val == 0) return def;
1130 else return (float)atof(val);
1133 double FGFDM::attrd(XMLAttributes* atts, const char* attr)
1135 if(!atts->hasAttribute(attr)) {
1136 SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr <<
1137 "' in YASim aircraft description");
1140 return attrd(atts, attr, 0);
1143 double FGFDM::attrd(XMLAttributes* atts, const char* attr, double def)
1145 const char* val = atts->getValue(attr);
1146 if(val == 0) return def;
1147 else return atof(val);
1150 // ACK: the dreaded ambiguous string boolean. Remind me to shoot Maik
1151 // when I have a chance. :). Unless you have a parser that can check
1152 // symbol constants (we don't), this kind of coding is just a Bad
1153 // Idea. This implementation, for example, silently returns a boolean
1154 // falsehood for values of "1", "yes", "True", and "TRUE". Which is
1155 // especially annoying preexisting boolean attributes in the same
1156 // parser want to see "1" and will choke on a "true"...
1158 // Unfortunately, this usage creeped into existing configuration files
1159 // while I wasn't active, and it's going to be hard to remove. Issue
1160 // a warning to nag people into changing their ways for now...
1161 bool FGFDM::attrb(XMLAttributes* atts, const char* attr)
1163 const char* val = atts->getValue(attr);
1164 if(val == 0) return false;
1166 if(eq(val,"true")) {
1167 SG_LOG(SG_FLIGHT, SG_ALERT, "Warning: " <<
1168 "deprecated 'true' boolean in YASim configuration file. " <<
1169 "Use numeric booleans (attribute=\"1\") instead");
1172 return attri(atts, attr, 0) ? true : false;
1175 }; // namespace yasim