PID Controller in Simulink question

조회 수: 3 (최근 30일)
Manikanta Aditya
Manikanta Aditya 2023년 7월 22일
댓글: Manikanta Aditya 2023년 7월 23일
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.

채택된 답변

Paul
Paul 2023년 7월 22일
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
Sam Chak
Sam Chak 2023년 7월 23일
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)
ans = 5
ki_values(end)
ans = 8
kd_values(end)
ans = 11
pid_controller = pid(kp_values(end), ki_values(end), kd_values(end))
pid_controller = 1 Kp + Ki * --- + Kd * s s with Kp = 5, Ki = 8, Kd = 11 Continuous-time PID controller in parallel form.
Manikanta Aditya
Manikanta Aditya 2023년 7월 23일
Thanks @Sam Chak!, It was helpful

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sam Chak
Sam Chak 2023년 7월 23일
If you set the PID controller block to have external inputs for the control gains as advised by @Paul, then the configuration should look like the following block diagram. However, I'm unsure how you intend to set up the filtered derivative, since yours has only Kd.

카테고리

Help CenterFile Exchange에서 PID Controller Tuning에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by