diff options
Diffstat (limited to 'Project/RateLimiter.cpp')
-rw-r--r-- | Project/RateLimiter.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Project/RateLimiter.cpp b/Project/RateLimiter.cpp index afba0ee..c8da81d 100644 --- a/Project/RateLimiter.cpp +++ b/Project/RateLimiter.cpp @@ -110,9 +110,13 @@ void RateLimiter::UpdatePoints() } } -bool RateLimiter::Solve(double input, double timeStep) +bool RateLimiter::Solve(double* input, double timeStep) { - double rate = (input - m_output) / timeStep; + if(!input) { + m_output = 0.0; + return true; + } + double rate = (input[0] - m_output) / timeStep; bool reachLimit = false; if(rate > m_upLimit) { @@ -126,7 +130,7 @@ bool RateLimiter::Solve(double input, double timeStep) if(reachLimit) m_output += rate * timeStep; else - m_output = input; + m_output = input[0]; return true; } |