Presentation PLC TRAINING - dkttc.ac.th · PDF file... ( Ladder Diagram )Ladder Diagram ) 4....

Preview:

Citation preview

9/14/2014

1

7 7 เหตุผลที�เราเลอืกใช้เหตุผลที�เราเลอืกใช้ Beckoff Beckoff --TwincatTwincat ::

� รองรับภาษา IEC 61131-3 Standards

� Configuration parameters ต่างๆได้ง่ายด้วย TwinCat

� Windows Embedded XP or CE

� Free Drivers for use in Visual Studio.net and

Visual Basic programming.

� PLC Open Control Library

� Scope View , Sampling Trace

– Monitor use0,0 0,2 0,4 0,6 0,8

02040

6080100

-22-20-18-16-14-12-10-8-6-4-2024681012

-2

0

2

0200400

600800

1000

Basic Training (TwinCat)Basic Training (TwinCat)

� Visualizations

– HMI

1

2

Performance

Costs

Overview

BCxxxx

BXxxxx

CX1000

IPC

9/14/2014

2

Windows NT/ XP Pro

TwinCat Realtime Server

TwinCat PLC Control

Variable definition(I/O, internal)

Programming(FBD, ST, SFC, IL, LD)

TwinCat System Manager

IO-Configuration(Devices, Boxes, Terminals)

Scanning IEC-Project I/O-

Variables

Login,

Download, Run,

Create

bootproject

Compiling(Rebuild all, Save)

TwinCat System

Control

Properties

System(Auto Boot, Auto Logon

prove password)

Properties

PLC

(Bootproject, Retain

Data)

Linking,

generating Mappings

Check configuration

Save to registry

(Re-) Start System

Each Time PLC Control

program is change ,

system manager need to

reset again.

Overview System ManagerOverview System Manager

3

� มาตรฐาน IEC 61131-3 1. ภาษาที�ใช้ในการเขียนโปรแกรม PLC

1) IL ( Instruction List )Instruction List )

2) LD ( Ladder Diagram )Ladder Diagram )

4

9/14/2014

3

� มาตรฐาน IEC 61131-3

3) FBD ( Function Block Diagram )Function Block Diagram )

4) ST ( Structured )Structured )

5

� มาตรฐาน IEC 61131-3 5) SFC ( Sequential Function Chart )Sequential Function Chart )

6

9/14/2014

4

6) Continuous Function Chart (CFC)

� มาตรฐาน IEC 61131-3

7

� การติดตั ?ง TwinCat V2.10 Installation

ขั �นตอนที1เลอืก Next

ขั �นตอนที 2เลอืก Next

8

9/14/2014

5

� การติดตั ?ง TwinCat V2.10 Installation

ขั �นตอนที 3เลอืก Yes

ขั �นตอนที 4ใสช่ือที User Name

และ Company Name

9

� การติดตั ?ง TwinCat V2.10 Installation

ขั �นตอนที 5เลอืก TwinCAT NCI

ขั �นตอนที 6เลอืก ติดตั �ง30

days

10

9/14/2014

6

� การติดตั ?ง TwinCat V2.10 Installation

ขั �นตอนที 7เลอืก ติดตั �งทกุ

ตวั

ขั �นตอนที 8ทําการติดตั �ง

Information

11

� การติดตั ?ง TwinCat V2.10 Installation

ขั �นตอนที 9เลอืก ภาษาทีต้องการ

ขั �นตอนที 10

เมือติดตั �งเสร็จแล้วต้อง Restart

12

9/14/2014

7

�� เริ�มใช้งาน เริ�มใช้งาน TwinCatTwinCat PLC Control PLC Control

1.1 คลิกขวาที�ไอคอน TwinCat ด้านล่างขวามือ และเลือก PLC Control

1.2 สร้างโปรเจค็ใหม่

1.3 เลือกระบบการทาํงานเป็นแบบ PC Control เลือก PC or CX (x86)

และเลือก OK

11. . สรา้งโปรเจค็ใหม่ สรา้งโปรเจค็ใหม่ ( Creating New Project ) ( Creating New Project )

13

� เริ�มใช้งาน TwinCat PLC Control

1.4 เลือกสร้างโปรแกรม Program และตั ?งชื�อMAIN เลือกภาษา STและเลือก OK

1.5 คลิกขวาที� POUs เลือก Add Object

