Looks like if the engine is "Starved" once, it always stays that way
even if the aircraft is refuelled. I have tried to make this work, and
hacked the state machine.
Please review my changes as I may have broken something.

* I have moved the selection of the next state into the appropriate
handler - I think it belongs there
* I have overridden the ConsumeFuel function so that it automatically
sets the state to tpOff if out of fuel.
* The starter operates as follows: the engine is spin-up. After that
state is set to tpStart. In the next iteration Start() will check if
there is fuel or not.

This probably belongs to the jsbsim mail list, but I am not subscribed
there and Jon seems to be reading fg-devel anyway. Sorry if this
caused any inconvenience.

Greets,
Csaba
Index: src/FDM/JSBSim/models/propulsion/FGTurbine.cpp
===================================================================
RCS file: 
/var/cvs/FlightGear-0.9/source/src/FDM/JSBSim/models/propulsion/FGTurbine.cpp,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 FGTurbine.cpp
--- src/FDM/JSBSim/models/propulsion/FGTurbine.cpp      6 Jan 2007 10:49:26 
-0000       1.1.2.1
+++ src/FDM/JSBSim/models/propulsion/FGTurbine.cpp      4 Jun 2007 17:44:54 
-0000
@@ -91,29 +91,7 @@
     AugmentCmd = 0.0;
   }
 
-  // When trimming is finished check if user wants engine OFF or RUNNING
-  if ((phase == tpTrim) && (dt > 0)) {
-    if (Running && !Starved) {
-      phase = tpRun;
-      N2 = IdleN2 + ThrottlePos * N2_factor;
-      N1 = IdleN1 + ThrottlePos * N1_factor;
-      OilTemp_degK = 366.0;
-      Cutoff = false;
-      }
-    else {
-      phase = tpOff;
-      Cutoff = true;
-      EGT_degC = TAT;
-      }
-    }
-
-  if (!Running && Cutoff && Starter) {
-     if (phase == tpOff) phase = tpSpinUp;
-     }
-  if (!Running && !Cutoff && (N2 > 15.0)) phase = tpStart;
-  if (Cutoff && (phase != tpSpinUp)) phase = tpOff;
   if (dt == 0) phase = tpTrim;
-  if (Starved) phase = tpOff;
   if (Stalled) phase = tpStall;
   if (Seized) phase = tpSeize;
 
@@ -135,6 +113,16 @@
 
 
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
+void FGTurbine::ConsumeFuel(void)
+{
+  FGEngine::ConsumeFuel();
+  if (Cutoff || Starved) {
+    phase = tpOff;
+  }
+}
+
+//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
 double FGTurbine::Off(void)
 {
   double qbar = Auxiliary->Getqbar();
@@ -148,6 +136,11 @@
   NozzlePosition = Seek(&NozzlePosition, 1.0, 0.8, 0.8);
   EPR = Seek(&EPR, 1.0, 0.2, 0.2);
   Augmentation = false;
+
+  if (Cutoff && Starter) {
+    phase = tpSpinUp;
+  }
+  
   return 0.0;
 }
 
@@ -209,8 +202,6 @@
   }
 
   ConsumeFuel();
-  if (Cutoff) phase = tpOff;
-  if (Starved) phase = tpOff;
 
   return thrust;
 }
@@ -228,6 +219,11 @@
   OilTemp_degK = Seek(&OilTemp_degK, TAT + 273.0, 0.2, 0.2);
   EPR = 1.0;
   NozzlePosition = 1.0;
+
+  if (N2 > 15.0) {
+    phase = tpStart;
+  }
+
   return 0.0;
 }
 
@@ -235,7 +231,7 @@
 
 double FGTurbine::Start(void)
 {
-  if ((N2 > 15.0) && !Starved) {       // minimum 15% N2 needed for start
+  if (N2 > 15.0) {       // minimum 15% N2 needed for start
     Cranking = true;                   // provided for sound effects signal
     if (N2 < IdleN2) {
       N2 = Seek(&N2, IdleN2, 2.0, N2/2.0);
@@ -320,6 +316,20 @@
       thrust = thrust * InjectionLookup->GetValue();
     }
 
+    // When trimming is finished check if user wants engine OFF or RUNNING
+    if (Running && !Starved) {
+      phase = tpRun;
+      N2 = IdleN2 + ThrottlePos * N2_factor;
+      N1 = IdleN1 + ThrottlePos * N1_factor;
+      OilTemp_degK = 366.0;
+      Cutoff = false;
+    }
+    else {
+      phase = tpOff;
+      Cutoff = true;
+      EGT_degC = TAT;
+    }
+
     return thrust;
 }
 
Index: src/FDM/JSBSim/models/propulsion/FGTurbine.h
===================================================================
RCS file: 
/var/cvs/FlightGear-0.9/source/src/FDM/JSBSim/models/propulsion/FGTurbine.h,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 FGTurbine.h
--- src/FDM/JSBSim/models/propulsion/FGTurbine.h        6 Jan 2007 10:49:26 
-0000       1.1.2.1
+++ src/FDM/JSBSim/models/propulsion/FGTurbine.h        4 Jun 2007 17:44:54 
-0000
@@ -152,6 +152,7 @@
   double GetPowerAvailable(void);
   double GetThrust(void) const {return Thrust;}
   double Seek(double* var, double target, double accel, double decel);
+  void ConsumeFuel(void);
 
   phaseType GetPhase(void) { return phase; }
 
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to