From 4a683bed1ea4e76b330a9e13a37cb343a47278b4 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 24 Feb 2009 00:16:03 +0000 Subject: [PATCH] "min throttle" tunable from Maik: 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 | 3 +++ src/FDM/YASim/PistonEngine.cpp | 8 +++++++- src/FDM/YASim/PistonEngine.hpp | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 0e4ee3918..9b675ece4 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -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; diff --git a/src/FDM/YASim/PistonEngine.cpp b/src/FDM/YASim/PistonEngine.cpp index b032342d4..1ef086b14 100644 --- a/src/FDM/YASim/PistonEngine.cpp +++ b/src/FDM/YASim/PistonEngine.cpp @@ -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; diff --git a/src/FDM/YASim/PistonEngine.hpp b/src/FDM/YASim/PistonEngine.hpp index 40d6bac52..2431c4947 100644 --- a/src/FDM/YASim/PistonEngine.hpp +++ b/src/FDM/YASim/PistonEngine.hpp @@ -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; -- 2.39.5