Reputation: 5565
I am trying to calculate gains ( Kp, Ki, Kd ) of a PID controller. I have to improve the response of a plant. I already have the Transfer function of the plant.
I was wondering if matlab has some command for calculation of controller gains ( kp ki and kd ) from the transfer function of the plant and it finds those gains based on certain parameters ( less than 5% OS, no Steady State error and minimal rise time )
PS - I would highly appreciate solutions other than simulink
EDIT:
TF = 1.546/s+0.497
Upvotes: 1
Views: 3386
Reputation: 6424
Yes matlab has the automatic PID tuning capability.
PID tuning is the process of finding the values of proportional, integral, and derivative gains of a PID controller to achieve desired performance and meet design requirements.
You may check these two links: link1 and link2.
This example particularly deals with transfer function and PID controller design.
Generally:
To tune the overshoot, you can use phase margin. Typically, higher phase margin improves stability and overshoot, but limits bandwidth and response speed.
For example you can do this:
sys = tf(1,[1 3 3 1]);
opts = pidtuneOptions('PhaseMargin',45);
[C,info] = pidtune(sys,'pid',opts);
Keep in mind that a higher bandwidth (0 dB crossover of the open-loop) results in a faster rise time, and a higher phase margin reduces the overshoot and improves the system stability. So, you can do this:
opts = pidtuneOptions('CrossoverFrequency',32,'PhaseMargin',90);
[C, info] = pidtune(sys, 'pid', opts)
On the other hand, A proportional controller Kp will have the effect of reducing the rise time and will reduce but never eliminate the steady-state error. An integral control Ki will have the effect of eliminating the steady-state error for a constant or step input, but it may make the transient response slower.
Upvotes: 3