Trong một số các tài liệu, danh từ hệ thống (system) được định nghĩa là tập hợp hay sắp xếp kết nối có trật tự các phần tử vật lý theo một thể. Danh từ điều khiển (control) thường mang ý nghĩa là điều chỉnh (regulate), hướng đến nhắm đến (direct) và thực thi tác vụ hay một lệnh (command). Như vậy hệ thống điều khiển được hiểu là một tập hợp sắp xếp trật tự các phần tử vật lý theo một thể, để nó có thể tự điều chỉnh, định hướng và thực thi tác vụ cho riêng bản thân nó hoặc cho các hệ thống khác. Các thành phần cơ bản của hệ thống điều khiển bao gồm: Mục tiêu điều khiển (biến điều khiển_input). VD: Tốc độ, lưu lượng, sản lượng,… Các phần tử của hệ thống bao gồm bộ điều khiển và đối tượng điều khiển. VD: PLC, Động cơ, van điện từ, Congtactor, Rolay,…
Trang 1Buổi 1: Tổng quan về hệ thống điều khiển trong công nghiệp
1 Cấu trúc về hệ thống điều khiển trong công nghiệp
Trong một số các tài liệu, danh từ hệ thống (system) được định nghĩa là tập hợp hay sắp xếp kết nối
Các thành phần cơ bản của hệ thống điều khiển bao gồm:
- Mục tiêu điều khiển (biến điều khiển_input) VD: Tốc độ, lưu lượng, sản lượng,…
- Các phần tử của hệ thống bao gồm bộ điều khiển và đối tượng điều khiển VD: PLC, Động cơ, van điện từ, Congtactor, Rolay,…
- Kết quả hay tín hiệu ra (output) VD: Tín hiệu điện, tín hiệu khí, …
Hệ thống điều khiển thường được phân thành hai dạng:
- Hệ thống điều khiển vòng hở (open-loop) Hệ thống điều khiển vòng hở là hệ thống có tác động điều khiển độc lập với tín hiệu ngõ ra
- Hệ thống điều khiển vòng kín (closed-loop)
Hệ thống điều khiển vòng kín là hệ thống có tác động điều khiển phụ thuộc vào tín hiệu ngõ ra Hệ thống điều khiển vòng kín còn được gọi là hệ thống điều khiển hồi tiếp (feedback control systems)
Trang 2Mô hình OSI
2 Giới thiệu về các thiết bị cấp trường
Các thiết bị cấp trường là các thiết bị trực tiếp tiếp xúc với quá trình công nghệ, nó có nhiệm vụ thực hiện quy trình công nghệ (hiện trường), đo đạc, lấy các thông số trạng thái hoạt động của máy móc, chất lượng sản phẩm và đưa về bộ điều khiển để quản lý và thực hiện điều chỉnh quá trình Các thiết bị cấp trường thường là các cơ cấu chấp hành như: động cơ, van, các bộ điều khiển chấp hành công tactor, rolay, các loại cảm biến áp suất, lưu lượng, nhiệt độ…
Một số thiết bị cấp trường hay được sử dụng:
Động cơ: chia ra thành động cơ một chiều, động cơ xoay chiều 1P, 3P
Rơle: chia thành rơ le cuộn hút dùng nguồn một chiều, dùng nguồn xoay chiều, rơle thời gian, rơle nhiệt…
Congtactor: congtacto 1P, 2P, 3P…
Van: van 24VDC, van 220VAC, van ON-OFF, van tuyến tín, van khí nén…
Cảm biến: cảm biến xuất tín hiệu logic, cảm biến xuất tín hiệu analog dạng điện áp, analog dạng dòng điện, dạng cơ khí…
3 Các họ PLC của hãng SIEMEN
S7-200, S7-300, S7-400, S7-1200, S7-1500
S7-200: PDS 210, CPU 212, 214, 215(Profibus DP), 216, 221, 222, 224, 224XP, 226, 226XM Step7-Microwin V1.0.0 SP9
S7-300: CPU 312, 314, 315-2DP, 315-2PN/DP, 317-2DP, 317-2PN /DP, 319-3PN/DP
Step7-Simatic Manager V5.5
Trang 3S7-400: CPU 412-1, 412-2, 412-PN, 414-2, 414-3, 414-3PN/DP, 2, 416F-2, 3, 3PN/DP, 416F-3PN/DP, 417-4
416-Step7-Simatic Manager V5.5
S7-1200: CPU 1211C, 1212C, 1214C, 1215C, 1217C
STEP 7 Professional/Basic V11 SP2
S7-1500: CPU 1500 (new production)
TIA portal V12 (Totally Integrated Automation Portal )
Giới thiệu riêng họ PLC S7-200
CPU 212: 8I/6O+2Modul mở rộng max 40I/38O
CPU 214: 14I/10O+7Modul mở rộng max 238I/234O
Trang 4CPU215: 14I/10O+7Modul mở rộng max 238I/234O+ Profibus DP
CPU216: 16I/16O+7Modul mở rộng max 240I/240O
CPU221: 6I/4O
CPU222: 8I/6O+2Modul mở rộng max 40I/38O
CPU224: 14I/10O+7Modul mở rộng max 238I/234O
CPU224XP (Extended Port): 14I/10O + 7Modul mở rộng max
238I/234O+1PORT-Communication+ 2/1 analoge in-/outputs
CPU226: 24I/16O+7Modul mở rộng max 248I/240O (2port-communication)
CPU226XM(Extended Memory):: 24I/16O+7Modul mở rộng max 248I/240O
(2port-communication)
Trang 5Các loại modul mở rộng:
Trang 74 Cấu trúc phần cứng và cách đấu nối PLC S7-200 CPU 224 AC/DC/RELAY
Trang 85 Giới thiệu về phần mềm lập trình Step7 Microwin
(thực hành trên máy)
Buổi 2: Giới thiệu về cấu trúc bộ nhớ lập trình PLC
1 Dữ liệu
- PLC xử lý thông tin, dữ liệu dưới dạng: Bit, Byte, Word, Double Word
- 1 Bit = 1 Ô nhớ, 1Byte = 8Bit, 1Word = 2Byte, 1Double Word = 2Word
1B Max value = 28-1 = 255; 1kB = 1024 B; 1MB = 1024kB; 1GB = 1024 MB
1Word = 2B, Max value = 216 – 1 = 65535
- 1Double Word = 4B, Max value = 232
- Vùng nhớ tham số: Là vùng bộ nhớ dùng để lưu giữ các từ khóa, địa chỉ trạm
- Vùng nhớ dữ liệu: Là vùng lưu giữ dữ liệu chương trình như kết quả phép tính, hằng số được
định nghĩa trong chương trình Là 1 vùng nhớ động Nó có thể truy nhập theo từng bit, byte, word hoặc double word
Trang 9+ Bộ đệm cổng ra tương tự: AQW 0 – AQW 30
+ Thanh ghi (Accumulater): AC 0, AC1, AC2, AC3
+ Bộ đếm tốc độ cao: HSC0 -> HSC5
- Đặc tính của các vùng nhớ:
Trang 10Retentive (Nhớ lâu, giữ lại giá trị khi mất nguồn)
Can be forced (Có thể can thiệp)
- Các truy cập dữ liệu vào vùng nhớ
Trang 11a Truy nhập theo bit:
Tên miền + địa chỉ byte + + chỉ số bit
Ví dụ: V5.4
Trang 12Truy suất các vùng khác; Ví dụ: I0.0; Q0.2; M0.3; SM0.5
b Truy nhập theo byte:
Tên miền + B + địa chỉ byte
Ví dụ: VB5
Truy suất các vùng khác; Ví dụ: IB0; QB2; MB7; SMB37
c Truy nhập theo Word (từ):
Tên miền + W + địa chỉ byte cao của word trong miền
Ví dụ: VW;
Như vậy VW4 gồm 2 byte VB4 và VB5 gộp lại trong đó VB4 đóng vai
trò là byte cao, còn VB5 đóng vai trò là byte thấp trong word VW4
VW4 = VB4 + VB5
Truy suất các vùng khác; Ví dụ: IW0; QW4; MW40; SMW68
d Truy nhập theo doubleword (từ kép):
Tên miền + D + địa chỉ byte cao nhất của một double word trong
miền
Ví dụ: VD2
VD2 chỉ từ kép gồm 4 byte VB2, VB3, VB4, VB5 thuộc miền V,
trong đó byte VB2 có vai trò là byte cao nh ất, byte VB5 có vai trò byte
thấp nhất trong VD2
Truy suất các vùng khác; Ví dụ: ID0; QD3; MD100; SMD48
2 Nguyên lý hoạt động của PLC
3.1 Cấu trúc chương trình:
Các chương trình cho S7-200 phải luôn có một chương trình chính (Main Program)
Nếu có sử dụng chương trình con và chương trình xử lý ngắt thì được viết tiếp sau chương trình chính
3.3 Quy trình thiết kế hệ thống điều khiển dùng PLC
Để chương trình gọn gàng, dễ quan sát và không nhầm lẫn địa chỉ trong quá trình thảo chương trình, thực hiện các yêu cầu sau:
- Hiểu rõ nguyên lý hoạt động của hệ thống
- Xác định có bao nhiêu tín hiệu vào / ra
- Lập bảng phân phối nhiệm vụ I / O
Trang 13- Xây dựng giải thuật hoặc Grafcet
- Viết và kiểm tra chương trình chạy demo
- Kết nối thiết bị và kiểm tra hệ thống hoạt động
Trang 1410 Bảng biến địa phương
Navigation Bar: Presents groups of pushbutton controls for programming features:
"View"—Select this category to display push button controls for the Program Block, Symbol Table,
Status Chart, Data Block, System Block, Cross Reference, and Communications
"Tools"—Select this category to display pushbutton controls for the Instruction Wizard, TD 200
Wizard, Position Control Wizard, EM 253 Control Panel, and the Modem Expansion Wizard
Note: When the Navigation Bar contains objects that cannot be shown because of the current window size, the Navigation Bar displays scroll buttons to let you move up or down to the other objects
Instruction Tree: Provides a tree view of all project objects and all the instructions that are available
for your current program editor (LAD, FBD, or STL) You can right-click folders in the Projects portion of the tree to insert additional Program Organizational Units (POUs); you can right-click an individual POU to open it, delete it, edit its property sheet, password-protect it, or rename subroutines and interrupt routines You can right-click a folder or individual instruction in the Instructions portion
of the tree in order to hide the entire tree Once you open an instruction folder, you can drag and drop individual instructions or double-click to automatically insert the selected instruction at the cursor location in the Program Editor window as desired You can organize frequently used instructions by dragging and dropping them in a Favorites folder
Cross Reference: Allows you to view Cross Reference and Element Usage information for your
program
Data Block: Window Allows you to display and edit the content of your data block
Status Chart Window: Allows you to track the status of program inputs, outputs, or variables by
putting them into the chart You can create multiple status charts in order to view elements from different portions of your program Each status chart has its own tab in the Status Chart window
Symbol Table/Global Variable Table Window: Allows you to assign and edit global symbols (in
other words, symbolic values that can be used in any POU, not just the POU where the symbol was created) You can create multiple symbol tables A pre-defined table of S7-200 System Symbols can
be added to your project
Output Window: Provides informational messages when you compile your program or instruction
library When the output window lists program errors, you can double-click on an error message and the appropriate network is displayed in the program editor window
Trang 15Status Bar: Provides information about the status of the operations that you perform in STEP
7-Micro/WIN
Program Editor Window: Contains the Local Variable Table and the program view for the editor
(LAD, FBD, or STL) that you are using for this project You can drag the split bar to expand the program view and cover up the Local Variable Table if desired When you create subroutines or interrupt routines in addition to the main program section (OB1), tabs appear at the bottom of the program editor window You can click on the tabs to move between the subroutines, interrupts, and OB1
Local Variable Table: Contains assignments that you have made to local variables (in other words,
variables that are used by your subroutines and interrupt routines) Variables created in the Local Variable Table use temporary memory; address assignment is handled for you by the system; use of the variable is restricted to the POU where it was created
Menu Bar: Allows you to perform operations using either a mouse or keystrokes You can customize
the Tools menu to add your own tools
Toolbars: Provides easy mouse access to the most commonly used STEP 7-Micro/WIN operations
You can customize the content and appearance of each of the toolbars
2 Concepts for Programming
a Ladder Logic Editor: The STEP 7-Micro/WIN Ladder Logic (LAD) editor allows you to build
programs that resemble an electrical wiring diagram Ladder programming is the method of choice for many PLC programmers and maintenance personnel; it is an excellent language for beginning programmers The ladder programs allow the CPU to emulate the flow of electric current from a power source through a series of logical input conditions that in turn enable logical output conditions The logic is separated into networks The program is executed as dictated by the program, one network
at a time, from left to right and then top to bottom Once the CPU has reached the end of the program,
it starts over again at the top of the program In the Ladder Logic Editor had three method: Contacts, Coils, Box
Trang 16The main points to consider when you select the LAD editor are:
· Ladder logic is easy for beginning programmers to use
· Graphical representation is often easy to understand, and is popular around the world
· The LAD editor can be used with both the SIMATIC and IEC 1131-3 instruction sets
· You can always use the STL editor to display a program created with the LAD editor
b Statement List Editor
general, the STL editor is more suitable for experienced programmers who are familiar with PLCs and logic programming The STL editor also allows you to create programs that you could not otherwise create with the Ladder Logic or Function Block Diagram editors This is because you are programming in the native language of the CPU, rather than a graphical editor where some restrictions must be applied in order to draw the diagrams correctly
The main points to consider when you select the STL editor are:
· STL is most appropriate for experienced programmers
· STL sometimes allows you to solve problems that you cannot solve easily with the LAD or FBD editor
· You can only use the SIMATIC instruction set with the STL editor There is no IEC instruction set for STL
· While you can always use the STL editor to view or edit a program that was created with the SIMATIC LAD or FBD editors, the reverse is not always true You cannot always use the SIMATIC LAD or FBD editors to display a program that was written with the STL editor
c Function Block Diagram Editor
The STEP 7-Micro/WIN Function Block Diagram (FBD) editor allows you to view the instructions as logic boxes that resemble common logic gate diagrams There are no contacts and coils as found in the LAD editor, but there are equivalent instructions that appear as box instructions The program logic is derived from the connections between these box instructions That is, the output from one instruction (such as an AND box) can be used to enable another instruction (such as a timer) to create the necessary control logic This connection concept allows you to easily solve a wide variety of logic problems, just as you can with the other editors
The main points to consider when you select the FBD editor are:
· The graphical logic gate style of representation is good for following program flow
· The FBD editor can be used with both the SIMATIC and IEC 1131-3 instruction sets
· You can always use the STL editor to display a program created with the LAD editor
· The expandable AND/OR boxes make it easier to draw complex input combinations
-|<B,D,I,R|- -|<=B,D,I,R|-
LDB,D,I,R< address Mem (B,D,I,R), mem or num LDB,D,I,R<= address Mem (B,D,I,R), mem or num
Trang 17LDB,D,I,R= address Mem (B,D,I,R), mem or num LDB,D,I,R<> address Mem (B,D,I,R), mem or num LDB,D,I,R>= address Mem (B,D,I,R), mem or num LDB,D,I,R> address Mem (B,D,I,R), mem or num
HC, Constant, *VD)
LD bit -D mem1, mem2 //MOVD num, mem2 //-D mem1, mem2 (VD, ID, QD, MD, SMD, SD, LD, AC,
HC, Constant, *VD)
LD bit +I mem1, mem2 //MOVD num, mem2 //+I mem1, mem2 (VW, IW, QW, MW,
SW, SMW, T, C, AC,
LW, AIW, Constant,
*VD)
LD bit -I mem1, mem2 //MOVD num, mem2 //-I mem1, mem2 (VW, IW, QW, MW,
SW, SMW, T, C, AC,
LW, AIW, Constant,
*VD)
LD bit / Enable
Trang 18LD bit
*D mem1, mem2 (VD, ID, QD, MD, SMD, SD, LD, AC,
HC, Constant, *VD)
LD bit /D mem1, mem2 (VD, ID, QD, MD, SMD, SD, LD, AC,
HC, Constant, *VD)
LD bit / Reset CTD Cn, num / 0-255 (num 32767- down counter)
//CTU Cn, num / 0-255 (num 32767- down counter)\
LD bit / Enable TON Tn, num
n (32,96) /1ms
n (T33-T36, T97-T100)
n (T37-T63, T255)
T101-6 Giới thiệu phần mềm S7-200
Pass: 6596
- Clear PLC: Dùng để xóa chương trình và cài đặt trên PLC
- Load PLC: Dùng để down load chương trình mô phỏng (*.awl) được Export từ Step7-Micor/Win
- RUN: Chạy chương trình mô phỏng
- STOP: Dừng chương trình mô phỏng
- Interchange Input/Output: Dùng để kết nối với phần mềm giao diện ảo PC-SIMU
- End Interchange Input/Output: Dừng kết nối với phần mềm giao diện ảo PC-SIMU
- View AWL: Mở hộp thoại xem nội dung chương trình dạng ngôn ngữ STL
- View KOP: Mở hộp thoại xem nội dung chương trình dạng ngôn ngữ LAD
- View DB1: Mở hộp thoại xem nội dung dữ liệu DB1