Modelarea si Simularea unui sistem electric
Se considera un circuit RLC:
intr: U(t)
ies: UL
R1=5
R2=100
C=150uF
L=5H
Formule:
Legea lui Ohm->
;
Aceasta schema simuleaza un proces electric in care avem o intrare, respectiv o iesire.
In aceasta schema sunt 3 tipuri fundamentale de comportament din punct de vedere energetic :
Element de tip I (Inductiv):
Aceste elemente modeleaza un comportament de tip acumulativ de energie similar comportamentului bobinelor, sau similar comportamentului maselor in miscare cu energie cinetica.
Element de tip C (Capacitiv):
Modeleaza elemente fizice care acumuleaza energie similar condensatoarelor.
Element de tip R (rezistiv):
Modeleaza elemente similare ca si comportament cu rezistente.
Aceste elemente sunt denumite:
I,C -> acumulative
R -> disipatoare
Din punct de vedere energetic rationamentele sunt similare pentru orice domeniu al fizici.Fiecare domeniu utilizeaza variabile specifice pentru descrierea fenomenelor.
Modelarea sistemului:
In acest process electric am folosit doua legi ale fizicii:
Legea lui Ohm
Legea II a lui Kirchoff
Calculele pentru modelarea matematica:
Modelul I/O
i1=i2+i3
U(t)=i1*R1+i2*R2+UC
0=UL-UC-i2*R2=>+i2R2=UL
i3=
UC=
U(t)=i1*R1+UL=>i1=
i2=i1-i3=
U(t)=U-UL+
=>
Modelul ISO
ISO:
U(t)=R1+R2+C
y=Cx+Du
Pentru simularea sistemului continuu si discret am ales testarea sistemului la semnalul treapta, impuls si rampa.
Model I/O
Treapta
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
clear all;
close all;
clc;
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
figure(1);
step(num,den)
xlabel('Treapta cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
[num,den]=c2dm(num,den,0.01,'zoh')
figure(1)
dstep(num,den)
xlabel('Treapta cu semnal discret')
Impuls
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
[num,den]=c2dm(num,den,0.01,'zoh')
t=0:0.1:10;
u=t;
impulse(num,den)
xlabel('Impuls cu semnal continuu');
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
[num,den]=c2dm(num,den,0.01,'zoh')
t=0:0.1:10;
u=t;
dimpulse(num,den,u)
xlabel('Impuls cu semnal discret');
Rampa
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
t=0:0.1:10;
u=t;
dlsim(num,den,u)
xlabel('Rampa cu semnal continuu');
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 ];
[num,den]=c2dm(num,den,0.01,'zoh')
t=0:0.1:10;
u=t;
dlsim(num,den,u)
xlabel('Rampa cu semnal discret');
Model ISO
Treapta
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
ts=0.0000001;
[num,den]=ss2tf(A,B,C,D);
figure(1)
step(num,den)
xlabel('Treapta cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
ts=0.0000001;
[num,den]=ss2tf(A,B,C,D);
[num,den]=c2dm(num,den,ts,'zoh')
figure(1)
dstep(num,den)
xlabel('Treapta cu semnal discret')
Impuls
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
ts=0.0000001;
[num,den]=ss2tf(A,B,C,D);
figure(1)
impulse(num,den)
xlabel('Impuls cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
ts=0.0000001;
[num,den]=ss2tf(A,B,C,D);
[num,den]=c2dm(num,den,ts,'zoh')
figure(1)
dimpulse(num,den)
xlabel('Impulse cu semnal discret')
Rampa
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
t=0:0.1:10;
u=t;
[num,den]=ss2tf(A,B,C,D);
figure(1)
dlsim(num,den,u)
xlabel('Rampa cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
t=0:0.1:10;
u=t;
ts=0.0000001;
[num,den]=ss2tf(A,B,C,D);
[num,den]=c2dm(num,den,ts,'zoh')
figure(1)
dlsim(num,den,u)
xlabel('Rampa cu semnal discret')
Pentru analiza stabilitatii am ales diagrama Nyquist si Bode in frecventa.
I/O
Bode
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
clear all;
close all;
clc;
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
figure(1);
bode(num,den)
xlabel('Diagrama Bode cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
[num,den]=c2dm(num,den,0.01,'zoh')
figure(1)
bode(num,den)
xlabel('Diagrama Bode cu semnal discret')
Nyquist
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
clear all;
close all;
clc;
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
figure(1);
nyquist(num,den)
xlabel('Diagrama Nyquist cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81 0];
[num,den]=c2dm(num,den,0.001,'zoh')
figure(1)
nyquist(num,den)
xlabel('Diagrama Nyquist cu semnal discret')
ISO
Bode
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
[num,den]=ss2tf(A,B,C,D);
figure(1)
bode(num,den)
xlabel('Diagrama Bode cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
ts=0.0000001;
[num,den]=ss2tf(A,B,C,D);
[num,den]=c2dm(num,den,ts,'zoh')
figure(1)
Bode(num,den)
xlabel('Diagrama Bode cu semnal discret')
Nyquist
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
[num,den]=ss2tf(A,B,C,D);
figure(1)
nyquist(num,den)
xlabel('Diagrama Nyquist cu semnal continuu')
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
D=0;
ts=0.0000001;
[num,den]=ss2tf(A,B,C,D);
[num,den]=c2dm(num,den,ts,'
figure(1)
nyquist(num,den)
xlabel('Diagrama Nyquist cu semnal discret')
Observabilitatea si Controlabilitatea
Model I/O
clear all
close all
num=[0.0418 44.44 ];
den=[1 47.77 14814814.81]
[A,B,C]=tf2ss(num,den);
n=length(A);
Mc=Ctrb(A,B);
Mo=Obsv(A,C);
Rank(Mc);
Rank(Mo);
disp('Sistemul este:')
if n==Rank(Mc)
disp('Controlabil,')
else
disp('Necontrolabil,')
end
disp('si')
if n==Rank(Mo)
disp('Observabil.')
else
disp('Neobservabil.')
end
[ABAR,BBAR,CBAR,T,K] = CTRBF(A,B,C)
Model ISO
clc
clear all
close all
R1=50;
R2=100;
C=0.00015;
L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0];
n=length(A);
Mc=Ctrb(A,B);
Mo=Obsv(A,C);
Rank(Mc);
Rank(Mo);
disp('Sistemul este:')
if n==Rank(Mc)
disp('Controlabil,')
else
disp('Necontrolabil,')
end
disp('si')
if n==Rank(Mo)
disp('Observabil.')
else
disp('Neobservabil.')
end
[ABAR,BBAR,CBAR,T,K] = CTRBF(A,B,C)
Identificarea experimentala
Pentru identificarea sistemului am ales functia ARX nerecursiva
Model I/O
Implementarea programului :
num=[0.0418 44.44 0];
den=[1 47.77 14814814.81];
Ts=0.1;
t=0:Ts:10;
sysc=tf(num,den);
sysd = c2d(sysc,Ts,'
u=ones(size(t));
u=square(t);u=u';
%bucla deschisa fara zg
y=lsim(sysd,u,t);
stairs(t,y);
save date_bd_fz u y Ts;
%bucla deschisa cu zg
zg=(2*rand(size(y))-1)*0.01;
y=y+zg
figure(2);
stairs(t,y);
save date_bd_cz u y Ts;
%bucla inchisa fara zg
ut=u
sysi=feedback(sysd,1,-1);
y=lsim(sysi,ut,t);
u=ut-y;
y1=y
figure(3);
stairs(t,y)
save date_bi_fz u y Ts;
%bucla inchisa cu zg var1
y=y+zg
save date_bi_cz1 u y Ts;
%bucla inchisa cu zg var2
sys2=feedback(1,sysd,-1);
y2=lsim(sys2,zg,t);
y=y1+y2;
u=ut-y;
save date_bi_cz2 u y Ts;
%----- ----- --------------identificare----- ----- ----------------
clear all;
close all;
clc;
m=menu('alegeti datele dorite','bucla deschisa fara zg','bucla deschisa cu zg','bucla inchisa fara zg','bucla inchisa cu zgomot var1','bucla inchisa cu zgomot var2')
if m==1 ;
load date_bd_fz;
end
if m==2 ;
load date_bd_cz;
end
if m==3;
load date_bi_fz;
end
if m==4;
load date_bi_cz1;
end
if m==5
load date_bi_cz2
end
dat=iddata(y,u,Ts);
nn=[3 3 0];
M=arx(dat,nn);
yest=idsim(u,M);
eest=yest-y;
plot(yest,'r');hold on;
plot(y,'.b');
figure
plot(eest)
Model ISO
R1=50; R2=100; C=0.00015; L=5;
A=[-(R1+R2)/C -1/C ; 1/L 0 ];
B=[1/C ; 0];
C=[1 0]; D=0;
[num,den]=ss2tf(A,B,C,D);
Ts=0.1;
t=0:Ts:10;
sysc=tf(num,den);
sysd = c2d(sysc,Ts,'
u=ones(size(t));
u=square(t);u=u';
%bucla deschisa fara zg
y=lsim(sysd,u,t);
stairs(t,y);
save date_bd_fz u y Ts;
%bucla deschisa cu zg
zg=(2*rand(size(y))-1)*0.01;
y=y+zg
figure(2);
stairs(t,y);
save date_bd_cz u y Ts;
%bucla inchisa fara zg
ut=u
sysi=feedback(sysd,1,-1);
y=lsim(sysi,ut,t);
u=ut-y;
y1=y
figure(3);
stairs(t,y)
save date_bi_fz u y Ts;
%bucla inchisa cu zg var1
y=y+zg
save date_bi_cz1 u y Ts;
%bucla inchisa cu zg var2
sys2=feedback(1,sysd,-1);
y2=lsim(sys2,zg,t);
y=y1+y2;
u=ut-y;
save date_bi_cz2 u y Ts;
%----- ----- --------------identificare----- ----- ----------------
clear all;
close all;
clc;
m=menu('alegeti datele dorite','bucla deschisa fara zg','bucla deschisa cu zg','bucla inchisa fara zg','bucla inchisa cu zgomot var1','bucla inchisa cu zgomot var2')
if m==1 ;
load date_bd_fz;
end
if m==2 ;
load date_bd_cz;
end
if m==3;
load date_bi_fz;
end
if m==4;
load date_bi_cz1;
end
if m==5
load date_bi_cz2
end
dat=iddata(y,u,Ts);
nn=[3 3 0];
M=arx(dat,nn);
yest=idsim(u,M);
eest=yest-y;
plot(yest,'r');hold on;
plot(y,'.b');
figure
plot(eest)
Afisarea grafica :
Model I/O
Treapta
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Impuls
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Rampa
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Model ISO
Treapta
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Impuls
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Rampa
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
I/O
Bode
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Nyquist
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
ISO
Bode
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Nyquist
-------- ----- ------ ---Semnal continuu-------- ----- ------ --
-------- ----- ------ ---Semnal discret-------- ----- ------ -----
Observabilitatea si Controlabilitatea
Model I/O
den =
1.0e+007 *
0.0000 0.0000 1.4815
Sistemul este:
Controlabil,
si
Observabil.
ABAR =
1.0e+007 *
0 0.0000
-1.4815 -0.0000
BBAR =
0
1
CBAR =
1.0e+005 *
-6.1926 0.0004
T =
0 1
1 0
K =
1 1
Model ISO
Sistemul este:
Controlabil,
si
Observabil.
ABAR =
1.0e+006 *
0 0.0000
-0.0067 -1.0000
BBAR =
1.0e+003 *
CBAR =
1
T =
1
0
K =
1
Identificarea experimentala
Model I/O
Bucla deschisa fara zgomot
Bucla deschisa cu zgomot
Bucla inchisa fara zgomot
Bucla inchisa cu zgomot var1
Bucla inchisa cu zgomot var2
Model ISO
Bucla deschisa fara zgomot
Bucla deschisa cu zgomot
Bucla inchisa fara zgomot
Bucla inchisa cu zgomot var1
Bucla inchisa cu zgomot var2
Politica de confidentialitate |
.com | Copyright ©
2024 - Toate drepturile rezervate. Toate documentele au caracter informativ cu scop educational. |
Personaje din literatura |
Baltagul – caracterizarea personajelor |
Caracterizare Alexandru Lapusneanul |
Caracterizarea lui Gavilescu |
Caracterizarea personajelor negative din basmul |
Tehnica si mecanica |
Cuplaje - definitii. notatii. exemple. repere istorice. |
Actionare macara |
Reprezentarea si cotarea filetelor |
Geografie |
Turismul pe terra |
Vulcanii Și mediul |
Padurile pe terra si industrializarea lemnului |
Termeni si conditii |
Contact |
Creeaza si tu |