Problem with pidtune function

조회 수: 5 (최근 30일)
Collin Lightfoot
Collin Lightfoot 2024년 4월 28일
댓글: Sam Chak 2024년 5월 1일
For the following code I keep getting just an integral element to my controller even though I am specifying PID. I need PID to get the response I'm looking for but unsure of what I'm doing wrong. tfp4 comes from a state space which I am sure is correct and isn't causing any errors that should effect my response.
[C,info] = pidtune(tfp4, 'PID')
tuned = feedback(C*tfp4, 1);
t = linspace(0, 100, 1000);
u = 3*pi/180*heaviside(t);
[y42, t42] = lsim(tuned, u, t);
y42 = y42*180/pi;
figure()
plot(t42, y42)
  댓글 수: 2
Paul
Paul 2024년 4월 28일
will be difficult for anyone to help w/o the tfp4 model, which can be saved in a .mat file and added to the question using the Paperclip icon in the Insert menu.
If I had to guess, I'd say that pidtune is able to meet its internally generated design goals with just the integral control; the call to pidtune isn't specifying any design goals in particular, i.e., the resopnse you're looking for.
Collin Lightfoot
Collin Lightfoot 2024년 4월 28일
Thanks. I’ll try setting some response parameters and see if that gets me anywhere.

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

채택된 답변

Sam Chak
Sam Chak 2024년 4월 29일
According to the documentation, if the tuning algorithm can achieve satisfactory performance and robustness using a lower-order controller than what is specified for the desired PID controller type, the pidtune function will return a 'C' controller with fewer actions than specified. In your case, 'C' could be an Integral-only controller, even though the type is 'PID'.
Additionally, if no performance specifications are provided, the algorithm will choose a crossover frequency based on the plant dynamics and automatically design for a target phase margin of 60°
%% 4th-order transfer function plant (tfp4)
num = [-1 4 6 4 1];
den = [ 1 4 6 4 1];
Gp = tf(num, den)
Gp = -s^4 + 4 s^3 + 6 s^2 + 4 s + 1 ------------------------------ s^4 + 4 s^3 + 6 s^2 + 4 s + 1 Continuous-time transfer function.
%% Attempt to implement a PID Controller
% C0 = pidstd(1, 1, 1e-6); % baseline controller
% [C, info] = pidtune(Gp, C0)
[C, info] = pidtune(Gp, 'PID')
C = 1 Ki * --- s with Ki = 0.667 Continuous-time I-only controller.
info = struct with fields:
Stable: 1 CrossoverFrequency: 1 PhaseMargin: 90.0000
%% Closed-loop system
Gcl = feedback(C*Gp, 1)
Gcl = -0.6667 s^4 + 2.667 s^3 + 4 s^2 + 2.667 s + 0.6667 ------------------------------------------------------ s^5 + 3.333 s^4 + 8.667 s^3 + 8 s^2 + 3.667 s + 0.6667 Continuous-time transfer function.
%% Plot results
subplot(211)
step(Gp, 10), grid on, legend('Original Plant')
subplot(212)
step(Gcl), grid on, legend('Compensated Plant with I-only controller', 'location', 'East')
  댓글 수: 3
Collin Lightfoot
Collin Lightfoot 2024년 5월 1일
Thank you!
Sam Chak
Sam Chak 2024년 5월 1일
You're welcome! If you have additional questions on how to improve the performance, feel free to ask.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by