14

9/14/2014

8

� เริ�มใช้งาน TwinCat PLC Control

1.6 เลือกสร้างโปรแกรม Program และตั ?งชื�อPROGRAM_LD เลือกภาษา LDและเลือก OK

1.7 คลิกขวาที� POUs เลือก Add Object อีกครั ?ง

15

� เริ�มใช้งาน TwinCat PLC Control

1.8 เลือกสร้างโปรแกรม Program และตั ?งชื�อPROGRAM_FBD เลือกภาษา FBDและกด OK

1.9 กลบัมาที�โปรแกรม MAIN คลิกเมาท์ที�บรรทดั #0001

16

9/14/2014

9

� เริ�มใช้งาน TwinCat PLC Control

1.10 กด F2 เลือก User defined Programsเลือก PROGRAM_FBDและกด OK

1.11 กด Enter ลงมาบรรทดัที�#0002

17

� เริ�มใช้งาน TwinCat PLC Control

1.12 กด F2 เลือก User defined Programsเลือก PROGRAM_LDและกด OK

18

9/14/2014

10

� เริ�มใช้งาน TwinCat PLC Control

1.13 กลบัมาที� โปรแกรม MAINจะเหน็ว่าโปรแกรม MAIN จะเรียก PROGRAM_FBD และ PROGRAM_LD ขึ?นมาทาํงาน

19

2.1 ดบัเบิลคลิกที�โปรแกรม PROGRAM_LD

22. . เขียนโปรแกรมเบื?องต้น เขียนโปรแกรมเบื?องต้น ( Write and Edit ( Write and Edit Programming ) Programming )

2.2 ที� Network1 นํา Contact NO มาวาง 1 ตวั

2.3 ประกาศตวัแปร STARTClass: VAR_GLOBALType: BOOL

20

9/14/2014

11

2.4 สร้างโปรแกรมตามตวัอย่างทั ?งหมด และประกาศตวัแปรให้อยู่ใน VAR_GLOBAL ทั ?งหมดและเป็น BOOL

21

2.5 ที�PROGRAM_FBD ให้สร้างโปรแกรมตามตวัอย่างทั ?งหมด และประกาศตวัแปรให้อยู่ใน VAR_GLOBAL

DEVICE_UP:BOOL;COUNT_OUT:BOOL;DATA_UP:INT;

22

9/14/2014

12

2.6 ทาํการ Save และ Build

3.1 คลิกขวาที�ไอคอน TwinCat เลือก System > Start3. Start TwinCat Run time On PC Base

23

3.2 เลือก Online >Login

- กด Yes

- เลือก Online >Run

24

9/14/2014

13

4.1 เลือก Resource

44. Sampling Trace . Sampling Trace

4.2 ดบัเบิลคลิกที� Sampling Trace

25

4.3 คลิกขวาที�พื?นที�ของ Sampling Trace เลือก Trace Configuration

44. Sampling Trace . Sampling Trace

26

9/14/2014

14

4.5 เลือก Help Manager

44. Sampling Trace . Sampling Trace

4.6 คลิกที� Global_Variablesเลือกตวัแปร

COUNT_OUTDATA_UPDEVICE_UP

27

4.7 ที�ช่อง Sample rate ใส่ค่า 200

44. Sampling Trace . Sampling Trace

28

9/14/2014

15

4.8 ช่อง Var0 เลือก DEVICE_UPที�ช่อง Var1 เลือก DATA_UPที�ช่อง Var2 เลือก COUNT_OUT

44. Sampling Trace . Sampling Trace

29

44. Sampling Trace . Sampling Trace 4.9 ทาํการ Login Program

และคลิกขวาเลือก Start Trace4.10 คลิกขวาเลือก Auto Read Trace

30

9/14/2014

16

55. . Visualizations5.1 เลือกเมนู Visu

5.2 คลิกขวาที� Visualizations เลือก Add Object

- ตั �งชื�อเป็น HMI

31

55. . Visualizations5.3 เลือกเครื�องมือ Button มาวาง

5.4 ดบัเบิลคลิกที�ปุ่ ม Button เลือกคาํสั �ง Text

ที�ช่อง Content พิมพค์าํว่า START

32

9/14/2014

17

55. . Visualizations5.5 เลือกคาํสั �ง Input คลิกเครื�องหมายถกูที�ช่อง Tap variable

