35int main(
int argc,
char** argv)
41 readXML(SGPath::fromLocal8Bit(argv[1]), fdm);
42 }
catch (
const sg_exception &e) {
43 printf(
"XML parse error: %s (%s)\n",
44 e.getFormattedMessage().c_str(), e.getOrigin());
47 Airplane* airplane = fdm.getAirplane();
48 PropEngine* pe = airplane->getThruster(0)->getPropEngine();
49 Propeller* prop = pe->getPropeller();
50 Engine* eng = pe->getEngine();
54 pe->setFuelState(
true);
57 float alt = (argc > 2 ?
atof(argv[2]) : 0) * FT2M;
58 pe->setStandardAtmosphere(alt);
60 float speed = (argc > 3 ?
atof(argv[3]) : 0) * KTS2MPS;
62 wind[0] = -speed; wind[1] = wind[2] = 0;
65 printf(
"Alt: %f\n", alt / FT2M);
66 printf(
"Spd: %f\n", speed / KTS2MPS);
67 printf(
"-----------------\n");
68 printf(
"Throt RPM thrustlbs HP eff %% torque\n");
74 float rpm = pe->getOmega() * (1/RPM2RAD);
78 float thrust = Math::mag3(tmp);
80 float power = pe->getOmega() * eng->getTorque();
82 float eff = thrust * speed / power;
84 printf(
"%5.3f %7.1f %8.1f %8.1f %7.1f %8.1f\n",
85 throttle, rpm, thrust * N2LB, power * (1/
HP2W), 100*eff, eng->getTorque());
89 printf(
"Propeller vs. RPM\n");
90 printf(
"-----------------\n");
91 printf(
"RPM thrustlbs HP eff %% torque\n");
93 float thrust, torque, rpm = 3000 *
i/(
COUNT-1.0);
94 float omega = rpm * RPM2RAD;
95 prop->calc(Atmosphere::getStdDensity(alt),
96 speed, omega, &thrust, &torque);
97 float power = torque * omega;
98 float eff = (thrust * speed) / power;
99 printf(
"%7.1f %11.1f %10.1f %7.1f %11.1f\n",
100 rpm, thrust * N2LB, power * (1/
HP2W), 100*eff, torque);