Tobias Vögeli
/
GRT_VC_PIDT1
pr7
PID_Cntrl.cpp@0:05dd1de8cc3f, 2019-05-03 (annotated)
- Committer:
- altb2
- Date:
- Fri May 03 09:37:27 2019 +0000
- Revision:
- 0:05dd1de8cc3f
- Child:
- 1:92f175969d90
Final Template Version for Lab #7
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb2 | 0:05dd1de8cc3f | 1 | /* |
altb2 | 0:05dd1de8cc3f | 2 | PI Controller class |
altb2 | 0:05dd1de8cc3f | 3 | |
altb2 | 0:05dd1de8cc3f | 4 | 1 s |
altb2 | 0:05dd1de8cc3f | 5 | G(s) = P + I --- + D --------- |
altb2 | 0:05dd1de8cc3f | 6 | s T_f*s + p |
altb2 | 0:05dd1de8cc3f | 7 | */ |
altb2 | 0:05dd1de8cc3f | 8 | |
altb2 | 0:05dd1de8cc3f | 9 | #include "PID_Cntrl.h" |
altb2 | 0:05dd1de8cc3f | 10 | using namespace std; |
altb2 | 0:05dd1de8cc3f | 11 | |
altb2 | 0:05dd1de8cc3f | 12 | PID_Cntrl::PID_Cntrl(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax) |
altb2 | 0:05dd1de8cc3f | 13 | { |
altb2 | 0:05dd1de8cc3f | 14 | // .... |
altb2 | 0:05dd1de8cc3f | 15 | |
altb2 | 0:05dd1de8cc3f | 16 | reset(0.0f); |
altb2 | 0:05dd1de8cc3f | 17 | } |
altb2 | 0:05dd1de8cc3f | 18 | |
altb2 | 0:05dd1de8cc3f | 19 | PID_Cntrl::~PID_Cntrl() {} |
altb2 | 0:05dd1de8cc3f | 20 | |
altb2 | 0:05dd1de8cc3f | 21 | void PID_Cntrl::reset(float initValue) |
altb2 | 0:05dd1de8cc3f | 22 | { |
altb2 | 0:05dd1de8cc3f | 23 | // here code for resetting variables |
altb2 | 0:05dd1de8cc3f | 24 | |
altb2 | 0:05dd1de8cc3f | 25 | } |
altb2 | 0:05dd1de8cc3f | 26 | |
altb2 | 0:05dd1de8cc3f | 27 | float PID_Cntrl::update(double e) |
altb2 | 0:05dd1de8cc3f | 28 | { |
altb2 | 0:05dd1de8cc3f | 29 | // here the main code!!! |
altb2 | 0:05dd1de8cc3f | 30 | |
altb2 | 0:05dd1de8cc3f | 31 | return 0.0f; |
altb2 | 0:05dd1de8cc3f | 32 | } |
altb2 | 0:05dd1de8cc3f | 33 |