PID Controller in Simulink question
4 views (last 30 days)
Show older comments
Manikanta Aditya
on 22 Jul 2023
Commented: Manikanta Aditya
on 23 Jul 2023
Can i apply a series of values as Kp Ki and Kd values instead of just one single value. Like lets say it starts from 1,2,3.. and after the last value it stays at that value till end of simulation.
0 Comments
Accepted Answer
Paul
on 22 Jul 2023
Set the 'Source' parameter to 'external' as in doc for PID block. The you can calculate the gains external to the block as functions of time however is needed and feed the gain values into the block as inputs.
8 Comments
Sam Chak
on 23 Jul 2023
I see now, you are not using Simulink. So you want to hold the last value of each gain?
But I think that the pid() function does not accept time-varying parameters. However, you can possibly use the time-sampling approach or event-triggered method to update PID controller
kp_values = [1, 2, 3, 4, 5];
ki_values = [4, 5, 6, 7, 8];
kd_values = [7, 8, 9, 10, 11];
kp_values(end)
ki_values(end)
kd_values(end)
pid_controller = pid(kp_values(end), ki_values(end), kd_values(end))
More Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!