Nhận xét: Model state space co | input, 1 output voi 5 bién trạng thái Chon Open Selection dé xem két qua state space, hàm truyền của hệ thống... e© Mục tiêu của thiết kế: + Duy tri se
Trang 1
TRƯỜNG ĐẠI HỌC BÁCH KHOA - ĐHQG TP.HCM
KHOA CƠ KHÍ
BỘ MÔN CƠ ĐIỆN TỬ
HOC PHAN MO RONG DONG LUC HOC VA DIEU KHIEN (ME3011)
Giảng viên hướng dẫn : PGS.TS Nguyễn Quốc Chí
Họ và tên sinh viên : Võ Anh Tuan
Thành phố Hỗ Chi Minh, 2024
Trang 2
SLIDE #2: CONTROL SYSTEM DESIGN OVERVIEW
Ta có cac file basic motor iopts.mdl cé block diagram tong nhu sau:
Hệ đã có sẵn thiết lap vong kin Input Perturbation v
Trong block Controller, block diagram nhu sau:
Vact
Trang 3
denominator coefficient must be a vector The output width equals the number of rows in the numerator coefficient You should specify the coefficients in descending order of powers of s
‘Parameter tunability’ controls the runtime tunability level for numerator and denominator coefficients
‘Auto’: Allow Simulink to choose the most appropriate tunability level
‘Optimized’: Tunability is optimized for performance
‘Unconstrained': Tunability is unconstrained across the simulation targets
num(s) den(s)
§
ð Cancel Help Apply
Power Amplifier Mathematical Mode! pos_L
Trong block Power Amplifer, block diagram nhu sau:
torque Convert to
Torque
PA characteristics có 2 biến có chứa tập dữ liệu là pa input voltage va
pa_output_voltage
Trang 4Lookup Table (n-D) Perform n-dimensional interpolated table lookup including index searches The table is a sampled representation of a function in N variables Breakpoint sets relate the input values to positions in the table The first dimension corresponds to the top (or left) input port
Table and Breakpoints Algorithm Data Types Number of table dimensions: 1
characteristics
Ip Apply
9 [ œ ] cancel me Trong block Mathematical Model, block diagram như sau:
Ax + Bu pos_A
State Space pos_L
Tiến hành kiểm tra các biến trang thai, step response cia hé thong bang tab Model
Linearizer va nhan Linearize dé Linearize hé thong
Variable Preview
Linearization at model initial condition:
State-space model with 1 outputs, 1 inputs, and 5
states
Nhận xét: Model state space co | input, 1 output voi 5 bién trạng thái
Chon Open Selection dé xem két qua state space, hàm truyền của hệ thống
Trang 5
¥ Variable Preview 9
Linearization at model initial condition:
State-space model with 1 outputs, 1 inputs, and 5
states
State space:
Trang 6Linearization Result:
A =
xl x2 x3 x4 x5
xI -439.§ 0 0 -0.000S x2 0 0 1 0 0 x3 -5.93le+09 -1.3e+04 -1.7 5739 x4 0 0 0 0 1 x5 0 9.63e+04 1.481 -9.63e+04
ul - Step Output Channel Names:
yl - Model Hàm truyền của model:
Trang 7Linearization Result:
From input "ul" to output "y1":
1.076e04 s*2 + 6.996e08 s + 2.197e10
Trang 8rom: Step To: Model
Nhận xét: Phản hồi của hệ có overshoot 38%, settling time là 0,623 giây Hệ có
nhiều đường cong nhỏ hinh sin 1a do chịu tác động của tần số dao động cao
e© Mục tiêu của thiết kế:
+ Duy tri settling time < l giây
+ Khử tần số dao động cao
Quay vé block diagram téng, tién hanh chay model (RUN) với Time Stop là 10 giây
va bam vào Scope đề xem đáp ứng ban đầu của hệ thông từ 0 đến I0 giây:
Trang 10‘CONTROL SYSTEM
Open Sine fot New Update Preferences
Session Session Architecture Blocks
mur ARCHITECTURE ceacs IMULNK PREFERENCES
Y_ Conlroller3 and Faced Blocks °
+ Design ° —
Block Name Value bbaic_motor_jopts!ConvoleriGain st) |x) [Aad Blocks
Trang 12Design requirement type: [Settling time
Design requirement parameters
Trang 13
Tune băng cách câm các điểm nghiệm đưa về đường | gidy dé ra thong sô điêu
chỉnh bộ Gain đúng yêu câu
@ contro! System Dexigner -basie- motor Jopts o x
Trang 14~ nưm(8) Multiplication; Element-wise(K.*u) x
Doves “Do Tar” reforonce error “ 1 oa len(s
Trang 15£60QQ%
= linsys5
Nhận xét: Phản hồi của hệ cong tự nhiên hơn, không còn nhiều dao động như ban
đầu và settling time vẫn thỏa (< l giây)
Trang 16SLIDE #3: MODEL REPRESENTATIONS
3.1 System Modeling Approaches
Co 3 cach dé Modeling I hệ thống:
+ Cách 1; Phuong phap Black Box Diéu kién:
e Phuong trinh toan chưa biết
e (C6 san dự liệu đo được
e Phuong trinh toan da biét
e Cac thông số hệ thông đã biết
R=1Q
Lạ + Rạ+ lu=y L=4h
C C=IF
+ Cách 3: Gray box (parameter estimation) Điều kiện:
e©_ Phương trình toán đã biết
e Các thông số hệ thông chưa biết
Lg+Rq+—q=V q+ Kg c1 L=” mm 3.2 System Representations
Trang 17Ta có các file second order sys.mdl cé block diagram téng như sau:
num(s) den(s)
Hàm truyền của khối Plant như sau:
cy) Transfer Fen ^
number of rows in the numerator coefficient You should specify the
‘Parameter tunability’ controls the runtime tunability level for numerator and denominator coefficients
‘Auto': Allow Simulink to choose the most appropriate tunability level
‘Optimized’: Tunability is optimized for performance
‘Unconstrained': Tunability is unconstrained across the simulation targets
Trang 18+h moms †
Tiến hành kiểm tra step response của hệ thống bằng tab Model Linearizer và nhân Step để xem phản hồi hệ thống
Trang 19From: Step To: Transfer Fen 0.2 T T T
System: linsys1 /\ ^ \/O: Step to Transfer Fen
\ ^ Settling time (seconds): 38.2
Quay vé block diagram téng, tién hanh chay model (RUN) véi Time Stop là 60 giây
va bam vào Scope đề xem đáp ứng ban đầu của hệ thông từ 0 đến 60 giây:
Trang 20Nhận xét: đường phản hồi của scope và của step respone trong LTI có hình dáng tương tự nhau Đường phản hồi của scope hơi nhọn trong khi LTI cong tự nhiên hơn 3.3 Linear Time-Invariant Models
Cung cấp khả năng phân tích chuyên sâu nhanh chóng
e Phan hoi tan s6
e Dat pole/zero
Co 4 dang phan tich co ban
e Dang ham truyén (mién tan s6): Hữu ích đối với hệ thông tuyên tính bậc thấp
§
© Dạng state space (miễn thời gian): Hữu ích đối với hệ thông tuyến tính bậc
cao, hệ phi tuyến
x= Ax+ Bu y=Cx+Du
Trang 21© - Dạng dữ liệu của phản hồi tần sô (miền tần số): bao gồm dữ liệu các tần số phan hồi lấy mẫu đo được
Trang 223.4 Code chuyên đổi các dạng trong LTI Object
Hàm truyền ban đầu:
Trang 23>> sys tf new = tf(sys_ ss) ? =———
u
3.5 Thém thanh phan Real-World
Mé file motor model _pulse.mdl, ta co block diagram téng nhw sau:
Nhân vào khôi Vact đê xem tín hiệu xung đầu vào:
Signal Builder (motor_model_pulse/Vact) — oOo x File Edit Group Signal Axes Help 4
Je@|s¢B8bloe|-IFReoeaeae Play! 4 mi/S)/e
Active Group: | Group 1
Trang 24Tiến hành chạy model (RUN) với Time Stop là 10 giây và bắm vào Scope để xem đáp ứng ban đầu của hệ thống từ 0 đến 10 giây:
Nhận xét: từ 0 đến 4 giây, hệ vẫn đứng yên do chưa được cấp xung Từ giây thứ 4 đến giây thứ 6 (thời gian có xung), tốc độ của hệ tăng tuyến tính Từ giây 6 trở đi, do
không còn xung nên vận tốc không tăng nữa và hệ có vận tốc không đối
Thêm khối Random Number, tiễn hành chạy model (RUN) với Time Stop là 10 giây
va bam vào Scope đề xem đáp ứng ban đầu của hệ thông từ 0 đến I0 giây:
Trang 25
Nhận xét: từ 0 đến 4 giây, hệ không đứng yên mà chuyên động hỗn loạn do khối Random Number Từ giây thứ 4 đến giây thứ 6 (thời gian có xung), tốc độ của hệ có xu hướng tăng nhưng không tuyến tính Từ giây 6 trở đi, do không còn xung nên vận tốc có
xu hướng không tăng nữa nhưng vận tốc thay đôi không ngừng do khối Random Number Trong Simulink, ta khảo sát hệ lý tưởng nên đường phản hồi trong scope là một đường lý tưởng ít hỗn loạn Nhưng, ngoài thực tế, hệ sẽ chịu nhiều tác động nhiễu nên đường phản hồi hỗn loạn không ngừng Tuy nhiên, ta cần đảm báo sự hỗn loạn đó có giữ được xu hướng tăng, giảm như lý tưởng không
3.6 Physical Modeling
Có 2 cách
+ Cách I: từ một hệ thống thực tế, ta biểu diễn hệ thống bằng phương trình vi phân
Từ phương trình vi phân, thong qua bién d6i Laplace để đưa hệ thành hàm truyền và từ
đó ta tién hanh design theo yêu cầu
+ Cách 2: ta mô phỏng toàn bộ các thành phần của hệ thông
Trang 26JX, = b,x, —k(X,—x¿)—b,„(Ÿ,T—3;)+T
@ S,X, = —b,X, + k(x, —X,)+,(% -X,)
©\
Trang 27SLIDE #4: SYSTEM IDENTIFICATION
Mo file measure_data.mat có bộ dữ liệu dung cho system identification
Vao APPS, chon tab System Identification xuat hién giao diện:
File Options Window Help
Operations
ee —L—
So GSS Se? = GSS
Fd ww * III Data Views Model Views
To To Time plot Workspace LT! Viewer Model output Transient resp Nonlinear ARX Data spectra Model resids Frequency resp Hamm-Wiener Frequency function [| Zeros and poles
Noise spectrum
Empty icon No action invoked
Vao Import Data, chon dtr ligu ta cần 1mport là dữ liệu miền thời gian
Trang 29
Data Format for Signals
Lúc này giao diện system identifñcation xuất hiện với đữ liệu ban đầu tên mydata:
Ÿđ System Identification - Untitled — ao x File Options Window Help
Import data x Import models v
Trang 30
Tich chon muc Time plot để xuất hiện biểu đồ tín hiệu input va output theo thời
gian
A Time Plot: u1->y1
File Qptions Style Channel Experiment Help
“@ System Identification - Untitled
Eile Options Window Help
Data set mydatad inserted Double click on icon (right mouse) for text information
So sanh input, output gitra mydata voi mydatad:
Trang 31File Qptions Style Channel Experiment Help
Kéo dữ liệu mydatad vao myc Working Data vì dữ liệu ta làm việc là mydatad
File Qptions Window Help
owe [>I
Pe Ld
Data Views To Model Views:
7 Time plot ‘tea | Model output ~ Transient resp "| Nonlinear ARX
(Data spectra | Model resids | Frequency resp | Ramm-Wiener
Vao muc Preprocess, chon Select Range dé phân chia dữ liệu cần khảo sát Với dữ
liệu 10 giây đầu tiên, ta dùng cho mô hình dự đoán 10 giây còn lại ta dùng đề thâm định:
Trang 32File Options Style Channel Help File Options Style Channel Help
B 10°? Input and output signals h +10" Input and output signals
File Options Window Help
Import data v Import models v
= Validation Data
Fe
Kéo mydatade vao Working Data va kéo mydatadv vao Validation Data va tich muc Time plot:
Trang 33“4 Estimate State-Space Models
Orders and Domain
(®) Continuous-time
Discrete-time (0.002 seconds) [_ ]Feedthrough (D)
Status: Estimated using N4SID with prediction focus
Fit to estimation data: 87.05%, FPE: 1.93672e-09
Nhận xét: Dữ liệu khớp 87,05%
Trang 34Trong mục Model order, ta chon Pick best value in the range với range là 1:10 dé phần mềm tự chọn ra order phù hợp cho mình Ở đây, phù hợp là bậc 4 Đặt tên mô hình
thứ hai là mr4, bậc của mô hình là bậc 4 và nhân Estimatc:
“4 Estimate State-Space Models — Oo
Orders and Domain
Model order | Pick best value in the range vị 1:10
(®) Continuous-time
© Discrete-time (0.002 seconds) L_]Feedthrough (D)
2 Click on a bar to select order Order
- Red: Default Choice (4) 1
Trang 35
Fit to estimation data: 97.67%, FPE: 6.30414e-11
Nhận xét: Dữ liệu khớp 97,67%
Ta tiếp tục khảo sát bậc cao hơn bậc do phần mềm chọn:
Trang 36“4 Estimate State-Space Models
Model Structure Estimation Options
Orders and Domain
Model order _{ Specify value ME
Status: Estimated using N4SID with prediction focus
Fit to estimation data: 98.85%, FPE: 1.52368e-11
Nhận xét: Dữ liệu khớp 98,85%
Trang 37Kéo model mr2, mr4, mr5 vào To LTI Viewer, ta có được step response cua timg model:
File Edit Window Help
Trang 38
<a System Identification - Untitled —
File Options Window Help
mr2: 4.117 0.5
Trang 39Nhận xét: dữ liệu output của model mr5 là phù hợp nhất (85,28) nên ta sẽ chọn dữ
liệu mrS
Kéo mr5 vao To Workspace
'@ System Identification - Untitled " n x
File Options Window Help
Import data » Import models v
L] Data spectra “ Model resids oO Frequency resp Hamm-Wiener
Trang 41SLIDE #5: PARAMETER ESTIMATION
Mo file DMC_parameter.m
% %e a ee =} [El Section Break > &
+ Fal y Section vei} Run to End ~
CODE ANALYZE SECTION RUN
7 Tsz0.082, % sampling rate [s] baka 1
14 % motor constant [Mm/A] Pa_outputvol 1x201 double
15 Ka=1.3/2.5; % power amplifier gain [A/V] R 2
H udata 5 dot -ommand Window ® H ydata
x New to MATLAB? See resources for Getting Started
>> s£jle
>> DMC_parameters
© >>
Nhân Run dé load bộ dữ ligu dung cho Simulink
Ta chạy sơ ñle motor_pe.mdl có sơ đồ khối tông như sau:
( 1 +> Reference Position
reference Vact > Vact pos_L
Vao APPS chon tab Parameter Estimation xuat hién giao dién
Trang 42Parameters Tuned for All Experiments Select Parameters
There are no parameters selected for estimation
Parameters and Initial States Tuned per Experiment
Experiment | No experiment available ¥ |
te, co
Ta chon cac bién parameter ding cho estimate O day ta chon bién b1, b12, b2, k
trong mién lién tuc
3Ñ Select mooie: vonaties
Finer by vanabie name
Used By ) is 16.06 motor_pe’Made\Mahemabes Mec State Space
] j2 13600? motot_pe’ModelMathematicd Model State Space
oO | oO xa I3 ‘otot_pe’ModelPower Ampifior\onvert to Torque 1) Km 01 not pelVodel(Posver Arnplier'Comerl lo Tongze
wv of te-05 matot_pe’ModelMaimematicd Model Siate Space
] |e 1606 ‘motor_pe!Mode\tiatemabest Mee State Space
E] OC) ie 10.05 moiot_pe’ModelMahematicd Modal State Space
4 ] * 0901 n6f0L_De'Mođe\ÂAfhematicaf Medtl/St8Ie Space:
| ps mp4 velwge [.10 98 -9 800900000000001 -9.69929200909699 9 6 9 5.0.4.9 3000000000 | motor_pe’ModelPower Amplfier/PA characteritice
B E msAwe [2504397270810365 -2.40267 1801319891 -2.80903089019476 -2.4670087201. mơtor peModelEower ArncVterĐA characteratics
Trang 43'@ Edit: Estimated Parameters — Oo x
Parameters Tuned for All Experiments
b1 1e-05 Yes [V] Estimate (8) b12 we 1e-05 Y tat va
Maximum [inf |v)
Scale
Parameters and Initial States Tuned per Experiment
Experiment | No experiment available ¥