Plot step response for control signal (u1 u2 ...) in a MIMO system with feedback
22 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Cesar Adolfo Cruz Vargaya
le 21 Nov 2022
Réponse apportée : Sam Chak
le 26 Nov 2022
0) Especify aditional variables and its values (use space as separator)
otherVars = "K1 K2 B1 B2 m1 m2"; otherVars = split(otherVars);
valueVars = "1 1 1 1 1 1"; valueVars = split(valueVars);
if length(otherVars) == length(valueVars)
arrayfun(@eval,strcat(otherVars,'=',valueVars));
else
warning("Number of variables not equal to its values")
return
end
1) Define the state space matrices
% STATE SPACE REPRESENTATION
AA = [0 0 1 0;0 0 0 1;-K1/m1 K1/m1 -B1/m1 B1/m1;K1/m2 -(K1+K2)/m2 -B1/m2 -(B1+B2)/m2];
BB = [0 0;0 0;1/m1 0;0 1/m2];
CC = [1 0 0 0;0 1 0 0];
DD = [0 0;0 0];
1.1) Define the value of for every
T = [4 4]; I = eye(size(DD,1)); s = tf('s');
2) Obtain the plant transfer function
Gp = tf(ss(AA,BB,CC,DD))
Gp.TimeUnit = 'seconds';
Gp.InputName = 'u';
Gp.OutputName = 'y';
3) Obtain the open loop transfer function
Go = (1/s)*diag(1./T)
4) Obtain the full process transfer function
G = feedback(Go,I)
5) Obtain the PID controller block transfer function
Gc = Gp\Go; Gc = minreal(Gc)
Gc.TimeUnit = 'seconds';
Gc.InputName = 'e';
Gc.OutputName = 'u';
6) Plot the step response from input r to output y
timeLimit = 40;
Sum1 = sumblk('e=r-y',size(T,2));
Cnt = connect(Gc,Gp,Sum1,'r','y','u');
step(Cnt,timeLimit,'r'), grid on
7) Plot the response from input r to output u (problem here)
Tp = getIOTransfer(Cnt,'r','u');
step(Tp,timeLimit,'r'), grid on
I want to obtain the plots for U as this one, is the same problem but the data is obtained through a for loop
This is the original diagram block that I'm trying to simulate without using for loops
0 commentaires
Réponse acceptée
Amey Waghmare
le 25 Nov 2022
As per my understanding, you want to plot the response of the system from ‘r’ to ‘u’ but receive the error ‘Cannot simulate the time response of improper (non-causal) models’.
In order to obtain the step response of a system, the system should be ‘causal’ or ‘proper’. A proper system is a one having at least as many poles as zeros or number of poles is greater than number of zeros. To check if a system is proper, you can use the following command;
isproper(sys)
In the code, the Transfer function ‘Tp’ is improper, specifically the transfer functions from r1 to u1 and r2 to u2 are non-causal, with number of poles being 12 and number of zeros being 13 and hence it is not possible to obtain the step response.
2 commentaires
Paul
le 26 Nov 2022
Hi Cesar,
Tp is not the controller block. That is, Tp is not equal to Gc. Tp is the closed-loop transfer function from r to u; Gc is just the transfer function from e to u. These are not the same thing.
Correct. connect does not execute minreal AFAIK. But I don't see how that's relevant here.
Can you clarify this statement: "if a T.F. is improper then it's graph shouldn't be able to tend to a value."
The design approach used in the Question could be slightly modified so that we can generate the step response from r to us. But those won't look like either set of plots that have been shown.
Plus de réponses (1)
Sam Chak
le 26 Nov 2022
The original plant is a coupled 2nd-order MIMO system. If the desired closed-loop transfer function is a 1st-order system, this suggests there is loss of information, and in your case, the velocity becomes unobservable.
By redesigning your desired , see example below, you should be able to make proper.
Moreover, the settling time of the closed-loop transfer function is almost the same as the time in the previous .
otherVars = "K1 K2 B1 B2 m1 m2"; otherVars = split(otherVars);
valueVars = "1 1 1 1 1 1"; valueVars = split(valueVars);
if length(otherVars) == length(valueVars)
arrayfun(@eval,strcat(otherVars,'=',valueVars));
else
warning("Number of variables not equal to its values")
return
end
AA = [0 0 1 0;0 0 0 1;-K1/m1 K1/m1 -B1/m1 B1/m1;K1/m2 -(K1+K2)/m2 -B1/m2 -(B1+B2)/m2];
BB = [0 0;0 0;1/m1 0;0 1/m2];
CC = [1 0 0 0;0 1 0 0];
DD = [0 0;0 0];
T = [4 4];
I = eye(size(DD, 1));
s = tf('s');
Gp = tf(ss(AA, BB, CC, DD))
Gp.TimeUnit = 'seconds';
Gp.InputName = 'u';
Gp.OutputName = 'y';
w = 5/13;
Go = tf(w^2, [1 2*w 0])
Gc = Gp\Go;
Gc = minreal(Gc)
Gc.TimeUnit = 'seconds';
Gc.InputName = 'e';
Gc.OutputName = 'u';
timeLimit = 40;
Sum1 = sumblk('e = r - y', size(T, 2));
Cnt = connect(Gc, Gp, Sum1, 'r', 'y', 'u');
step(Cnt, timeLimit), grid on
Tp = getIOTransfer(Cnt, 'r', 'u');
Tp = minreal(tf(Tp))
step(Tp, timeLimit, 'r'), grid on
0 commentaires
Voir également
Catégories
En savoir plus sur Classical Control Design dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!