namespace JSBSim {
-static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.30 2010/05/02 15:10:07 jberndt Exp $";
+static const char *IdSrc = "$Id: FGPropeller.cpp,v 1.33 2011/03/10 01:35:25 dpculp Exp $";
static const char *IdHdr = ID_PROPELLER;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for (int i=0; i<2; i++) {
table_element = prop_element->FindNextElement("table");
name = table_element->GetAttributeValue("name");
- if (name == "C_THRUST") {
- cThrust = new FGTable(PropertyManager, table_element);
- } else if (name == "C_POWER") {
- cPower = new FGTable(PropertyManager, table_element);
- } else if (name == "CT_MACH") {
- CtMach = new FGTable(PropertyManager, table_element);
- } else if (name == "CP_MACH") {
- CpMach = new FGTable(PropertyManager, table_element);
- } else {
- cerr << "Unknown table type: " << name << " in propeller definition." << endl;
+ try {
+ if (name == "C_THRUST") {
+ cThrust = new FGTable(PropertyManager, table_element);
+ } else if (name == "C_POWER") {
+ cPower = new FGTable(PropertyManager, table_element);
+ } else if (name == "CT_MACH") {
+ CtMach = new FGTable(PropertyManager, table_element);
+ } else if (name == "CP_MACH") {
+ CpMach = new FGTable(PropertyManager, table_element);
+ } else {
+ cerr << "Unknown table type: " << name << " in propeller definition." << endl;
+ }
+ } catch (std::string str) {
+ throw("Error loading propeller table:" + name + ". " + str);
}
}
// We must be getting the aerodynamic velocity here, NOT the inertial velocity.
// We need the velocity with respect to the wind.
//
-// Note that PowerAvailable is the excess power available after the drag of the
-// propeller has been subtracted. At equilibrium, PowerAvailable will be zero -
-// indicating that the propeller will not accelerate or decelerate.
// Remembering that Torque * omega = Power, we can derive the torque on the
// propeller and its acceleration to give a new RPM. The current RPM will be
// used to calculate thrust.
//
// Because RPM could be zero, we need to be creative about what RPM is stated as.
-double FGPropeller::Calculate(double PowerAvailable)
+double FGPropeller::Calculate(double EnginePower)
{
- double omega, alpha, beta;
+ double omega, alpha, beta, PowerAvailable;
double Vel = fdmex->GetAuxiliary()->GetAeroUVW(eU);
double rho = fdmex->GetAtmosphere()->GetDensity();
double RPS = RPM/60.0;
+ PowerAvailable = EnginePower - GetPowerRequired();
+
// Calculate helical tip Mach
double Area = 0.25*Diameter*Diameter*M_PI;
double Vtip = RPS * Diameter * M_PI;
if (CL > 1.5) CL = 1.5;
double BladeArea = Diameter * Diameter / 32.0 * numBlades;
vTorque(eX) = -Sense*BladeArea*Diameter*Vel*Vel*rho*0.19*CL;
- PowerRequired = vTorque(eX)*0.2*M_PI;
+ PowerRequired = fabs(vTorque(eX))*0.2*M_PI;
}
return PowerRequired;