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 Center および File ExchangePID Controller Tuning についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by