Programmable Logic Controllers: A Concise Exploration

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 33

Programmable Logic

Controllers

A Concise Exploration
I. Industrial Automation
• Common knowledge: computers are used
in factories...
• Robotic arm, CNC, injection molding
I. Industrial Automation
• Donut machine, Ice cream sandwich
machines
I. Industrial Automation
• Not common knowledge: today this is
usually accomplished with Programmable
Logic Controllers (PLCs)

• PLCs are the answer to a variety of needs:


durability, reliability, flexibility, scalability,
reprogrammability, etc...
I. Industrial Automation
• Why should you care? Because you will run into
PLCs...
• Did you know? <Insert shocking Buckley
statistic here>
• Median starting salary for entry-level “Electrical
Controls Engineer” is $57,452. (EE is $55K, HW
Eng is $48K, SW Eng is $53K) [monster.com]
• As long as there is industry, it will be computer
controlled and engineers will earn paychecks.
II. History
• Relentless trend toward tools in industry.

 Handicraft (forever)
 Water-powered silk mill (1721)
 Spinning Jenny (1764)
 Steam power (1780s)
 Gas lighting (1810s)
 Etc…
II. History
• Obvious next step: Electricity

• [Aside: why was Buffalo the place to be


100 years ago? ... Hydroelectric power! –
started circa 1853]

• Electric tools, but still micromanaged by


humans.
II. History
• Machines become autonomous.

• Common method: relay logic


III. Relay Logic

• Conditional logic can be represented in


terms of contacts and coils.
• Contact: A simple input switch.
• Coil: An output load, e.g., a relay or motor.
• Symbolic representation called ladder
logic.
III. Relay Logic
• To clarify: “Ladder Logic” is a notation
originally used to describe/document
relay logic configurations.
• Later became the basis for PLC
programming languages
• (This parallels HW Desc. Langs. (HDLs)...
VHDL was intended by DoD to document
ASICs... Learn more in CSE 341 and
especially CSE 490)
IV. Ladder Logic

• Power supply rails drawn as parallel


vertical lines on left and right
• Connection of rails implies current will flow
• An output is “on” when a connection is
completed and current flows through the
load’s coil
IV. Ladder Logic
• Simple “always on” load:

[Always_On = 1]

• Boring... Load controlled by a single


contact:

[Switch_Con = Switch]
IV. Ladder Logic

• Boolean logic - C = A and B

• C = A or B
IV. Ladder Logic
• C = not A

• A contact with a slash through it is


“normally closed.” This indicates a
connection when A is NOT triggered.
• So when sensor/input A is activated, there
is an open circuit
IV. Ladder Logic
• Each rung of the ladder is a statement that is
asynchronous when implemented in relay
logic, but evaluated sequentially by the PLC.

• X = (A or B) and (C or D),
Y = ~A and [B or (C and D)]
IV. Ladder Logic

• Converting between ladder logic and


physical electronics is straight forward.

• So this…
IV. Ladder Logic

• …becomes this:
V. PLC
• The first PLC was invented by Dick Morely in
1978.
• Morely designed a computer with three
components: a processor, memory, and a logic
solver.
• “[The logic solver] allowed us to get the speed
we needed in this application-specific computer
to solve the perceptually simple problem of
several cabinets full of relay wiring.” -Morely
V. PLC
• The first PLC (the 084) was extremely durable
and reliable...
• “We used to test the programmable controllers
with a Tesla coil that struck a quarter inch to half-
inch arch anywhere on the system, and the
programmable controller still had to continue to
run.” –Morely

• FYI, this is a Tesla coil: http://


www.youtube.com/watch?v=oNrgXtCu4aU
V. PLC
• Hello World on the PLC. Real hardware:

• In ladder logic:
V. PLC
• Not very interesting… how about a “stay-
on” variation? (When the switch is
released, the light stays on)
• PLC benefit: The state of an “output” in one
rung may be used as a “contact” in another.
• In fact, there are “internal utility relays” –
virtual outputs that act as intermediate
steps toward real outputs.
V. PLC

• Latched (“stay-on”) Hello World:

• When the switch is pressed, “Neon” will be


