PLC Controlling Program of An Elevator
PLC Controlling Program of An Elevator
Elevator
Bachelor’s Thesis
Valkeakoski
Spring 2020
Thai Nguyen
1
ABSTRACT
ABSTRACT
Pages 63 pages
2
CONTENTS
1 INTRODUCTION ........................................................................................................... 4
5 SIMULATION .............................................................................................................. 48
5.1 Normal movement ............................................................................................ 48
5.2 Prioritized movement ....................................................................................... 51
5.3 Explaining the reset condition of ‘’up_memory’’ and ‘’down_memory’’ ......... 56
5.4 Stop motor and open the door when finishing a call ....................................... 57
5.5 Closing door....................................................................................................... 58
3
5.6 Operation with signals from open button and overload, obstacle sensors ..... 60
6 CONCLUSION ............................................................................................................. 62
REFERENCES .................................................................................................................... 63
4
1 INTRODUCTION
Programmable logic controllers (PLC) have long been the core element in
industrial automation. They provide machines with the possibility to
analyse data and cooperate in automated production and service lines.
Elevators are prime examples of such systems, since most of their
operations are automatically controlled by microprocessors, including
PLCs. This thesis will give an insight to the reader on how a PLC can control
a single elevator to perform safely and efficiently. It can be also viewed as
a tutorial of PLC programming for automation students, with thorough
step-by-step instructions and explanations of the program.
2 THEORECTICAL BACKGROUND
2.1 Elevator
There are three main types of elevators: traction with a machine room,
machine-room-less traction and hydraulic (Archtoolbox, n.d).
Rack or Chassis
A rack or chassis is a base used for mounting the power supply, the CPU
and I/O modules. It has a backplane at the rear that enables I/O to
communicate with the CPU.
CPU
The most important part of the PLC is the Central Processing Unit (CPU). A
PLC’s CPU is an either a 16 or 32 bit microprocessor that consists of
memory chip and integrated circuits for monitoring, logic controlling and
communicating (Gonzalez, 2015). The CPU can be understood as the
8
master device and the actuator is the slave. It receives control algorithms
downloaded from a programming software, which then command the PLC
to carry out instructions like actuating devices, analyzing field data. The
CPU also makes routine memory checkups of the PLC to report back any
errors and ensure the memory is undamaged (Gonzalez, 2015). Like any
other common CPUs, PLC CPUs also have ROM (read-only memory) and
RAM (random access memory). ROM stores data permanently into the
operating system whereas RAM stores status data from field devices and
other values like timers, counters, etc.
PLCs repeatedly carry out three basic steps in their functions. Prior to that,
the logic is checked by the programming software to detect any errors.
Figure 7 describes the order of the sequence
10
Input scan: Read input values in I/O cards and copy them to the
memory.
Logic scan: Reads the input data and correspondingly execute the
program. In this step, the CPU regularly check on input status and
updates the output values.
Output scan: Copy output values from the memory to the I/O cards
that control output devices.
2.2.4 Communications
Figure 8 demonstrates the components inside the cabinet that controls the
elevator’s operation.
The PLC is in charge of reading inputs such as push buttons, sensor signals
and make logic commands, which are sent to the elevator drive. Logic
programs can be downloaded into the PLC through a remote PLC gateway
or by plugging a USB device that contains the program.
The elevator drive directly controls the elevator motor that lifts or lower
the car.
AND Operation
An AND Operation is an operation in which an output is only energized
when there are two normally open switches. It can be understood in
control systems that two input states should be both TRUE, 1 or HIGH for
the output to be activated. Figure 11 shows the expression of AND
Operation in LAD and FBD. The output is only activated when both input A
and B in LAD, or 1 and 2 in FBD is true. Table 1 describes the relation
between the output values and each value of the inputs.
Inputs Outputs
A B
0 0 0
0 1 0
1 0 0
1 1 1
14
OR Operation
On the contrary, an OR Operation output is energized when one of the two
inputs is on. Figure 12 shows the expression of this operation. Table 2
describes the relation between the output values and each value of the
inputs.
Inputs Outputs
A B
0 0 0
0 1 1
1 0 1
1 1 1
NOT Operation
In a NOT Operation (figure 13), the output value is always the opposite to
the input value (Table 3). This operation is also known as an inverter.
Input Output
0 1
1 0
The NAND Operation (figure 14) is the combination of the AND Operation
and the NOT Operation. Unlike the AND Operation, the output of NAND is
the opposite to AND’s output (Table 4). Therefore, it can be activated in
three cases instead of 1.
Inputs Outputs
A B
0 0 1
0 1 1
1 0 1
1 1 0
Inputs Outputs
A B
0 0 1
0 1 0
1 0 0
1 1 0
Inputs Outputs
A B
0 0 0
0 1 1
1 0 1
1 1 0
Assignment
‘’Assignment’’ (figure 17) is an instruction used when one several or inputs
can exclusively activate an output. This means that if the combined input
values or result of logic operation (RLO) has the value of ‘’1’’ then the
output value is ‘’1, otherwise it will return to ‘’0’’.
Set output
The ‘’Set output’’ instruction (figure 18) has less impact over an output
compared to Assignment. Particularly, the output is still activated when
the RLO has the value of ‘’1’’, but it will remain unchanged even if the input
condition is no longer met.
Reset output
The reset output instruction (figure 19) has the opposite role to set output.
When the RLO is ‘’1’’, the output will be deactivated, otherwise its state is
unchanged.
In this section, features and logic commands made for the program are
mentioned and explained.
The listed components below are classified as either inputs or outputs for
declaration in the program.
Floor door and cabin door (outputs): Since the car door and floor door
operates simultaneously in real time, there is one output signal that
simulates their operation.
Car motor (outputs): There are two output signals for moving the elevator
car upwards and downwards.
Sensors (inputs)
Obstacle sensor: Detects if there is an object or person between the
door sides.
Overload sensor: Detects if the elevator is overloaded.
Floor level sensor: Indicate which floor the elevator is at.
Buttons (inputs)
Open and Close buttons in elevator car.
Car call buttons: Call buttons inside the elevator car.
Floor call buttons: Call buttons on each floor.
The elevator is designed to move between four floors. Initially, the car is at
the first floor, meaning that the it is at the very start of the operation. If
the elevator is at another floor from the beginning, it makes no problem
for the program. Signals from call buttons will activate the movement of
the car.
It will move in a power saving order, which means that if the car is moving
in one direction and there is another call to an opposite direction, it will
respond to all the calls in the initial direction before responding to the
latter. For example, if the elevator just went up from floor 1 to floor 3 and
there are two more calls to floor 5 and floor 1, it will continue moving up
to floor 5.
The elevator finishes a call when the call signal matches the floor level
sensor. For example, a call to the second floor is finished when the signal
from that floor’s level sensor is high and a floor call was made. Then, all
the call signal to the second floor is reset to 0. The door is then opened for
19
a fixed period then closed before the car moves to another floor. The car
can only resume moving when the door is fully closed. When the Open
button is pressed, the door is reopened if it is closing, if it is still opened
then the open time is reset. There is also a fixed period after the door is
fully closed again to wait for the Open button signal before the car moves
again.
Next up, select ‘’Add new device’’ and choose a desired controller. If
project involves testing with real devices, then users should choose the
same model number as in the software. In this project the selected device
is a 1215 DC/DC/Rly CPU.
20
When an HMI is added, a new window will open showing the connection
between the devices. The PLC is connected to the HMI screen through a
PROFINET subnet.
21
To view the PLC’s information, double click ‘’PLC_1’’ in figure 25. A rack
installation of the CPU will pop up like in figure 26 below, then double click
‘’PLC_1’’ again. The general tab below the rack indicates the PLC’s data
such as its Ethernet address or the number of I/O channels available.
22
The program can be viewed both in LAD and FBD. Switching between these
languages is possible by right clicking the program block and select ‘’Switch
programming language’’.
Figure 29 shows the view of program block. Default instructions which are
normally open and closed contacts, assignment, empty box, open and
close branch are placed on top of the network tabs. All other instructions
are included in the right-hand side window.
The first and most important logic operation is the elevator calls. These are
the signals that trigger the movement of the elevator. Elevator calls consist
of two types, car calls and floor calls. Car calls are requests made from
buttons inside the elevator car to instruct the car to move towards a
desired floor. Since there a total of five floors, there will be five car call
buttons, each representing the number of a floor. Floor calls are made by
pressing the call buttons on each floor. Therefore, there are also five floor
call buttons. Figures 30 and 31 describe the logic operation of an elevator
call.
Since only buttons can activate a call, the ‘’assignment’’ instruction is used
to activate the output. Tag name ‘’carcall_F1’’ represents the car call to the
first floor. Tag name ‘’floorcall_F1’’ represents the floor call to the first
floor. This syntax is the same for the other four calls.
In real life applications, floor level sensors are used to indicate elevator’s
location. This data can also be used to stop or move the elevator car. To
simulate the signals of the sensors, a memory input with a changeable
integer value is used (“step_count”). Its beginning value is 0. As the
elevator moves up or down, the value will be added or subtracted, which
gives out different values that represents a floor level signal. The logic
operation that controls this input is shown in figures below.
In each output end, the ‘’ADD’’’ and “SUB” (subtract) functions are
responsible for increasing and decreasing ‘’step_count’’ with the deviation
of 1. If only inputs ‘’motor_up’’ and ‘’motor_down” (elevator is moving up
and down) are used then the outputs will be activated just once, which
means that ‘’step_count’’ can only reach to ‘’1’’ at maximum. This is where
a clock memory bit comes in to continuously feed the output. Clock
memory bits are commonly used to activate flashing lights or to trigger
periodic activities. Each bit is assigned to a frequency. Bit number 7 is used
in the program since it best suited to the simulation speed for easy
monitoring.
Table 7 below shows the clock memory bits and their corresponding
periods and frequencies.
Bit 7 6 5 4 3 2 1 0
Period (s) 2.0 1.6 1.0 0.8 0.5 0.4 0.2 0.1
In the first rung in LAD and in the first set of blocks in FBD, the
‘’up_memory” memory output is set by an AND operation between
“motor_up’’ and the OR operation of “F2_sensor’’, ‘’F3_sensor’’ and
‘’F4_sensor’’. This means that if the system responds to the upward signal
and the elevator goes to floor 2, 3 or 4 then the car is assigned with the
upward direction. The output is reset (in the third rung) if the car reaches
the fifth floor, which means that it can only go downward from this point.
One important notice is that direction assignment is only used when there
are calls from both directions, in order to prioritize one over another. For
example, if the upward direction is assigned to the car while it only has
calls from lower floors left, it will still go downwards.
32
Outputs used for direction assignment can also be reset using motor
signals. The reason for choosing these inputs will be further explained in
section 5.3.
The following networks represents the logic operation that triggers the
motor to move the elevator up or down.
33
There are four cases where the elevator is instructed to move up:
The first one is when the car is at the first floor and there are calls
from the upper floors.
In the second case where the elevator is at the second floor, there is
another OR operation added to the initial condition which is similar
to the first case. The first additional input (‘’F1_visit’’) can be
understood as: if there is no request to the first floor and there are
calls from upper floors then the motor will go upwards. The second
and third inputs (‘’F1_visit’’ and ‘’up_memory’’) make use of the
direction assignment mentioned above. It means that if there are
simultaneous calls to the upper floors (upward calls) and to the first
floor (downward call) and ‘’up_memory’’ is True (the car has just
moved up), then the car will continue to move upwards.
Similar to the second case, when the car is at the third and the fourth
floor, it will move up on two conditions: there are only upward calls
or there are calls from both directions, but it has just moved up.
The logic operation for motor moving down signal is the same as
moving up, with ‘’down_memory’’ being the input to prioritize the
downward movement.
The elevator and floor doors are open by setting ‘’door_motor’’. The input
memory ‘’door_closing’’ will be explained in the following network.
The following networks illustrate the door closing operation when there is
no interference from the open button, the obstacle sensor and the
overload sensor.
This operation waits for signals from the open button, the door obstacle
sensor or the overload sensor to cancel the operation of the previous
network.
41
The first scenario where the Open button is used is when the car finishes a
call and the door starts opening. At this time if the Open button is pressed
then the open time in the network shown in figure 45 or 46 is halted. When
the Open button is reset after three second (figure 47 or 48), the timer in
previous network is initialized again.
The third scenario happens when the door is fully closed and then the
Open button is pressed, which can be understood as when passengers
cannot come out of the car in the first attempt.
When the door is closing and one of these signals is activated then memory
input ‘’’door_reopened’’ is set, which then set ‘’door_motor’’ and opens
the door. It is also remained open until both signals are false.
If all inputs are true (open button, obstacle and overload sensors), the
operation keeps the door opened until both obstacle and overload sensor
signals are False, then the open button is reset after three seconds.
Since ‘’door_openedF(n)’’ inputs are used to close the door (section 3.4.6),
there must be a reset operation for them, otherwise they would be kept
closed even when the car finishes a call.
The first condition to reset these inputs is when the elevator leaves a floor
and no floor sensor is active. Therefore, a normally closed contacts for all
floor sensor inputs is used in the first rung. However, when there is no
other call then the car will just stay put, so at least one of the sensors will
be active. This require for another condition which is shown in the second
rung: there are also five normally closed contacts, but the inputs are
elevator calls to all five floors, meaning that if there is no call left then the
door open memory inputs will also be reset.
45
life situations, buttons are created to do this. In this case, the SetTag
function is used to activate and deactivate the signals. Tagged values
are ‘’obstacle’’ and ‘’overload’’. The value is set to 1 to activate and
to 0 to deactivate. The reason for not using SetBit function is that
once a button pressed, the value cannot be reset unless there is a
reset logic operation.
5 SIMULATION
In the simulation screen (figure 57), the elevator is moving up from floor 2
when there is a car call to the third floor.
49
In figures 58 and 59, the logic operation for moving the elevator up is
indicated in the second rung in LAD and in the second lower block in FBD.
Active inputs are ‘’F2_sensor’’, ‘’F3_visit’’ and a normally closed contact of
‘’F1_visit’’, which activate the ‘’motor_up’’ output. The call can also be
made by pressing ‘’Call to floor 3’’ button.
50
Figure 62. Elevator reached floor 4 and needs to keep moving down
55
Figure 64. Error shown in HMI Screen where both ‘’up’’ and ‘’down’’
direction signals are active
57
5.4 Stop motor and open the door when finishing a call
In the example simulation shown below, when the car reaches the fourth
floor, it is stopped by resetting ‘’motor_up’’ and ‘’motor_down’’ and the
door is also opened. The open-end signal, ‘’door_openedF4’’ indicates that
the door is fully opened and initiates the door closing operation.
58
Figure 66. Elevator stops at floor 4 and opens the door in the HMI
Screen
Figure 67. Elevator stops at floor 4 and opens the door in LAD
In the below network, when the open-end signal is true, a three second
timer is started, followed by the door closing signal (resetting
‘’door_motor’’). Memory input ‘’door_closing’’ is also assigned to keep
59
‘’door_motor’’ from being set in the previous network so that the door is
not opened again. If the open button is pressed and either the overload or
the obstacle sensor is active, then this operation is halted.
Figure 69. Resetting all calls when the door is fully closed
5.6 Operation with signals from open button and overload, obstacle sensors
Figures below shows the logic operation when the open button is pressed,
and the obstacle sensor is triggered.
If the door has been opened when the elevator finished a call, then the
door closing operation in figure 68 is halted until the sensor is deactivated
and the open button is reset after a three second duration.
61
6 CONCLUSION
Throughout the thesis process, the author has gained valuable experiences
in PLC programming. The most evident one is that, to build large logic
networks as time-efficient and error-free as possible, one needs to deeply
understand the fundamental functions and beware of all the outcomes
even before the testing step. Otherwise, it would be a time-consuming
process even if the functions seem to be simple. In addition, the author
finds that programming in the ladder logic is more efficient compared to
the function block diagram, since large networks in ladder logic are more
compact and easier to monitor.
REFERENCES
Ladder Logic World. (n.d). Parts of ladder logic. Retrieved 14 February 2020
from
https://ladderlogicworld.com/