CHAPTER 7
EXAMPLES
Introduction
7.1 Self-maintenance
7.2 Making large time intervals
7.3 Delays of ON and OFF status
7.4 Counter over 9999
7.5 Alternate ON-OFF output
7.6 Automation of parking garage
7.7 Operating a charge and discharge process
7.8 Automation of product packaging
7.9 Automation of storage door
7.6 Automation of parking garage
We are dealing with a simple system that can control 100 car at the maximum.
Each time a car enters, PLC automatically adds it to a total sum of other
cars found in the garage. Each car that comes out will automatically be
taken off. When 100 cars park, a signal will turn on signalizing that a
garage is full and notifying other drivers not to enter because there is no
space available.

Signal from a sensor at the garage entrance sets bit IR200.00. This bit is a
condition for execution of the following two instructions in a program.
First instruction resets carry bit CY (it is always done before some other
calculation that would influence it), and the other instruction adds one to
a number of cars in word HR00, and a sum total is again stored in HR00. HR
memory space is selected for storing a total number of cars because this
keeps the status even after supply stops.
Symbol "#" in addition and subtraction instructions defines decimal constant
that is being added or subtracted from a number of cars already in the
garage. Condition for executing comparison instruction CPM is always
executed because bit SR253.13 is always set; this practically means that
comparison will be done in each cycle regardless whether car has entered or
left the garage.
Signal lamp for "garage full" is connected to an output IR010.00. Working of
the lamp is controlled by EQ (equal) flag at address SR255.06 and GR
(greater than) flag at address SR255.05. Both bits are in OR connection
with an output IR010.00 where the signal lamp is. This way lamp will emit
light when a number of cars is greater than or equal to 100. Number of cars
in a real setting can really be greater than 100 because some untrusting
driver may decide to check whether there is any space left, and so a current
number of cars can increase from a 100 to 101. When he leaves the garage, a
number of cars goes down to 100 which is how many parking spots there are in
fact.
Ladder diagram:

7.7 Operating a charge and discharge process
Charge and discharge of a reservoir is a common process in industry as well
as a need for mixing two or more substances. By using automated valves this
process can be completely automated. Let's say that fluid used in the
example is water, and that a reservoir has to be filled up and emptied four
times.
When you push T1 on the operating panel, valve V1 opens and a reservoir
starts filling up with water. At the same time, motor M of the mixer starts
working. When the reservoir fills up, water level goes up and reaches the
level set by a sensor S1. V1 valve closes and motor of the mixer stops.
Valve V2 opens then, and a reservoir starts emptying. When water level falls
below the level set by a sensor S2, valve V2 closes. By repeating the same
cycle four times, lamp that indicates end of a cycle is activated. Pressing
T1 key will start a new cycle.


Both types of differentiators are used in this example. You
can get an idea of what their role is from picture below. Level S1 and S2
sensors provide information on whether fluid level goes beyond a specified
value. This type of information is not important when you wish to know
whether fluid level goes up or down in a certain sequence. Mainly, event of
approaching the upper level, or a moment when fluid that fills up a
reservoir goes beyond upper level and activates sensor S1 is detected in
segment 3 of a ladder diagram. Brief activation of IR200.02 output has as a
consequence a turn off of an output V1 (valve for water, prevents further
flow of water but also motor operation in the mixer). Moment prior to this
(segment 5) valve V2 turns on which marks a beginning of fluid outflow.
Other two differentiators (in segments 6 and 7) have a task
of registering events such as closing a valve MV2 and drop in fluid level
below allowed minimum.

Ladder diagram:

7.8 Automation of product packaging
Product packaging is one of the most frequent cases for automation in
industry. It can be encountered with small machines (ex. packaging grain
like food products) and large systems such as machines for packaging
medications. Example we are showing here solves the classic packaging
problem with few elements of automation. Small number of needed inputs and
outputs provides for the use of CPM1A PLC controller which represents simple
and economical solution.

By pushing START key you activate Flag1 which represents an assisting flag
(Segment 1) that comes up as a condition in further program (resetting
depends only on a STOP key). When started, motor of an conveyor for
boxes is activated. The conveyor takes a box up to the limit switch, and a
motor stops then (Segment 4). Condition for starting a conveyor with apples is
actually a limit switch for a box. When a box is detected, a conveyor with
apples starts moving (Segment 2). Presence of the box allows counter to
count 10 apples through a sensor used for apples and to generate counter
CNT010 flag which is a condition for new activation of a conveyor with boxes
(Segment 3). When the conveyor with boxes has been activated, limit switch
resets counter which is again ready to count 10 apples. Operations repeat
until STOP key is pressed when condition for setting Flag1 is lost. Picture
below gives a time diagram for a packaging line signal.

Ladder diagram:

7.9 Automation of storage door
Storage door or any door for that matter can be automated, so that man does
not have to be directly involved in their being opened or closed. By
applying one three-phased motor where you can change
direction of its movement, doors can be lifted up and lowered back down.
Ultrasonic sensor is used in recognizing presence of a
vehicle by the doors, and photo-electric sensor is used to register a
passing vehicle. When a vehicle approaches, the doors move up, and when a
vehicle passes through the door (a ray of light is interrupted on
photo-electric sensor) they lower down.

By setting a bit IR000.00 at the PLC controller input where ultrasonic
sensor is connected, output IR010.00 (a switch is attached to
this output) is activated, so that a motor lifts the doors up. Aside from
this condition, the power source for lifting the doors must not be active
(IR010.01) and the doors must not be in upper position already (IR000.02).
Condition for upper limit switch is given as normally closed, so
change of its status from OFF to ON (when doors are lifted) will end a
condition for bit IR010.00 where power source for lifting the doors is
(Segment 1).
Photo-electric switch registers a vehicle that passes by, and sets flag
IR200.00. DIFD instruction is used. This instruction is activated when a
condition that precedes it changes status from ON to OFF. When a vehicle
passes through a door, it interrupts a ray and bit IR000.01 status changes
from ON to OFF (Segment 2).

By changing status of an assisting flag from OFF to ON a condition for
lowering a door is executed (Segment 3). Aside from this condition, it is
necessary that a unit power source for lifting a door is turned off, and
that door is not in lower position already. Bit which operates this power
source for lowering, IR010.01 is automatic, so doors are lowered until they
come to the bottom limit switch which is represented in a condition as
normally closed. Its status change from OFF to ON interrupts a condition of
the power source for lowering doors. With oncoming new vehicle, cycle is
repeated.
Ladder diagram:

|