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