#include <iostream>
#include <sstream>
#include "FGTurbine.h"
-#include "FGState.h"
-#include "models/FGPropulsion.h"
#include "FGThruster.h"
+#include "models/FGPropulsion.h"
+#include "models/FGAuxiliary.h"
+#include "models/FGAtmosphere.h"
using namespace std;
namespace JSBSim {
-static const char *IdSrc = "$Id$";
+static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.31 2011/03/03 12:16:26 jberndt Exp $";
static const char *IdHdr = ID_TURBINE;
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
BypassRatio = BleedDemand = 0.0;
IdleThrustLookup = MilThrustLookup = MaxThrustLookup = InjectionLookup = 0;
N1_spinup = 1.0; N2_spinup = 3.0;
+ EPR = 1.0;
ResetToIC();
void FGTurbine::ResetToIC(void)
{
+
+ FGEngine::ResetToIC();
+
N1 = N2 = 0.0;
N2norm = 0.0;
correctedTSFC = TSFC;
// The main purpose of Calculate() is to determine what phase the engine should
// be in, then call the corresponding function.
-double FGTurbine::Calculate(void)
+void FGTurbine::Calculate(void)
{
double thrust;
+ RunPreFunctions();
+
TAT = (Auxiliary->GetTotalTemperature() - 491.69) * 0.5555556;
double qbar = Auxiliary->Getqbar();
- dt = State->Getdt() * Propulsion->GetRate();
+ dt = FDMExec->GetDeltaT() * Propulsion->GetRate();
ThrottlePos = FCS->GetThrottlePos(EngineNumber);
if (ThrottlePos > 1.0) {
AugmentCmd = ThrottlePos - 1.0;
if (!Running && Cutoff && Starter) {
if (phase == tpOff) phase = tpSpinUp;
- }
+ }
// start
if ((Starter == true) || (qbar > 30.0)) {
default: thrust = Off();
}
- thrust = Thruster->Calculate(thrust); // allow thruster to modify thrust (i.e. reversing)
+ Thruster->Calculate(thrust); // allow thruster to modify thrust (i.e. reversing)
- return thrust;
+ RunPostFunctions();
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (!Augmentation) {
correctedTSFC = TSFC * sqrt(T/389.7) * (0.84 + (1-N2norm)*(1-N2norm));
- FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 100000);
+ FuelFlow_pph = Seek(&FuelFlow_pph, thrust * correctedTSFC, 1000.0, 10000.0);
if (FuelFlow_pph < IdleFF) FuelFlow_pph = IdleFF;
NozzlePosition = Seek(&NozzlePosition, 1.0 - N2norm, 0.8, 0.8);
thrust = thrust * (1.0 - BleedDemand);
double FGTurbine::CalcFuelNeed(void)
{
- double dT = State->Getdt() * Propulsion->GetRate();
+ double dT = FDMExec->GetDeltaT() * Propulsion->GetRate();
FuelFlowRate = FuelFlow_pph / 3600.0; // Calculates flow in lbs/sec from lbs/hr
FuelExpended = FuelFlowRate * dT; // Calculates fuel expended in this time step
return FuelExpended;
MaxThrustLookup = new FGFunction(PropertyManager, function_element, property_prefix);
} else if (name == "Injection") {
InjectionLookup = new FGFunction(PropertyManager, function_element, property_prefix);
- } else {
- cerr << "Unknown function type: " << name << " in turbine definition." <<
- endl;
}
}
PropertyManager->Tie( property_name.c_str(), &Seized);
property_name = base_property_name + "/stalled";
PropertyManager->Tie( property_name.c_str(), &Stalled);
+ property_name = base_property_name + "/bleed-factor";
+ PropertyManager->Tie( property_name.c_str(), (FGTurbine*)this, &FGTurbine::GetBleedDemand, &FGTurbine::SetBleedDemand);
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
int FGTurbine::InitRunning(void) {
- State->SuspendIntegration();
+ FDMExec->SuspendIntegration();
Cutoff=false;
Running=true;
N2=IdleN2;
Calculate();
- State->ResumeIntegration();
+ FDMExec->ResumeIntegration();
return phase==tpRun;
}