programabilni logi čki kontroleri plc –program i primeri primene

47
Programabilni logički kontroleri PLC –program i primeri primene Industrijski sistemi i protokoli - predavanje 3 Ver 2010.2

Upload: josef

Post on 08-Feb-2016

177 views

Category:

Documents


12 download

DESCRIPTION

Programabilni logi čki kontroleri PLC –program i primeri primene. Industrijski sistemi i protokoli - predavanje 3 Ver 2010.2. Sadr žaj. 1. Osnove kontaktorskih šema (m irno i radno, tasteri, kontakti i PLC bitovi 2 . Lestvičasti (ladder) dijagram za programiranje PLC - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Programabilni logi čki kontroleri  PLC  –program i primeri primene

Programabilni logički kontroleri PLC –program i primeri primene

Industrijski sistemi i protokoli - predavanje 3

Ver 2010.2

Page 2: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 2/30

1. Osnove kontaktorskih šema (mirno i radno, tasteri, kontakti i PLC bitovi

2.Lestvičasti (ladder) dijagram za programiranje PLC3. Blokovi ladder dijagrama 4. Primeri Ladder dijagrama 5. Primena u elektromotornim pogonima

Sadržaj

Page 3: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 3/30

TasteriŠta je radno stanje, akcija, nenormalno stanje kod tastera? To je pritisak na taster!

Radni tester vodi u radnom stanju, a normalno (kada ga ne pritiskamo) je otvoren normalno otvoren. Tako mu definiše i sam grafički simbol i NO.

Mirni tester vodi u neradnom stanju, koje je normalno jer ga ne pritiskamo , on je normalno zatvoren. Tako mu definiše i sam grafički simbol i NC.

Normalno otvoren (radni) i zatvoren (mirni)?

Suština ovde je da su vas pogrešno učili 1) da je normalno da ne radimo. 2) da smo mirni samo kad ne radimo.

Page 4: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 4/30

Rele

Normalno otvoren (radni) i zatvoren (mirni)?

1

2

A1

A2

1

2

A1

A2

3

4

5

6

Kontaktor

glavni kontakti

namotaj elmagneta(špulna)

12 – radni (NO)

313 – mirni (NC)

13

14

21

22

pomoćni kontakti

Page 5: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 5/30

Moderni kontaktori

Normalno otvoren (radni) i zatvoren (mirni)?

Page 6: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 6/30

Princip rada kontaktora

Normalno otvoren (radni) i zatvoren (mirni)?

Nema napona na namotaju, el.magnet ne radi, nema privlačenjakotve, kontakti razdvojeni.

Napon na namotaju ,elmagnetPrivlači se kotva, kontakti zatvoreni

Page 7: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 7/30

Kontakti releja ili kontaktoraŠta je radno stanje, akcija, nenormalno stanje kod releja/kontakotora? To je napon na špulni !

Radni kontakt vodi u radnom stanju, a normalno (kada nema komande) je otvoren normalno otvoren. Tako mu definiše i sam grafički simbol i NO.

Mirni kontakt vodi u neradnom stanju, koje je normalno jer kad nema napona, on je normalno zatvoren. Tako mu definiše i sam grafički simbol i NC.

Normalno otvoren (radni) i zatvoren (mirni)?

Eneg. ka mreži

Energ. ka potrošaču

Špulna(komanda)

pomoćni mirni (NC,12)

pomoćni radni (NO, 34)

Page 8: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 8/30

Bitovi u PLC Šta je radno stanje, akcija, neaktivno, nenormalno stanje kod bitova ? To je stanje 1, stanje ON !

Radni bit vodi u radnom stanju (1), a normalno (kada nije 1) je otvoren normalno otvoren kontakt.

Mirni bit vodi u neradnom stanju (0),normalnom stanju on je normalno zatvoren kontakt.

Bit može biti ulaz (na primer I0.0) koji je 1 ako je napon na ulazu, ili izlaz (na primer Q0.0) koji je 1 akoje napon na izlazu, ili čak i samo bit iz memorije (naprimer M0.0) koji je 1 ako je prethodno setovan ili 0ako je prethodno resetovan.

Normalno otvoren (radni) i zatvoren (mirni)?

Page 9: Programabilni logi čki kontroleri  PLC  –program i primeri primene

Primeri sa PLC Ladder dijagramima

Page 10: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 10/30

Način programiranja PLC Siemens S7

Lestvičasta logika (ladder logic) je način crtanja el. logičkih šema. To je grafički jezik, veoma popular kod PLC. Originalno je izmišljen da zameni relejnu logiku. Ime je dobio jer program podseća na merdevine.

LD start_tasterO izlazA stop_taster= izlaz

