1 #include "Atmosphere.hpp"
2 #include "ControlMap.hpp"
6 #include "RigidBody.hpp"
8 #include "Thruster.hpp"
10 #include "Airplane.hpp"
15 inline float norm(float f) { return f<1 ? 1/f : f; }
16 inline float abs(float f) { return f<0 ? -f : f; }
21 _pilotPos[0] = _pilotPos[1] = _pilotPos[2] = 0;
44 for(i=0; i<_fuselages.size(); i++)
45 delete (Fuselage*)_fuselages.get(i);
46 for(i=0; i<_tanks.size(); i++)
47 delete (Tank*)_tanks.get(i);
48 for(i=0; i<_thrusters.size(); i++)
49 delete (ThrustRec*)_thrusters.get(i);
50 for(i=0; i<_gears.size(); i++)
51 delete (GearRec*)_gears.get(i);
52 for(i=0; i<_surfs.size(); i++)
53 delete (Surface*)_surfs.get(i);
54 for(i=0; i<_contacts.size(); i++)
55 delete[] (float*)_contacts.get(i);
58 void Airplane::iterate(float dt)
60 // The gear might have moved. Change their aerodynamics.
66 void Airplane::consumeFuel(float dt)
68 // This is a really simple implementation that assumes all engines
69 // draw equally from all tanks in proportion to the amount of fuel
70 // stored there. Needs to be fixed, but that has to wait for a
71 // decision as to what the property interface will look like.
73 float fuelFlow = 0, totalFuel = 0.00001; // <-- overflow protection
74 for(i=0; i<_thrusters.size(); i++)
75 fuelFlow += ((ThrustRec*)_thrusters.get(i))->thruster->getFuelFlow();
76 for(i=0; i<_tanks.size(); i++)
77 totalFuel += ((Tank*)_tanks.get(i))->fill;
78 for(i=0; i<_tanks.size(); i++) {
79 Tank* t = (Tank*)_tanks.get(i);
80 t->fill -= dt * fuelFlow * (t->fill/totalFuel);
87 for(int i=0; i<_thrusters.size(); i++)
88 ((ThrustRec*)_thrusters.get(i))->thruster->setFuelState(false);
90 // Set the tank masses on the RigidBody
91 for(i=0; i<_tanks.size(); i++) {
92 Tank* t = (Tank*)_tanks.get(i);
93 _model.getBody()->setMass(t->handle, t->fill);
97 ControlMap* Airplane::getControlMap()
102 Model* Airplane::getModel()
107 void Airplane::getPilotAccel(float* out)
109 State* s = _model.getState();
112 Glue::geodUp(s->pos, out);
113 Math::mul3(-9.8f, out, out);
115 // The regular acceleration
117 Math::mul3(-1, s->acc, tmp);
118 Math::add3(tmp, out, out);
120 // Convert to aircraft coordinates
121 Math::vmul33(s->orient, out, out);
123 // FIXME: rotational & centripetal acceleration needed
126 void Airplane::setPilotPos(float* pos)
129 for(i=0; i<3; i++) _pilotPos[i] = pos[i];
132 void Airplane::getPilotPos(float* out)
135 for(i=0; i<3; i++) out[i] = _pilotPos[i];
138 int Airplane::numGear()
140 return _gears.size();
143 Gear* Airplane::getGear(int g)
145 return ((GearRec*)_gears.get(g))->gear;
148 void Airplane::updateGearState()
150 for(int i=0; i<_gears.size(); i++) {
151 GearRec* gr = (GearRec*)_gears.get(i);
152 float ext = gr->gear->getExtension();
154 gr->surf->setXDrag(ext);
155 gr->surf->setYDrag(ext);
156 gr->surf->setZDrag(ext);
160 void Airplane::setApproach(float speed, float altitude)
162 // The zero AoA will become a calculated stall AoA in compile()
163 setApproach(speed, altitude, 0);
166 void Airplane::setApproach(float speed, float altitude, float aoa)
168 _approachSpeed = speed;
169 _approachP = Atmosphere::getStdPressure(altitude);
170 _approachT = Atmosphere::getStdTemperature(altitude);
174 void Airplane::setCruise(float speed, float altitude)
176 _cruiseSpeed = speed;
177 _cruiseP = Atmosphere::getStdPressure(altitude);
178 _cruiseT = Atmosphere::getStdTemperature(altitude);
183 void Airplane::setElevatorControl(int control)
185 _approachElevator.control = control;
186 _approachElevator.val = 0;
187 _approachControls.add(&_approachElevator);
190 void Airplane::addApproachControl(int control, float val)
192 Control* c = new Control();
193 c->control = control;
195 _approachControls.add(c);
198 void Airplane::addCruiseControl(int control, float val)
200 Control* c = new Control();
201 c->control = control;
203 _cruiseControls.add(c);
206 int Airplane::numTanks()
208 return _tanks.size();
211 float Airplane::getFuel(int tank)
213 return ((Tank*)_tanks.get(tank))->fill;
216 float Airplane::getFuelDensity(int tank)
218 return ((Tank*)_tanks.get(tank))->density;
221 float Airplane::getTankCapacity(int tank)
223 return ((Tank*)_tanks.get(tank))->cap;
226 void Airplane::setWeight(float weight)
228 _emptyWeight = weight;
231 void Airplane::setWing(Wing* wing)
236 void Airplane::setTail(Wing* tail)
241 void Airplane::addVStab(Wing* vstab)
246 void Airplane::addFuselage(float* front, float* back, float width,
247 float taper, float mid)
249 Fuselage* f = new Fuselage();
252 f->front[i] = front[i];
253 f->back[i] = back[i];
261 int Airplane::addTank(float* pos, float cap, float density)
263 Tank* t = new Tank();
265 for(i=0; i<3; i++) t->pos[i] = pos[i];
268 t->density = density;
269 t->handle = 0xffffffff;
270 return _tanks.add(t);
273 void Airplane::addGear(Gear* gear)
275 GearRec* g = new GearRec();
281 void Airplane::addThruster(Thruster* thruster, float mass, float* cg)
283 ThrustRec* t = new ThrustRec();
284 t->thruster = thruster;
287 for(i=0; i<3; i++) t->cg[i] = cg[i];
291 void Airplane::addBallast(float* pos, float mass)
293 _model.getBody()->addMass(mass, pos);
297 int Airplane::addWeight(float* pos, float size)
299 WeightRec* wr = new WeightRec();
300 wr->handle = _model.getBody()->addMass(0, pos);
302 wr->surf = new Surface();
303 wr->surf->setPosition(pos);
304 wr->surf->setTotalDrag(size*size);
305 _model.addSurface(wr->surf);
306 _surfs.add(wr->surf);
308 return _weights.add(wr);
311 void Airplane::setWeight(int handle, float mass)
313 WeightRec* wr = (WeightRec*)_weights.get(handle);
315 _model.getBody()->setMass(wr->handle, mass);
317 // Kill the aerodynamic drag if the mass is exactly zero. This is
318 // how we simulate droppable stores.
320 wr->surf->setXDrag(0);
321 wr->surf->setYDrag(0);
322 wr->surf->setZDrag(0);
324 wr->surf->setXDrag(1);
325 wr->surf->setYDrag(1);
326 wr->surf->setZDrag(1);
330 void Airplane::setFuelFraction(float frac)
333 for(i=0; i<_tanks.size(); i++) {
334 Tank* t = (Tank*)_tanks.get(i);
335 t->fill = frac * t->cap;
336 _model.getBody()->setMass(t->handle, t->cap * frac);
340 float Airplane::getDragCoefficient()
345 float Airplane::getLiftRatio()
350 float Airplane::getCruiseAoA()
355 float Airplane::getTailIncidence()
357 return _tailIncidence;
360 char* Airplane::getFailureMsg()
365 int Airplane::getSolutionIterations()
367 return _solutionIterations;
370 void Airplane::setupState(float aoa, float speed, State* s)
372 float cosAoA = Math::cos(aoa);
373 float sinAoA = Math::sin(aoa);
374 s->orient[0] = cosAoA; s->orient[1] = 0; s->orient[2] = sinAoA;
375 s->orient[3] = 0; s->orient[4] = 1; s->orient[5] = 0;
376 s->orient[6] = -sinAoA; s->orient[7] = 0; s->orient[8] = cosAoA;
378 s->v[0] = speed; s->v[1] = 0; s->v[2] = 0;
382 s->pos[i] = s->rot[i] = s->acc[i] = s->racc[i] = 0;
384 // Put us 1m above the origin, or else the gravity computation in
389 void Airplane::addContactPoint(float* pos)
391 float* cp = new float[3];
398 float Airplane::compileWing(Wing* w)
400 // The tip of the wing is a contact point
403 addContactPoint(tip);
404 if(w->isMirrored()) {
406 addContactPoint(tip);
409 // Make sure it's initialized. The surfaces will pop out with
410 // total drag coefficients equal to their areas, which is what we
416 for(i=0; i<w->numSurfaces(); i++) {
417 Surface* s = (Surface*)w->getSurface(i);
419 float td = s->getTotalDrag();
422 _model.addSurface(s);
424 float mass = w->getSurfaceWeight(i);
425 mass = mass * Math::sqrt(mass);
428 _model.getBody()->addMass(mass, pos);
434 float Airplane::compileFuselage(Fuselage* f)
436 // The front and back are contact points
437 addContactPoint(f->front);
438 addContactPoint(f->back);
442 Math::sub3(f->front, f->back, fwd);
443 float len = Math::mag3(fwd);
444 float wid = f->width;
445 int segs = (int)Math::ceil(len/wid);
446 float segWgt = len*wid/segs;
448 for(j=0; j<segs; j++) {
449 float frac = (j+0.5f) / segs;
453 scale = f->taper+(1-f->taper) * (frac / f->mid);
455 scale = f->taper+(1-f->taper) * (frac - f->mid) / (1 - f->mid);
459 Math::mul3(frac, fwd, pos);
460 Math::add3(f->back, pos, pos);
462 // _Mass_ weighting goes as surface area^(3/2)
463 float mass = scale*segWgt * Math::sqrt(scale*segWgt);
464 _model.getBody()->addMass(mass, pos);
467 // Make a Surface too
468 Surface* s = new Surface();
470 float sideDrag = len/wid;
471 s->setYDrag(sideDrag);
472 s->setZDrag(sideDrag);
473 s->setTotalDrag(scale*segWgt);
475 // FIXME: fails for fuselages aligned along the Y axis
477 float *x=o, *y=o+3, *z=o+6; // nicknames for the axes
479 y[0] = 0; y[1] = 1; y[2] = 0;
480 Math::cross3(x, y, z);
482 Math::cross3(z, x, y);
483 s->setOrientation(o);
485 _model.addSurface(s);
491 // FIXME: should probably add a mass for the gear, too
492 void Airplane::compileGear(GearRec* gr)
496 // Make a Surface object for the aerodynamic behavior
497 Surface* s = new Surface();
500 // Put the surface at the half-way point on the gear strut, give
501 // it a drag coefficient equal to a square of the same dimension
502 // (gear are really draggy) and make it symmetric. Assume that
503 // the "length" of the gear is 3x the compression distance
504 float pos[3], cmp[3];
505 g->getCompression(cmp);
506 float length = 3 * Math::mag3(cmp);
508 Math::mul3(0.5, cmp, cmp);
509 Math::add3(pos, cmp, pos);
512 s->setTotalDrag(length*length);
515 _model.addSurface(s);
519 void Airplane::compileContactPoints()
521 // Figure it will compress by 20cm
524 comp[0] = 0; comp[1] = 0; comp[2] = DIST;
526 // Give it a spring constant such that at full compression it will
527 // hold up 10 times the planes mass. That's about right. Yeah.
528 float mass = _model.getBody()->getTotalMass();
529 float spring = (1/DIST) * 9.8f * 10.0f * mass;
530 float damp = 2 * Math::sqrt(spring * mass);
533 for(i=0; i<_contacts.size(); i++) {
534 float *cp = (float*)_contacts.get(i);
536 Gear* g = new Gear();
539 g->setCompression(comp);
540 g->setSpring(spring);
545 g->setStaticFriction(0.6f);
546 g->setDynamicFriction(0.5f);
552 void Airplane::compile()
555 ground[0] = 0; ground[1] = 0; ground[2] = 1;
556 _model.setGroundPlane(ground, -100000);
558 RigidBody* body = _model.getBody();
559 int firstMass = body->numMasses();
561 // Generate the point masses for the plane. Just use unitless
562 // numbers for a first pass, then go back through and rescale to
563 // make the weight right.
567 aeroWgt += compileWing(_wing);
568 aeroWgt += compileWing(_tail);
570 for(i=0; i<_vstabs.size(); i++) {
571 aeroWgt += compileWing((Wing*)_vstabs.get(i));
575 for(i=0; i<_fuselages.size(); i++) {
576 aeroWgt += compileFuselage((Fuselage*)_fuselages.get(i));
579 // Count up the absolute weight we have
580 float nonAeroWgt = _ballast;
581 for(i=0; i<_thrusters.size(); i++)
582 nonAeroWgt += ((ThrustRec*)_thrusters.get(i))->mass;
584 // Rescale to the specified empty weight
585 float wscale = (_emptyWeight-nonAeroWgt)/aeroWgt;
586 for(i=firstMass; i<body->numMasses(); i++)
587 body->setMass(i, body->getMass(i)*wscale);
589 // Add the thruster masses
590 for(i=0; i<_thrusters.size(); i++) {
591 ThrustRec* t = (ThrustRec*)_thrusters.get(i);
592 body->addMass(t->mass, t->cg);
595 // Add the tanks, empty for now.
597 for(i=0; i<_tanks.size(); i++) {
598 Tank* t = (Tank*)_tanks.get(i);
599 t->handle = body->addMass(0, t->pos);
602 _cruiseWeight = _emptyWeight + totalFuel*0.5f;
603 _approachWeight = _emptyWeight + totalFuel*0.2f;
607 // Add surfaces for the landing gear.
608 for(i=0; i<_gears.size(); i++)
609 compileGear((GearRec*)_gears.get(i));
611 // The Thruster objects
612 for(i=0; i<_thrusters.size(); i++) {
613 ThrustRec* tr = (ThrustRec*)_thrusters.get(i);
614 tr->handle = _model.addThruster(tr->thruster);
619 float gespan = _wing->getGroundEffect(gepos);
620 _model.setGroundEffect(gepos, gespan, 0.15f);
625 // Do this after solveGear, because it creates "gear" objects that
626 // we don't want to affect.
627 compileContactPoints();
630 void Airplane::solveGear()
633 _model.getBody()->getCG(cg);
635 // Calculate spring constant weightings for the gear. Weight by
636 // the inverse of the distance to the c.g. in the XY plane, which
637 // should be correct for most gear arrangements. Add 50cm of
638 // "buffer" to keep things from blowing up with aircraft with a
639 // single gear very near the c.g. (AV-8, for example).
642 for(i=0; i<_gears.size(); i++) {
643 GearRec* gr = (GearRec*)_gears.get(i);
646 Math::sub3(cg, pos, pos);
647 gr->wgt = 1.0f/(0.5f+Math::sqrt(pos[0]*pos[0] + pos[1]*pos[1]));
651 // Renormalize so they sum to 1
652 for(i=0; i<_gears.size(); i++)
653 ((GearRec*)_gears.get(i))->wgt /= total;
655 // The force at max compression should be sufficient to stop a
656 // plane moving downwards at 2x the approach descent rate. Assume
657 // a 3 degree approach.
658 float descentRate = 2.0f*_approachSpeed/19.1f;
660 // Spread the kinetic energy according to the gear weights. This
661 // will results in an equal compression fraction (not distance) of
663 float energy = 0.5f*_approachWeight*descentRate*descentRate;
665 for(i=0; i<_gears.size(); i++) {
666 GearRec* gr = (GearRec*)_gears.get(i);
667 float e = energy * gr->wgt;
669 gr->gear->getCompression(comp);
670 float len = Math::mag3(comp);
672 // Energy in a spring: e = 0.5 * k * len^2
673 float k = 2 * e / (len*len);
675 gr->gear->setSpring(k * gr->gear->getSpring());
677 // Critically damped (too damped, too!)
678 gr->gear->setDamping(2*Math::sqrt(k*_approachWeight*gr->wgt)
679 * gr->gear->getDamping());
681 // These are pretty generic
682 gr->gear->setStaticFriction(0.8f);
683 gr->gear->setDynamicFriction(0.7f);
687 void Airplane::initEngines()
689 for(int i=0; i<_thrusters.size(); i++) {
690 ThrustRec* tr = (ThrustRec*)_thrusters.get(i);
691 tr->thruster->init();
695 void Airplane::stabilizeThrust()
698 for(i=0; i<_thrusters.size(); i++)
699 _model.getThruster(i)->stabilize();
702 void Airplane::runCruise()
704 setupState(_cruiseAoA, _cruiseSpeed, &_cruiseState);
705 _model.setState(&_cruiseState);
706 _model.setAir(_cruiseP, _cruiseT,
707 Atmosphere::calcStdDensity(_cruiseP, _cruiseT));
709 // The control configuration
712 for(i=0; i<_cruiseControls.size(); i++) {
713 Control* c = (Control*)_cruiseControls.get(i);
714 _controls.setInput(c->control, c->val);
716 _controls.applyControls(1000000); // Huge dt value
720 Math::mul3(-1, _cruiseState.v, wind);
721 Math::vmul33(_cruiseState.orient, wind, wind);
723 // Cruise is by convention at 50% tank capacity
724 setFuelFraction(0.5);
726 // Set up the thruster parameters and iterate until the thrust
728 for(i=0; i<_thrusters.size(); i++) {
729 Thruster* t = ((ThrustRec*)_thrusters.get(i))->thruster;
731 t->setAir(_cruiseP, _cruiseT,
732 Atmosphere::calcStdDensity(_cruiseP, _cruiseT));
738 // Precompute thrust in the model, and calculate aerodynamic forces
739 _model.getBody()->recalc();
740 _model.getBody()->reset();
741 _model.initIteration();
742 _model.calcForces(&_cruiseState);
745 void Airplane::runApproach()
747 setupState(_approachAoA, _approachSpeed, &_approachState);
748 _model.setState(&_approachState);
749 _model.setAir(_approachP, _approachT,
750 Atmosphere::calcStdDensity(_approachP, _approachT));
752 // The control configuration
755 for(i=0; i<_approachControls.size(); i++) {
756 Control* c = (Control*)_approachControls.get(i);
757 _controls.setInput(c->control, c->val);
759 _controls.applyControls(1000000);
763 Math::mul3(-1, _approachState.v, wind);
764 Math::vmul33(_approachState.orient, wind, wind);
766 // Approach is by convention at 20% tank capacity
767 setFuelFraction(0.2f);
769 // Run the thrusters until they get to a stable setting. FIXME:
770 // this is lots of wasted work.
771 for(i=0; i<_thrusters.size(); i++) {
772 Thruster* t = ((ThrustRec*)_thrusters.get(i))->thruster;
774 t->setAir(_approachP, _approachT,
775 Atmosphere::calcStdDensity(_approachP, _approachT));
781 // Precompute thrust in the model, and calculate aerodynamic forces
782 _model.getBody()->recalc();
783 _model.getBody()->reset();
784 _model.initIteration();
785 _model.calcForces(&_approachState);
788 void Airplane::applyDragFactor(float factor)
790 float applied = Math::sqrt(factor);
791 _dragFactor *= applied;
792 _wing->setDragScale(_wing->getDragScale() * applied);
793 _tail->setDragScale(_tail->getDragScale() * applied);
795 for(i=0; i<_vstabs.size(); i++) {
796 Wing* w = (Wing*)_vstabs.get(i);
797 w->setDragScale(w->getDragScale() * applied);
799 for(i=0; i<_surfs.size(); i++) {
800 Surface* s = (Surface*)_surfs.get(i);
801 s->setTotalDrag(s->getTotalDrag() * applied);
805 void Airplane::applyLiftRatio(float factor)
807 float applied = Math::sqrt(factor);
808 _liftRatio *= applied;
809 _wing->setLiftRatio(_wing->getLiftRatio() * applied);
810 _tail->setLiftRatio(_tail->getLiftRatio() * applied);
812 for(i=0; i<_vstabs.size(); i++) {
813 Wing* w = (Wing*)_vstabs.get(i);
814 w->setLiftRatio(w->getLiftRatio() * applied);
818 float Airplane::clamp(float val, float min, float max)
820 if(val < min) return min;
821 if(val > max) return max;
825 float Airplane::normFactor(float f)
832 void Airplane::solve()
834 static const float ARCMIN = 0.0002909f;
837 _solutionIterations = 0;
841 printf("%d %f %f %f %f %f\n", //DEBUG
847 _approachElevator.val);
850 if(_solutionIterations++ > 10000) {
851 _failureMsg = "Solution failed to converge after 10000 iterations";
855 // Run an iteration at cruise, and extract the needed numbers:
858 _model.getThrust(tmp);
859 float thrust = tmp[0];
861 _model.getBody()->getAccel(tmp);
862 Math::tmul33(_cruiseState.orient, tmp, tmp);
863 float xforce = _cruiseWeight * tmp[0];
864 float clift0 = _cruiseWeight * tmp[2];
866 _model.getBody()->getAngularAccel(tmp);
867 Math::tmul33(_cruiseState.orient, tmp, tmp);
868 float pitch0 = tmp[1];
870 // Run an approach iteration, and do likewise
873 _model.getBody()->getAngularAccel(tmp);
874 Math::tmul33(_approachState.orient, tmp, tmp);
875 double apitch0 = tmp[1];
877 _model.getBody()->getAccel(tmp);
878 Math::tmul33(_approachState.orient, tmp, tmp);
879 float alift = _approachWeight * tmp[2];
881 // Modify the cruise AoA a bit to get a derivative
882 _cruiseAoA += ARCMIN;
884 _cruiseAoA -= ARCMIN;
886 _model.getBody()->getAccel(tmp);
887 Math::tmul33(_cruiseState.orient, tmp, tmp);
888 float clift1 = _cruiseWeight * tmp[2];
890 // Do the same with the tail incidence
891 _tail->setIncidence(_tailIncidence + ARCMIN);
893 _tail->setIncidence(_tailIncidence);
895 _model.getBody()->getAngularAccel(tmp);
896 Math::tmul33(_cruiseState.orient, tmp, tmp);
897 float pitch1 = tmp[1];
900 float awgt = 9.8f * _approachWeight;
902 float dragFactor = thrust / (thrust-xforce);
903 float liftFactor = awgt / (awgt+alift);
904 float aoaDelta = -clift0 * (ARCMIN/(clift1-clift0));
905 float tailDelta = -pitch0 * (ARCMIN/(pitch1-pitch0));
908 if(dragFactor <= 0 || liftFactor <= 0)
911 // And the elevator control in the approach. This works just
912 // like the tail incidence computation (it's solving for the
913 // same thing -- pitching moment -- by diddling a different
915 const float ELEVDIDDLE = 0.001f;
916 _approachElevator.val += ELEVDIDDLE;
918 _approachElevator.val -= ELEVDIDDLE;
920 _model.getBody()->getAngularAccel(tmp);
921 Math::tmul33(_approachState.orient, tmp, tmp);
922 double apitch1 = tmp[1];
923 float elevDelta = -apitch0 * (ELEVDIDDLE/(apitch1-apitch0));
925 // Now apply the values we just computed. Note that the
926 // "minor" variables are deferred until we get the lift/drag
927 // numbers in the right ballpark.
929 applyDragFactor(dragFactor);
930 applyLiftRatio(liftFactor);
932 // Solver threshold. How close to the solution are we trying
933 // to get? Trying too hard can result in oscillations about
934 // the correct solution, which is bad. Stick this in as a
935 // compile time constant for now, and consider making it
936 // settable per-model.
939 // DON'T do the following until the above are sane
940 if(normFactor(dragFactor) > STHRESH*1.0001
941 || normFactor(liftFactor) > STHRESH*1.0001)
946 // OK, now we can adjust the minor variables:
947 _cruiseAoA += 0.5f*aoaDelta;
948 _tailIncidence += 0.5f*tailDelta;
950 _cruiseAoA = clamp(_cruiseAoA, -0.175f, 0.175f);
951 _tailIncidence = clamp(_tailIncidence, -0.175f, 0.175f);
953 if(abs(xforce/_cruiseWeight) < STHRESH*0.0001 &&
954 abs(alift/_approachWeight) < STHRESH*0.0001 &&
955 abs(aoaDelta) < STHRESH*.000017 &&
956 abs(tailDelta) < STHRESH*.000017)
958 // If this finaly value is OK, then we're all done
959 if(abs(elevDelta) < STHRESH*0.0001)
962 // Otherwise, adjust and do the next iteration
963 _approachElevator.val += 0.8 * elevDelta;
964 if(abs(_approachElevator.val) > 1) {
965 _failureMsg = "Insufficient elevator to trim for approach";
971 if(_dragFactor < 1e-06 || _dragFactor > 1e6) {
972 _failureMsg = "Drag factor beyond reasonable bounds.";
974 } else if(_liftRatio < 1e-04 || _liftRatio > 1e4) {
975 _failureMsg = "Lift ratio beyond reasonable bounds.";
977 } else if(Math::abs(_cruiseAoA) >= .17453293) {
978 _failureMsg = "Cruise AoA > 10 degrees";
980 } else if(Math::abs(_tailIncidence) >= .17453293) {
981 _failureMsg = "Tail incidence > 10 degrees";
985 }; // namespace yasim