]> git.mxchange.org Git - flightgear.git/commitdiff
Latest JSBSim fixes, including Dave Luff's mixture improvements for
authordavid <david>
Wed, 13 Feb 2002 14:35:10 +0000 (14:35 +0000)
committerdavid <david>
Wed, 13 Feb 2002 14:35:10 +0000 (14:35 +0000)
the JSBSim piston-engine model.

src/FDM/JSBSim/FGPiston.cpp
src/FDM/JSBSim/filtersjb/FGFCSComponent.h
src/FDM/JSBSim/filtersjb/FGSummer.cpp
src/FDM/JSBSim/filtersjb/FGSummer.h

index ea54f7c206c337ede577c2b8740dc10e508a7673..e96146cb9131e5eee179fd109043739dbc786154 100644 (file)
@@ -154,19 +154,23 @@ double FGPiston::Calculate(double PowerRequired)
     
   IAS = Auxiliary->GetVcalibratedKTS();
 
-  if (Mixture >= 0.3) {
     doEngineStartup();
     doManifoldPressure();
     doAirFlow();
     doFuelFlow();
-    doEnginePower();
+
+  //Now that the fuel flow is done check if the mixture is too lean to run the engine
+  //Assume lean limit at 22 AFR for now - thats a thi of 0.668
+  //This might be a bit generous, but since there's currently no audiable warning of impending
+  //cutout in the form of misfiring and/or rough running its probably reasonable for now.
+  if(equivalence_ratio < 0.668)
+    Running = false;
+
+  doEnginePower();
     doEGT();
     doCHT();
     doOilTemperature();
     doOilPressure();
-  } else {
-    HP = 0;
-  }
 
   PowerAvailable = (HP * hptoftlbssec) - PowerRequired;
   return PowerAvailable;
@@ -227,11 +231,16 @@ void FGPiston::doEngineStartup(void)
 
   if ((!Running) && (spark) && (fuel)) {
   // start the engine if revs high enough
-    if ((RPM > 450) && (crank_counter > 175)) {
-      // For now just instantaneously start but later we should maybe crank for
-      // a bit
-      Running = true;
-      // RPM = 600;
+    if(Cranking) {
+      if ((RPM > 450) && (crank_counter > 175)) {
+        //Add a little delay to startup on the starter
+        Running = true;
+      }
+    } else {
+      if (RPM > 450) {
+        Running = true;
+        //This allows us to in-air start when windmilling
+      }
     }
   }
 
index 8a6ec33f88caee12c10cee11ae5a67e9552796a9..c8df597b44d1e8137eeb2c5305fae28cd1774d9b 100644 (file)
@@ -104,7 +104,7 @@ public:
 
 protected:
    /// Pilot/Aircraft, FCS, Autopilot inputs
-  enum eInputType {itPilotAC, itFCS, itAP} InputType;
+  enum eInputType {itPilotAC, itFCS, itAP, itBias} InputType;
   FGFCS* fcs;
   string Type;
   string Name;
index 3b9de88469027923d9e485cc5157441e55abf4e1..dba37c45874f6a06e630f080c2ef13f8a0d2d630 100644 (file)
@@ -54,6 +54,7 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
   eParam tmpInputIndex;
 
   clip = false;
+  Bias = 0.0;
   InputIndices.clear();
   InputTypes.clear();
 
@@ -73,6 +74,10 @@ FGSummer::FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg) : FGFCSComponent(fcs),
         tmpInputIndex = fcs->GetState()->GetParameterIndex(token);
         InputIndices.push_back(tmpInputIndex);
         InputTypes.push_back(itPilotAC);
+      } else if (token.find(".") != token.npos) { // bias
+        *AC_cfg >> Bias;
+        InputIndices.push_back((eParam)0);
+        InputTypes.push_back(itBias);
       } else {
         *AC_cfg >> tmpInputIndex;
         InputIndices.push_back(tmpInputIndex);
@@ -119,6 +124,9 @@ bool FGSummer::Run(void )
     case itFCS:
       Output += fcs->GetComponentOutput(InputIndices[idx]);
       break;
+    case itBias:
+      Output += Bias;
+      break;
     }
   }
 
index f4234897ce5fd753478075bac6102d46928303dc..2ff7674a60fb7267e51df2e075f6edc57f30cd96 100644 (file)
 HISTORY
 --------------------------------------------------------------------------------
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-COMMENTS, REFERENCES,  and NOTES
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 SENTRY
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -57,11 +53,31 @@ INCLUDES
 #include "../FGConfigFile.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-DEFINES
+DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 #define ID_SUMMER "$Id$"
 
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+FORWARD DECLARATIONS
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+COMMENTS, REFERENCES, and NOTES [use "class documentation" below for API docs]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+CLASS DOCUMENTATION
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
+
+/** Models a flight control system summing component.
+    The Summer component sums multiple inputs. These can be pilot control inputs,
+    state variables, or even floating point numbers (e.g. for a bias).
+    @author Jon S. Berndt
+    @version $Id$
+    @see
+*/
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DECLARATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -69,9 +85,14 @@ CLASS DECLARATION
 class FGSummer  : public FGFCSComponent
 {
 public:
+  /** Constructor.
+      @param fcs a pointer to the parent FGFCS object.
+      @param AC_cfg a pointer to the configuration file object. */
   FGSummer(FGFCS* fcs, FGConfigFile* AC_cfg);
+  /// Destructor
   ~FGSummer();
 
+  /// The execution method for this FCS component.
   bool Run(void);
 
 private:
@@ -80,6 +101,7 @@ private:
   vector <int> InputTypes;
   bool clip;
   double clipmin,clipmax;
+  double Bias;
   void Debug(int from);
 };