Alternativa STL (statment list) - Instruction List language

Page 11: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 11/30

Način programiranja PLC Siemens S7

Stara relejna šema(napajanje, žice, špulne, mirni i radni kontakti releja)

Lestvičasti PLC programi koji zamenjuju ovu šemu

Page 12: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 12/30

PLC S7-200 – ciklus izvršenja programa

Page 13: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC: Osnovni blokovi Ladder dijagrama

Page 14: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 14/30

PLC S7 - tipovi podataka , bitovi i bajtovi

Page 15: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 15/30

PLC S7 - tipovi podataka , word i double word

Page 16: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 16/30

PLC S7 osnovni Ladder blokovi - KontaktiThe Normally Open contact is closed (on) when the bit is 1.The Normally Closed contact is closed (on) when the bit is 0.

Rade sa ulaznim bitovima I0.0 .. Izlaznim bitovima Q0.0.. i memorisanim bitovima M0.0 ...

Page 17: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 17/30

Radi sa Izlaznim bitovima Q0.0.. i memorisanim bitovima M0.0 ...

The Set (S) and Reset (R) instructions set (turn on) or reset (turn off) the specified number of points (N), starting at the specified address (Bit). Tipically, N=1. You can set or reset from 1 to 255 points. If the reset specifies either a timer bit (T) or counter bit (C), the instruction resets the timer or counter bit and clears the current value of the timer or counter.

PLC S7 osnovni Ladder blokovi– set/reset

Page 18: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 18/30

Dodela vrednosti , MOV instrukcija

The Move Byte (MOVB) instruction moves the input byte (IN) to the output byte (OUT) without changing the original value.

The Move Word (MOVW) instruction moves the input word (IN) to the output word (OUT) without changing the original value.

Ove dve instrukcije ćete često koristiti da podesite neki komunikacioni modul povezan sa , ili unutar PLC ! Na primer registar za baud rate postavi na 9600 !IN povežemo sa 9600 i povučemo liniju ka EN (dozvolimo upis)

PLC S7 osnovni Ladder blokovi– MOV

Page 19: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 19/30

Kontrola toka programa , FOR and NEXT

The FOR (FOR) instruction executes the instructions between the FOR and the NEXT. You specify the index value or current loop count (INDX), the starting value (INIT), and the ending value (FINAL). The NEXT (NEXT) instruction marks the end of the FOR loop, and sets the top of the stack to 1.

PLC S7 osnovni Ladder blokovi– FOR and NEXT

Page 20: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 20/30

Kontrola toka programa , JMP and LBL

The Jump to Label (JMP) instruction performs a branch to the specified label (n) within the program. When a jump is taken, the top of stack value is always a logical 1.LBL is the program jump point.

PLC S7 osnovni Ladder blokovi– JMP and LBL

Page 21: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 21/30

PLC S7-200 – podprogram (subroutine)

Call Parameter TypeDescriptionIN Parameters are passed into the subroutine. If direct address (such as VB10),

