Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of AutomationElements by
PT2.h
00001 #ifndef PT2_H 00002 #define PT2_H 00003 00004 #include "mbed.h" 00005 00006 /** Transfer function of a PT2 form. 00007 * G(s) = Y(s) / U(s) = K / ( (1 + T_1 s) * (1 + T_2 s) ) 00008 * 00009 * Author(s): TVZ Mechatronics Team 00010 * 00011 */ 00012 class PT2 { 00013 public: 00014 /** Default constructor. 00015 * K = 1, T_1 = 1 s, T_2 = 0.5 s, sampleTime = 0.1 s. 00016 */ 00017 PT2(); 00018 /** PT2 transfer function parameters and sample time in seconds. */ 00019 PT2(double K, double T_1, double T_2, double sampleTime); 00020 /** Update PT2 transfer function parameters and sample time. */ 00021 void setParameters(double K, double T_1, double T_2, 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_2, T_d, a, b, c, d, a_1, a_2, b_1, b_2, y, y_p1, y_p2, u, u_p1, u_p2; 00028 }; 00029 00030 #endif // PT2_H
Generated on Thu Jul 14 2022 20:25:49 by
1.7.2
