if (Stalled) phase = tpStall;
if (Seized) phase = tpSeize;
- double CT = 0.0;
switch (phase) {
case tpOff: Thrust = Off(); break;
- case tpRun: Thrust = Run(CT); break;
+ case tpRun: Thrust = Run(); break;
case tpSpinUp: Thrust = SpinUp(); break;
case tpStart: Thrust = Start(); break;
case tpStall: Thrust = Stall(); break;
case tpSeize: Thrust = Seize(); break;
- case tpTrim: Thrust = Trim(CT); break;
+ case tpTrim: Thrust = Trim(); break;
default: Thrust = Off();
}
- Thruster->SetThrustCoefficient(CT);
-
- return Thruster->Calculate(Thrust);
+ // The thruster can modify the thrust, eg. thrust reverser
+ return Thrust = Thruster->Calculate(Thrust);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGTurbine::Run(double &TC)
+double FGTurbine::Run(void)
{
double idlethrust, milthrust, thrust;
double N2norm; // 0.0 = idle N2, 1.0 = maximum N2
-
- idlethrust = ThrustTables[0]->TotalValue();
- milthrust = (1.0 - idlethrust) * ThrustTables[1]->TotalValue();
+ idlethrust = MilThrust * ThrustTables[0]->TotalValue();
+ milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
Running = true;
Starter = false;
N2 = Seek(&N2, IdleN2 + ThrottlePos * N2_factor, delay, delay * 3.0);
N1 = Seek(&N1, IdleN1 + ThrottlePos * N1_factor, delay, delay * 2.4);
N2norm = (N2 - IdleN2) / N2_factor;
- TC = idlethrust + (milthrust * N2norm * N2norm);
- thrust = TC * MilThrust;
+ thrust = idlethrust + (milthrust * N2norm * N2norm);
EGT_degC = TAT + 363.1 + ThrottlePos * 357.1;
OilPressure_psi = N2 * 0.62;
OilTemp_degK = Seek(&OilTemp_degK, 366.0, 1.2, 0.1);
if (!Augmentation) {
- double correctedTSFC = TSFC + TSFC - (N2norm * TSFC);
+ double correctedTSFC = TSFC * (0.84 + (1-N2norm)*(1-N2norm));
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 100000);
if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
- TC = TC * (1.0 - BleedDemand);
- EPR = 1.0 + TC;
+ thrust = thrust * (1.0 - BleedDemand);
+ EPR = 1.0 + thrust/MilThrust;
}
if (AugMethod == 1) {
}
if ((Augmented == 1) && Augmentation && (AugMethod < 2)) {
- TC = ThrustTables[2]->TotalValue();
- thrust = TC * MaxThrust;
+ thrust = MaxThrust * ThrustTables[2]->TotalValue();
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
}
if (AugMethod == 2) {
if (AugmentCmd > 0.0) {
Augmentation = true;
- double tdiff = ThrustTables[2]->TotalValue() - TC;
- TC += (tdiff * AugmentCmd);
- thrust = TC * MaxThrust;
+ double tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
+ thrust += (tdiff * AugmentCmd);
FuelFlow_pph = Seek(&FuelFlow_pph, thrust * ATSFC, 5000.0, 10000.0);
NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
} else {
}
if ((Injected == 1) && Injection) {
- TC = TC * ThrustTables[3]->TotalValue();
- thrust = thrust * ThrustTables[3]->TotalValue();
+ thrust = thrust * ThrustTables[3]->TotalValue();
}
ConsumeFuel();
EGT_degC = Seek(&EGT_degC, TAT + 363.1, 21.3, 7.3);
FuelFlow_pph = Seek(&FuelFlow_pph, IdleFF, 103.7, 103.7);
OilPressure_psi = N2 * 0.62;
+ ConsumeFuel();
}
else {
phase = tpRun;
FuelFlow_pph = IdleFF;
N1 = Seek(&N1, qbar/10.0, 0, N1/10.0);
N2 = Seek(&N2, qbar/15.0, 0, N2/10.0);
+ ConsumeFuel();
if (ThrottlePos < 0.01) phase = tpRun; // clear the stall with throttle
return 0.0;
N2 = 0.0;
N1 = Seek(&N1, qbar/20.0, 0, N1/15.0);
FuelFlow_pph = IdleFF;
+ ConsumeFuel();
OilPressure_psi = 0.0;
OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0, 0.2);
Running = false;
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-double FGTurbine::Trim(double &TC)
+double FGTurbine::Trim(void)
{
double idlethrust, milthrust, thrust, tdiff;
- idlethrust = ThrustTables[0]->TotalValue();;
- milthrust = (1.0 - TC) * ThrustTables[1]->TotalValue();
- TC = (idlethrust + (milthrust * ThrottlePos * ThrottlePos))
+ idlethrust = MilThrust * ThrustTables[0]->TotalValue();;
+ milthrust = (MilThrust - idlethrust) * ThrustTables[1]->TotalValue();
+ thrust = (idlethrust + (milthrust * ThrottlePos * ThrottlePos))
* (1.0 - BleedDemand);
if (AugmentCmd > 0.0) {
- tdiff = ThrustTables[2]->TotalValue() - TC;
- TC += (tdiff * AugmentCmd);
- thrust = TC * MaxThrust;
-
- } else
- thrust = TC * MilThrust;
+ tdiff = (MaxThrust * ThrustTables[2]->TotalValue()) - thrust;
+ thrust += (tdiff * AugmentCmd);
+ }
return thrust;
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGTurbine::GetEngineLabels(void)
+string FGTurbine::GetEngineLabels(string delimeter)
{
std::ostringstream buf;
- buf << Name << "_N1[" << EngineNumber << "], "
- << Name << "_N2[" << EngineNumber << "], "
- << Thruster->GetThrusterLabels(EngineNumber);
+ buf << Name << "_N1[" << EngineNumber << "]" << delimeter
+ << Name << "_N2[" << EngineNumber << "]" << delimeter
+ << Thruster->GetThrusterLabels(EngineNumber, delimeter);
return buf.str();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-string FGTurbine::GetEngineValues(void)
+string FGTurbine::GetEngineValues(string delimeter)
{
std::ostringstream buf;
- buf << N1 << ", "
- << N2 << ", "
- << Thruster->GetThrusterValues(EngineNumber);
+ buf << N1 << delimeter
+ << N2 << delimeter
+ << Thruster->GetThrusterValues(EngineNumber, delimeter);
return buf.str();
}
{
char property_name[80];
- snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
+ snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
PropertyManager->Tie( property_name, &N1);
- snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
+ snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
PropertyManager->Tie( property_name, &N2);
+ snprintf(property_name, 80, "propulsion/engine[%u]/fuel-flow", EngineNumber);
+ PropertyManager->Tie( property_name, &FuelFlow_pph);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
char property_name[80];
- snprintf(property_name, 80, "propulsion/n1[%u]", EngineNumber);
+ snprintf(property_name, 80, "propulsion/engine[%u]/n1", EngineNumber);
PropertyManager->Untie(property_name);
- snprintf(property_name, 80, "propulsion/n2[%u]", EngineNumber);
+ snprintf(property_name, 80, "propulsion/engine[%u]/n2", EngineNumber);
PropertyManager->Untie(property_name);
+ snprintf(property_name, 80, "propulsion/engine[%u]/fuel-flow", EngineNumber);
+ PropertyManager->Untie( property_name);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%