Simulink PID Tuner can't find good solution

조회 수: 1 (최근 30일)
George Nehma
George Nehma 2023년 8월 2일
답변: Sam Chak 2023년 8월 19일
I have a 6DOF Aircraft dynamics model and am trying to control it with a few PID controllers for each aspect as shown in the image
I am trying to use the PID Tuner to find some good values for my gains, but everytime the solution just blows up as you can see. I have been able to manually tune the gains to control certain maneuovers, but am wondering why the PID Tuner App can't find some good values?
  댓글 수: 2
Sam Chak
Sam Chak 2023년 8월 2일
I don't think it's possible to tune all 5 PID controller blocks simultaneously. If each subsystem is fully decoupled, then I believe you can tune the corresponding PID controller one at a time.
I remember that the 6-DOF Aircraft dynamics are highly nonlinear, and the states are strongly coupled. If the 6-DOF Aircraft dynamics are linearized, could you please show the model?
George Nehma
George Nehma 2023년 8월 2일
편집: George Nehma 2023년 8월 2일
I just clicked into one of the controllers to tune, so I think I was trying to tune just one controller at a time.
You're correct, it is highly nonlinear and strongly coupled, but this is the State Space plant model the lineariser developed:
Plant =
A =
q_e2b q_e2b q_e2b q_e2b X_ECEF X_ECEF X_ECEF V_ECEF
q_e2b 3.922e-06 -4.374e-06 -1.362e-05 2.882e-05 0 0 0 0
q_e2b 6.998e-06 -7.805e-06 1.215e-05 -1.362e-05 0 0 0 0
q_e2b -2.247e-06 -3.395e-05 7.805e-06 4.374e-06 0 0 0 0
q_e2b -3.444e-05 -2.247e-06 -6.998e-06 -3.922e-06 0 0 0 0
X_ECEF 0 0 0 0 0 0 0 1
X_ECEF 0 0 0 0 0 0 0 0
X_ECEF 0 0 0 0 0 0 0 0
V_ECEF 36.66 -23.95 15.67 4.609 2.626e-06 -2.518e-05 1.362e-05 -0.07975
V_ECEF -85.19 -79.31 -22.86 42.48 1.493e-05 -9.18e-05 4.881e-05 0.04115
V_ECEF 72.41 -5.426 26.81 -7.521 6.389e-06 -3.864e-05 1.935e-05 -0.103
w_b 2.498 -14.11 2.514 4.886 6.064e-06 -3.658e-05 1.98e-05 -0.04206
w_b 1.146 0.6344 0.3719 -0.4382 8.646e-07 -5.229e-06 2.827e-06 -0.0002576
w_b -2.667 4.153 -1.422 -1.213 -2.684e-06 1.623e-05 -8.777e-06 0.01655
Integrator 0 0 0 0 -0.0004318 0.002611 -0.001412 0
Alt Controll 0 0 0 0 -0.002879 0.01741 -0.009414 0
Phi Controll 0.03005 0.02694 -0.05243 0.09356 -5.77e-09 -3.997e-09 -5.628e-09 0
V_ECEF V_ECEF w_b w_b w_b Integrator Alt Controll Phi Controll
q_e2b 0 0 0.1311 0.4082 0.2288 0 0 0
q_e2b 0 0 0.1176 0.2288 -0.4082 0 0 0
q_e2b 0 0 -0.2288 0.1176 0.1311 0 0 0
q_e2b 0 0 0.4082 -0.1311 0.1176 0 0 0
X_ECEF 0 0 0 0 0 0 0 0
X_ECEF 1 0 0 0 0 0 0 0
X_ECEF 0 1 0 0 0 0 0 0
V_ECEF 0.02421 -0.1031 -0.07382 0.9576 0.3644 0 0 -0.0009028
V_ECEF -0.4573 0.1663 -0.05092 -6.056 0.2514 0 0 -0.0006227
V_ECEF 0.1807 -0.1861 -0.07159 3.32 0.3534 0 0 -0.0008755
w_b -0.05897 -0.03856 -1.856 0 0.1926 0 0 0.02236
w_b 0.006346 -0.00436 0 -0.4747 0 0 0 0
w_b 0.01162 0.01981 0.004665 0 -0.2395 0 0 0.001105
Integrator 0 0 0 0 0 0 0 0
Alt Controll 0 0 0 0 0 0 -0.01 0
Phi Controll 0 0 0 0 0 0 0 -0.1
B =
Elevator
q_e2b 0
q_e2b 0
q_e2b 0
q_e2b 0
X_ECEF 0
X_ECEF 0
X_ECEF 0
V_ECEF 0.01426
V_ECEF -0.08832
V_ECEF 0.04811
w_b 0
w_b -0.05363
w_b 0
Integrator 0
Alt Controll 0
Phi Controll 0
C =
q_e2b q_e2b q_e2b q_e2b X_ECEF X_ECEF X_ECEF V_ECEF
Theta Contro -93.56 -52.43 -26.94 30.05 -0.004312 0.02611 -0.01413 0
V_ECEF V_ECEF w_b w_b w_b Integrator Alt Controll Phi Controll
Theta Contro 0 0 0 0 0 1 -0.01 0
D =
Elevator
Theta Contro 0

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

