PLC_3B_Timer_Counter

Download Report

Transcript PLC_3B_Timer_Counter

Styrteknik: Tidskretsar, räknare
Olika exempel med Timers och Counters
En Enkel Timer med MELSEC IL
LD
OUT
LD
OUT
BTN_DGVG
T1
K50
T1
LEDKG_RED
Funktion:
• Om BTN_DGVG trycks ned och hålls nedtryckt:
=> LEDKG_red = 1 efter 5.0 sek (50*100 ms)
• OBS här anges timer T1 explicit i koden. Normalt
används funktionsblock som väljer timer internt.
PLC3B:1
Styrteknik: Tidskretsar, räknare
Ex test3: Ladder Diagram
Vilken timer som används kan erhållas med
”Upload project” som visar MELSEC-koden
PLC3B:2
Styrteknik: Tidskretsar, räknare
PLC3B:3
Ex test3: MELSEC IL from Ladder Diagram using IEC timer TON
•
•
•
•
•
Med Upload Project erhålls koden!
X005 = BTN_DGVG
M8000 = RUN-indikering
Värdet 5000 sparas i D128
Y000 = LEDKG_RED
•
•
•
•
•
Subrutinen P_30
5000/100 = 50 => D132 (dvs 5 sek)
Timer T17 används
Utvärdet sparas i M257
T17*100=>aktuellt tidsvärde=>D130
ger värdet till utgången ET
Styrteknik: Tidskretsar, räknare
Ex test4: IEC Function Block Diagram
PLC3B:4
Styrteknik: Tidskretsar, räknare
Ex test5: MELSEC Function Block Diagram
PLC3B:5
Styrteknik: Tidskretsar, räknare
Ex test5: MELSEC Function Block Diagram
Upload Project ger koden!
OBS ingen subrutin
PLC3B:6
Styrteknik: Tidskretsar, räknare
PLC3B:7
Ex test6: IEC Function Block Diagram, Pulse Timer
Styrteknik: Tidskretsar, räknare
PLC3B:8
In GX IEC Developer timers and counters are programmed using a group of
special functions provided in the Manufacturer Library.
Function:
Operands
TIMER_M / COUNTER_M
Normal timers/counters
Extended timers/counters
Action
Passes the setpoint value and calls (starts) the
timer/counter
Med en Function måste man specifiera
vilken Timer (T1-T32) man ska använda.
Styrteknik: Tidskretsar, räknare
PLC3B:9
MELSEC Output Instructions: OUT T
10 seconds after setting X0, the following program sets the outputs Y10 and
Y14. A low speed timer (100 ms) is used.
•
•
•
•
•
Function TIMER_M
TC1 = T1, Coil på T1, adress
TS1 = Status T1, avläst värde
Övrigt enligt tidigare ex
OBS Man väljer själv vilken Timer (T1)
som ska användas.
Styrteknik: Tidskretsar, räknare
PLC3B:10
Input of a binary value from digital inputs
Binary Conversion BINP
The program reads the time
setting via the inputs X10 through
X1F in BCD data format. Note 16
inputs are needed.
With leading edge from X0 BCD
data is converted into BIN data
first and stored in D10.
After setting X2 the time setting is
read. After the set time has
passed Y15 is set.
A low speed timer (100 ms) is
used.
Styrteknik: Tidskretsar, räknare
Användning av MELSEC Function: TIMER_M
LEDKG_GREEN tänds 5 sek efter att
BTN_DGVG har tryckts ned
PLC3B:11
Styrteknik: Tidskretsar, räknare
Ex test_C1: MELSEC IL Counter
OBS Här anges Counter C0 explicit i koden*)
PLC3B:12
Styrteknik: Tidskretsar, räknare
Ex test_C2: IEC Function Block Diagram
PLC3B:13
Styrteknik: Tidskretsar, räknare
Ex test_C3: MELSEC Function Block Diagram
PLC3B:14
Styrteknik: Tidskretsar, räknare
Ex test_C4: MELSEC Function Block Diagram
PLC3B:15
Styrteknik: Tidskretsar, räknare
PLC3B:16
FX1 har 2000 programsteg, För de olika testerna med
räknaren gäller:
•Test_C1: MELSEC kod =>12 programsteg
•Test_C2: IEC Function Block => 44 programsteg
•Test_C3: MELSEC Function Block => 22 programsteg
•Test_C4: MELSEC Function =>12 programsteg
MELSEC-Blocken är anpassade för PLC:en och
kräver färre programsteg. Konstruktionen kan inte
flyttas till andra styrsystem lika lätt.
Styrteknik: Tidskretsar, räknare
PLC3B:17
Räknarens värde kan
visas på utgångarna.
Vid lab 2 ska antalet
bilar i ett garage visas.
Styrteknik: Tidskretsar, räknare
PLC3B:18
Styrteknik: Tidskretsar, räknare
PLC3B:19
Styrteknik: Tidskretsar, räknare
On-off cycle timer
PLC3B:20
Styrteknik: Tidskretsar, räknare
PLC3B:21
Styrteknik: Tidskretsar, räknare
PLC3B:22
Varianter av ”One shot”
Styrteknik: Tidskretsar, räknare
PLC3B:23
Exempel med timer från AMS kapitel 9.
Consider the short ladder logic program in Figure 9.13 for control of a heating
oven. The system is started with a Start button that seals in the Auto mode. This can be
stopped if the Stop button is pushed. (Remember: Stop buttons are normally closed.)
When the Auto goes on initially the TON timer is used to sound the horn for the first 10
seconds to warn that the oven will start, and after that the horn stops and the heating coils
start. When the oven is turned off the fan continues to blow for 300s or 5 minutes after.
Tips: Stop button kan vara t.ex. SW_KGS på labkortet. Sluten kontakt innebär att processen kan
starta. Start kan vara BTN_KGSG.
Använd Function Block Diagram eller Ladder Diagram.
I lösningen I AMS är heat.dn, “done bit”, den normala utgången på en timer. Signalen heat.tt är 1 sä
länge timern räknar, signalen finns inte I IEC:s tidskretsar.
Börja med att rita ett tidsdiagram för exemplet.
Styrteknik: Tidskretsar, räknare
PLC3B:23
Exempel med Counter från AMS kapitel 9.
The program in Figure 9.17 is used to remove 5 out of every 10 parts from a conveyor
with a pneumatic cylinder. When the part is detected both counters will increase
their values by 1. When the sixth part arrives the first counter will then be done, thereby
allowing the pneumatic cylinder to actuate for any part after the fifth. The second counter
will continue until the eleventh part is detected and then both of the counters will be reset.
Rita tidsdiagram för lösningen. Skriv program.
Styrteknik: Tidskretsar, räknare
PLC3B:23
Exempel från AMS kapitel 9.
Shear Press
1. A toggle start switch (TS1) and a limit switch on a safety gate (LS1) must both
be on before a solenoid (SOL1) can be energized to extend a stamping cylinder
to the top of a part.
2. While the stamping solenoid is energized, it must remain energized until a limit
switch (LS2) is activated. This second limit switch indicates the end of a stroke.
At this point the solenoid should be de-energized, thus retracting the cylinder.
3. When the cylinder is fully retracted a limit switch (LS3) is activated. The cycle
may not begin again until this limit switch is active.
4. A cycle counter should also be included to allow counts of parts produced.
When this value exceeds 5000 the machine should shut down and a light lit up.
5. A safety check should be included. If the cylinder solenoid has been on for more
than 5 seconds, it suggests that the cylinder is jammed or the machine has a
fault. If this is the case, the machine should be shut down and a maintenance
light turned on.
Skriv program!
Styrteknik: Tidskretsar, räknare
PLC3B:23
Flera exempel från AMS kapitel 9
16. In dangerous processes it is common to use two palm buttons that require a operator to use
both hands to start a process (this keeps hands out of presses, etc.). To develop this there are
two inputs that must be turned on within 0.25s of each other before a machine cycle may begin.
18. Write a ladder logic program that does what is described below.
- When button A is pushed, a light will flash for 5 seconds.
- The flashing light will be on for 0.25 sec and off for 0.75 sec.
- If button A has been pushed 5 times the light will not flash until the system is reset.
- The system can be reset by pressing button B
20. A buffer can hold up to 10 parts. Parts enter the buffer on a conveyor controller by output conveyor. As parts arrive they trigger an input sensor enter. When a part is removed from the
buffer they trigger the exit sensor. Write a program to stop the conveyor when the buffer is full,
and restart it when there are fewer than 10 parts in the buffer. As normal the system should also
include a start and stop button.
22. We are using a pneumatic cylinder in a process. The cylinder can become stuck, and we need
to detect this. Proximity sensors are added to both endpoints of the cylinder’s travel to indicate
when it has reached the end of motion. If the cylinder takes more than 2 seconds to complete a
motion this will indicate a problem. When this occurs the machine should be shut down and a
light turned on. Develop ladder logic that will cycle the cylinder in and out repeatedly, and
watch for failure.