diff options
Diffstat (limited to 'Project/RateLimiter.h')
-rw-r--r-- | Project/RateLimiter.h | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/Project/RateLimiter.h b/Project/RateLimiter.h index 49596db..bab52db 100644 --- a/Project/RateLimiter.h +++ b/Project/RateLimiter.h @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2017 Thales Lima Oliveira <thales@ufu.br> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + #ifndef RATELIMITER_H #define RATELIMITER_H @@ -5,6 +22,13 @@ class RateLimiterForm; +/** + * @class RateLimiter + * @author Thales Lima Oliveira <thales@ufu.br> + * @date 05/10/2017 + * @brief Limits the rising and/or falling rate.<br> + * @file RateLimiter.h + */ class RateLimiter : public ControlElement { public: @@ -23,11 +47,25 @@ class RateLimiter : public ControlElement double GetLowLimit() const { return m_lowLimit; } void SetUpLimit(double upLimit) { m_upLimit = upLimit; } void SetLowLimit(double lowLimit) { m_lowLimit = lowLimit; } - + /** + * @brief Calculate the rate and limits it if exceeds.<br> + * The rate is calculated by:<br><br> + * \f$ rate = \frac{x(i) - y(i-1)}{\Delta t} \f$<br><br> + * \f$ x(i) \f$ is the current input and \f$ y(i-1) \f$ is the previous output.<br> + * If the \f$rate\f$ is greater than rising rate (\f$ R \f$), the output will be:<br><br> + * \f$ output = \Delta t \cdot R + y(i-1)\f$<br><br> + * If the \f$rate\f$ is lower than falling rate (\f$ F \f$), the output will be:<br><br> + * \f$ output = \Delta t \cdot L + y(i-1) \f$<br><br> + * Otherwise:<br><br> + * \f$ output = input \f$. + * @param input input value. + * @param timeStep Time step. + * @return Always true. + */ virtual bool Solve(double input, double timeStep); - + virtual Element* GetCopy(); - + protected: double m_upLimit = 5.0; double m_lowLimit = -5.0; |