LINK DOWNLOAD MIỄN PHÍ TÀI LIỆU "Tài liệu What is a PLC Starters pdf": http://123doc.vn/document/1049625-tai-lieu-what-is-a-plc-starters-pdf.htm
A PLC works by continually scanning a program. We can think of this scan cycle as consisting
of 3 important steps. There are typically more than 3 but we can focus on the important parts and
not worry about the others. Typically the others are checking the system and updating the current
internal counter and timer values.
Step 1-CHECK INPUT STATUS-First the PLC takes a look at each input to determine if it is on or
off. In other words, is the sensor connected to the first input on? How about the second input?
How about the third It records this data into its memory to be used during the next step.
Step 2-EXECUTE PROGRAM-Next the PLC executes your program one instruction at a time.
Maybe your program said that if the first input was on then it should turn on the first output. Since
it already knows which inputs are on/off from the previous step it will be able to decide whether
the first output should be turned on based on the state of the first input. It will store the execution
results for use later during the next step.
Step 3-UPDATE OUTPUT STATUS-Finally the PLC updates the status of the outputs. It updates
the outputs based on which inputs were on during the first step and the results of executing your
program during the second step. Based on the example in step 2 it would now turn on the first
output because the first input was on and your program said to turn on the first output when this
condition is true.
After the third step the PLC goes back to step one and repeats the steps continuously. One scan
time is defined as the time it takes to execute the 3 steps listed above.
Response Time
The total response time of the PLC is a fact we have to consider when shopping for a PLC. Just
like our brains, the PLC takes a certain amount of time to react to changes. In many applications
speed is not a concern, in others though
If you take a moment to look away from this text you might see a picture on the wall. Your eyes
actually see the picture before your brain says "Oh, there's a picture on the wall". In this example
your eyes can be considered the sensor. The eyes are connected to the input circuit of your brain.
The input circuit of your brain takes a certain amount of time to realize that your eyes saw
something. (If you have been drinking alcohol this input response time would be longer!)
Eventually your brain realizes that the eyes have seen something and it processes the data. It
then sends an output signal to your mouth. Your mouth receives this data and begins to respond
to it. Eventually your mouth utters the words "Gee, that's a really ugly picture!".
Notice in this example we had to respond to 3 things:
INPUT- It took a certain amount of time for the brain to notice the input signal
from the eyes.
EXECUTION- It took a certain amount of time to process the information
received from the eyes. Consider the program to be: If the eyes see an ugly
picture then output appropriate words to the mouth.
OUTPUT- The mouth receives a signal from the brain and eventually spits (no
pun intended) out the words "Gee, that's a really ugly picture!"
Response Time Concerns
Now that we know about response time, here's what it really means to the application. The PLC
can only see an input turn on/off when it's looking. In other words, it only looks at its inputs during
the check input status part of the scan.
In the diagram, input 1 is not seen until scan 2. This is because when input 1 turned on, scan 1
had already finished looking at the inputs.
Input 2 is not seen until scan 3. This is also because when the input turned on scan 2 had already
finished looking at the inputs.
Input 3 is never seen. This is because when scan 3 was looking at the inputs, signal 3 was not on
yet. It turns off before scan 4 looks at the inputs. Therefore signal 3 is never seen by the plc.
To avoid this we say that the input should be on
for at least 1 input delay time + one scan time.
But what if it was not possible for the input to be on this long? Then the plc doesn't see the input
turn on. Therefore it becomes a paper weight! Not true of course there must be a way to get
around this. Actually there are 2 ways.
Pulse stretch function. This function extends the length
of the input signal until the plc looks at the inputs during
the next scan.( i.e. it stretches the duration of the pulse.)
Interrupt function. This function interrupts the scan to
process a special routine that you have written. i.e. As
soon as the input turns on, regardless of where the scan
currently is, the plc immediately stops what its doing and
executes an interrupt routine. (A routine can be thought
of as a mini program outside of the main program.) After
its done executing the interrupt routine, it goes back to
the point it left off at and continues on with the normal
scan process.
Now let's consider the longest time for an output to actually turn on. Let's assume that when a
switch turns on we need to turn on a load connected to the plc output.
The diagram below shows the longest delay (worst case because the input is not seen until scan
2) for the output to turn on after the input has turned on.
The maximum delay is thus 2 scan cycles - 1 input delay time.
It's not so difficult, now is it ?
Creating Programs
Relays
Now that we understand how the PLC processes inputs, outputs, and the actual program we are
almost ready to start writing a program. But first lets see how a relay actually works. After all, the
main purpose of a plc is to replace "real-world" relays.
We can think of a relay as an electromagnetic switch. Apply a voltage to the coil and a magnetic
field is generated. This magnetic field sucks the contacts of the relay in, causing them to make a
connection. These contacts can be considered to be a switch. They allow current to flow between
2 points thereby closing the circuit.
Let's consider the following example. Here we simply turn on a bell (Lunch time!) whenever a
switch is closed. We have 3 real-world parts. A switch, a relay and a bell. Whenever the switch
closes we apply a current to a bell causing it to sound.
Notice in the picture that we have 2 separate circuits. The bottom(blue) indicates the DC part. The
top(red) indicates the AC part.
Here we are using a dc relay to control an AC circuit. That's the fun of relays! When the switch is
open no current can flow through the coil of the relay. As soon as the switch is closed, however,
current runs through the coil causing a magnetic field to build up. This magnetic field causes the
contacts of the relay to close. Now AC current flows through the bell and we hear it. Lunch time!
A typical industrial relay
Replacing Relays
Next, lets use a plc in place of the relay. (Note that this might not be very cost effective for this
application but it does demonstrate the basics we need.) The first thing that's necessary is to
create what's called a ladder diagram. After seeing a few of these it will become obvious why its
called a ladder diagram. We have to create one of these because, unfortunately, a plc doesn't
understand a schematic diagram. It only recognizes code. Fortunately most PLCs have software
which convert ladder diagrams into code. This shields us from actually learning the plc's code.
First step- We have to translate all of the items we're using into symbols the plc understands.
The plc doesn't understand terms like switch, relay, bell, etc. It prefers input, output, coil, contact,
etc. It doesn't care what the actual input or output device actually is. It only cares that its an input
or an output.
First we replace the battery with a symbol. This symbol is common to all ladder diagrams. We
draw what are called bus bars. These simply look like two vertical bars. One on each side of the
diagram. Think of the left one as being + voltage and the right one as being ground. Further think
of the current (logic) flow as being from left to right.
Next we give the inputs a symbol. In this basic example we have one real world input. (i.e. the
switch) We give the input that the switch will be connected to, to the symbol shown below. This
symbol can also be used as the contact of a relay.
A contact symbol
Next we give the outputs a symbol. In this example we use one output (i.e. the bell). We give the
output that the bell will be physically connected to the symbol shown below. This symbol is used
as the coil of a relay.
A coil symbol
The AC supply is an external supply so we don't put it in our ladder. The plc only cares about
which output it turns on and not what's physically connected to it.
Second step- We must tell the plc where everything is located. In other words we have to give all
the devices an address. Where is the switch going to be physically connected to the plc? How
about the bell? We start with a blank road map in the PLCs town and give each item an address.
Could you find your friends if you didn't know their address? You know they live in the same town
but which house? The plc town has a lot of houses (inputs and outputs) but we have to figure out
who lives where (what device is connected where). We'll get further into the addressing scheme
later. The plc manufacturers each do it a different way! For now let's say that our input will be
called "0000". The output will be called "500".
Final step- We have to convert the schematic into a logical sequence of events. This is much
easier than it sounds. The program we're going to write tells the plc what to do when certain
events take place. In our example we have to tell the plc what to do when the operator turns on
the switch. Obviously we want the bell to sound but the plc doesn't know that. It's a pretty stupid
device, isn't it!
The picture above is the final converted diagram. Notice that we eliminated the real world relay
from needing a symbol. It's actually "inferred" from the diagram. Huh? Don't worry, you'll see what
we mean as we do more examples.
Basic Instructions
Now let's examine some of the basic instructions is greater detail to see more
about what each one does.
Load
The load (LD) instruction is a normally open contact. It is sometimes also called examine if on.
(XIO) (as in examine the input to see if its physically on) The symbol for a load instruction is
shown below.
A LoaD (contact) symbol
This is used when an input signal is needed to be present for the symbol to turn on. When the
physical input is on we can say that the instruction is True. We examine the input for an on signal.
If the input is physically on then the symbol is on. An on condition is also referred to as a logic 1
state.
This symbol normally can be used for internal inputs, external inputs and external output
contacts. Remember that internal relays don't physically exist. They are simulated (software)
relays.
LoadBar
The LoaDBar instruction is a normally closed contact. It is sometimes also called LoaDNot or
examine if closed. (XIC) (as in examine the input to see if its physically closed) The symbol for a
loadbar instruction is shown below.
A LoaDNot (normally closed contact) symbol
This is used when an input signal does not need to be present for the symbol to turn on. When
the physical input is off we can say that the instruction is True. We examine the input for an off
signal. If the input is physically off then the symbol is on. An off condition is also referred to as a
logic 0 state.
This symbol normally can be used for internal inputs, external inputs and sometimes, external
output contacts. Remember again that internal relays don't physically exist. They are simulated
(software) relays. It is the exact opposite of the Load instruction.
*NOTE- With most PLCs this instruction (Load or Loadbar) MUST be the first symbol on the left of
the ladder.
Logic State Load LoadBar
0 False True
1 True False
Out
The Out instruction is sometimes also called an OutputEnergize instruction. The output instruction
is like a relay coil. Its symbol looks as shown below.
An OUT (coil) symbol
When there is a path of True instructions preceding this on the ladder rung, it will also be True.
When the instruction is True it is physically On. We can think of this instruction as a normally open
output. This instruction can be used for internal coils and external outputs.
Outbar
The Outbar instruction is sometimes also called an OutNot instruction. Some vendors don't have
this instruction. The outbar instruction is like a normally closed relay coil. Its symbol looks like that
shown below.
An OUTBar (normally closed coil) symbol
When there is a path of False instructions preceding this on the ladder rung, it will be True. When
the instruction is True it is physically On. We can think of this instruction as a normally closed
output. This instruction can be used for internal coils and external outputs. It is the exact opposite
of the Out instruction.
Logic State Out OutBar
0 False True
1 True False
A Simple Example
N ow let's compare a simple ladder diagram with its real world external physically connected
relay circuit and SEE the differences.
In the above circuit, the coil will be energized when there is a closed loop between the + and -
terminals of the battery. We can simulate this same circuit with a ladder diagram. A ladder
diagram consists of individual rungs just like on a real ladder. Each rung must contain one or
more inputs and one or more outputs. The first instruction on a rung must always be an input
instruction and the last instruction on a rung should always be an output (or its equivalent).
Notice in this simple one rung ladder diagram we have recreated the external circuit above with a
ladder diagram. Here we used the Load and Out instructions. Some manufacturers require that
every ladder diagram include an END instruction on the last rung. Some PLCs also require an
ENDH instruction on the rung after the END rung.
Next we'll trace the registers. Registers? Let's see
Không có nhận xét nào:
Đăng nhận xét