How to simulate a transfer function matrix of closed loop MIMO system?

조회 수: 8 (최근 30일)
Hi,
I have bi MIMO system with 7 inputs and 5 states and 5 outputs. I have simulate the open loop system using 'lsim' which shows the system is unstable. I designed a decentralized controller and now I want to show that my closed loop system is stable by simulating the transfer function matrix. However, now when I simulate the transfer function matrix using 'lsim' all the outputs are NAN. How can I simulate closed loop transfer function of MIMO system using matlab?
Thanks, Hamid
  댓글 수: 2
Ced
Ced 2016년 4월 7일
Open loop or closed loop does not matter for lsim. Assuming we are talking about a linear system (since you have a transfer function), all lsim knows is that there is some system with inputs and outputs. Whether that input is the control signal (open loop) or some reference signal (closed loop) is irrelevant.
I'm afraid that if everything is NaN, that points to a problem of your closed loop system rather than the lsim function.
How are you generating your closed loop TF? Have you checked that all the connections are fed back correctly?
Hamidreza Jafarian
Hamidreza Jafarian 2016년 4월 7일
Thank you Ced for your response. How can I make sure "all the connections are fed back correctly?"? This section of my code is as below:
controller=[comp11*cos(alpha_angle1) 0 0 0 0; comp11*sin(alpha_angle1) 0 0 0 0; 0 comp21*cos(alpha_angle2) 0 0 0; 0 comp21*sin(alpha_angle2) 0 0 0; 0 0 comp31*comp32 comp32 0; 0 0 0 0 comp32 0 0 0 0 0];
feedback_matrix = [1 0 0 0 0; 0 1 0 0 0; 0 0 1 0 0; 0 0 0 1 0; 0 0 0 0 1]; sys_closed_loop = feedback(controller'*sys_orig_tf',feedback_matrix);
"sys_orig_tf'" is my open loop transfer function with 7 inputs and 5 outputs.
Thanks, Hamid

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

채택된 답변

Ced
Ced 2016년 4월 7일
편집: Ced 2016년 4월 7일
Careful!!
sys_orig_tf' not only transposes your system, but takes the complex conjugate of it! This most likely completely changes your system. You probably don't want this. (Happened to me before too ...)
For the actual question, you can name your signals, that way matlab will issue a warning when there are missing connections or so. feedback has an option to use IO names, or alternatively you can use the connect function to specify which are the inputs and output of your systems. Connections with the same name are automatically matched. I think the help has some nice examples, let me know if you have questions.
One more thing:
You can define a feedthrough system (which your controller basically is) in a clean way using ss. E.g. if you have 3 inputs u, and want u1 = 1*pos, u2 = 2*vel, u3 = 5*acc, where pos, vel, acc are the three states/outputs you are feeding back (hypothetically) as compensation, you could
controller = ss([],[],[],diag([ 1 2 5 ]));
controller.InputName = {'pos','vel','acc'};
controller.OutputName = {'u1','u2','u3'};
Note that the output of your plant are the input of the controller ( and vice-versa ).
  댓글 수: 3
