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

13 ビュー (過去 30 日間)
Hamidreza Jafarian
Hamidreza Jafarian 2016 年 4 月 7 日
回答済み: Harish Kumar Anandan 2018 年 3 月 27 日
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 Center および File ExchangeDynamic System Models についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by