adding a communication delay in simulink

4 visualizzazioni (ultimi 30 giorni)
I am trying to make a control system block diagram in simulink. I previously made a transfer function with internal communication delay in MATLAB. I am trying to recreate the results in simulink. I used a LTI block to write down in a block, then I simulated the system. Without the delay, I get matching results (with the MATLAB code and simulink) but not with the delay. Is there another way to add the delay?

Risposta accettata

Paul
Paul il 27 Mag 2022
Try using the LTI System block.
  28 Commenti
Paul
Paul il 12 Giu 2022
Repeating the code from above:
theta=0.02;
kp=0.2;
kd=0.68;
taup=0.1;
tau=0.1;
h=0.5;
kdd=0;
s=tf('s');
Gamma2=((exp(-theta*s)*s^2)+(kd*s)+kp)/((h*s+1)*(s^2+(kd*s)+kp));
tf_b=((0.5*s)+1)/(s^2)*(kp + kd*s);
Now sub in the Pade approximant into Gamma2
tempsys = pade(Gamma2)
tempsys = A = x1 x2 x3 x4 x5 x6 x7 x8 x9 x1 1 0 0 0 0 0 0 0 0 x2 0 1 0 0 0 0 0 0 0 x3 0 0 1 0 0 0 0 -2 0 x4 0 0 0 1 0 0 0 0 0 x5 0 0 0 0 1 0 0 -2 0 x6 0 0 0 0 0 -2.68 -1.56 -0.8 0 x7 0 0 0 0 0 1 0 0 0 x8 0 0 0 0 0 0 0.5 0 0 x9 16 0 0 0 0 0 0 0 -100 B = u1 x1 0 x2 0 x3 0 x4 0 x5 0 x6 2 x7 0 x8 0 x9 0 C = x1 x2 x3 x4 x5 x6 x7 x8 x9 y1 -1 0 0 0.68 0 0 0 0.4 12.5 D = u1 y1 0 E = x1 x2 x3 x4 x5 x6 x7 x8 x9 x1 0 1 0 0 0 0 0 0 0 x2 0 0 1 0 0 0 0 0 0 x3 0 0 0 0 0 0 0 0 0 x4 0 0 0 0 1 0 0 0 0 x5 0 0 0 0 0 0 0 0 0 x6 0 0 0 0 0 1 0 0 0 x7 0 0 0 0 0 0 1 0 0 x8 0 0 0 0 0 0 0 1 0 x9 0 0 0 0 0 0 0 0 1 Continuous-time state-space model.
We see that tempsys has nine states and is still in descriptor form. Convert to zpk form:
tempsys = zpk(tempsys)
tempsys = -2 (s-101.4) (s^2 + 0.6748s + 0.1973) ------------------------------------- (s+100) (s+2) (s^2 + 0.68s + 0.2) Continuous-time zero/pole/gain model.
We see that, in reality, tempsys really only has four states in the input/ouput relationship. I'm going to speculate that when presented with a model in descriptor form, hinfnorm() does something similar and gets rid of the extraneous states. The we see that
hinfnorm(tempsys)
ans = 1.0000
On the Simulink side, the linearizer operates in a way that is functionally equivalent to this (I think it actually uses connect() )
D = pade(exp(-theta*s),1);
P = tf(1,[h 1]);
Gamma3 = series(parallel(D,tf([kd kp],[1 0 0 ])),feedback(P,tf_b));
zpk form of Gamma3 shows
zpk(Gamma3)
ans = -2 s^2 (s-101.4) (s^2 + 0.6748s + 0.1973) ----------------------------------------- s^2 (s+100) (s+2) (s^2 + 0.68s + 0.2) Continuous-time zero/pole/gain model.
Note that Gamma3 has two poles at the origin, which is why
hinfnorm(Gamma3)
ans = Inf
But those poles cancel with the zeros at the origin.
Gamma3 = zpk(minreal(Gamma3))
Gamma3 = -2 (s-101.4) (s^2 + 0.6748s + 0.1973) ------------------------------------- (s+100) (s+2) (s^2 + 0.68s + 0.2) Continuous-time zero/pole/gain model.
And we see that
hinfnorm(Gamma3)
ans = 1.0000
as expected.
It looks like hinfnorm(), or something it calls, is doing the minimal realization when presented with a descriptor model. Simulink linearizer does not do the minimal realization and leaves that step up to the user (which is the correct thing to do, IMO).
Kashish Pilyal
Kashish Pilyal il 13 Giu 2022
Thank you for the help

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Time and Frequency Domain Analysis in Help Center e File Exchange

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by