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.
Dependencies: mbed
PID_Cntrl.h@1:314e2e3727f2, 2019-05-07 (annotated)
- Committer:
- altb2
- Date:
- Tue May 07 10:22:30 2019 +0000
- Revision:
- 1:314e2e3727f2
- Parent:
- 0:4ed9a8952ddc
- Child:
- 3:477db0d9895e
My Musterloesung (not tested)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| altb2 | 1:314e2e3727f2 | 1 | #ifndef PID_CNTRL_H_ |
| altb2 | 1:314e2e3727f2 | 2 | #define PID_CNTRL_H_ |
| altb2 | 1:314e2e3727f2 | 3 | |
| altb2 | 1:314e2e3727f2 | 4 | // PID Controller Class (Template) |
| altb2 | 0:4ed9a8952ddc | 5 | class PID_Cntrl |
| altb2 | 0:4ed9a8952ddc | 6 | { |
| altb2 | 0:4ed9a8952ddc | 7 | public: |
| altb2 | 0:4ed9a8952ddc | 8 | |
| altb2 | 0:4ed9a8952ddc | 9 | PID_Cntrl(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax); |
| altb2 | 0:4ed9a8952ddc | 10 | |
| altb2 | 0:4ed9a8952ddc | 11 | float operator()(float error) { |
| altb2 | 1:314e2e3727f2 | 12 | return update((double)error); |
| altb2 | 0:4ed9a8952ddc | 13 | } |
| altb2 | 0:4ed9a8952ddc | 14 | |
| altb2 | 0:4ed9a8952ddc | 15 | virtual ~PID_Cntrl(); |
| altb2 | 0:4ed9a8952ddc | 16 | |
| altb2 | 0:4ed9a8952ddc | 17 | void reset(float initValue); |
| altb2 | 1:314e2e3727f2 | 18 | float update(double error); |
| altb2 | 0:4ed9a8952ddc | 19 | |
| altb2 | 0:4ed9a8952ddc | 20 | private: |
| altb2 | 1:314e2e3727f2 | 21 | float e_old,D_old,I_old; |
| altb2 | 1:314e2e3727f2 | 22 | float tau_f,Ts; |
| altb2 | 1:314e2e3727f2 | 23 | float Kp,Ki,Kd; |
| altb2 | 1:314e2e3727f2 | 24 | float uMin, uMax; |
| altb2 | 1:314e2e3727f2 | 25 | // here some local variables are defined |
| altb2 | 1:314e2e3727f2 | 26 | }; |
| altb2 | 0:4ed9a8952ddc | 27 | |
| altb2 | 1:314e2e3727f2 | 28 | #endif |