]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/propulsion/FGTurbine.cpp
Merge branch 'next' of git://gitorious.org/fg/flightgear into next
[flightgear.git] / src / FDM / JSBSim / models / propulsion / FGTurbine.cpp
index c61667b4b2ddc98fac8c9757b62fbab7036e37f8..c4cfc30331209866ed8315be72dfec5bcde98685 100644 (file)
@@ -51,7 +51,7 @@ using namespace std;
 
 namespace JSBSim {
 
-static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.27 2010/05/24 11:26:37 jberndt Exp $";
+static const char *IdSrc = "$Id: FGTurbine.cpp,v 1.32 2011/06/07 00:28:03 jentron Exp $";
 static const char *IdHdr = ID_TURBINE;
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -74,6 +74,7 @@ FGTurbine::FGTurbine(FGFDMExec* exec, Element *el, int engine_number)
   BypassRatio = BleedDemand = 0.0;
   IdleThrustLookup = MilThrustLookup = MaxThrustLookup = InjectionLookup = 0;
   N1_spinup = 1.0; N2_spinup = 3.0; 
+  EPR = 1.0;
 
   ResetToIC();
 
@@ -96,6 +97,9 @@ FGTurbine::~FGTurbine()
 
 void FGTurbine::ResetToIC(void)
 {
+    
+  FGEngine::ResetToIC();
+    
   N1 = N2 = 0.0;
   N2norm = 0.0;
   correctedTSFC = TSFC;
@@ -113,10 +117,12 @@ void FGTurbine::ResetToIC(void)
 // 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 = FDMExec->GetDeltaT() * Propulsion->GetRate();
@@ -170,9 +176,9 @@ double FGTurbine::Calculate(void)
     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();
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -354,7 +360,7 @@ double FGTurbine::Seize(void)
 
 double FGTurbine::Trim()
 {
-    double idlethrust, milthrust, thrust, tdiff;
+    double idlethrust, milthrust, thrust, tdiff, N2, N2norm;
     idlethrust = MilThrust * IdleThrustLookup->GetValue();
     milthrust = (MilThrust - idlethrust) * MilThrustLookup->GetValue();
     N2 = IdleN2 + ThrottlePos * N2_factor;
@@ -474,9 +480,6 @@ bool FGTurbine::Load(FGFDMExec* exec, Element *el)
       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;
     }
   }
 
@@ -535,6 +538,8 @@ void FGTurbine::bindmodel()
   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);
 }
 
 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%