Vẽ đường cong quá trình quá độ Kết quả chạy chương trình như sau: Hình 1.. Kết quả mô phỏng trên VisualBas 6.. Dùng Matlab – Simulink mô phỏng lại hệ thống 1... Kết quả mô phỏng bằng Ma
Trang 1BÀI TẬP LỚN
MÔ HÌNH HÓA HỆ THỐNG
Sinh viên: Nguyễn Đức Dũng Lớp: DTD53-DH2 MSV: 45880
Đề 07: Dùng máy tính khảo sát quá trình quá độ của hệ thống điều khiển tự động
Cho hệ thống điều khiển tự động có sơ đồ cấu trúc như sau:
K1=50; K2=5; K3=0,5; T1=0,1; T2=0,01; T3=0,2
Nhiệm vụ của sinh viên:
1) Viết phương trình sai phân
* Tính W(p)
W(s) =
1 2 3
1 T s (1 T s)(1 T s)
K K K 1
(1 T s)(1 T s)(1 T s)
K K
T T T s T T s (T T T T T T )s 1 K K K
Thay s= 2 z 1
T z 1
1 1
K
1 T s
2
K (1 T s)(1 T s)
K 3
_
Trang 2W(z) =
1 2
K K
Nhân cả tử và mẫu với T3(z+1)3 Ta được:
3 3
1 2
K K T z 1
Az Bz C z D
Với:
A = 8T1T2T3+4(T1T2+T2T3+T1T3)T+2(T1+T2+T3)T2+(1+K1K2K3)T3
B = -24T1T2T3+4(-T1T2-T2T3-T1T3)T+2(T1+T2+T3)T2+(3+3K1K2K3)T3
C = 24T1T2T3+4(-T1T2-T2T3-T1T3)T+2(-T1-T2-T3)T2+(3+3K1K2K3)T3
D = -8T1T2T3+4(T1T2+T2T3+T1T3)T+2(-T1-T2-T3)T2+(1+K1K2K3)T3
Ta có hàm sai phân như sau:
3
1 2
K K T z 1
Y(z)
U(u) Az Bz C z D
Y(z)(Az3 + Bz2 + Cz+D) = K1K2T3(z+1)3U(z)
Az3 Y(z) + Bz2 Y(z) + CzY(z)+DY(z) = K1K2T3(z3U(z) + 3z2U(z) + 3zU(z) + U(z)) AY(k+3) + BY(k+2) + CY(k+1) + DY(k) = K1K2T3[U(k+3) + 3u(k+2) + 3U(k+1) + U(k)]
u(t) = 1(t) nên u(k+3) = u (k+2) = u(k+1) = u(k) = 1
Vậy ta có:
AY(k+3) + BY(k+2) + CY(k+1) + D(k) = 8K1K2T3
Trang 3Ta có phương trình sai phân:
3
1 2 8K K T
2 Viết phương trình mô phỏng
Private Sub close_Click()
MsgBox ("ket thuc chuong trinh")
End
End Sub
Private Sub ve_Click()
Dim k1 As Double
Dim k2 As Double
Dim k3 As Double
Dim t As Double
Dim Y(1000) As Double
Dim u(1000) As Double
k1 = txtK1.Text
k2 = txtK2.Text
k3 = txtK3.Text
t1 = txtT1.Text
t2 = txtT3.Text
t3 = txtT3.Text
t = txtT.Text
A = 8 * t1 * t2 * t3 + 4 * t1 * t2 * t + 2 * t ^ 2 * t1 + 2 * t ^ 2 * t2 + 2 * t ^ 2 * t3 +
2 * t ^ 2 * t1 * t3 + 2 * t ^ 2 * t2 * t3 + t ^ 3 + k1 * k2 * k3 * t3
Trang 4B = -24 * t1 * t2 * t3 - 4 * t1 * t2 * t + 2 * t ^ 2 * t1 + 2 * t ^ 2 * t2 + 2 * t ^ 2 * t3 + 2 * t ^ 2 * t1 * t3 + 2 * t ^ 2 * t2 * t3 + 3 * t ^ 3 + 3 * k1 * k2 * k3 * t3
C = 24 * t1 * t2 * t3 - 4 * t1 * t2 * t - 2 * t ^ 2 * t1 - 2 * t ^ 2 * t2 - 2 * t ^ 2 * t3 - 2
* t ^ 2 * t1 * t3 - 2 * t ^ 2 * t2 * t3 + 3 * t ^ 3 + 3 * k1 * k2 * k3 * t3
D = -8 * t1 * t2 * t3 - 4 * t1 * t2 * t - 2 * t ^ 2 * t1 - 2 * t ^ 2 * t2 - 2 * t ^ 2 * t3 - 2
* t ^ 2 * t1 * t3 - 2 * t ^ 2 * t2 * t3 + t ^ 3 + k1 * k2 * k3 * t3
E = 8 * k1 * k2 * t ^ 3
For k = 0 To 997
Y(k + 2) = (-B / A) * Y(k + 2) + (-C / A) * Y(k + 1) + (-D / A) * Y(k) + E / A Next k
For i = 0 To 100
If i Mod 10 = 0 Then
txty.Text = txty + " " + "y[" + CStr(i) + "] = " + Format(CStr(Y(i)),
"#0.0000000") + vbNewLine
End If
Next i
' cac chi tieu chat luong
'dau ra on dinh yod
yod = Y(1000)
ykod.Text = yod
'ymax
ymax = Y(1)
For k = 1 To 1000
If Y(k) > ymax Then
ymax = Y(k)
End If
Trang 5Next k
ykmax.Text = ymax
'do qua dieu chinh omax
omax = 100 * (ymax - yod) / yod
qdc.Text = omax
' Thoi gian qua do
Tqd = 1000
Do While (Abs(Y(Tqd) - yod) < 0.05) Tqd = Tqd - 1
Loop
Tqd = Tqd * t
txtTod.Text = Tqd
' Tmax
tmax = 0
For k = 1 To 1000
If Y(k) = ymax Then
tmax = k * t
End If
Next k
tmax.Text = tmax
' ve do thi
dothi1_Click
dothi1.ForeColor = vbBlue
k = 0
w = 0
dothi1.CurrentX = X
Trang 6dothi1.CurrentY = w
For k = 1 To 1000
X = k * 0.01
w = Y(k)
dothi1.Line -(X, w)
Next k
End Sub
Private Sub dothi1_Click()
Dim i As Single
dothi1.Scale (-0.1, 9)-(4, -0.5) ' tao khung toa do
dothi1.Line (-0.1, 0)-(4, 0), vbBlack ' Draw X axis
For i = 0 To 4 Step 0.5
dothi1.Line (i, -0.1)-(i, 0), vbBlack ' Ðánh dâ'u
If i * 10 Mod 5 = 0 Then dothi1.Print i
Next i
dothi1.Line (0, -0.1)-(0, 9), vbBlack ' Draw Y axis
For i = 0 To 9 Step 0.5
dothi1.Line (-0.1, i)-(0, i), vbBlack ' ve duong thang
If i * 10 Mod 2 = 0 Then dothi1.Print i ' danh so
Next i
End Sub
3 Chọn số bước tính
Chọn k = 1000 để hệ ổn định
4 In kết quả
In 100 giá trị của y[k] – cách 10 giá trị in một số Kết quả như sau: y[0] = 0,00000
Trang 7y[10] = 3,68448
y[20] = 32,03244
y[30] = -4461,06121
y[40] = -284526,13747
y[50] = -6793502,71019
y[60] = 149107193,53138
y[70] = 19529955477,02810
y[80] = 741082475430,86900
y[90] = 3860719448918,80000
y[100] = -1098015348216610,00000
y[110] = -63078218070728100,00000
y[120] = -1315507434488950000,00000
y[130] = 42832916022369100000,00000
y[140] = 4497917775195740000000,00000
y[150] = 155825809834508000000000,00000
y[160] = 127280430092793000000000,00000
y[170] = -265991219719729000000000000,00000
y[180] = -13867487266353400000000000000,00000
y[190] = -246191638351017000000000000000,00000 y[200] = 11623352234149500000000000000000,00000 y[210] = 1026817236717670000000000000000000,00000 y[220] = 32346110477408500000000000000000000,00000
Trang 8y[230] = -136479612541711000000000000000000000,00000
y[240] = -63570601045505100000000000000000000000,00000
y[250] = -3022375478643470000000000000000000000000,00000
y[260] = -43865342165956500000000000000000000000000,00000
y[270] = 3035552854226180000000000000000000000000000,00000
y[280] = 232433782971078000000000000000000000000000000,00000
y[290] = 6614636150777710000000000000000000000000000000,00000
y[300] = -67179174483246700000000000000000000000000000000,00000
y[310] = -15014373592445400000000000000000000000000000000000,00000 y[320] = -652723131454455000000000000000000000000000000000000,00000 y[330] = -7225244336363390000000000000000000000000000000000000,00000 y[340] = 770891244214737000000000000000000000000000000000000000,00000 y[350] =
52181464618815200000000000000000000000000000000000000000,00000
y[360] =
1328623316235240000000000000000000000000000000000000000000,00000 y[370] =
-23102990778674900000000000000000000000000000000000000000000,00000 y[380] =
-3508744848681370000000000000000000000000000000000000000000000,00000 y[390] =
-139588202562866000000000000000000000000000000000000000000000000,000 00
Trang 9y[400] =
-1024263033259720000000000000000000000000000000000000000000000000,00 000
y[410] =
191579954404095000000000000000000000000000000000000000000000000000, 00000
y[420] =
1161903217850810000000000000000000000000000000000000000000000000000 0,00000
y[430] =
2609860827561510000000000000000000000000000000000000000000000000000 00,00000
y[440] =
-6932146970999620000000000000000000000000000000000000000000000000000 000,00000
y[450] =
-8120402192664460000000000000000000000000000000000000000000000000000 00000,00000
y[460] =
-2953277155633750000000000000000000000000000000000000000000000000000 0000000,00000
y[470] =
-9481998425318110000000000000000000000000000000000000000000000000000 0000000,00000
y[480] =
4678514272059970000000000000000000000000000000000000000000000000000 0000000000,00000
Trang 10y[490] =
2565825524804100000000000000000000000000000000000000000000000000000 000000000000,00000
y[500] =
4980085519063640000000000000000000000000000000000000000000000000000 0000000000000,00000
y[510] =
-1932620685385340000000000000000000000000000000000000000000000000000 000000000000000,00000
y[520] =
-1862357657022720000000000000000000000000000000000000000000000000000 00000000000000000,00000
y[530] =
-6173652725598010000000000000000000000000000000000000000000000000000 000000000000000000,00000
y[540] =
9006118994411800000000000000000000000000000000000000000000000000000 000000000000000000,00000
y[550] =
1125896988254690000000000000000000000000000000000000000000000000000 0000000000000000000000,00000
y[560] =
5618150557039900000000000000000000000000000000000000000000000000000 00000000000000000000000,00000
y[570] =
9129564054332940000000000000000000000000000000000000000000000000000 000000000000000000000000,00000
Trang 11y[580] =
-5142157146335330000000000000000000000000000000000000000000000000000 00000000000000000000000000,00000
y[590] =
-4234487895546990000000000000000000000000000000000000000000000000000 0000000000000000000000000000,00000
y[600] =
-1272917938667400000000000000000000000000000000000000000000000000000 000000000000000000000000000000,00000
y[610] =
8757582197602720000000000000000000000000000000000000000000000000000 000000000000000000000000000000,00000
y[620] =
2675428252744640000000000000000000000000000000000000000000000000000 000000000000000000000000000000000,00000
y[630] =
1219288872126040000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000,00000
y[640] =
1575740610102050000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000,00000
y[650] =
-1324061035474150000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000,00000
y[660] =
-9547983596857690000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000,00000
Trang 12y[670] =
-2582327798103920000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000,00000
y[680] =
3451373287451230000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000,00000
y[690] =
6286673601144060000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000,00000
y[700] =
2621351323910450000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000,00000
y[710] =
2452447189041830000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000,00000
y[720] =
-3326363304159920000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000,00000
y[730] =
-2135270139762510000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000,00000
y[740] =
-5136159338026110000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000,00000
y[750] =
1099568249072160000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000,00000
Trang 13y[760] =
1462311597952060000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000,00000
y[770] =
5578393588733760000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000,00000 y[780] =
3042133247478480000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000,00000 y[790] =
-8195373662699370000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000,00000 y[800] =
-4736117137243880000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000,0000 0
y[810] =
-9962744346416210000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000,000 00
y[820] =
3172180357548620000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000,0 0000
y[830] =
3369637050195580000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 ,00000
y[840] =
1173789526168500000000000000000000000000000000000000000000000000000
Trang 140000000000000000000000000000000000000000000000000000000000000000000 00,00000
y[850] =
1282496572691670000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 00,00000
y[860] =
-1987025990834550000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 00000,00000
y[870] =
-1041739255143980000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 0000000,00000
y[880] =
-1868874060181500000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 00000000,00000
y[890] =
8631758536470610000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 000000000,00000
y[900] =
7696377316951530000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 00000000000,00000
y[910] =
2438518236965230000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 0000000000000,00000
Trang 15y[920] =
-9508561182031140000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 0000000000000,00000
y[930] =
-4752446051536840000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 0000000000000000,00000
y[940] =
-2271629340320920000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 000000000000000000,00000
y[950] =
-3341612275846750000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000,00000
y[960] =
2258615573520880000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000,00000
y[970] =
1743038248668050000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000,00000
y[980] =
4991439200562990000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000,00000
y[990] =
-4878410598115950000000000000000000000000000000000000000000000000000
Trang 160000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000,00000
5 Vẽ đường cong quá trình quá độ
Kết quả chạy chương trình như sau:
Hình 1 Kết quả mô phỏng trên VisualBas
6 Các chỉ tiêu chất lượng của hệ
Ymax = 53.5823
Yod = 53.5823
Sigma = 1025.23(%)
Tmax = 1(s)
Tod = 36.8
7 Dùng Matlab – Simulink mô phỏng lại hệ thống
1 K1 = 50;
2 K2 = 5;
3 K3 = 0.5;
4 T1 = 0.1;
5 T2 = 0.01;
6 T3 = 0.2;
7 num=[K1*K2];
8 den=[T1*T2*T3 T1*T2+T1*T3+T2*T3 T1+T2+T3 1+K1*K2*K3];
9 step(num,den);
10 title('Dac tinh qua do cua he DKTD');
11 ylabel('y(t)');
12 xlabel('t,sec');
13 grid on
Trang 17Hình 1.2 Kết quả mô phỏng bằng Matlab
Kết luận: Hệ đã cho ổn định theo thời gian Kết quả khảo sát bằng Matlab hoàn
toàn trùng với kết quả thu được trên VB, chứng tỏ tính đúng đắn của phương pháp
đã dùng để mô hình hóa hệ thống
8.Nhận dạng hệ thống
Từ đường cong quá độ thu được nhờ các phần mềm mô phỏng ta nhận thấy:
- Đường cong xuất phát từ gốc tọa độ cho thấy trong hàm truyền kín của hệ bậc của
tử số nhỏ hơn bậc của mẫu số
- Giá trị xác lập ổn định là một số khác 0 nên dễ thấy hàm quá độ đơn điệu tăng và không có độ quá điều chỉnh nên có thể kết luận hằng số thời gian của tử nhỏ hơn hằng số thời gian của mẫu
So với hàm truyền đã cho:
W(s)= 3 1002
0,02s 0,3s s 100,1 +Bậc của tử (=0 ) < bậc của mẫu (=3) nên hàm số xác lập tại một giá trị khác 0