涂 桂旺 / AutomationElements

Fork of AutomationElements by TVZ Mechatronics Team

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers PT1.h Source File

PT1.h

00001 #ifndef PT1_H
00002 #define PT1_H
00003 
00004 #include "mbed.h"
00005 
00006 /** Transfer function of a PT1 form.
00007  * G(s) = Y(s) / U(s) = K / (1 + T_1 s)
00008  *
00009  * Author(s): TVZ Mechatronics Team
00010  *
00011  */
00012 class PT1 {
00013     public:
00014         /** Default constructor.
00015          * K = 1, T_1 = 1, sampleTime = 0.1
00016          */
00017         PT1();
00018         /** PT1 transfer function parameters and sample time in seconds. */
00019         PT1(double K, double T_1, double sampleTime);
00020         /** Update PT1 transfer function parameters and sample time. */
00021         void setParameters(double K, double T_1, double sampleTime);
00022         /** Calculate the output y. */
00023         double out();
00024         /** Set the input u. */
00025         void in(double u);
00026     private:
00027         double K, T_1, T_d, a_1, b_1, y, y_p1, u, u_p1;
00028 };
00029 
00030 #endif // PT1_H