the value at the specified location is passed into the subroutine. If data constant (16#1234), or an address (&VB100), the constant or address value is passed into

the subroutine.IN_OUT The value at the specified parameter location is passed and the result value from

the subroutine is returned to the same location. OUT The result value from the subroutine is returned to the specified parameter location. TEMP Any local memory that is not used for passed parameters may be used for temporary

storage within the subroutine.

When the main program calls the subroutine for execution, the subroutine carries out its program to its end. Then, the system returns control to the main program at the network from which the subroutine was called.

Page 22: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 22/30

S7-200 PLCs incorporate instructions for use with interrupts.

Interrupts are used to initiate a specific, short PLC programsegment, called an interrupt routine, when an internal orexternal event occurs. After the interrupt routine has beenexecuted, control is returned to the main program.

Three types of interrupts are supported by S7-200 PLCs,• communication port interrupts, • I/O interrupts, •timebased interrupts.

Communication port interrupts are used to control a communication port operated in Freeport mode.I/O interrupts are used to respond quickly to high-speed I/Otransitions, such as those associated with high-speed countersor pulse train outputs. Time-based interrupts allow the user program to execute an interrupt routine on a cyclic basis.

Each of these types of interrupts has an associated priority that determines which interrupt is processed first in the event that two or more interrupts are requested at the same time.Communication port interrupts have the highest and time-based have the lowest priority.

PLC S7-200 – Prekid (interrupt)

Page 23: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 23/30

1. Prekid (interrupt, u PLC svetu često zvan događaj ili event) se opslužuje nezavisno od periodičnog PLC ciklusa skeniranja.

2. Kod prekida treba definisati dve stvari • Izvor prekida • Podprogram koji treba izvršiti kada se desi prekid

3. Te dve stvari treba spojiti, ATTACH blok !ATTACH blok kaže pridruži ovaj podprogram (interrupt routine) sa onim interuptom ili događajem (event)

4. Ponekad treba redefinisati akciju , onda prvo moramo razdvojiti rutine od događaja, za to služi DTCH blok

Naravno, događaj (prekid) treba dozvoliti (ENI ) ili po potrebi zabraniti (DISI). U startu je većina zabranjena.

PLC S7-200 – Prekid (interrupt)

Page 24: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 24/30

The Enable Interrupt (ENI) instruction globally enables processing of all attached interrupt events.

The Disable Interrupt (DISI) instruction disables processing of all interrupt events.

The Attach Interrupt (ATCH) instruction associates an interrupt event (EVNT) with an interrupt routine number (INT), and enables the interrupt event.

The Detach Interrupt (DTCH) instruction disassociates an interrupt event (EVNT) from all interrupt routines, and disables the interrupt event.

PLC S7-200 – Prekid (interrupt) ATCH traži i ime podprograma za izvršenje, koji treba povezati sa tim događajem

ATCH traži broj događaja tj prekida

DTCH odvaja događaja od svih rutina. Ne mora da zna koja je bila priljučena tom događaju, sve ubija !

Page 25: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 25/30

PLC S7-200 – Prekid (interrupt)

Tabela Event-aza PLC S200(nepotpuna)

Page 26: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 26/30

PLC S7-200 – Osnovni blokovi Ladder dijagramaFloating point matematika

IN1 + IN2 = OUT

IN1 - IN2 = OUT(nije prikazano)

IN1 * IN2 = OUT

IN1 / IN2 = OUT

Itd..

Page 27: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC: Timer and Counter

Page 28: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 28/30

PLC S7-200 – tajmerski blokovi

This timer continues counting after the Preset is reached, and it stops counting at the maximum value of 32767.TON, TONR, and TOF timers are available in three resolutions. The resolution is determined by the timer number as shown in the chart below. Each count of the current value is a multiple of the time base. For example, a count of 50 on a 10-ms timer represents 500 ms.

Timer Type Resolution Maximum Value Timer NumberTONR 1 ms 32.767 s T0, T64

10 ms 327.67 s T1-T4, T65-T68 100 ms 3276.7 s T5-T31, T69-T95

TON, TOF 1 ms 32.767 s T32, T96 10 ms 327.67 s T33-T36, T97-T100 100 ms 3276.7 s T37-T63, T101-T255

The On-Delay Timer (TON) instruction counts time when the enabling input is ON. When the current value (Txxx) is greater than or equal to the preset time (PT), the timer bit is ON.The On-Delay timer current value is cleared when the enabling input is OFF.

Page 29: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 29/30

PLC S7-200 – tajmerski blokovi

The On-Delay Timer (TON) instruction counts time when the enabling input is ON. When the current value (Txxx) is greater than or equal to the preset time (PT), the timer bit is ON.The On-Delay timer current value is cleared when the enabling input is OFF.

The On-Delay Timer (TON) time diagram

Page 30: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 30/30

PLC S7-200 – tajmerski blokovi

The Retentive On-Delay Timer (TONR) instruction counts time when the enabling input is ON. When the current value (Txxx) is greater than or equal to the preset time (PT), the timer bit is ON.The current value of the Retentive On-Delay timer is maintained when the input is OFF. You can use the Retentive On-Delay timer to accumulate time for multiple periods of the input ON. A Reset instruction (R) is used to clear the current value of the TONR.

Page 31: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 31/30

PLC S7-200 – tajmerski blokovi

The Off-Delay Timer (TOF) is used to delay turning an output OFF for a fixed period of time after the input turns OFF. When the enabling input turns ON, the timer bit turns ON immediately, and the current value is set to 0. When the input turns OFF, the timer counts until the elapsed time reaches the preset time. When the preset is reached, the timer bit turns OFF and the current value stops counting. If the input is OFF for a time shorter than the preset value, the timer bit remains ON. The TOF instruction must see an ON to OFF transition to begin counting.

Page 32: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 32/30

PLC S7-200 – brojački blokovi (counter Down)The Count Down (CTD) counts down from the current value of that counter each time the count down input CD makes the transition from off to on. When the current value Cxxx is equal to zero, the counter bit (Cxxx) turns on. The counter resets the counter bit (Cxxx) and loads the current value with the preset value (PV) when the load input (LD) turns on. The Down Counter stops counting when it reaches zero, and the counter bit Cxxx turns on.

Counter Down time diagram

Page 33: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 33/30

PLC S7-200 – brojački blokovi (counter)The Count UP Down (CTUD) counts up each time the count-up input CU makes the transition from off to on, and counts down each time the count-down input CD makes the transition from off to on. The current value Cxx of the counter maintains the current count. The preset value PV is compared to the current value each time the counter instruction is executed. Upon reaching maximum value (32,767), the next rising edge at the count-UP input causes the current count to wrap around to the minimum value (-32,768). On reaching the minimum value (- 32,768), the next rising edge at the count-DOWN input causes the current count to

wrap around to the maximum value (32,767). When the

current value Cxx is greater than or equal to the preset value PV, the counter bit Cxx turns on. Otherwise, the counter bit turns off. The counter is reset when the Reset (R) input turns on.

Page 34: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 34/30

PLC S7-200 – brojački blokovi (counter)The Count Up (CTU) instruction counts up from the current value each time the count-up input CU makes the transition from off to on. When the current value (Cxxx) is greater than or equal to the Preset Value (PV), the counter bit (Cxxx) turns on. The counter is reset when the Reset (R) input turns on, or when the Reset instruction is executed. The counter stops counting when it reaches the maximum value (32,767).

Page 35: Programabilni logi čki kontroleri  PLC  –program i primeri primene

Primeri Ladder dijagrama

Page 36: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 36/30

PLC S7-200 – samodržanje

Pritisnut normalno otvoren start_taster i nepritisnut normalno zatvoren stop_taster uključuju izlaz.Zatim , izlaz samog sebe drži sve dok neko ne pritisne stop_taster

Ovo važi u slučaju da se koriste dva radna tastera.

start_taster

stop_taster

24 V

I0.1

I0.2

PLC

Page 37: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 37/30

PLC S7-200 – samodržanje industrija

Pritisnut normalno otvoren start_taster i nepritisnut (aliprovodan) normalno otvoren stop_taster uključuju izlaz.Zatim , izlaz samog sebe drži sve dok neko ne pritisne stop_tasterOvo važi u slučaju da se za stop koriste mirni taster! Na primer, podnaponska sklopka dok ima napona drži stopprovodnim, ako napon nestane, stop izbacuje pogon. start_taster

stop_taster

24 V

I0.1

I0.2

PLC

Page 38: Programabilni logi čki kontroleri  PLC  –program i primeri primene

Primena PLC u pogonima

Page 39: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 39/30

Primena PLC pri kontroli motora

Šema pre pojave PLC Logika je rešena relejima,špulnama i pomoćnim kontaktima kontaktora (svi na različitim naponima) kojisu povezani velikim brojemžica. Promena logičkefunkcije i proširenja su bila gotovo nemoguća.

CR – rele (špulna i kontakt)M– kontaktor-motor starter (špulna i trofazni energetski kontakti)OL – trofazni bimetal i pomoćni mirni kontakt) Start

