test
Dependencies: ESP8266 HCSR04 PID
Fork of car_test_v1 by
AutomationElement/I.h@3:9e51de1050a1, 2017-11-25 (annotated)
- Committer:
- tgw
- Date:
- Sat Nov 25 03:36:58 2017 +0000
- Revision:
- 3:9e51de1050a1
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tgw | 3:9e51de1050a1 | 1 | #ifndef I_H |
tgw | 3:9e51de1050a1 | 2 | #define I_H |
tgw | 3:9e51de1050a1 | 3 | |
tgw | 3:9e51de1050a1 | 4 | #include "mbed.h" |
tgw | 3:9e51de1050a1 | 5 | |
tgw | 3:9e51de1050a1 | 6 | /** Transfer function of an integrator. |
tgw | 3:9e51de1050a1 | 7 | * G(s) = Y(s) / U(s) = K_I / s |
tgw | 3:9e51de1050a1 | 8 | * |
tgw | 3:9e51de1050a1 | 9 | * Author(s): TVZ Mechatronics Team |
tgw | 3:9e51de1050a1 | 10 | * |
tgw | 3:9e51de1050a1 | 11 | */ |
tgw | 3:9e51de1050a1 | 12 | class I { |
tgw | 3:9e51de1050a1 | 13 | public: |
tgw | 3:9e51de1050a1 | 14 | /** Default constructor. |
tgw | 3:9e51de1050a1 | 15 | * K_I = 1, sampleTime = 0.1 |
tgw | 3:9e51de1050a1 | 16 | */ |
tgw | 3:9e51de1050a1 | 17 | I(); |
tgw | 3:9e51de1050a1 | 18 | /** Integrator gain and sample time in seconds. */ |
tgw | 3:9e51de1050a1 | 19 | I(double K_I, double sampleTime); |
tgw | 3:9e51de1050a1 | 20 | /** Update integrator gain and sample time. */ |
tgw | 3:9e51de1050a1 | 21 | void setParameters(double K_I, double sampleTime); |
tgw | 3:9e51de1050a1 | 22 | /** Calculate the output y. */ |
tgw | 3:9e51de1050a1 | 23 | double out(); |
tgw | 3:9e51de1050a1 | 24 | /** Set the input u. */ |
tgw | 3:9e51de1050a1 | 25 | void in(double u); |
tgw | 3:9e51de1050a1 | 26 | private: |
tgw | 3:9e51de1050a1 | 27 | double K_I, T_d, y, y_p1, u, u_p1; |
tgw | 3:9e51de1050a1 | 28 | }; |
tgw | 3:9e51de1050a1 | 29 | |
tgw | 3:9e51de1050a1 | 30 | #endif // I_H |