Mang Profibus

  • Published on
    18-Dec-2014

  • View
    74

  • Download
    11

Embed Size (px)

Transcript

<p>TRNG H S PHM K THUT TPHCM KHOA IN T</p> <p>BI GING:</p> <p>IU KHIN LP TRNH 2</p> <p>BIN SON: GV GV ThS Nguyn Tn i ThS T Vn Phng</p> <p>TP H CH MINH, THNG 01 NM 2008</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>MC LCCHNG I: PLC S7-300 1.1 Gii thiu v PLC S7-300. 1.2 Cc Module ca PLC S7-300 1.3 Cc Module hot ng. 1.4 Cc kiu d liu. 1.5 Cu trc b nh. 1.6 Chu k qut ca PLC S7-300 1.7 Trao i d liu gia CPU v Module m rng. 1.8 Cu trc chng trnh ca PLC S7-300 1.9 Cc khi OB c bit CHNG II: TP LNH CA S7-300 1.1 Cu trc lnh v trng thi kt qu 1 1 4 5 5 7 8 9 10</p> <p>T yen u q 1.3 Nhm lnh c bit Ban 1.4 Nhm lnh so snh1.2 Nhm lnh logic 1.5 Nhm lnh ton hc</p> <p>ruo</p> <p>H Su ng D</p> <p>ph</p> <p>yt am K</p> <p>h</p> <p>P. HC uat T</p> <p>M12 12 14 20 23 28 29 30 40 47 47 48 49 49 50 51 52 53 53 54</p> <p>1.6 Lnh chuyn i s BCD sang s nguyn 1.7 Lnh v Timer 1.8 Lnh v Counter. CHNG III: MNG PROFIBUS- DP 3.1 Tng quan 3.1.2 Kin trc giao thc v k thut truyn 3.1.3 Truy cp BUS 3.1.4 Dch v truyn d lu 3.1.5 Cu trc bc in 3.2 Profibus DP 3.2.1 Cu hnh h thng v thit b 3.2.2 c tnh vn hnh ca h thng 3.2.3 Trao i d liu gia Master v Slaver 3.2.4 ng b ho d liu vo /ra</p> <p>Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>3.2.5 Tham s ho v chun on h thng 3.2.6 Giao tip trc tip gia cc Slave 3.2.7 Ch ng thi 3.3 Gii thiu Module EM-277 3.3.1 Gii thiu 3.3.2 Cc thng s ca EM-277 3.3.3 Cu trc vng nh ca Master v Slave 3.4 Kt ni mng vi module EM-277 3.4.1 Thit lp a ch mng cho khi EM-277 3.4.2 Truyn d liu gia trm ch v khi EM-277 3.4.3 Tp c s d liu ca thit b ( cc tp GSD) 3.4.5 ng dng mng Profibus DP iu khin thit b CHNG IV : MNG ASI 4.1 Gii thiu v mng ASI 4.1.1 Khi nim</p> <p>55 55 56 57 57 57 58 61 61 61 64 64</p> <p>T yen u q Ban 4.1.3 Hot ng ca mng ASI4.1.2 Giao tip ASI 4.1.4 ng dng mng ASI 4.2 Cc AS-I MASTER 4.2.1 Gii thiu 4.2.2 AS-I Master PLC S7-200 4.2.3 AS-I Master cho PLC S7-300 4.2.4 AS-I Gateway 4.3 Cc thnh phn mng ASI 4.3.1 Cp AS-I 4.3.2 Cc Module AS-I 4.3.3 Lp t Module AS-I 4.3.4 AS-I Repeater/Extender 4.3.5 B nh a ch 4.4 Ch AS-I MASTER</p> <p>u DH S g n ruo</p> <p>K pham</p> <p>y th</p> <p>P. HC uat T</p> <p>M</p> <p>75 75 75 77 82 84 86 86 86 89 91 92 92 93 97 97 99 100 100 102 108 108</p> <p>4.4.1 Nguyn tc Master/Slaver trong AS-I 4.4.2 Chuyn i d liu 4.5 H thng AS-I 4.5.1 Thit lp h thng AS-I</p> <p>Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>4.5.2 H thng truyn d liu AS-I 4.5.3 Cu trc bc in 4.6 AS-I MASTER MODULE CP 243-2 4.6.1 Gii thiu module CP 243-2 4.6.2 c tnh k thut ca Module CP 243-2 CHNG V: PHN MM WINCC 5.1 Gii thiu chung v WinCC 5.1.1 Khi nim 5.1.2 c im 5.1.3 u im ca Version WinCC 6.0 5.2 Cc Poject trong WINCC 5.2.1 Single-user Project 5.2.2 Multi-user Project 5.2.3 Client Project</p> <p>109 110 113 113 115 129 129 129 129 131 131 131</p> <p>u DH S g n uo 5.3.1 Thit lp Driver kt ni gia WinCC Tr v PLC n e y qu Ban 5.3.2 nh ngha cc Tag5.3 S dng WINCC 5.3.3 To giao din ngi dng 5.3.4 To nh ng v hiu ng cho i tng 5.3.5 Biu din gi tr ca qu trnh Logging Editor 5.3.6 Thit lp cnh bo v thng bo li 5.3.7 To Function v Action 5.3.8 Thit lp Report 5.3.9 Chy chng trnh WinCC 5.4 iu khin v gim st qua mng PROFIBUS 5.4.1 Yu cu 5.4.2 Kt ni phn cng</p> <p>K pham</p> <p>y th</p> <p>P. HC uat T</p> <p>M</p> <p>132 132 133 133 134 134 136 136 137 138 138 139 140 140 141 141 146</p> <p>5.4.3 Khai bo phn cng trn SIMATIC MANAGER 5.4.4 Thit lp giao din trn WinCC v thit lp giao tip vi S&amp;-300</p> <p>Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>TI LIU THAM KHO[1] [2] [3] [4] [5] [6] [7] [8] Nguyn Don Phc, t ng ha vi Simatic S7-300, NXB KHKT, 2006 Hong Minh Sn, Mng truyn thng cng nghip , NXB KHKT, 2001. Trn Thu H, T ng ho trong cng nghip vi WinCC, NXB Hng c, 2007. TT Vit c - H S phm K thut Tp.HCM, SIMATIC S7-300 iu khin h thng. TT Vit_c - Trng H S phm K thut Tp.HCM, Ti liu hun luyn PROFIBUS - DP&amp;FMS. Siemens, AS-Interface Introdution and Basic information, 2000. Siemens, S7-300 Programmable Controller Hardware and installation. Internet.u DH S g n ruo K pham y th P. HC uat T M</p> <p>B</p> <p>T yen u q an</p> <p>Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>CHNG 1:</p> <p>PLC S7-300</p> <p>1.1 GII THIU V PLC S7-300: PLC S7-300 l thit b iu khin lo g i c k h t r n h c t r u n g b n h do hng S iemens sn xut vi kch thc nh, gn. Chng c kt cu theo kiu cc Module c sp xp trn cc thanh rack. Trn mi rack cho php t c nhiu nht 8 Module m rng (khng k CPU, Module ngui nui). Mt CPU S7-300 c th lm vic trc tip vi nhiu nht 4 rack. S7-300 c thit k da trn tnh cht ca PLC S7-200 ( c trnh by trong mn hc KLT 1) v b sung nhng tnh nng mi, c bit trong iu khin lin kt c h thng nhiu PLC, gi l mng PLC s c trnh by trong cc chng sau. 1.2 CC MODULE CA PLC S7-300: Nhm mc ch tng tnh mm do trong cc ng dng thc t, M cc i tng iu C H . P khin ca mt trm S7-300 c ch to theo Module. at Tu y th K Cc Module gm c: Module CPU, ngun, ng vo/ra am s, tng t, mng, S lng u ph S H Module nhiu hay t ty vo yu cu thc t, song ti thiu bao gi cng c mt D uong r T Module chnh l CPU, cc Module cn li nhn truyn tn hiu vi i tng iu yen u q khin, cc Module chc nng chuyn dng nh PID, iu khin ng c, chng c Ban</p> <p>gi chung l Module m rng.</p> <p>Cu hnh ca mt trm PLC S7-300 nh sau:</p> <p>CPU</p> <p>Hnh 1.1: Cc khi trn mt thanh rack ca trm PLC S7-300.</p> <p>TRANG - 1Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>-</p> <p>Module CPU: cha b vi x l, h iu hnh, b nh, cc b nh thi gian, b m, cng truyn thng (RS485) v c th c vi cng vo/ra s onboard. PLC S7-300 c nhiu loi CPU khc nhau, chng c t tn theo b vi x l c trong CPU nh CPU312, CPU314, CPU315, CPU316, CPU318 Nhng Module cng c chung b vi x l nhng khc nhau v cng vo/ra onboard, khc nhau v cc khi hm c bit c sn trong th vin ca h iu hnh c phn bit vi nhau trong tn gi bng cch thm cm t IFM (Intergrated Function Module). V d Module CPU314 IFM. Ngoi ra cn c cc loi Module CPU vi hai cng truyn thng, trong cng truyn thng th hai c chc nng chnh l phc v vic ni mng phn tn c km theo nhng phn mm tin dng c ci t sn trong h iu hnh. Cc loi CPU ny c phn bit vi cc CPU khc bng tn gi thm cm t DP (Distributted Port) trong tn gi. V d Module CPU 314C-2DP Hnh v sau minh ha mt s CPU ca PLC S7-300:P. HC uat T M</p> <p>B</p> <p>T yen u q an</p> <p>u DH S g n ruo</p> <p>K pham</p> <p>y th</p> <p>CPU 312 IFM</p> <p>CPU 314C-2PIP</p> <p>CPU 314</p> <p>CPU 314C-2DP</p> <p>Hnh 1.2: Cc Module tch hp CPU ca PLC S7-300. Module m rng: chia lm 5 loi o o o o o PS ( Power Supply): Module ngun nui. C 3 loi 2A, 5A v 10A. SM (Signal Module): Module m rng cng tn hiu vo/ra, bao gm: DI (Digital Input): Module m rng cc cng vo s. S cc cng vo s m rng c th l 8, 16, hoc 32 tu thuc vo tng loi Module. DO (Digital Output): Module m rng cc cng ra s. S cc cng ra s m rng c th l 8, 16 hoc 32 tu thuc vo tng loi Module. DI/DO (Digital input/Digital output): Module m rng cc cng vo/ra s. S cc cng vo/ra s c th l 8 vo/8 ra hoc 16 vo/16 ra ty thuc tng loi Module. AI (Analog input): Module m rng cng vo tng t. Chng l b chuyn i tng t s 12 bits (AD). S cc cng vo tng t c th l 2, 4, 8 ty tng loi Module.</p> <p>o</p> <p>TRANG - 2Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>o</p> <p>AO (Analog output): Module m rng cc cng ra tng t. Chng l nhng b chuyn i s tng t (DA). S cc cng ra tng t c th l 2, 4 hoc 8 ty thuc tng loi. AI/AO (Analog input/Analog output): Module m rng vo/ra tng t. S cng vo/ra tng t c th l 4 vo/2 ra hoc 4 vo/4 ra ty tng loi Module. IM (Interface Module): Module ghp ni. y l loi Module chuyn dng c chc nng ni cc nhm Module m rng li vi nhau thnh mt khi v c qun l chung bi mt CPU. Mt CPU c th lm vic trc tip nhiu nht 4 rack, mi rack ti a 8 Module m rng v cc rack c ni vi nhau bng Module IM. FM (Function Module): Module c chc nng iu khin ring, v d nh Module iu khin ng ng c bc, Module iu khin ng c servo, Module PID, iu khin m tc cao CP (Communication Module): Module phc v truyn thng trong mng gia cc b PLC vi nhau hoc gia PLC vi my tnh.u DH S g n ruo K pham y th HCM</p> <p>o</p> <p>o</p> <p>o</p> <p>o</p> <p>P. Hnh sau minh ha mt s Module m rng ca PLC u S7-300: at T T yen u q an</p> <p>B</p> <p>a) Module ngun (PS)</p> <p>b) Module vo s (DI)</p> <p>c) Module ra analog (AO)</p> <p>d) Module ra s (DO)</p> <p>e) Module chc nng (FM) f) Module truyn thng</p> <p>Hnh 1.3: Module m rng ca PLC S7-300</p> <p>TRANG - 3Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>1.3 CC MODE HOT NG: PLC S7-300 c 4 mode hot ng, gm: o o o RUN_P: X l chng trnh, c th c v ghi c t PG. RUN: X l chng trnh, khng th c t PG. STOP: Dng, chng trnh khng c x l.</p> <p>MRES: Chc nng reset h thng (Module Reset o Cc mode ny c chn da vo cng tc chn mt trc CPU nh hnh 1.4 Trong : 1. n bo trng thi 2. Card nh 3. Nt chn kiu lm vic 4. u ni 24V 5. Cng giao tip MPI 6. Ngn pinT yen u q an u DH S g n ruo K pham y th P. HC uat T M</p> <p>B</p> <p>Hnh 1.4: Mt trc CPU S7-300</p> <p>-</p> <p>Ngoi ra, CPU cn c cc n ch bo gip ngi s dng chn on c trng thi hin ti ca PLC. o o o o o o SF: bo li trong nhm, trong CPU hay trong cc Module. BATF: li pin, ht pin hoc khng c pin. DC5V: bo c ngun 5V. FRCE: bo t nht c mt ng vo/ra ang b cng bc hot ng. RUN: nhp nhy khi CPU khi ng v sng khi CPU lm vic. STOP: sng khi PLC dng, chp chm khi c yu cu reset b nh, chp nhanh khi ang reset b nh. Card nh: dng lu chng trnh m khng cn pin trong trng hp mt in. Ngn pin : nm di np, cha pin cung cp nng lng cho RAM khi mt in. u ni MPI: u ni dnh cho thit b lp trnh hay cc thit b cn giao tip qua cng MPI. u ni in 24V: cung cp ngun cho CPU.</p> <p>-</p> <p>Cc thnh phn khc trn CPU: o o o o</p> <p>TRANG - 4Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>1.4 CC KIU D LIU: Tng t nh PLC S7-200, cc kiu d liu s dng trong chng trnh ca PLC S7-300 gm c: BOOL: c dung lng 1 bit, gi tr l 0 hoc 1, s dng cho bin c 2 gi tr BYTE: dung lng 8 bit, thng dng biu din s nguyn dng t 0 n 255, m BCD ca s thp phn 2 ch s, m ASCII ca k t, WORD: dung lng 2 byte, biu din s nguyn dng t 0 n 65535. INT: dung lng 2 byte, biu din s nguyn t -32768 n 32767. DINT: dung lng 4 byte, biu din s nguyn t -2147483648 n 2147483647. REAL: dung lng 4 byte, biu din s thc c du phy. S5T (S5TIME): biu din khong thi gian, tnh theo gi/pht/giy/mgiy TOD: biu din khong thi gian tnh theo gi/pht/giy DATE: biu din thi gian theo nm/thng/ngy CHAR: biu din k t (ti a 4 k t).T u DH S g n ruo K pham y th P. HC uat T M</p> <p>Ngoi ra cn c cc kiu d liu khc:</p> <p>n 1.5 CU TRC B NH: quye Ban</p> <p>B nh PLC c minh ha trong hnh 1.5, gm: vng nh cha thanh ghi, vng nh System, vng nh Work, v vng nh Load.</p> <p>Hnh 1.5: Phn chia vng nh S7-300</p> <p>TRANG - 5Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>-</p> <p>Load memory: L vng nh cha chng trnh ng dng do ngi s dng vit v c cha trong cc OB, FC, FB hoc trong cc khi chng trnh trong th vin h thng c s dng (SFB, SFC) v cc khi d liu DB. Vng nh ny to ra t mt phn RAM ca CPU v EEPROM. Khi thc hin lnh xa b nh (MRES) th ton b cc khi chng trnh trong RAM b xa ht. Tng t, khi chng trnh c Download t my tnh vo CPU, chng s c ghi ln phn RAM ca vng nh ny. Vng nh chng trnh c chia lm 3 min: o o o OB (Organization Block): min cha chng trnh t chc. FC (Function): min cha chng trnh con c t chc thnh hm, c bin hnh thc trao i d liu vi chng trnh gi. FB (Function Block): Min cha chng trnh con c t chc thnh hm, c kh nng trao i d liu vi bt k khi chng trnh no. Cc d liu c xy dng trn mt khi ring gi l DB.</p> <p>-</p> <p>Work memory:M (OB, FB, FC, L vng nh cha cc khi d liu DB ang m, khi chng trnh . HC P T SFC, SFB) ang c CPU thc hin. Ti mt thi huat nht nh vng nh ny y tim K ch cha mt khi chng trnh. Sau khi thc ham hin khi chng trnh ny xong up S H D th n s b CPU xa khi work memory v np vo khi chng trnh k tip uong r T n lt thc hin. uyen B thnh 2 min: Vng nh ny chia an q</p> <p>o</p> <p>DB (Data Block): Min cha cc d liu t chc thnh khi, kch thc v s lng do ngi s dng quy nh. Chng trnh c th truy cp min ny theo bit (DBX), byte (DBB), Word (DBW), Double word (DBD). L (Local data block): Min d liu cc b c cc khi chng trnh OB, FC, FB s dng cho cc bin tm thi v trao i cc bin hnh thc vi cc khi gi n. Ni dung d liu trong khi ny s b xo khi kt thc chng trnh tng ng trong OB, FC, FB. Min ny c th truy cp theo bit (L), byte (LB), word (LW) hoc duoble word (LD). Ty theo cc khi chng trnh khc nhau m bng khai bo cha cc bin khc nhau nhm phc v cho yu cu ca khi .</p> <p>o</p> <p>-</p> <p>System memory: Cha cc tham s ca h iu hnh v chng trnh ng dng, chia lm 7 min. o Min I: (Process image input): min b m cc cng vo s. Trc khi thc hin chng trnh, PLC c tt c d liu u vo v ct vo min nh ny. PLC khng c trc tip cng vo m c t b m I. Min Q: (Process image output): min b m cc cng ra s. Khi kt thc chng trnh, PLC chuyn gi tr logic t b m Q n cc cng ra s. Thng thng chng trnh khng gn trc tip gi tr ti cng ra m ch chuyn chng vo b m Q.</p> <p>o</p> <p>TRANG - 6Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>o</p> <p>Min M: min nh cc bit c. Chng trnh ng dng s dng vng nh ny lu cc tham s cn thit v c th truy nhp theo bit, byte, word, double word. Min T: min nh phc v b thi gian. Bao gm vic lu tr gi tr thi gian thi gian nh trc, thi gian tc thi v gi tr logic u ra ca timer. Min C: min phc v b m. Bao gm vic lu tr gi tr t trc, gi tr tc thi v gi tr logic u ra. Min PI: min a ch cng vo cc Module tng t. Cc gi tr tng t ti cc cng vo s c chuyn t ng theo nhng a ch. Chng trnh ng dng c th truy cp min PI theo bit (PI), theo byte (PIB), theo t (PIW), hoc theo t kp (PID). Min PQ: min a ch cng ra cc Module tng t. Gi tr theo nhng a ch ny s c Module tng t chuyn ti cc cng ra tng t. Chng trnh ng dng c th truy cp min nh PQ theo bit (PQ), theo byte (PQB), theo t (PQW) hoc theo t kp. Trong cc vng nh trnh by trn khng c vng nh lm b m cho cng vo/ra tng t, nh vy mi CMc tc dng trc lnh truy nhp Module tng t (c hoc gi gi T tr) u .H P huat tip ti cng vt l. Ky tan q ruo H Su ng D pham</p> <p>o o o</p> <p>o</p> <p> TS7-300: 1.6 CHU K QUT CA PLC uyen</p> <p>B PLC S7-300 thc hin chng trnh theo chu trnh lp. Mi Tng t PLC S7-200, vng lp c gi l vng qut.</p> <p>-</p> <p>Vng qut c bt u bng giai on truyn thng ni b v kim tra li. Bc tip theo l giai on chuyn d liu t cc cng vo s ti b m o I. Sau l giai on thc hin chng trnh. Chng trnh c thc hin t lnh u tin n lnh kt thc ca khi OB1. Kt qu c lu trong b m Q. Sau cng l giai on chuyn cc ni dung ca b m o Q ti cc cng ra s.</p> <p>Hnh 1.6: Vng qut chng trnh</p> <p>TRANG - 7Thu vien DH SPKT TP. HCM - http://www.thuvienspkt.edu.vn</p> <p>Truong DH SPKT TP. HCM</p> <p>http://www.hcmute.edu.vn</p> <p>IU KHIN LP TRNH 2</p> <p>CHNG 1</p> <p>B m I v Q khng lin quan ti cc cng vo/ra tng t nn cc lnh truy nhp cng tng t c thc hin trc tip vi cng vt l m khng thng qua b m. Thi gian cn thit PLC thc hin c mt vng qut gi l thi gian...</p>