5.6 คลิกที�ช่องว่างด้านข้างของ Tap variable เสรจ็แล้ว กด F2

5.7 เลือก Global_Variableเลือกตวัแปร START

33

55. . Visualizations5.8 เลือกเครื�องมือ Ellipse วาดวงกลม

5.9 ดบัเบิลคลิกที�วงกลม เลือกคาํสั �ง Text

ที�ช่อง Content พิมพ ์ คาํว่าOUT1

34

9/14/2014

18

55. . Visualizations

5.11 เลือกคาํสั �ง Colorsที� Alarm color กดปุ่ ม Insideเลือกสีแดง

5.10 เลือกคาํสั �ง Colorsที� color กดปุ่ ม Insideเลือกสีเขียว

35

55. . Visualizations

5.12 เลือกคาํสั �ง Variableคลิกที�ช่องว่างของChange color

5.13 กดปุ่ ม F2 เลือก Global_variableเลือกตวัแปร OUT1

36

9/14/2014

19

55. . Visualizations

5.14 สร้างปุ่ ม Button ขึ?นมาอีก 1 ปุ่ ม กาํหนดชื�อ STOP และ link กบัตวัแปร STOP

37

55. . Visualizations

5.15 กลบัมาที�โปรแกรม PROGRAM_FBD ทาํการแก้ไขโปรแกรมตามตวัอย่าง คือ สร้างตวัแปร DATA_IN ที�ขา PV ของ CTU

Class: VAR_GLOBALType: INT

38

9/14/2014

20

55. . Visualizations

5.16 กลบัมาที�โปรแกรม Visualizationเลือกเครื�องมือ Rectangle

5.17 ดบัเบิลคลิกที�เครื�องมือ Rectangle ที�คาํสั �งText พิมพค์าํสั �งที� Contentตามตวัอย่าง COUNT=%d

39

55. . Visualizations

5.18 ที�คาํสั �ง Input เลือกคลิกเครื�องหมายถกูที�หน้าคาํสั �ง Text input of variable และที�ช่องList box เลือกคาํสั �ง Numpad

5.19 ที�คาํสั �ง Variables กดF2 ที�ช่องคาํสั �ง Textdisplayเลือกตวัแปรที�Global_Variableเป็น DATA_IN

40

9/14/2014

21

55. . Visualizations5.20 เลือกเครื�องมือ Meter มาวาง

5.21 กาํหนดค่าConfig ตามตวัอย่างจากนั?นให้คลิกปุ่ ม Variable/Scale

41

55. . Visualizations5.22 กาํหนดค่าต่างๆตามตวัอย่าง Scale start : 0Scale end: 50Main scale: 10Sub scale: 2Scale format: %.0f

จากนั?นคลิกที�ช่อง Variable และ กด F2 เลือกตวัแปรที� Global_Variablesเลือกตวัแปร DATA_UP

42

9/14/2014

22

55. . Visualizations5.23 คลิกที�ปุ่ ม Color areas

5.24 กาํหนดค่าที� Begin of area: 0End of area : 25

คลิกปุ่ ม Color selection เลือก สีเขียวหลงัจากนั?นคลิกปุ่ ม Add

43

55. . Visualizations5.25 กาํหนดค่าที� Begin of area: 25

End of area : 40คลิกปุ่ ม Color selection เลือก สีเหลืองหลงัจากนั?นคลิกปุ่ ม Add

44

9/14/2014

23

55. . Visualizations5.26 กาํหนดค่าที� Begin of area: 40

End of area : 50คลิกปุ่ ม Color selection เลือก สีแดงหลงัจากนั?นคลิกปุ่ ม Add

45

55. . Visualizations5.27 ทาํการ Login และ Run โปรแกรม คลิกที� COUNT=0 จากนั?นให้ป่อนค่า 20

46

9/14/2014

24

66. . PC Control Mode Link BC9050

6.1 เปิด MyNetwork ที�ต่อกบั BC9050กาํหนด Protocol(TCP/IP)ให้เป็น Group เดียวกบั BC9050172.16.17.100255.255.0.0

47

66. . PC Control Mode Link BC9050

ปรบั Dip Switch เพื�อตั ?ง Address ของ BC9000

48

9/14/2014

25

