summaryrefslogtreecommitdiffstats
path: root/Project/RateLimiter.cpp
diff options
context:
space:
mode:
authorThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-12-31 17:59:10 -0200
committerThales Lima Oliveira <thaleslima.ufu@gmail.com>2017-12-31 17:59:10 -0200
commitdbe0b112622f8e91fa3e44a6b6e1aa7e230d3ded (patch)
tree51c89fc8155dcc447743dc89a1ab5ce36acc72cf /Project/RateLimiter.cpp
parentff52be4e9705d443a4fde091525806322c2dc032 (diff)
downloadPSP.git-dbe0b112622f8e91fa3e44a6b6e1aa7e230d3ded.tar.gz
PSP.git-dbe0b112622f8e91fa3e44a6b6e1aa7e230d3ded.tar.xz
PSP.git-dbe0b112622f8e91fa3e44a6b6e1aa7e230d3ded.zip
Math Expression implemented
Diffstat (limited to 'Project/RateLimiter.cpp')
-rw-r--r--Project/RateLimiter.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/Project/RateLimiter.cpp b/Project/RateLimiter.cpp
index b9235a7..c8da81d 100644
--- a/Project/RateLimiter.cpp
+++ b/Project/RateLimiter.cpp
@@ -110,9 +110,13 @@ void RateLimiter::UpdatePoints()
}
}
-bool RateLimiter::Solve(double input, double timeStep, double currentTime)
+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, double currentTime)
if(reachLimit)
m_output += rate * timeStep;
else
- m_output = input;
+ m_output = input[0];
return true;
}