tasterRele

kontaktor

bimetal

napon

Page 40: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 40/30

Primena PLC pri kontroli motora

1. Motor starter, aktuator, prenosi snagu

Ovoga se nećemo rešiti ni sa PLC

2. Tasteri (HMI)

ALi, želimo da sve ostalo ( i mnogo više) radi PLC

Page 41: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 41/30

Primena PLC pri kontroli motora

Komanda(za novu komandu treba nam samo novi taster)

Logika(lako se menja i proširuje po potrebi)

snaga

Page 42: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 42/30

Primena PLC pri kontroli motora

Tipovi lokalnih komanda ka PLC

Radni taster Normalno otvoren

Mirni taster Normalno zatvoren

Normalno otvoren prekidač

Normalno zatvoren prekidač

Radni kontakt Normalno otvoren

Mirni kontakt Normalno zatvoren

+24V

Page 43: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 43/30

Motor radi, Q0.0 se samodrži, stop i bimetal nisu aktivni Start taster dozvoljava signal ka Q0.0, motor startujeNi start ni stop nisu aktivni, Q0.0 neaktivan.

Primena PLC pri kontroli motora

Stop taster ukida signal ka Q0.0 motor sa zaustavlja

Page 44: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 44/30

Proširenje aplikacije – svetlosni indikatori

Komanda(za novu komandu treba nam samo novi taster)

Logika(lako se menja i proširuje po potrebi)

snagaDodatni svetlosni indikatori

Page 45: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 45/30

Proširenje aplikacije – svetlosni indikatori

Prosto rešenje. Novi kod i dve nove linije iz PLC

Page 46: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 46/30

Motor starter

Page 47: Programabilni logi čki kontroleri  PLC  –program i primeri primene

PLC – Industrijski sistemi i protokoli 47/30

Druge aplikacije kontaktora i PLC