Filter coefficient (N) in PID block?
Mostra commenti meno recenti
Good evening folks!
While tuning my quadrotor model in Matlab I found that the Matlab PID function had a Filter coefficient (N) term in the PID equation. However I have not encountered such a term in my typical PID programs. How would one implement this term into the PID equation and what would be some simple C code to add this term into the derivative? I tried generating C code from my model but got a lot of header and C program files with nothing close to simple.
My current PID code line in C is:
U2 = KP * phi_error + KI * phi_errorsum + KD * (PHI_RATE_desired-PHI_RATE);
Many Thanks, Robert
Risposta accettata
Più risposte (4)
Shashank Prasanna
il 17 Feb 2013
2 voti
Hi Robert, this link should give you a better idea of what N means:
If you have Simulink Control Design toolbox, then you can use the built in pidtune functionality to tune the PID.
1 Commento
Brian Candiloro
il 13 Gen 2023
Can this filter term be realized in a physical opamp differentiator circuit or only in code?
Robert
il 17 Feb 2013
0 voti
Robert
il 21 Feb 2013
0 voti
1 Commento
Seng Tak Goh
il 11 Mar 2019
Hi Robert,
In essence, the filtered derivative is doing a first order filtering on the change of the inputs, scaled by D gain.
The 1/s integrates the previous output scaled by N term, then adding the input change scaled by D * N to produce the output.
If you multiply the D term of the continuous form by s, you will see it better how the filtering comes into play.
In discrete form:
y[n] = D*N*(u[n]-u[n-1]) + (1-N*Ts)*y[n-1];
Categorie
Scopri di più su PID Controller Tuning in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!