Hamidreza Jafarian
Hamidreza Jafarian 2016년 4월 7일
Hi Ced,
I tried to generate the system model as you said which is as below:
sys_orig_tf.u = {'md1','mq1','md2','mq2','md3','mq3','Vg'} sys_orig_tf.y = {'Vdc1','Vdc2','Vdc3','Id','Iq'}
D1 = tunableGain('Decoupler1',[cos(alpha_angle1); sin(alpha_angle1)]); D1.u = 'm1'; D1.y = {'md1','mq1'};
D2 = tunableGain('Decoupler2',[cos(alpha_angle2); sin(alpha_angle2)]); D2.u = 'm2'; D2.y = {'md2','mq2'};
PI1 = tunablePID('PI1','pi'); PI1.TimeUnit = 'milliseconds'; PI1.u = 'e1'; PI1.y = 'm1'; PI1.Kp.Value = 4; % initialize Kp to 4 PI1.Ki.Value = 0.7; % initialize Kd to 0.7
PI2 = tunablePID('PI2','pi'); PI2.TimeUnit = 'milliseconds'; PI2.u = 'e2'; PI2.y = 'm2'; PI2.Kp.Value = 4; % initialize Kp to 4 PI2.Ki.Value = 0.7; % initialize Ki to 0.7
PI3 = tunablePID('PI3','pi'); PI3.TimeUnit = 'milliseconds'; PI3.u = 'e3'; PI3.y = 'Id_ref'; PI3.Kp.Value = 4; % initialize Kp to 4 PI3.Ki.Value = 0.7; % initialize Ki to 0.7
PI4 = tunablePID('PI4','pi'); PI4.TimeUnit = 'milliseconds'; PI4.u = 'e4'; PI4.y = 'md3'; PI4.Kp.Value = 4; % initialize Kp to 4 PI4.Ki.Value = 0.7; % initialize Ki to 0.7
PI5 = tunablePID('PI5','pi'); PI5.TimeUnit = 'milliseconds'; PI5.u = 'e5'; PI5.y = 'mq3'; PI5.Kp.Value = PI4.Kp.Value; % initialize Kp to 4 PI5.Ki.Value = PI4.Ki.Value; % initialize Kd to 0.7
Sum1 = sumblk('e1 = r1 - Vdc1'); Sum2 = sumblk('e2 = r2 - Vdc2'); Sum3 = sumblk('e3 = r3 - Vdc3'); Sum4 = sumblk('e4 = Id_ref - Id'); Sum5 = sumblk('e5 = r4 - Iq');
sys_closed_loop = connect(sys_orig_tf,D1,D2,PI1,PI2,PI3,PI4,PI5,Sum1,Sum2,Sum3,Sum4,Sum5,'r1','r2','r3','r4','Vg','Vdc1','Vdc2','Vdc3','Id','Iq');
Now, when I simulate I get this error: Error using DynamicSystem/connect (line 286) Input argument 14 is not a dynamic system or has some unspecified I/O names.
I think it refers to "r1" but I can not figure out why I get this issue. do you have any idea?
Thanks, Hamid
Ced
Ced 2016년 4월 8일
편집: Ced 2016년 4월 8일
Hi
You can transpose it, just not with ', which in matlab is the hermitian operator (i.e. complex conjugate transpose). You need to use either .' (with the dot) or transpose.
Example:
% System with 1 input, 2 outputs
% Each tf is 1/(s^2 + s + 1)
P = tf({1 ; 1},{[1 1 1];[1 1 1]});
% Hermitian system: 2 inputs, 1 output
% Each tf is 1/(s^2 - s + 1), NOTE the minus!
P'
% Transposed system: 2 inputs, 1 output
% Each tf is 1/(s^2 + s + 1)
P.'
transpose(P)
I'm not sure I understand why exactly you need to transpose your system though. Generally, it would be P*C.
Then, for the second issue: You need to specify the I/O names as cells of strings, otherwise Matlab cannot know which ones are supposed to be inputs and which ones outputs, i.e.
cl_u = {'r1','r2','r3','r4'};
cl_y = {'Vg','Vdc1','Vdc2','Vdc3','Id','Iq'};
sys_closed_loop = connect(sys_orig_tf,D1,D2,PI1,PI2,PI3,PI4,PI5,Sum1,Sum2,Sum3,Sum4,Sum5, cl_u, cl_y);

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

추가 답변 (1개)

Harish Kumar Anandan
Harish Kumar Anandan 2018년 3월 27일
I have a 2 input 2 output system and I have designed H-infinity controller for the system, Now when I try to get step response how to give feedback command? sO FAR I HAVE WORKED WITH
% step response plant1stp=sbs (g11,g12); plant2stp=sbs (g21,g22); overalplant=abv(plant1stp,plant2stp); loop1=mmult(overalplant,hinf_cont); [l,m,n,o]=unpck(loop1);
disp('step responses') clf step(l1,m1,n1,o1,2)

카테고리

Help CenterFile Exchange에서 Dynamic System Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by