Library containing essential automation elements with parameters in continuous Laplace domain, and implemented with fixed sample time. This means that "out" member functions should be called using Ticker object.
Dependents: CurrentMeasurement Zavrsni_rad_NXP_cup HC-SR04 Nucleo_SSD1306_DS1302_ESP8266_AM2320_BME280 ... more
Diff: DT1.h
- Revision:
- 0:3dd7aeceee65
diff -r 000000000000 -r 3dd7aeceee65 DT1.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DT1.h Thu Jan 22 11:41:02 2015 +0000 @@ -0,0 +1,32 @@ +#ifndef DT1_H +#define DT1_H + +#include "mbed.h" + +/** Transfer function of a DT1 form. + * G(s) = Y(s) / U(s) = T_D s / (1 + T_1 s) + * + * Author(s): TVZ Mechatronics Team + * + */ +class DT1 { + public: + /** Default constructor. + * T_1 = 1, T_D = 0.5, sampleTime = 0.1 + */ + DT1(); + /** DT1 transfer function parameters and sample time in seconds. */ + DT1(double T_1, double T_D, double sampleTime); + /** Update DT1 transfer function parameters and sample time. */ + void setParameters(double T_1, double T_D, double sampleTime); + /** Calculate the output y. */ + double out(); + /** Set the input u. */ + void in(double u); + private: + double y, y_p1; + double u, u_p1; + double T_1, T_D, T_d, a_1, b_0, b_1; +}; + +#endif // DT1_H \ No newline at end of file