]> git.mxchange.org Git - flightgear.git/commitdiff
"min throttle" tunable from Maik:
authorandy <andy>
Tue, 24 Feb 2009 00:16:03 +0000 (00:16 +0000)
committerTim Moore <timoore@redhat.com>
Fri, 27 Feb 2009 22:42:33 +0000 (23:42 +0100)
Background are problems modeling the rotax 912 engine. The idle speed
of the real engine is about half of the speed I could achieve with the
default minimum manifold pressure. While on ground I can switch off
the engine by pulling the throttle. The audible difference between the
different minimum idle speed (real vs. simulated) is extreme. With the
patch I get quite realistic sound. For the rotax engine I use
min-throttle="0.05" which is half of the former default value.

src/FDM/YASim/FGFDM.cpp
src/FDM/YASim/PistonEngine.cpp
src/FDM/YASim/PistonEngine.hpp

index 0e4ee39186b2bbccc075843a37728b8e502ca0cb..9b675ece4e24a869765b3aa37c7298bdfb7feae7 100644 (file)
@@ -801,6 +801,9 @@ void FGFDM::parsePistonEngine(XMLAttributes* a)
     if(a->hasAttribute("compression"))
         eng->setCompression(attrf(a, "compression"));        
 
+    if(a->hasAttribute("min-throttle"))
+        eng->setMinThrottle(attrf(a, "min-throttle"));
+
     if(a->hasAttribute("turbo-mul")) {
         float mul = attrf(a, "turbo-mul");
         float mp = attrf(a, "wastegate-mp", 1e6) * INHG2PA;
index b032342d486b4f82572f27cd6e9aa2622e712004..1ef086b140950b0818ef70abdc112bc0ec4aac5c 100644 (file)
@@ -36,6 +36,7 @@ PistonEngine::PistonEngine(float power, float speed)
     _mixCoeff = realFlow * 1.1f / _omega0;
 
     _turbo = 1;
+    _minthrottle = 0.1;
     _maxMP = 1e6; // No waste gate on non-turbo engines.
     _wastegate = 1;
     _charge = 1;
@@ -72,6 +73,11 @@ void PistonEngine::setCompression(float c)
     _compression = c;
 }
 
+void PistonEngine::setMinThrottle(float m)
+{
+    _minthrottle = m;
+}
+
 float PistonEngine::getMaxPower()
 {
     return _power0;
@@ -147,7 +153,7 @@ void PistonEngine::calc(float pressure, float temp, float speed)
     // We need to adjust the minimum manifold pressure to get a
     // reasonable idle speed (a "closed" throttle doesn't suck a total
     // vacuum in real manifolds).  This is a hack.
-    float _minMP = (-0.008 * _turbo ) + 0.1;
+    float _minMP = (-0.008 * _turbo ) + _minthrottle;
 
     _mp = pressure * _charge;
 
index 40d6bac52e5dcbbca5cf98e7d012b74548eb5b8a..2431c494785e082730093086747ede56952db482 100644 (file)
@@ -14,6 +14,7 @@ public:
     void setTurboParams(float mul, float maxMP);
     void setDisplacement(float d);
     void setCompression(float c);
+    void setMinThrottle(float m);
     void setWastegate(float norm) { _wastegate = norm; }
     void setSupercharger(bool hasSuper) { _hasSuper = hasSuper; }
     void setTurboLag(float lag) { _turboLag = lag; }
@@ -47,6 +48,7 @@ private:
     float _wastegate;    // wastegate setting, [0:1]
     float _displacement; // piston stroke volume
     float _compression;  // compression ratio (>1)
+    float _minthrottle; // minimum throttle [0:1]
 
     // Runtime state/output:
     float _mp;