#include "TurbineEngine.hpp"
#include "Rotor.hpp"
#include "Rotorpart.hpp"
-#include "Rotorblade.hpp"
#include "FGFDM.hpp"
}
for(i=0; i<_controlProps.size(); i++)
delete (PropOut*)_controlProps.get(i);
+ delete _turb;
}
void FGFDM::iterate(float dt)
v[2] = attrf(a, "z");
_airplane.setPilotPos(v);
} else if(eq(name, "rotor")) {
- _airplane.addRotor(parseRotor(a, name));
+ _airplane.getModel()->getRotorgear()->addRotor(parseRotor(a, name));
+ } else if(eq(name, "rotorgear")) {
+ Rotorgear* r = _airplane.getModel()->getRotorgear();
+ _currObj = r;
+ #define p(x) if (a->hasAttribute(#x)) r->setParameter((char *)#x,attrf(a,#x) );
+ #define p2(x,y) if (a->hasAttribute(#x)) {r->setParameter((char *)#y,attrf(a,#x) ); SG_LOG(SG_INPUT, SG_ALERT,"Warning: Aircraft defnition files uses outdated tag '" <<#x<<"', use '"<<#y<<"' instead (see README.YASim)" <<endl);}
+ p(max_power_engine)
+ p(engine_prop_factor)
+ p(yasimdragfactor)
+ p(yasimliftfactor)
+ p(max_power_rotor_brake)
+ p(rotorgear_friction)
+ p(engine_accel_limit)
+ p2(engine_accell_limit,engine_accel_limit)
+ #undef p
+ #undef p2
+ r->setInUse();
} else if(eq(name, "wing")) {
_airplane.setWing(parseWing(a, name));
} else if(eq(name, "hstab")) {
if(a->hasAttribute("epr")) j->setEPR(attrf(a, "epr"));
if(a->hasAttribute("exhaust-speed"))
j->setVMax(attrf(a, "exhaust-speed") * KTS2MPS);
+ if(a->hasAttribute("spool-time"))
+ j->setSpooling(attrf(a, "spool-time"));
j->setPosition(v);
_airplane.addThruster(j, mass, v);
l->setHoldbackMount(v);
float length = attrf(a, "length", 1.0);
l->setLength(length);
- l->setDownAngle(attrf(a, "down-angle", 30) * DEG2RAD);
- l->setUpAngle(attrf(a, "up-angle", -30) * DEG2RAD);
+ l->setDownAngle(attrf(a, "down-angle", 45) * DEG2RAD);
+ l->setUpAngle(attrf(a, "up-angle", -45) * DEG2RAD);
+ l->setHoldbackLength(attrf(a, "holdback-length", 2.0));
_airplane.addLaunchbar(l);
} else if(eq(name, "fuselage")) {
float b[3];
p->prop->setFloatValue(val);
}
- for(i=0; i<_airplane.getNumRotors(); i++) {
- Rotor*r=(Rotor*)_airplane.getRotor(i);
+ for(i=0; i<_airplane.getRotorgear()->getNumRotors(); i++) {
+ Rotor*r=(Rotor*)_airplane.getRotorgear()->getRotor(i);
int j = 0;
float f;
char b[256];
- while(j = r->getValueforFGSet(j, b, &f))
+ while((j = r->getValueforFGSet(j, b, &f)))
if(b[0]) fgSetFloat(b,f);
-
- for(j=0; j < r->numRotorparts(); j++) {
+ j=0;
+ while((j = _airplane.getRotorgear()->getValueforFGSet(j, b, &f)))
+ if(b[0]) fgSetFloat(b,f);
+ for(j=0; j < r->numRotorparts(); j+=r->numRotorparts()>>2) {
Rotorpart* s = (Rotorpart*)r->getRotorpart(j);
char *b;
int k;
if(b[0]) fgSetFloat(b, s->getAlpha(k));
}
}
- for(j=0; j < r->numRotorblades(); j++) {
- Rotorblade* s = (Rotorblade*)r->getRotorblade(j);
- char *b;
- int k;
- for (k=0; k<2; k++) {
- b = s->getAlphaoutput(k);
- if(b[0]) fgSetFloat(b, s->getAlpha(k));
- }
- }
}
float fuelDensity = _airplane.getFuelDensity(0); // HACK
node->setFloatValue("mp-inhg", pe->getMP() * (1/INHG2PA));
node->setFloatValue("egt-degf",
pe->getEGT() * K2DEGF + K2DEGFOFFSET);
+ node->setFloatValue("oil-temperature-degf",
+ pe->getOilTemp() * K2DEGF + K2DEGFOFFSET);
node->setFloatValue("boost-gauge-inhg",
pe->getBoost() * (1/INHG2PA));
} else if(p->getEngine()->isTurbineEngine()) {
node->setFloatValue("n1", j->getN1());
node->setFloatValue("n2", j->getN2());
node->setFloatValue("epr", j->getEPR());
- node->setFloatValue("egr-degf",
+ node->setFloatValue("egt-degf",
j->getEGT() * K2DEGF + K2DEGFOFFSET);
// These are "unmodeled" values that are still needed for
w->setTaper(attrf(a, "taper", 1));
w->setDihedral(attrf(a, "dihedral", defDihed) * DEG2RAD);
w->setCamber(attrf(a, "camber", 0));
- w->setIncidence(attrf(a, "incidence", 0) * DEG2RAD);
- w->setTwist(attrf(a, "twist", 0) * DEG2RAD);
+
+ // These come in with positive indicating positive AoA, but the
+ // internals expect a rotation about the left-pointing Y axis, so
+ // invert the sign.
+ w->setIncidence(attrf(a, "incidence", 0) * DEG2RAD * -1);
+ w->setTwist(attrf(a, "twist", 0) * DEG2RAD * -1);
// The 70% is a magic number that sorta kinda seems to match known
// throttle settings to approach speed.
w->setPowerAtPitchB(attrf(a, "poweratpitch_b", 3000));
if(attrb(a,"notorque"))
w->setNotorque(1);
- if(attrb(a,"simblades"))
- w->setSimBlades(1);
+#define p(x) if (a->hasAttribute(#x)) w->setParameter((char *)#x,attrf(a,#x) );
+ p(translift_ve)
+ p(translift_maxfactor)
+ p(ground_effect_constant)
+ p(vortex_state_lift_factor)
+ p(vortex_state_c1)
+ p(vortex_state_c2)
+ p(vortex_state_c3)
+ p(vortex_state_e1)
+ p(vortex_state_e2)
+ p(twist)
+ p(number_of_segments)
+ p(number_of_parts)
+ p(rel_len_where_incidence_is_measured)
+ p(chord)
+ p(taper)
+ p(airfoil_incidence_no_lift)
+ p(rel_len_blade_start)
+ p(incidence_stall_zero_speed)
+ p(incidence_stall_half_sonic_speed)
+ p(lift_factor_stall)
+ p(stall_change_over)
+ p(drag_factor_stall)
+ p(airfoil_lift_coefficient)
+ p(airfoil_drag_coefficient0)
+ p(airfoil_drag_coefficient1)
+ p(cyclic_factor)
+ p(rotor_correction_factor)
+#undef p
_currObj = w;
return w;
}
float mul = attrf(a, "turbo-mul");
float mp = attrf(a, "wastegate-mp", 1e6) * INHG2PA;
eng->setTurboParams(mul, mp);
+ eng->setTurboLag(attrf(a, "turbo-lag", 2));
}
+ if(a->hasAttribute("supercharger"))
+ eng->setSupercharger(attrb(a, "supercharger"));
+
((PropEngine*)_currObj)->setEngine(eng);
}
PropEngine* thruster = new PropEngine(prop, eng, moment);
_airplane.addThruster(thruster, mass, cg);
+ // Set the stops (fine = minimum pitch, coarse = maximum pitch)
+ float fine_stop = attrf(a, "fine-stop", 0.25f);
+ float coarse_stop = attrf(a, "coarse-stop", 4.0f);
+ prop->setStops(fine_stop, coarse_stop);
+
if(a->hasAttribute("takeoff-power")) {
float power0 = attrf(a, "takeoff-power") * HP2W;
float omega0 = attrf(a, "takeoff-rpm") * RPM2RAD;
if(eq(name, "COLLECTIVE")) return ControlMap::COLLECTIVE;
if(eq(name, "CYCLICAIL")) return ControlMap::CYCLICAIL;
if(eq(name, "CYCLICELE")) return ControlMap::CYCLICELE;
- if(eq(name, "ROTORENGINEON")) return ControlMap::ROTORENGINEON;
+ if(eq(name, "ROTORGEARENGINEON")) return ControlMap::ROTORENGINEON;
+ if(eq(name, "ROTORBRAKE")) return ControlMap::ROTORBRAKE;
if(eq(name, "REVERSE_THRUST")) return ControlMap::REVERSE_THRUST;
+ if(eq(name, "WASTEGATE")) return ControlMap::WASTEGATE;
SG_LOG(SG_FLIGHT,SG_ALERT,"Unrecognized control type '"
<< name << "' in YASim aircraft description.");
exit(1);