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);
91 ControlMap* Airplane::getControlMap()
96 Model* Airplane::getModel()
101 void Airplane::getPilotAccel(float* out)
103 State* s = _model.getState();
106 Glue::geodUp(s->pos, out);
107 Math::mul3(-9.8f, out, out);
109 // The regular acceleration
111 Math::mul3(-1, s->acc, tmp);
112 Math::add3(tmp, out, out);
114 // Convert to aircraft coordinates
115 Math::vmul33(s->orient, out, out);
117 // FIXME: rotational & centripetal acceleration needed
120 void Airplane::setPilotPos(float* pos)
123 for(i=0; i<3; i++) _pilotPos[i] = pos[i];
126 void Airplane::getPilotPos(float* out)
129 for(i=0; i<3; i++) out[i] = _pilotPos[i];
132 int Airplane::numGear()
134 return _gears.size();
137 Gear* Airplane::getGear(int g)
139 return ((GearRec*)_gears.get(g))->gear;
142 void Airplane::updateGearState()
144 for(int i=0; i<_gears.size(); i++) {
145 GearRec* gr = (GearRec*)_gears.get(i);
146 float ext = gr->gear->getExtension();
148 gr->surf->setXDrag(ext);
149 gr->surf->setYDrag(ext);
150 gr->surf->setZDrag(ext);
154 void Airplane::setApproach(float speed, float altitude)
156 // The zero AoA will become a calculated stall AoA in compile()
157 setApproach(speed, altitude, 0);
160 void Airplane::setApproach(float speed, float altitude, float aoa)
162 _approachSpeed = speed;
163 _approachP = Atmosphere::getStdPressure(altitude);
164 _approachT = Atmosphere::getStdTemperature(altitude);
168 void Airplane::setCruise(float speed, float altitude)
170 _cruiseSpeed = speed;
171 _cruiseP = Atmosphere::getStdPressure(altitude);
172 _cruiseT = Atmosphere::getStdTemperature(altitude);
177 void Airplane::setElevatorControl(int control)
179 _approachElevator.control = control;
180 _approachElevator.val = 0;
181 _approachControls.add(&_approachElevator);
184 void Airplane::addApproachControl(int control, float val)
186 Control* c = new Control();
187 c->control = control;
189 _approachControls.add(c);
192 void Airplane::addCruiseControl(int control, float val)
194 Control* c = new Control();
195 c->control = control;
197 _cruiseControls.add(c);
200 int Airplane::numTanks()
202 return _tanks.size();
205 float Airplane::getFuel(int tank)
207 return ((Tank*)_tanks.get(tank))->fill;
210 float Airplane::getFuelDensity(int tank)
212 return ((Tank*)_tanks.get(tank))->density;
215 float Airplane::getTankCapacity(int tank)
217 return ((Tank*)_tanks.get(tank))->cap;
220 void Airplane::setWeight(float weight)
222 _emptyWeight = weight;
225 void Airplane::setWing(Wing* wing)
230 void Airplane::setTail(Wing* tail)
235 void Airplane::addVStab(Wing* vstab)
240 void Airplane::addFuselage(float* front, float* back, float width,
241 float taper, float mid)
243 Fuselage* f = new Fuselage();
246 f->front[i] = front[i];
247 f->back[i] = back[i];
255 int Airplane::addTank(float* pos, float cap, float density)
257 Tank* t = new Tank();
259 for(i=0; i<3; i++) t->pos[i] = pos[i];
262 t->density = density;
263 t->handle = 0xffffffff;
264 return _tanks.add(t);
267 void Airplane::addGear(Gear* gear)
269 GearRec* g = new GearRec();
275 void Airplane::addThruster(Thruster* thruster, float mass, float* cg)
277 ThrustRec* t = new ThrustRec();
278 t->thruster = thruster;
281 for(i=0; i<3; i++) t->cg[i] = cg[i];
285 void Airplane::addBallast(float* pos, float mass)
287 _model.getBody()->addMass(mass, pos);
291 int Airplane::addWeight(float* pos, float size)
293 WeightRec* wr = new WeightRec();
294 wr->handle = _model.getBody()->addMass(0, pos);
296 wr->surf = new Surface();
297 wr->surf->setPosition(pos);
298 wr->surf->setTotalDrag(size*size);
299 _model.addSurface(wr->surf);
300 _surfs.add(wr->surf);
302 return _weights.add(wr);
305 void Airplane::setWeight(int handle, float mass)
307 WeightRec* wr = (WeightRec*)_weights.get(handle);
309 _model.getBody()->setMass(wr->handle, mass);
311 // Kill the aerodynamic drag if the mass is exactly zero. This is
312 // how we simulate droppable stores.
314 wr->surf->setXDrag(0);
315 wr->surf->setYDrag(0);
316 wr->surf->setZDrag(0);
318 wr->surf->setXDrag(1);
319 wr->surf->setYDrag(1);
320 wr->surf->setZDrag(1);
324 void Airplane::setFuelFraction(float frac)
327 for(i=0; i<_tanks.size(); i++) {
328 Tank* t = (Tank*)_tanks.get(i);
329 t->fill = frac * t->cap;
330 _model.getBody()->setMass(t->handle, t->cap * frac);
334 float Airplane::getDragCoefficient()
339 float Airplane::getLiftRatio()
344 float Airplane::getCruiseAoA()
349 float Airplane::getTailIncidence()
351 return _tailIncidence;
354 char* Airplane::getFailureMsg()
359 int Airplane::getSolutionIterations()
361 return _solutionIterations;
364 void Airplane::setupState(float aoa, float speed, State* s)
366 float cosAoA = Math::cos(aoa);
367 float sinAoA = Math::sin(aoa);
368 s->orient[0] = cosAoA; s->orient[1] = 0; s->orient[2] = sinAoA;
369 s->orient[3] = 0; s->orient[4] = 1; s->orient[5] = 0;
370 s->orient[6] = -sinAoA; s->orient[7] = 0; s->orient[8] = cosAoA;
372 s->v[0] = speed; s->v[1] = 0; s->v[2] = 0;
376 s->pos[i] = s->rot[i] = s->acc[i] = s->racc[i] = 0;
378 // Put us 1m above the origin, or else the gravity computation in
383 void Airplane::addContactPoint(float* pos)
385 float* cp = new float[3];
392 float Airplane::compileWing(Wing* w)
394 // The tip of the wing is a contact point
397 addContactPoint(tip);
398 if(w->isMirrored()) {
400 addContactPoint(tip);
403 // Make sure it's initialized. The surfaces will pop out with
404 // total drag coefficients equal to their areas, which is what we
410 for(i=0; i<w->numSurfaces(); i++) {
411 Surface* s = (Surface*)w->getSurface(i);
413 float td = s->getTotalDrag();
416 _model.addSurface(s);
418 float mass = w->getSurfaceWeight(i);
419 mass = mass * Math::sqrt(mass);
422 _model.getBody()->addMass(mass, pos);
428 float Airplane::compileFuselage(Fuselage* f)
430 // The front and back are contact points
431 addContactPoint(f->front);
432 addContactPoint(f->back);
436 Math::sub3(f->front, f->back, fwd);
437 float len = Math::mag3(fwd);
438 float wid = f->width;
439 int segs = (int)Math::ceil(len/wid);
440 float segWgt = len*wid/segs;
442 for(j=0; j<segs; j++) {
443 float frac = (j+0.5f) / segs;
447 scale = f->taper+(1-f->taper) * (frac / f->mid);
449 scale = f->taper+(1-f->taper) * (frac - f->mid) / (1 - f->mid);
453 Math::mul3(frac, fwd, pos);
454 Math::add3(f->back, pos, pos);
456 // _Mass_ weighting goes as surface area^(3/2)
457 float mass = scale*segWgt * Math::sqrt(scale*segWgt);
458 _model.getBody()->addMass(mass, pos);
461 // Make a Surface too
462 Surface* s = new Surface();
464 float sideDrag = len/wid;
465 s->setYDrag(sideDrag);
466 s->setZDrag(sideDrag);
467 s->setTotalDrag(scale*segWgt);
469 // FIXME: fails for fuselages aligned along the Y axis
471 float *x=o, *y=o+3, *z=o+6; // nicknames for the axes
473 y[0] = 0; y[1] = 1; y[2] = 0;
474 Math::cross3(x, y, z);
476 Math::cross3(z, x, y);
477 s->setOrientation(o);
479 _model.addSurface(s);
485 // FIXME: should probably add a mass for the gear, too
486 void Airplane::compileGear(GearRec* gr)
490 // Make a Surface object for the aerodynamic behavior
491 Surface* s = new Surface();
494 // Put the surface at the half-way point on the gear strut, give
495 // it a drag coefficient equal to a square of the same dimension
496 // (gear are really draggy) and make it symmetric. Assume that
497 // the "length" of the gear is 3x the compression distance
498 float pos[3], cmp[3];
499 g->getCompression(cmp);
500 float length = 3 * Math::mag3(cmp);
502 Math::mul3(0.5, cmp, cmp);
503 Math::add3(pos, cmp, pos);
506 s->setTotalDrag(length*length);
509 _model.addSurface(s);
513 void Airplane::compileContactPoints()
515 // Figure it will compress by 20cm
518 comp[0] = 0; comp[1] = 0; comp[2] = DIST;
520 // Give it a spring constant such that at full compression it will
521 // hold up 10 times the planes mass. That's about right. Yeah.
522 float mass = _model.getBody()->getTotalMass();
523 float spring = (1/DIST) * 9.8f * 10.0f * mass;
524 float damp = 2 * Math::sqrt(spring * mass);
527 for(i=0; i<_contacts.size(); i++) {
528 float *cp = (float*)_contacts.get(i);
530 Gear* g = new Gear();
533 g->setCompression(comp);
534 g->setSpring(spring);
539 g->setStaticFriction(0.6f);
540 g->setDynamicFriction(0.5f);
546 void Airplane::compile()
549 ground[0] = 0; ground[1] = 0; ground[2] = 1;
550 _model.setGroundPlane(ground, -100000);
552 RigidBody* body = _model.getBody();
553 int firstMass = body->numMasses();
555 // Generate the point masses for the plane. Just use unitless
556 // numbers for a first pass, then go back through and rescale to
557 // make the weight right.
561 aeroWgt += compileWing(_wing);
562 aeroWgt += compileWing(_tail);
564 for(i=0; i<_vstabs.size(); i++) {
565 aeroWgt += compileWing((Wing*)_vstabs.get(i));
569 for(i=0; i<_fuselages.size(); i++) {
570 aeroWgt += compileFuselage((Fuselage*)_fuselages.get(i));
573 // Count up the absolute weight we have
574 float nonAeroWgt = _ballast;
575 for(i=0; i<_thrusters.size(); i++)
576 nonAeroWgt += ((ThrustRec*)_thrusters.get(i))->mass;
578 // Rescale to the specified empty weight
579 float wscale = (_emptyWeight-nonAeroWgt)/aeroWgt;
580 for(i=firstMass; i<body->numMasses(); i++)
581 body->setMass(i, body->getMass(i)*wscale);
583 // Add the thruster masses
584 for(i=0; i<_thrusters.size(); i++) {
585 ThrustRec* t = (ThrustRec*)_thrusters.get(i);
586 body->addMass(t->mass, t->cg);
589 // Add the tanks, empty for now.
591 for(i=0; i<_tanks.size(); i++) {
592 Tank* t = (Tank*)_tanks.get(i);
593 t->handle = body->addMass(0, t->pos);
596 _cruiseWeight = _emptyWeight + totalFuel*0.5f;
597 _approachWeight = _emptyWeight + totalFuel*0.2f;
601 // Add surfaces for the landing gear.
602 for(i=0; i<_gears.size(); i++)
603 compileGear((GearRec*)_gears.get(i));
605 // The Thruster objects
606 for(i=0; i<_thrusters.size(); i++) {
607 ThrustRec* tr = (ThrustRec*)_thrusters.get(i);
608 tr->handle = _model.addThruster(tr->thruster);
613 float gespan = _wing->getGroundEffect(gepos);
614 _model.setGroundEffect(gepos, gespan, 0.15f);
619 // Do this after solveGear, because it creates "gear" objects that
620 // we don't want to affect.
621 compileContactPoints();
624 void Airplane::solveGear()
627 _model.getBody()->getCG(cg);
629 // Calculate spring constant weightings for the gear. Weight by
630 // the inverse of the distance to the c.g. in the XY plane, which
631 // should be correct for most gear arrangements. Add 50cm of
632 // "buffer" to keep things from blowing up with aircraft with a
633 // single gear very near the c.g. (AV-8, for example).
636 for(i=0; i<_gears.size(); i++) {
637 GearRec* gr = (GearRec*)_gears.get(i);
640 Math::sub3(cg, pos, pos);
641 gr->wgt = 1.0f/(0.5f+Math::sqrt(pos[0]*pos[0] + pos[1]*pos[1]));
645 // Renormalize so they sum to 1
646 for(i=0; i<_gears.size(); i++)
647 ((GearRec*)_gears.get(i))->wgt /= total;
649 // The force at max compression should be sufficient to stop a
650 // plane moving downwards at 2x the approach descent rate. Assume
651 // a 3 degree approach.
652 float descentRate = 2.0f*_approachSpeed/19.1f;
654 // Spread the kinetic energy according to the gear weights. This
655 // will results in an equal compression fraction (not distance) of
657 float energy = 0.5f*_approachWeight*descentRate*descentRate;
659 for(i=0; i<_gears.size(); i++) {
660 GearRec* gr = (GearRec*)_gears.get(i);
661 float e = energy * gr->wgt;
663 gr->gear->getCompression(comp);
664 float len = Math::mag3(comp);
666 // Energy in a spring: e = 0.5 * k * len^2
667 float k = 2 * e / (len*len);
669 gr->gear->setSpring(k * gr->gear->getSpring());
671 // Critically damped (too damped, too!)
672 gr->gear->setDamping(2*Math::sqrt(k*_approachWeight*gr->wgt)
673 * gr->gear->getDamping());
675 // These are pretty generic
676 gr->gear->setStaticFriction(0.8f);
677 gr->gear->setDynamicFriction(0.7f);
681 void Airplane::initEngines()
683 for(int i=0; i<_thrusters.size(); i++) {
684 ThrustRec* tr = (ThrustRec*)_thrusters.get(i);
685 tr->thruster->init();
689 void Airplane::stabilizeThrust()
692 for(i=0; i<_thrusters.size(); i++)
693 _model.getThruster(i)->stabilize();
696 void Airplane::runCruise()
698 setupState(_cruiseAoA, _cruiseSpeed, &_cruiseState);
699 _model.setState(&_cruiseState);
700 _model.setAir(_cruiseP, _cruiseT,
701 Atmosphere::calcStdDensity(_cruiseP, _cruiseT));
703 // The control configuration
706 for(i=0; i<_cruiseControls.size(); i++) {
707 Control* c = (Control*)_cruiseControls.get(i);
708 _controls.setInput(c->control, c->val);
710 _controls.applyControls(1000000); // Huge dt value
714 Math::mul3(-1, _cruiseState.v, wind);
715 Math::vmul33(_cruiseState.orient, wind, wind);
717 // Cruise is by convention at 50% tank capacity
718 setFuelFraction(0.5);
720 // Set up the thruster parameters and iterate until the thrust
722 for(i=0; i<_thrusters.size(); i++) {
723 Thruster* t = ((ThrustRec*)_thrusters.get(i))->thruster;
725 t->setAir(_cruiseP, _cruiseT,
726 Atmosphere::calcStdDensity(_cruiseP, _cruiseT));
732 // Precompute thrust in the model, and calculate aerodynamic forces
733 _model.getBody()->recalc();
734 _model.getBody()->reset();
735 _model.initIteration();
736 _model.calcForces(&_cruiseState);
739 void Airplane::runApproach()
741 setupState(_approachAoA, _approachSpeed, &_approachState);
742 _model.setState(&_approachState);
743 _model.setAir(_approachP, _approachT,
744 Atmosphere::calcStdDensity(_approachP, _approachT));
746 // The control configuration
749 for(i=0; i<_approachControls.size(); i++) {
750 Control* c = (Control*)_approachControls.get(i);
751 _controls.setInput(c->control, c->val);
753 _controls.applyControls(1000000);
757 Math::mul3(-1, _approachState.v, wind);
758 Math::vmul33(_approachState.orient, wind, wind);
760 // Approach is by convention at 20% tank capacity
761 setFuelFraction(0.2f);
763 // Run the thrusters until they get to a stable setting. FIXME:
764 // this is lots of wasted work.
765 for(i=0; i<_thrusters.size(); i++) {
766 Thruster* t = ((ThrustRec*)_thrusters.get(i))->thruster;
768 t->setAir(_approachP, _approachT,
769 Atmosphere::calcStdDensity(_approachP, _approachT));
775 // Precompute thrust in the model, and calculate aerodynamic forces
776 _model.getBody()->recalc();
777 _model.getBody()->reset();
778 _model.initIteration();
779 _model.calcForces(&_approachState);
782 void Airplane::applyDragFactor(float factor)
784 float applied = Math::sqrt(factor);
785 _dragFactor *= applied;
786 _wing->setDragScale(_wing->getDragScale() * applied);
787 _tail->setDragScale(_tail->getDragScale() * applied);
789 for(i=0; i<_vstabs.size(); i++) {
790 Wing* w = (Wing*)_vstabs.get(i);
791 w->setDragScale(w->getDragScale() * applied);
793 for(i=0; i<_surfs.size(); i++) {
794 Surface* s = (Surface*)_surfs.get(i);
795 s->setTotalDrag(s->getTotalDrag() * applied);
799 void Airplane::applyLiftRatio(float factor)
801 float applied = Math::sqrt(factor);
802 _liftRatio *= applied;
803 _wing->setLiftRatio(_wing->getLiftRatio() * applied);
804 _tail->setLiftRatio(_tail->getLiftRatio() * applied);
806 for(i=0; i<_vstabs.size(); i++) {
807 Wing* w = (Wing*)_vstabs.get(i);
808 w->setLiftRatio(w->getLiftRatio() * applied);
812 float Airplane::clamp(float val, float min, float max)
814 if(val < min) return min;
815 if(val > max) return max;
819 float Airplane::normFactor(float f)
826 void Airplane::solve()
828 static const float ARCMIN = 0.0002909f;
831 _solutionIterations = 0;
835 printf("%d %f %f %f %f %f\n", //DEBUG
841 _approachElevator.val);
844 if(_solutionIterations++ > 10000) {
845 _failureMsg = "Solution failed to converge after 10000 iterations";
849 // Run an iteration at cruise, and extract the needed numbers:
852 _model.getThrust(tmp);
853 float thrust = tmp[0];
855 _model.getBody()->getAccel(tmp);
856 Math::tmul33(_cruiseState.orient, tmp, tmp);
857 float xforce = _cruiseWeight * tmp[0];
858 float clift0 = _cruiseWeight * tmp[2];
860 _model.getBody()->getAngularAccel(tmp);
861 Math::tmul33(_cruiseState.orient, tmp, tmp);
862 float pitch0 = tmp[1];
864 // Run an approach iteration, and do likewise
867 _model.getBody()->getAngularAccel(tmp);
868 Math::tmul33(_approachState.orient, tmp, tmp);
869 double apitch0 = tmp[1];
871 _model.getBody()->getAccel(tmp);
872 Math::tmul33(_approachState.orient, tmp, tmp);
873 float alift = _approachWeight * tmp[2];
875 // Modify the cruise AoA a bit to get a derivative
876 _cruiseAoA += ARCMIN;
878 _cruiseAoA -= ARCMIN;
880 _model.getBody()->getAccel(tmp);
881 Math::tmul33(_cruiseState.orient, tmp, tmp);
882 float clift1 = _cruiseWeight * tmp[2];
884 // Do the same with the tail incidence
885 _tail->setIncidence(_tailIncidence + ARCMIN);
887 _tail->setIncidence(_tailIncidence);
889 _model.getBody()->getAngularAccel(tmp);
890 Math::tmul33(_cruiseState.orient, tmp, tmp);
891 float pitch1 = tmp[1];
894 float awgt = 9.8f * _approachWeight;
896 float dragFactor = thrust / (thrust-xforce);
897 float liftFactor = awgt / (awgt+alift);
898 float aoaDelta = -clift0 * (ARCMIN/(clift1-clift0));
899 float tailDelta = -pitch0 * (ARCMIN/(pitch1-pitch0));
902 if(dragFactor <= 0 || liftFactor <= 0)
905 // And the elevator control in the approach. This works just
906 // like the tail incidence computation (it's solving for the
907 // same thing -- pitching moment -- by diddling a different
909 const float ELEVDIDDLE = 0.001f;
910 _approachElevator.val += ELEVDIDDLE;
912 _approachElevator.val -= ELEVDIDDLE;
914 _model.getBody()->getAngularAccel(tmp);
915 Math::tmul33(_approachState.orient, tmp, tmp);
916 double apitch1 = tmp[1];
917 float elevDelta = -apitch0 * (ELEVDIDDLE/(apitch1-apitch0));
919 // Now apply the values we just computed. Note that the
920 // "minor" variables are deferred until we get the lift/drag
921 // numbers in the right ballpark.
923 applyDragFactor(dragFactor);
924 applyLiftRatio(liftFactor);
926 // DON'T do the following until the above are sane
927 if(normFactor(dragFactor) > 1.0001
928 || normFactor(liftFactor) > 1.0001)
933 // OK, now we can adjust the minor variables:
934 _cruiseAoA += 0.5f*aoaDelta;
935 _tailIncidence += 0.5f*tailDelta;
937 _cruiseAoA = clamp(_cruiseAoA, -0.175f, 0.175f);
938 _tailIncidence = clamp(_tailIncidence, -0.175f, 0.175f);
940 if(abs(xforce/_cruiseWeight) < 0.0001 &&
941 abs(alift/_approachWeight) < 0.0001 &&
942 abs(aoaDelta) < .000017 &&
943 abs(tailDelta) < .000017)
945 // If this finaly value is OK, then we're all done
946 if(abs(elevDelta) < 0.0001)
949 // Otherwise, adjust and do the next iteration
950 _approachElevator.val += 0.8 * elevDelta;
951 if(abs(_approachElevator.val) > 1) {
952 _failureMsg = "Insufficient elevator to trim for approach";
958 if(_dragFactor < 1e-06 || _dragFactor > 1e6) {
959 _failureMsg = "Drag factor beyond reasonable bounds.";
961 } else if(_liftRatio < 1e-04 || _liftRatio > 1e4) {
962 _failureMsg = "Lift ratio beyond reasonable bounds.";
964 } else if(Math::abs(_cruiseAoA) >= .17453293) {
965 _failureMsg = "Cruise AoA > 10 degrees";
967 } else if(Math::abs(_tailIncidence) >= .17453293) {
968 _failureMsg = "Tail incidence > 10 degrees";
972 }; // namespace yasim