active in the first evaluation.
• In subsequent evaluations, “Neon” will
force itself to stay on.
V. PLC
• A bit more convoluted: toggling Hello World
with a single button.

Latch = (Switch AND notNeon) OR (Latch AND notNeon)


Neon = (Latch AND notSwitch) OR (Neon AND Switch)
• Remember - Switch state: ON OFF ON OFF
• Figure it out
V. PLC
• PLCs also support a range of special
functions: timers, counters, sequencers,
memory instructions, etc…

• Beyond the basics, they are non-standard


and manufacturer-specific.
V. PLC
• Timer:

• Counter:
VI. Washing Machine
• Washing machine example, using
sequencer.
5. “Agitate” and drain - spin
0. Fill with hot water -pump,
motor, agitate motor, drain
• Steps: hot water valve
valve
1. “Agitate” – spin motor,
6. Fill with cold water -pump
agitate motor
2. “Agitate” and drain – spin
7. Spin and drain –spin motor,
motor, agitate motor, drain
drain valve
valve
3. Fill with hot water -pump,
8. Stop
hot water valve
4. “Agitate” - spin motor,
agitate motor
VI. Washing Machine
• Reorganize into the “outputs”: edit the I/O
Table
Output Active in steps…
Pump 0, 3, and 6
Hot water valve 0 and 3
Spin Motor 1, 2, 4, 5, and 7
Agitate Motor 1, 2, 4, and 5
Drain valve 2, 5, and 7

• Assignment – complete the program – due


2/27
I/O Table – 1 step
st
Exercises
• Turn 8 LEDs on and off in sequence,
repeat.

• Turn a pump on for 60 seconds, then off


for 40 seconds, then repeat. Use a switch
to start it off.
Using a sequencer
• Define a Counter output – call it Seq1
• Give it a set value 1 greater than your
desired sequences:
– e.g. if 4, then 0 thru 4 = a set value of 5
• Use special bits as inputs
• Use Seq1:0 to reset the sequencer by
defining an output FUNC
60 on / 40 off
60 on / 40 off
Latch an output (keeps it ON)

Count down TMR60 from 60 to 0

While TMR60 is counting down (not at 0) run PUMP

While TMR60 is at 0, count down TMR40


VII. …
References

http://en.wikipedia.org/wiki/Programmable_logic_controller
http://www.plcs.net/contents.shtml
http://www.plcdev.com/plc_timeline
http://www.barn.org/FILES/historyofplc.html
http://www.jach.hawaii.edu/ets/mech/JCMT/carousel/car_eng.html - Old relay logic
http://www.rootcompromise.org/gallery/v/blackhat/bh-windows-2004/bh_windows_2004_014.jpg.html - Donut machine
http://www.fiona.co.jp/BOOK_JUV_PAGE/homerprice.htm - Homer Price
http://www.youtube.com/watch?v=gKzJqXSPuRE - Krispie Kreme
http://www.youtube.com/watch?v=-kiSQx0imxs – Ice Cream Sandwiches
http://www.youtube.com/watch?v=0PUFwwSDAWg – DVD Boxes
http://www.youtube.com/watch?v=ibc69W_N2h0 – Plasma Cutting
http://www.youtube.com/watch?v=y2mzjExWXzo – Injection Molding
http://rds.yahoo.com/_ylt=A9gnMiYBqv1FGjkBFlGjzbkF;_ylu=X3oDMTBsdmIydTZhBHNlYwNwcm9mBHZ0aWQDSTAwMV83MA--/SIG=12imesfu9/EXP=1174338
433/**http%3A//www.plastic-gear-manufacturer.com/injection-molding.htm -- Injection Molding
http://rds.yahoo.com/_ylt=A9gnMiIVqv1Fs60AJw.jzbkF;_ylu=X3oDMTBsdmIydTZhBHNlYwNwcm9mBHZ0aWQDSTAwMV83MA--/SIG=12pk1f58s/EXP=1174338
453/**http%3A//www.offshoresolutions.com/products/plastic/injectionMolded.htm -- Injection Molding
http://home.howstuffworks.com/washer.htm
http://en.wikipedia.org/wiki/Industrial_revolution
http://en.wikipedia.org/wiki/Niagara_falls#Historical_background
http://en.wikipedia.org/wiki/VHDL

You might also like