66. . PLC Control Mode Link BC9050

6.2 คลิก Start>Run

6.3 ping 172.16.17.1แล้วกด OK

PC ติดต่อกบัBC9000 ได้สาํเรจ็

49

66. . PLC Control Mode Link BC9050

6.4 คลิกขวาที�ไอคอน TwinCat เลือกSystem> Config

6.5 คลิกขวาที�ไอคอน TwinCat เลือกSystem Manager

50

9/14/2014

26

66. . PLC Control Mode Link BC9050

6.6 เลือก File >New

6.7 คลิกขวาที� I/O Deviceเลือก Append Device

51

66. . PLC Control Mode Link BC9050

6.8 เลือก Virtual Ethernet Interface

6.9 คลิกขวาที�Device1 (Virtual-Ethernet)เลือก Append Box

52

9/14/2014

27

66. . PLC Control Mode Link BC9050

6.12 คลิกขวาที� Box1( BC9000 )เลือก Append Terminal

6.13 เลือก Terminals (KLxxxx) ต่างให้ครบตามที�ติดตั ?งไว้

เลือก KL1408 *

เลือก KL2408 *

* ขึ�นอยู่กบั Terminal ที �เราตดิตั �งจรงิ 53

66. . PLC Control Mode Link BC9050

6.14 คลิกขวาที� Box1( BC9000 )เลือก Export Variable Info

6.15 ทาํการ Save (variable)

54

9/14/2014

28

66. . PLC Control Mode Link BC9050

6.17 เปิดโปรแกรม PLC ที�บนัทึกไว้ขึ?นมาเลือกที�เมนู Project และเลือก Import

6.18 เลือกเปิดไฟล ์variable ที�บนัทึกไว้ขึ?นมา

55

66. . PLC Control Mode Link BC9050

6.19 เลือก Resources

6.20 เลือก Global Variables และดบัเบิลคลิกที� TwinCAT_Import

56

9/14/2014

29

66. . PLC Control Mode Link BC9050

6.21 ทาํการเปลี�ยนชื�อตวัแปรตามตวัอย่าง

57

66. . PLC Control Mode Link BC90506.22 กลบัไปดบัเบิลคลิกที� Global_Variablesลบตวัแปร START,STOP,OUT1,DEVICE_UP,COUNT_OUT ทิ?งไป

58

9/14/2014

30

66. . PLC Control Mode Link BC9050

6.23 ดบัเบิลคลิกที� PLC Configuration และเลือกคลิกที� BC via AMS

59

66. . PLC Control Mode Link BC9050

6.24 คลิกที�ไอคอน TwinCAT เลือก Properties

6.25 เลือก AMS Router และคลิกที� Add

60

9/14/2014

31

66. . PLC Control Mode Link BC9050

6.26 ตั �งชื�อ BC9000 และใส่ Net Id ของPLCและใส่ IP Address ของPLCเมื�อเสรจ็แล้วเลือก OK

6.27 คลิกที�ไอคอน TwinCAT อีก เลือกSystem เลือก Config

61

66. . PLC Control Mode Link BC9050

6.28 กลบัมาที�โปรแกรม PROGRAM_LDเลือกเมนู Online เลือก Choose Run-Time System

62

9/14/2014

32

66. . PLC Control Mode Link BC9050

6.29 เลือกที� BC9000 เลือก Run-Time1(Port 800) และคลิก OK

63

66. . PLC Control Mode Link BC9050

6.30 เลือกที�เมนู Online เลือก Login

6.31 เลือกที�เมนู Online เลือก Run

64

9/14/2014

33

66. . PLC Control Mode Link BC90506.32 PLC กจ็ะทาํงานตามโปรแกรม

6.33 เมื�อต้องการโหลดโปรแกรมลง PLC ให้ทาํตามขั ?นตอนดงันี? เลือกเมนู Online เลือก Create BootProject

65

1.1 คลิกขวาที�ไอคอน TwinCat ด้านล่างขวามือ และเลือก PLC Control

1.2 สร้างโปรเจค็ใหม่

1.3 เลือกระบบการทาํงานเป็นแบบ PC Control เลือก PC or CX (x86)

และเลือก OK

11. . สร้างโปรเจค็ใหม่ สร้างโปรเจค็ใหม่ ( Creating New Project )( Creating New Project )

66