채택된 답변

Sam Chak
Sam Chak 2023년 8월 19일
This is a very high 16th-order coupled system. I'm not sure if it can be stablized by the PID controller. So I tried the LQR approach, and the closed-loop feedback appears to be stable.
A1 = [3.922e-06 -4.374e-06 -1.362e-05 2.882e-05 0 0 0 0; ...
6.998e-06 -7.805e-06 1.215e-05 -1.362e-05 0 0 0 0; ...
-2.247e-06 -3.395e-05 7.805e-06 4.374e-06 0 0 0 0; ...
-3.444e-05 -2.247e-06 -6.998e-06 -3.922e-06 0 0 0 0; ...
0 0 0 0 0 0 0 1; ...
0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 0 0; ...
36.66 -23.95 15.67 4.609 2.626e-06 -2.518e-05 1.362e-05 -0.07975; ...
-85.19 -79.31 -22.86 42.48 1.493e-05 -9.18e-05 4.881e-05 0.04115; ...
72.41 -5.426 26.81 -7.521 6.389e-06 -3.864e-05 1.935e-05 -0.103; ...
2.498 -14.11 2.514 4.886 6.064e-06 -3.658e-05 1.98e-05 -0.04206; ...
1.146 0.6344 0.3719 -0.4382 8.646e-07 -5.229e-06 2.827e-06 -0.0002576; ...
-2.667 4.153 -1.422 -1.213 -2.684e-06 1.623e-05 -8.777e-06 0.01655; ...
0 0 0 0 -0.0004318 0.002611 -0.001412 0; ...
0 0 0 0 -0.002879 0.01741 -0.009414 0; ...
0.03005 0.02694 -0.05243 0.09356 -5.77e-09 -3.997e-09 -5.628e-09 0];
A2 = [0 0 0.1311 0.4082 0.2288 0 0 0; ...
0 0 0.1176 0.2288 -0.4082 0 0 0; ...
0 0 -0.2288 0.1176 0.1311 0 0 0; ...
0 0 0.4082 -0.1311 0.1176 0 0 0; ...
0 0 0 0 0 0 0 0; ...
1 0 0 0 0 0 0 0; ...
0 1 0 0 0 0 0 0; ...
0.02421 -0.1031 -0.07382 0.9576 0.3644 0 0 -0.0009028; ...
-0.4573 0.1663 -0.05092 -6.056 0.2514 0 0 -0.0006227; ...
0.1807 -0.1861 -0.07159 3.32 0.3534 0 0 -0.0008755; ...
-0.05897 -0.03856 -1.856 0 0.1926 0 0 0.02236; ...
0.006346 -0.00436 0 -0.4747 0 0 0 0; ...
0.01162 0.01981 0.004665 0 -0.2395 0 0 0.001105; ...
0 0 0 0 0 0 0 0; ...
0 0 0 0 0 0 -0.01 0; ...
0 0 0 0 0 0 0 -0.1];
A = [A1 A2];
B = [0;
0;
0;
0;
0;
0;
0;
0.01426;
-0.08832;
0.04811;
0;
-0.05363;
0;
0;
0;
0];
C = [-93.56 -52.43 -26.94 30.05 -0.004312 0.02611 -0.01413 0 0 0 0 0 0 1 -0.01 0];
% LQR design
Q = 1e4*eye(length(A));
R = 1;
K = lqr(A, B, Q, R)
K = 1×16
1.0e+07 * 2.5596 -3.8716 0.0389 2.5615 -0.0000 0.0003 -0.0001 0.2496 0.1813 0.3216 0.4398 0.0563 6.6404 0.0000 -0.0000 0.0581
sys = ss(A-B*K, B, C, 0);
isstable(sys)
ans = logical
1
N = 1/dcgain(sys)
N = 100.0000
% closed-loop system
sys2 = ss(A-B*K, B*N, C, 0)
sys2 = A = x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x1 3.922e-06 -4.374e-06 -1.362e-05 2.882e-05 0 0 0 0 0 0 0.1311 0.4082 0.2288 0 x2 6.998e-06 -7.805e-06 1.215e-05 -1.362e-05 0 0 0 0 0 0 0.1176 0.2288 -0.4082 0 x3 -2.247e-06 -3.395e-05 7.805e-06 4.374e-06 0 0 0 0 0 0 -0.2288 0.1176 0.1311 0 x4 -3.444e-05 -2.247e-06 -6.998e-06 -3.922e-06 0 0 0 0 0 0 0.4082 -0.1311 0.1176 0 x5 0 0 0 0 0 0 0 1 0 0 0 0 0 0 x6 0 0 0 0 0 0 0 0 1 0 0 0 0 0 x7 0 0 0 0 0 0 0 0 0 1 0 0 0 0 x8 -3.65e+05 5.521e+05 -5530 -3.653e+05 3.062 -43.23 15.23 -3.559e+04 -2.585e+04 -4.586e+04 -6.272e+04 -8028 -9.469e+05 -1.426 x9 2.261e+06 -3.419e+06 3.433e+04 2.262e+06 -18.96 267.7 -94.32 2.204e+05 1.601e+05 2.84e+05 3.885e+05 4.972e+04 5.865e+06 8.832 x10 -1.231e+06 1.863e+06 -1.868e+04 -1.232e+06 10.33 -145.8 51.38 -1.201e+05 -8.72e+04 -1.547e+05 -2.116e+05 -2.709e+04 -3.195e+06 -4.811 x11 2.498 -14.11 2.514 4.886 6.064e-06 -3.658e-05 1.98e-05 -0.04206 -0.05897 -0.03856 -1.856 0 0.1926 0 x12 1.373e+06 -2.076e+06 2.086e+04 1.374e+06 -11.51 162.6 -57.27 1.338e+05 9.721e+04 1.725e+05 2.359e+05 3.02e+04 3.561e+06 5.363 x13 -2.667 4.153 -1.422 -1.213 -2.684e-06 1.623e-05 -8.777e-06 0.01655 0.01162 0.01981 0.004665 0 -0.2395 0 x14 0 0 0 0 -0.0004318 0.002611 -0.001412 0 0 0 0 0 0 0 x15 0 0 0 0 -0.002879 0.01741 -0.009414 0 0 0 0 0 0 0 x16 0.03005 0.02694 -0.05243 0.09356 -5.77e-09 -3.997e-09 -5.628e-09 0 0 0 0 0 0 0 x15 x16 x1 0 0 x2 0 0 x3 0 0 x4 0 0 x5 0 0 x6 0 0 x7 0 0 x8 0.5824 -8280 x9 -3.607 5.128e+04 x10 1.965 -2.793e+04 x11 0 0.02236 x12 -2.19 3.114e+04 x13 0 0.001105 x14 0 0 x15 -0.01 0 x16 0 -0.1 B = u1 x1 0 x2 0 x3 0 x4 0 x5 0 x6 0 x7 0 x8 1.426 x9 -8.832 x10 4.811 x11 0 x12 -5.363 x13 0 x14 0 x15 0 x16 0 C = x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 y1 -93.56 -52.43 -26.94 30.05 -0.004312 0.02611 -0.01413 0 0 0 0 0 0 1 -0.01 0 D = u1 y1 0 Continuous-time state-space model.
dcgain(sys2)
ans = 1.0000
stepinfo(sys2)
ans = struct with fields:
RiseTime: 3.2197e+05 TransientTime: 5.9513e+05 SettlingTime: 6.7426e+05 SettlingMin: 0.9000 SettlingMax: 0.9969 Overshoot: 0 Undershoot: 71.6491 Peak: 0.9969 PeakTime: 9.4624e+05
step(sys2, 1e6), grid on

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by