Rate limiter class.

Dependents:   BLDC_mainProgram L298N-Breakout-Test HBridgeDCMotor STMF302R8_MotorDrive ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RateLimiter.h Source File

RateLimiter.h

00001 #ifndef RATE_LIMITER_H
00002 #define RATE_LIMITER_H
00003 
00004 #include "mbed.h"
00005 
00006 /** A rate limiter class.
00007  * 
00008  * Author(s): TVZ Mechatronics Team
00009  *
00010  */
00011 class RateLimiter {
00012     public:
00013         /** Default constructor */
00014         RateLimiter ();
00015         /** Constructor receives rising (R) and falling (F) rate limits,
00016          * initial condition of the output and sample time in seconds. */
00017         RateLimiter (float R, float F, float initialCondition, float sampleTime);
00018         /** Setting the rate limits R and F. */
00019         void setLimits (float R, float F);
00020         void setLimits (float R, float F, float initialCondition, float sampleTime);
00021         /** Calculating the output of the rate limiter for the given input. */
00022         float out (float input);
00023         /** Reset the output of the rate limiter to zero. */
00024         void reset();
00025     private:
00026         float R, F, y0, y, T_d, rate;
00027 };
00028 
00029 #endif // RATE_LIMITER_H