�� Programming Control Pneumatics by Programming Control Pneumatics by TwinCatTwinCat

9/14/2014

34

� Programming Control PneumaticsProgramming Control Pneumatics

1.4 เลือกสร้างโปรแกรม Program และตั ?งชื�อ MAIN เลือกภาษา LDและเลือก OK

1.5 คลิกขวาที� POUs เลือก Add Object

67

� Programming Control PneumaticsProgramming Control Pneumatics

1.6 เปิดโปรแกรม กระบอกสูบ.EXE

68

Solenoid Valve

Cylinder

Switch panel

9/14/2014

35

� Programming Control PneumaticsProgramming Control Pneumatics

1.7 Exa1

69

� Programming Control PneumaticsProgramming Control Pneumatics

1.7 Exa

70

Symbol Variable VB

simulate

Variable Twincat Class/Type

A+ Y1 Y1 GLOBAL/BOOL

A- Y2 Y2 GLOBAL/BOOL

B+ Y3 Y3 GLOBAL/BOOL

B- Y4 Y4 GLOBAL/BOOL

C+ Y5 Y5 GLOBAL/BOOL

C- Y6 Y6 GLOBAL/BOOL

S1 S1 S1 GLOBAL/BOOL

S2 S2 S2 GLOBAL/BOOL

S2 S3 S3 GLOBAL/BOOL

S4 S4 S4 GLOBAL/BOOL

S5 S5 S5 GLOBAL/BOOL

S6 S6 S6 GLOBAL/BOOL

RUN RUN RUN GLOBAL/BOOL

9/14/2014

36

� Programming Control PneumaticsProgramming Control Pneumatics

1.8 กลบัมาที�โปรแกรม TinCat PLC Control

71

1.9 เลือกคลิกที� Resources

1.10 เลือกดบัเบิลคลิกที� Global Variablesและเลือก Global_Variables

� Programming Control PneumaticsProgramming Control Pneumatics

72

1.11 ในช่องด้านขวาให้ทาํการประกาศตวัแปรตามตวัอย่าง

9/14/2014

37

� Programming Control PneumaticsProgramming Control Pneumatics

73

1.12 ทาํการเขียนโปรแกรมตามสเตป็การทาํงานโจทย์

� Programming Control PneumaticsProgramming Control Pneumatics

74

1.13 ทาํการปิดโปรแกรม กระบอกสบู

1.14 เลือก System เลือก Stat

1.15 ที�โปรแกรม PLC เลือก online และเลือก Login

9/14/2014

38

� Programming Control PneumaticsProgramming Control Pneumatics

75

1.16 เลือก online และเลือก Run

1.17 เปิดโปรแกรม กระบอกสูบและทาํการกดสวิตช์ Run ทดสอบการทาํงาน

� Programming Control PneumaticsProgramming Control Pneumatics

2 Exa2

76

9/14/2014

39

� Programming Control PneumaticsProgramming Control Pneumaticsการแบง่กลุ่มจากปัญหาสญัญาณต้านกนั

77

Exa2

78

Symbol Variable VB

simulate

Variable Twincat Class/Type

A+ Y1 Y1 GLOBAL/BOOL

A- Y2 Y2 GLOBAL/BOOL

B+ Y3 Y3 GLOBAL/BOOL

B- Y4 Y4 GLOBAL/BOOL

C+ Y5 Y5 GLOBAL/BOOL

C- Y6 Y6 GLOBAL/BOOL

S1 S1 S1 GLOBAL/BOOL

S2 S2 S2 GLOBAL/BOOL

S2 S3 S3 GLOBAL/BOOL

S4 S4 S4 GLOBAL/BOOL

S5 S5 S5 GLOBAL/BOOL

S6 S6 S6 GLOBAL/BOOL

RUN RUN RUN GLOBAL/BOOL

G1 --- G1 GLOBAL/BOOL

G2 --- G2 GLOBAL/BOOL

G3 --- G3 GLOBAL/BOOL

9/14/2014

40

� Programming Control PneumaticsProgramming Control Pneumatics

79

ในช่องด้านขวาให้ทาํการประกาศตวัแปรเพิ�มตามตวัอย่าง

� Programming Control PneumaticsProgramming Control Pneumatics

80

9/14/2014

41

� Programming Control PneumaticsProgramming Control Pneumatics

81

Recommended