Industrial Production Line Automation
Industrial Production Line Automation
&
I
Acknowledgment
I would like to gratitude to the great god for all physical support he give
to me during the project processes.
Also I would like to thank Mr. louay Farouq and Mrs. Samah
Mohammed Hashim for their patience, support and helpful advices.
II
Abstract
In the late sixties of the last century the American company general electric
complex relay control system in order to use it in its car production lines. These
controllers showed very high efficiency in control systems and higher reliability in
protecting the components being controlled. In addition to this, the latter improved
characteristics made PLCs the most control system used in production Processes.
The aim of this project is to illustrate the usage of PLC in automation of production
lines and the utilization of its high capabilities to process input signals from several
sensors. This is done by implementing a small model of the filling stage of a soft
III
ا ُمل ْس َت ْس ل َت ْس
لـ:
فٍ أواخش انسزُُبد يٍ انقشٌ انًبضٍ اسزحذثذ ششكخ جُشال األيشَكُخ انًزحكًبد انًُطقُخ انقبثهخ نهجشيجخ
انًشحالد انًؼقذ و رنك نإلسزفبدح يُهب فٍ انزحكى ثخطىط إَزبج يصبَغ انسُبساد انخبصخ
ِّ كجذَم نُظبو رحكى
ثبنششكخ .أثشصد هزِ انًزحكًبد كفبءح ػبنُخ جذًا فٍ َظى انزحكى و يىثىقُخ ػبنُخ فٍ حًبَخ األَظًخ انًزحكى
ثهب ،ثبإلضبفخ نهًُضاد األخشي انزٍ رى اسزحذاثهب ثؼذ رنك ،انشٍء انزٌ جؼم يُهب أكثش أَظًخ انزحكى اسزخذا ًيب
َهذف هزا انًششوع إنً رىضُح اسزخذاو انًزحكًبد انًُطقُخ انقبثهخ نهجشيجخ فٍ أرًزخ خطىط اإلَزبج و
اإلسزفبدح يٍ يقذسرهب انؼبنُخ فٍ يؼبنجخ اإلشبساد انذاخهخ ػجش انحسبسبد انًخزهفخ يزؼذدح اإلسزخذايبد ،و
رنك ثأخز ًَىرج يصغش نًشحهخ انزؼجئخ نخط إَزبج انًششوثبد انغبصَخ كزطجُق نهزا اإلسزخذاو ،حُث َزى ػًم
ػذح ػًهُبد ثشكم رسهسهٍ إلَزبج انًششوة انغبصٌ ،فٍ هزِ انًشحهخ رزى اإلسزفبدح يٍ انًزحكًبد انًُطقُخ
انقبثهخ نهجشيجخ فٍ حفظ هزا انزسهسم نهزِ انؼًهُبد حست رضايٍ يؼٍُ.
IV
Table of contents
Dedication …………………………………………………………………………………………... I
Acknowledgment…………………………………………………………………………………..... II
Abstract ……………………………………………………………………………………………... III
………………………………………………………………………………………………المستخلص IV
Table of contents……………………………………………………………………………………. V
Chapter 1: Introduction……………………………………………………………………………. 1
1.1 Objective…………………………………………………………………………………..... 1
1.2 Introduction to industrial automation…………………………………………………….. 2
1.3 Categories of automation……………………………………………………………………. 2
1.4 Advantages and disadvantages of automation……………………………………………… 2
1.5 Automation tools……………………………………………………………………………. 3
1.6 Automated manufacturing…………………………………………………………………... 3
1.7 Thesis layout………………………………………………………………………………. 4
Chapter 2: Theoretical Background…………………………………………………………………. 5
2.1 the PLC automation technology……………………………………………………………... 5
2.2 methedology…………………………………………………………………………………. 6
2.3 how a PLC operates …………………………………………………………………………. 6
2.4 The Siemens S7-200 PLC…………………………………………………………………… 7
2.4,1 Ladder logic………………………………………………………………………… 7
2.4.2 PLC scan ……...……………………………………………………………………. 8
2.4.3 Basic requirements for PLC use………………………………………………….. 9
2.4.3.1 Programming device………………………………………………………… 10
2.4.3.2 Software……………………………………………………………………. 10
2.4.3.3 Connector cables…………………………………………………………... 10
2.4.4 STEP 7--Micro/WIN Programming Package………………………………………. 10
2.4.4.1 Using STEP 7--Micro/WIN to Create Your Programs……………………. 11
2.4.4.2 Establishing a connection…………………………………………………. 12
2.4.4.3 Downloading the Program………………………………………………… 14
2.4.4.4 Placing the S7-200 in RUN Mode or STOP mode………………………….. 15
2.5 Brushed DC electric motor………………………………………………………………... 15
2.5.1 Speed control………………………………………………………………………... 16
2.5.1.1 Using the PWM (Pulse Width Modulation) Output………………………… 18
2.5.1.2 Configuring the PWM Output……………………………………………... 18
2.6 Stepper motors……………………………………………………………………………….. 22
2.6.1 Stepper motor features………………………………………………………………. 22
2.6.2 Stepper motor types…………………………………………………………………. 23
2.6.3 Stepper motor operation…………………………………………………………….. 24
2.7 Sensors……………………………………………………………………………………….. 26
2.7.1 Proximity detectors………………………………………………………………….. 26
2.7.1.1 Inductive detection………………………………………………………….. 27
2.7.1.2 Capacitive detection………………………………………………………… 27
2.7.1.3 Sensitivity of proximity sensors…………………………………………….. 28
2.7.2 Photoelectric detectors……………………………………………………………… 29
2.7.2.1 Different detection systems…………………………………………………. 29
Chapter 3: Design And The Implementation Of The model………………………………………… 31
3.1 Sensor selection and placement……………………………………………………………... 32
3.1.1 Bottle status, conveyor 1……………………………………………………………. 32
V
3.1.2 Valve Sensor………………………………………………………………………… 33
3.1.3 Bottle status, conveyor 2……………………………………………………………. 34
3.2 The filling machine arm…………………………………………………………………….. 35
3.3 The Valve…………………………………………………………………………………… 39
3.4 Abnormal situations in the conveyor………………………………………………………... 40
3.4.1 Conveyor 1…………………………………………………………………………... 40
3.4.2 Conveyor 2…………………………………………………………………………... 40
3.5 Starting and Stopping the system……………………………………………………………. 41
3.6 Timing and sequencing of the filling machine……………………………………………. 41
3.7 PLC protection…………………………………………………………………………….. 42
3.8 The whole system…………………………………………………………………………… 43
3.9 Simulation………………………………………………………………………………….. 45
3.10 Hardware implementation…………………………………………………………………. 46
Chapter four : Results and Discussions……………………………………………………………... 47
4.1 Results……………………………………………………………………………………….. 47
4.1.1 Sequencing………………………………………………………………………….. 47
4.1.2 DC motors’ speeds………………………………………………………………….. 47
4.1.3 Stepper motor timing and delay…………………………………………………….. 47
4.1.4 Valve timing………………………………………………………………………… 48
4.2 Possible improvements……………………………………………………………………. 48
4.2.1 The stepper controller and the PTO (pulse train output)…………………………… 48
4.2.2 Weight sensors………………………………………………………………………. 49
Chapter five: project evaluation……………………………………………………………………. 50
5.1 Conclusion…………………………………………………………………………………. 50
5.2 Future work………………………………………………………………………………… 50
References…………………………………………………………………………………………… 51
Appendices
Main program code Appendix A
VI
Chapter one Introduction
Chapter one
Introduction
1.1 Objective
The project’s aim is to illustrate the concept of industrial automation through a simple design of part
of a soft drink production line automated by a PLC system.
The design should include all the necessary steps taken by a control systems engineer to implement
the automated system, the steps are listed below:
Industrial automation is the use of robotic devices to complete manufacturing tasks. In this day and
age of computers, industrial automation is becoming increasingly important in the manufacturing
process because computerized or robotic machines are capable of handling repetitive tasks quickly
1
Chapter one Introduction
and efficiently. Machines used in industrial automation are also capable of completing mundane
tasks that are not desirable to workers. In addition, the company can save money because it does not
need to pay for expensive benefits for this specialized machinery. There are both advantages and
disadvantages for a company when it comes to industrial automation.
Automation technology, if used wisely and effectively, can yield substantial opportunities for the
future. There is an opportunity to relieve humans from repetitive, hazardous, and unpleasant labor in
all forms. And there is an opportunity for future automation technologies to provide a growing
social and economic environment in which humans can enjoy a higher standard of living and a
better way of life.
Automated machines can be subdivided into two large categories, open-loop and closed-loop
machines, which can then be subdivided into even smaller categories. Open-loop machines are
devices that, once started, go through a cycle and then stop. Closed loop machines complete to the
cycle described earlier then repeats it until it’s stopped.
Advantages commonly attributed to automation include higher production rates and increased
productivity, more efficient use of materials, better product quality, improved safety, shorter
workweeks for labor, and reduced factory lead times. Higher output and increased productivity have
been two of the biggest reasons in justifying the use of automation. Despite the claims of high
quality from good workmanship by humans, automated systems typically perform the
manufacturing process with less variability than human workers, resulting in greater control and
consistency of product quality. Also, increased process control makes more efficient use of
materials, resulting in less scrap. Another benefit of automation is the reduction in the number of
hours worked on average per week by factory workers.
2
Chapter one Introduction
Other disadvantages of automated equipment include the high capital to invest in automation, a
higher level of maintenance needed than with a manually operated machine, and a generally lower
degree of flexibility in terms of the possible products as compared with a manual system.
Automated manufacturing refers to the application of automation to produce things in the factory
way. Most of the advantages of the automation technology have its influence in the manufacture
processes.
The main advantage of the automated manufacturing are: more quality, reduce the lead times,
simplification of production, reduce handling, improve work flow and increase the moral of workers
when a good implementation of the automation is made.
3
Chapter one Introduction
Throughout the next chapters the details of the project are shown. The second chapter describes the
components used in the project and how they were used. The design and implementation are
detailed in the third chapter. Then the results of the automated system are shown and discussed in
the fourth chapter. The conclusion reached and possible future works are discussed throughout the
fifth chapter.
4
Chapter two Theoretical Background
Chapter 2
Theoretical Background
Control engineering has evolved over time. In the past humans were the main method for controlling
a system. More recently electricity has been used for control and early electrical control was based
on relays. These relays allow power to be switched on and off without a mechanical switch. It is
common to use relays to make simple logical control decisions. The development of low cost
computer has brought the most recent revolution, the Programmable Logic Controller (PLC) (see
figure 2.1). The advent of the PLC began in the 1970s, and has become the most common choice for
manufacturing controls.
PLCs have been gaining popularity on the factory floor and will probably remain predominant
for some time to come. Most of this is because of the advantages they offer.
Figure 2.1
5
Chapter two Theoretical Background
2.2 methodology
PLCs are advantageous over normal computer as they were built for harsh industrial environment
and have the facility for extensive input/output (I/O) arrangements. These connect the PLC to
sensors and actuators. PLCs read limit switches, analog process variables (such as temperature and
pressure), and the positions of complex positioning systems. Some use machine vision. On the
actuator side, PLCs operate electric motors, pneumatic or hydraulic cylinders, magnetic relays,
solenoids, or analog outputs. The input/output arrangements may be built into a simple PLC, or the
PLC may have external I/O modules attached to a computer network that plugs into the PLC.
Figure 2.3
6
Chapter two Theoretical Background
Figure 2.4
Figure 2.5
7
Chapter two Theoretical Background
The left vertical line of a ladder logic diagram (figure 2.5) represents the power or energized
conductor. The output element or instruction represents the neutral or return path of the circuit. The
right vertical line, which represents the return path on a hard-wired
Control line diagram, is omitted. Ladder logic diagrams are read from left-to-right,
top-to-bottom. Rungs are sometimes referred to as networks. A network may have several control
elements, but only one output coil.
In the example program shown example I0.0, I0.1 and Q0.0 represent the first instruction
combination. If inputs I0.0 and I0.1 are energized, output relay Q0.0 energizes. The inputs could be
switches, pushbuttons, or contact closures. I0.4, I0.5, and Q1.1 represent the second instruction
combination. If either input I0.4 or I0.5 is energized, output relay Q0.1 energizes.
8
Chapter two Theoretical Background
Figure 2.6
Figure 2.7
9
Chapter two Theoretical Background
2.4.3.2 Software
A software program is required in order to tell the PLC what instructions it must follow.
Programming software is typically PLC specific. A software package for one PLC, or one family of
PLCs, such as the S7 family, would not be useful on other PLCs. The S7-200 uses a Windows based
software program called STEP 7-Micro/WIN32. The PG 720 and PG 740 have STEP 7 software
pre-installed. Micro/WIN32 is installed on a personal computer in a similar manner to any other
computer software.
The DIP switches of the RS-232/PPI multi master cable are set as shown on figure 2.8.
Figure 2.8
10
Chapter two Theoretical Background
program editors for convenience and efficiency in developing the control program for your
application.
Computer Requirements
STEP 7--Micro/WIN runs on either a personal computer or a Siemens programming device, such as
a PG 760. The computer or should meet the following minimum requirements:
- Operating system: Windows 2000, Windows XP (Professional or Home)
- At least 100M bytes of free hard disk space
- Mouse (recommended)
To open STEP 7--Micro/WIN, double-click on the STEP 7--Micro/WIN icon, or select the Start >
SIMATIC > STEP 7 MicroWIN 32 V4.0 menu command. As shown in Figure 2.9, the STEP 7--
Micro/WIN project window provides a convenient working space for creating your control program.
The toolbars provide buttons for shortcuts to frequently used menu commands. You can view or
hide any of the toolbars.
The navigation bar presents groups of icons for accessing different programming features of STEP
7--Micro/WIN.
The instruction tree displays all of the project objects and the instructions for creating your control
program. You can drag and drop individual instructions from the tree into your program, or you can
double-click an instruction to insert it at the current location of the cursor in the program editor. The
program editor contains the program logic and a local variable table where you can assign symbolic
names for temporary local variables. Subroutines and interrupt routines appear as tabs at the bottom
of the program editor window. Click on the tabs to move between the subroutines, interrupts, and
the main program.
11
Chapter two Theoretical Background
Figure 2.9
12
Chapter two Theoretical Background
Figure 2.10
This project uses the default settings for STEP 7--Micro/WIN and the RS-232/PPI Multi-Master
cable. To verify these settings:
1. Verify that the address of the PC/PPI cable in the Communications dialog box is set to 0.
2. Verify that the interface for the network parameter is set for PC/PPI cable(COM1).
3. Verify that the transmission rate is set to 9.6 kbps.
13
Chapter two Theoretical Background
Figure 2.11
Double-click the refresh icon in the Communications dialog box. STEP 7--Micro/WIN searches for
the S7-200 station and displays a CPU icon for the connected S7-200 station. Then select the S7-200
and click OK.
Figure 2.12
14
Chapter two Theoretical Background
The S7-200 can also be put in RUN or STOP mode directly from the PLC itself.
Figure 2.13
-PRINCIPLES OF OPERATION
The construction of a simple BDC motor is shown in Figure 2.14. All BDC motors are made of the
same basic components: a stator, rotor, brushes and a commutator. The following paragraphs will
15
Chapter two Theoretical Background
Figure 2.14
Stator
The stator generates a stationary magnetic field that surrounds the rotor. This field is generated by
either permanent magnets or electromagnetic windings. The different types of BDC motors are
distinguished by the construction of the stator or the way the electromagnetic windings are
connected to the power source.
Rotor
The rotor, also called the armature, is made up of one or more windings. When these windings are
energized they produce a magnetic field. The magnetic poles of this rotor field will be attracted to
the opposite poles generated by the stator, causing the rotor to turn. As the motor turns, the windings
are constantly being energized in a different sequence so that the magnetic poles generated by the
rotor do not overrun the poles generated in the stator. This switching of the field in the rotor
windings is called commutation.
Generally, the rotational speed of a DC motor is proportional to the voltage applied to it, and the
torque is proportional to the current. Speed control can be achieved by variable battery tappings,
variable supply voltage, resistors or electronic controls. The direction of a wound field DC motor
16
Chapter two Theoretical Background
can be changed by reversing either the field or armature connections but not both. This is commonly
done with a special set of contactors (direction contactors).
The effective voltage can be varied by inserting a series resistor or by an electronically controlled
switching device made of thyristors, transistors, or, formerly, mercury arc rectifiers. In a circuit
known as a chopper, the average voltage applied to the motor is varied by switching the supply
voltage very rapidly. As the "on" to "off" ratio is varied to alter the average applied voltage, the
speed of the motor varies. The percentage "on" time multiplied by the supply voltage gives the
average voltage applied to the motor. Therefore, with a 100 V supply and a 25% "on" time, the
average voltage at the motor will be 25 V. During the "off" time, the armature's inductance causes
the current to continue through a diode called a "flyback diode", in parallel with the motor. At this
point in the cycle, the supply current will be zero, and therefore the average motor current will
always be higher than the supply current unless the percentage "on" time is 100%. At 100% "on"
time, the supply and motor current are equal. The rapid switching wastes less energy than series
resistors. This method is also called pulse-width modulation (PWM) and is often controlled by a
microprocessor. An output filter is sometimes installed to smooth the average voltage applied to the
motor and reduce motor noise.
The S7-200 provides two digital outputs (Q0.0 and Q0.1) that can be configured using the Position
Control Wizard for use as either PWM or a PTO outputs. The Position Control Wizard can also be
used to configure the EM 253 Position Module.
When an output is configured for PWM operation, the cycle time of the output is fixed and the pulse
width or duty cycle of the pulse is controlled by your program. The variations in pulse width can be
used to control the speed or position in your application.
When an output is configured for PTO operation, a 50% duty cycle pulse train is generated for open
loop control of the speed and position for either stepper motors or servo motors. The built in PTO
17
Chapter two Theoretical Background
function only provides the pulse train output. Direction and limit controls must be supplied by your
application program using I/O built into the PLC or provided by expansion modules.
The EM 253 Position Module provides a single pulse train output with integrated direction control,
disable and clear outputs. It also includes dedicated inputs which allow the module to be configured
for several modes of operation including automatic reference point seek. The module provides a
unified solution for open loop control of the speed and position for either stepper motors or servo
motors.
To simplify the use of position control in your application, STEP 7--Micro/WIN provides a Position
Control wizard that allows you to completely configure the PWM, PTO or Position module in
minutes. The wizard generates position instructions that you can use to provide dynamic control of
speed and position in your application. For the Position module STEP 7--Micro/WIN also provides a
control panel that allows you to control, monitor and test your motion operations.
Since the PWM output can be varied from 0% to 100%, it provides a digital output that in many
ways is analogous to an analog output. For example the PWM output can be used to control the
speed of a motor from stop to full speed or it can be used to control position of a valve from closed
to full open.
Figure 2.15
and then double-click the Position Control Wizard icon, or select the Tools> Position Control
Wizard menu command. (See Figure 2.16)
Figure 2.16
- -a window then pops up with two options to choose from, the first option is chosen for PWM
or PTO operation. (figure 2.17)
Figure 2.17
- Then another window opens which asks to which output is the motor going to be connected.
The S7-200 PLC gives two outputs for such operation (Q0.0 and Q0.1) (see figure 2.18)
19
Chapter two Theoretical Background
Figure 2.18
-after specifying the output a new window opens which decides whether the chosen output operates
on PWM or PTO. (See figure 2.19)
Figure 2.19
20
Chapter two Theoretical Background
-the PWM subroutine block then appears in the instruction menu and was dragged into the program
block as shown on figure 2.20.
Figure 2.20
The PWM subroutine must be excited in order to start operation, this is done by the external start
switch which is connected to I0.0 as show on figure 2.20.
The Cycle input is a word value that defines the cycle time for the PWM output. The allowed range
is from 2 to 65535 units of the time base (microseconds or milliseconds) that was specified within
the wizard.
The Duty Cycle input is a word value that defines the pulse width for the PWM output. The allowed
range of values is from 0.0 to 65535 units of the time base (microseconds or milliseconds) that was
specified within the wizard. The Error is a byte value returned by the PWMx_RUN instruction that
indicates the result of execution.
21
Chapter two Theoretical Background
Stepper motors provide open-loop, relative position control. Open loop means that, when you
command the motor to take 42 steps, it provides no direct means of determining that it actually did
so. The control is relative, meaning that there is no way to determine the shaft position directly. You
can only command the motor to rotate a certain amount clockwise or counter-clockwise from its
current position. These "commands" consist of energizing the various motor coils in a particular
sequence of patterns. Each pattern causes the motor to move one step. Smooth motion may be
obtained from presenting the patterns in the proper order.
22
Chapter two Theoretical Background
1) Bipolar motors, with two coils. These have four wires on them. They are tricky to
control because they require changing the direction of the current flow through the
coils in the proper sequence.
2) Unipolar motors (used in project). These have six or eight (or sometimes five) wires,
and can be controlled from a microprocessor. A Unipolar stepper motor has four
fixed coils arranged around a magnetized rotor, as shown on figure. Typically, the
coils are arranged in two centre tapped pairs, on opposing sides of the motor. Driving
current through any coil will cause the rotor magnet to be attracted to it, and by
sequencing the drive current though each coil in turn, the motor can be made to rotate
continuously. Higher torque can be achieved if two coils are energized at a time, and
by alternating between one and two coil drive states, half stepping mode can be
realized.
Stepper motors vary in the amount of rotation delivered per step. They can turn as
little as 0.72 degree to as much as 90 degrees per step. The most common motors are
in the 7.5 degrees- to 18 degrees-per-step range. Many have integral reduction gear
trains so that they have even higher angular resolution. Because the motors are open-
loop, if you do manage to mechanically overwhelm the motor and turn the shaft to a
new position, the motor will not try to restore itself to the old position.
23
Chapter two Theoretical Background
To illustrate this, let’s consider the unipolar motor( shown in figure 2.22 below). Say that it is
required to rotate the permanent magnet rotor four steps in a clockwise direction.
At first look, it seems that the simplest way to do this is by energizing coil a so that the permanent
magnet rotor is attracted to it. Then energizing coil b and cutting the current from coil a. the
energizing coil c and cutting the current from coil b and so on. By this sequence the rotor will rotate
in a clockwise direction, to reverse the rotation just apply voltage to coils in a reverse sequence.
The method mentioned above is simple but doesn’t afford the maximum possible torque. Maximum
torque is achieved by energizing two coils at a time so that the rotor is always between the two coils.
Energizing sequences are given in table.1 and table.2 below.
24
Chapter two Theoretical Background
1 1 0 0 0
2 0 1 0 0
3 0 0 1 0
4 0 0 0 1
1 1 1 0 0
2 0 1 1 0
3 0 0 1 1
4 1 0 0 1
Both methods are called full-stepping approach because the rotor steps from coil to coil or the
midpoint of two coils to the other midpoint. This is in contrast to half-stepping where it possible to
move the rotor from one coil to the midpoint next to that coil. This operation mode is demonstrated
in table.3. The major drawback of this mode is that the torque is not constant; when the rotor steps to
the midpoint between two coils it experienced double the torque when it is attracted by a single coil.
In the first case the current running through two coils provides the necessary power for the rotor
holding torque.
25
Chapter two Theoretical Background
1 1 0 0 0
2 1 1 0 0
3 0 1 0 0
4 0 1 1 0
5 0 0 1 0
6 0 0 1 1
7 0 0 0 1
9 1 0 0 1
2.7 Sensors
Proximity detectors operate by remote control without physical contact with the object detected.
They are thus a common feature of automated systems in all sectors of industry (mechanical,
foodstuff and chemistry). There are two main types of proximity sensors, inductive and capacitive.
Figure 2.23 show a proximity sensor
26
Chapter two Theoretical Background
Figure 2.23
The main component of an inductive detector is an oscillator whose windings form the sensitive
surface. An ac magnetic field is created at the front of this surface. When a metal screen is placed in
this field, induced currents form an additional load which causes oscillations to stop.
Figure 2.24
The main component of a capacitive detector is an oscillator whose capacitors form the sensitive
surface. When a conductive or insulating material with a permittivity > 1 is placed in this field, it
modifies the coupling capacitances and causes oscillations.
27
Chapter two Theoretical Background
Figure 2.25
Figure 2.26
28
Chapter two Theoretical Background
Figure 2.27
- These detectors are made up of a light emitter, often of a light emitting diode (LED) which is
able to emit radiation invisible to the human eye. Moreover its modulated emission
guarantees a high degree of immunity to stray light as well as a virtually unlimited lifetime.
They are also fitted with a light receiver, in many cases a phototransistor which is a transistor
switching due to the presence of light.
The light emitter and receiver can be housed in the same box or in two separate boxes according to
which detection technique is used.
-Shaping and amplification of the informational image is the task of electronic components either
built into or separate from the sensor (Schmitt trigger and operational amplifiers). The object is
detected when it causes the intensity of the light beam to vary on the receiver or when it interrupts
this beam.
29
Chapter two Theoretical Background
The barrier system consists of a transmitter device and a receiver device mounted facing
each other. When an object passes between the two devices it blocks the light from reaching
the receiver which in turn gives a signal.
Figure 2.28
30
Chapter three Design And The Implementation Of The model
Chapter three
Several industrial plants were visited which included Coca Cola, Vita and Sigmatau. They helped in
understanding the nature of the automated processes and its implementation issues. These issues
start from the proper selection of required automation equipment such as sensors and controllers to
the required sequencing and timing of the inter-process operations and how to combine all of these
aspects into one coherent system.
The coca-cola and vita visits helped in studying the soft drink production line. At first it was
intended to design a PLC automation system for such a production or part of it. But due to the
limited financial resources as well as the inability of verifying the design, it was decided to build a
small simple model of part of the production line then apply an automation system to it.
This model represents the filling stage of the production line. In this stage the following operations
occur:-
1. the empty bottles enters the filling machine from a conveyor which is moving at a
constant speed,
2. after entering the filling machine the bottle rests in one of four arms (at right angles to
each other) mounted on a stepper motor which moves the empty bottle precisely to where
the valve is and stops,
3. the valve then opens for a predetermined time quantum and closes,
4. then the arm moves the bottle to the other end of the filling machine where it exits via the
second conveyor,
5. sometimes an abnormal situation occurs were a bottle may fall while on the conveyor so
it is to be removed using a solenoid arm,
The intended design is as follows. First conveyor 1 starts moving as it is influenced by dc motor
which it’s speed is controlled moving the empty bottles towards the filling machine at constant rate
and equally spaced at a predetermined distance to avoid jamming at the filling machine as well as
31
Chapter three Design And The Implementation Of The model
maintaining process synchronization, this will be described later. Then as an empty bottle
approaches the filling machine it’s position should be sensed as whether it’s standing up or lying
down, if it’s standing up it should be let into the filling machine otherwise it’s removed by the
solenoid arm. If the bottle was let in then the stepper controlled arm should move this bottle
towards the valve location at some predetermined speed to meet process synchronization. The bottle
position is then sensed to verify it had reached the valve then the valve opens for a predetermined
amount of time and closes. Meanwhile when the first bottle is under the valve a second bottle enters
the filling machine and rests at the next arm. Then this arm moves the second bottle toward the
valve and since these arms move together the first bottle moves towards its exit point (conveyor 2).
At the end of conveyor 2 the exiting bottles are counted to keep record of the number of filled
bottles. Sometimes some bottles may leave the filling machine empty or partially filled, this occurs
due to a valve fault. This issue is to be overcome by sensing the status of the bottles and either they
are removed or let through.
The process is to be started manually by the operator using a switch and then terminated either
automatically or manually. Manual termination maybe due to some fault in one or more of the
machines of the production line. Automatic termination is when the number of filled bottles reaches
some predetermined value according to the supply and demand conditions.
Two capacitive proximity sensors were chosen for this case after testing and yielding good results in
the laboratory. The tests showed that this sensor could detect glass presence within a specific
distance range.
32
Chapter three Design And The Implementation Of The model
The two sensors were placed on top of each other as shown schematically on figure 3.1. The bottom
sensor detects the bottle presence and the top one indicates that if this bottle is standing up or not.
Throughout the rest of this text the bottom and top sensors will be referred to as S1 and S2
respectively for convenience. S1 and S2 are connected to the PLC inputs I0.1 and I0.2 and will
provide a high logic state to these inputs when an object is sensed. In the program code they
resembled as normally open switches. (See appendix A for program code)
Figure 3.1
The first technique suggested placing light reflectors on all four arms and one photoelectric reflex
sensor on the side opposite to the valve. When one arm reaches the valve location the adjacent arm
will face the sensor, as all four arms rotate together, thus resulting in a sensor reading. This
technique was easy in implementation and yielded good results in indicating the arm position but it
had one drawback, it only showed that one arm was at the valve location but not showing whether
that arm had a bottle or was the bottle already filled or not.
33
Chapter three Design And The Implementation Of The model
The second technique helped overcome the first issue by using a capacitive proximity sensor instead
placed below the valve as shown on figure 3.2. The sensor showed the existence of a bottle
underneath the valve. Throughout the rest of the text this sensor will be referred to as S3. This
sensor is connected to I0.3 of the PLC and resembled in program code as normally open switch.
Figure 3.2
For this stage a polarized photoelectric transmitter/receiver sensor was placed as shown on figure
3.3. Assuming that the filled bottle contained an opaque liquid, as in most of the cases, the light will
be blocked from reaching the receiver thus indicating a filled bottle. Laboratory tests were done to
verify the theorem and yielded good results. For the rest of the text this sensor will be referred to as
S3, it’s connected to I0.4 of the PLC and resembled as a normally open switch in the program code.
34
Chapter three Design And The Implementation Of The model
Figure 3.3
The operation of the stepper motor was fully described in chapter 2, next is shown how the desired
mode of operation is designed.
The stepper motor used makes a full revolution of 360 degrees in 48 steps that is 7.5 degrees per
step. Therefore 90 degrees is done by moving 12 steps. Each of these steps was excited by a pulse to
one of the stepper inputs as was described in chapter 2, the stepper inputs are to be connected to the
PLC outputs Q0.4 to Q0.7 indirectly via protection relays. The protection relays are discussed later.
The length of each pulse determined the speed and was calculated as follows.
35
Chapter three Design And The Implementation Of The model
In order to implement the above requirements using Microwin software a separate program was
written to control the stepper motor and is called from the main program as a subroutine. This
subroutine is excited or called when S1 and S2 indicate a bottle has entered the machine.
36
Chapter three Design And The Implementation Of The model
2 capacitive proximity
sensors
NO Bottle
entered?
YES
Call stepper
subroutine
Clear counter
Put pulse on
line 1 for 0.25
seconds
Put pulse on
line 2 for 0.25
seconds
Put pulse on
line 3 for 0.25
seconds
Put pulse on
line 4 for 0.25
seconds
Increase
counter by 1
NO YES
Counter = 3 Exit subroutine
Figure 3.4
37
Chapter three Design And The Implementation Of The model
1. First a subroutine block must be inserted into the main program, this block is dragged from
the instruction menu under call subroutines. See figure 3.5.
Figure 3.5
From the figure it’s shown that this subroutine is initiated by I0.1 and I0.2 which are the two
capacitive proximity sensors S1 and S2 respectively.
2. Next an icon at the bottom of the page labeled SBR_0 navigates to a new window to write
the subroutines code. See figure 3.6.
Figure 3.6
Note the icon on the right PWM0_RUN, this is the subroutine for the PWM operation discussed
earlier but is locked and the user may not modify it unlike a normal subroutine.
To construct the loop the simple FOR instruction was used to repeat the loop three times. The ‘FOR’
instruction was dragged from the instruction menu from under Program control. See figure 3.7
38
Chapter three Design And The Implementation Of The model
Figure 3.7
The INIT field shows the starting count number and FINAL shows the final count number. The
INDX field species a memory address to store current count value in.
Next timers were used to control the output pulse length. Each timer introduced a delay of 0.25
seconds before switching the pulses between the 4 lines.
The control of the valve was very simple compared to the control of the dc motor and dc stepper
motor. The input from the sensor enables a timer which in turn activates the output to the valve for 2
seconds. For program code see appendix A
39
Chapter three Design And The Implementation Of The model
3.4.1 Conveyor 1
In this conveyor the problem faced was a bottle lying down. It was shown earlier how this situation
is sensed by the two sensors. When these two sensors indicate a falling glass a solenoid arm, which
moves across the conveyor, removes the bottle. The solenoid arm is connected to the output Q0.3 of
the PLC which is activated only when I0.1 reads ON (bottom sensor) and I0.2 reads OFF (top
sensor). The placement of the arm is shown below in figure 3.8.
Figure 3.8
3.4.2 Conveyor 2
The situation of a lying down bottle would not occur in the second conveyor as it was designed to
operate at lower speed compared to conveyor 1 for reasons described later. The problem faced here
is an empty bottle or partially filled bottle, this may occur due a valve fault which occurs very
rarely. This situation is solved by introducing an electromagnet controlled gate placed on the
conveyor as shown on figure 3.9.
The gate is connected to Q0.3 output from the PLC. When the sensor reads a full bottle it activates
the output Q0.3 in order to open the gate for that bottle to pass, otherwise the bottle is discarded
from the conveyor.
40
Chapter three Design And The Implementation Of The model
Figure 3.9
To stop the system manually the same switch is opened and the whole system then terminates, this
action is done by using the STOP instruction which is activated by opening the manual switch. The
STOP instruction causes a transition in the PLC from RUN mode to STOP mode thereby
terminating the whole process.
For the system to stop automatically a counter is assigned to count the number of full bottles exiting
through conveyor 2, when this counter reaches a predetermined value it activates the STOP output.
The counter was set to activate STOP when 100 bottles were counted, the counter itself was
incremented with each reading of the photoelectric sensor. In the program the counter is first reset
by I0.0 (manual switch) and incremented by I0.4 (photoelectric sensor)
41
Chapter three Design And The Implementation Of The model
enter the filling machine and rest in the available arm while the first bottle is being filled. A
difference of 5 seconds was designed to be the time interval at which successive bottles entered the
filling machine. How this time interval was attained was the tricky part and is described below.
First a distance between two successive bottles should be defined, this distance should be just big
enough so that a falling bottle may not interrupt other bottles. An adequate distance of 0.25 meters
was decided. Therefore to obtain a time interval of 5 seconds the speed of conveyor 1 should be 0.25
meters per 5 seconds, that is 0.05 meters per second.
Another aspect in the timing design was that of the initialization of the stepper motor. As it was
shown the rotation action is excited by the reading of the two sensors, S1 and S2. This causes the
rotation to start before the bottle rests in an arm because the sensors are placed before the filling
machine at a distance of 0.125 m. This spacing was designed to give adequate space for the arm to
move freely and not disturb the sensor readings.
This problem was solved by introducing a time delay before starting the rotation. Since the conveyor
is moving at 0.05 meters per second the bottle will rest at the arm after 2.5 seconds from passing the
sensors (time = distance / speed). Therefore the time delay was chosen to be 3.5 seconds (2.5
seconds + 1 second for the valve to close) and was programmed using a timer that is excited by the 2
sensors which in turn calls the stepper subroutine after 3.5 seconds.
Inductive loads may damage the PLC because of their feedback current, thus they are supplied by
an external source (see figure 3.10). This external source is connected to the motors with relays and
these relays are energized by the PLC outputs.
Next the PLC outputs’ current was also provided by an external source. This was done although the
PLC had an internal current source (see figure 3.10) so as not to draw much current from the PLC
thereby causing over heating of the PLC.
42
Chapter three Design And The Implementation Of The model
Figure 3.10
43
Chapter three Design And The Implementation Of The model
start
No Operation /
External switch state OFF Terminate whole
process
ON
OFF
Start conveyor 1
Clear bottle
Sensor 4 staus
counter
Start conveyor 2
OFF YES
ON NO
ON ON
YES
Terminate whole
No Operation OFF Sensor 3 status
process
ON
Figure 3.11
44
Chapter three Design And The Implementation Of The model
-the details of each independent procedure were shown earlier like for the stepper motor, therefore
the reader should look back into the previous sections for the detailed logic. As was mentioned
above this algorithm shows the interconnection of the system.
-note that the algorithm states that the check for S3 occurs only after the 90 degrees revolution, this
was intended to remove the ambiguity of whether the bottle under the valve was the filled bottle or a
new one. In the program code this issue was solved by merging the valve operation within the
stepper motor’s subroutine.
-also the status of sensor 2 is checked only if S1 reads an object unlike sensor 1 and sensor 4 which
are checked continuously.
3.9 Simulation
Unexpectedly the simulation of the design turned out to be one of the most tedious stages of the
project due to the following reason. The Siemens Company never supplied a software simulator with
its product, so a free license simulator that was found in the laboratory was used. This simulator did
not have many essential instructions built in it such as the ‘subroutine’ and ‘loop’ instructions which
were used extensively in the program as was shown earlier throughout this chapter. In this section it
is shown how the project was simulated although of the previously mentioned facts.
1. The outputs to the two DC motors were changed from PWM operation to normal
operation as simple contactors. Also the four outputs to the stepper motor were
substituted for one output which was Q0.5 to operate as a normal contactor, and the input
from sensor 3 was removed. These two actions were done to verify that the logic
sequence will call any of the subroutines as desired by the design.
2. Then the configuration of the simulator was matched to design, this was done by
changing CPU TYPE to S7 200 224XP and CPU no. to 1
3. Then the program code was loaded into the simulator
45
Chapter three Design And The Implementation Of The model
All necessary relays and power sources were available in the laboratory and were connected as it
was suggested in the design. A 24 volts DC source was used to drive the PLC outputs as well as the
stepper motor which operated under 24 volts, and a 9 volts DC source was used to drive the two DC
motors.
Finally the physical model was built by substituting the unavailable parts as was shown and put into
action.
46
Chapter four Results and Discussions
Chapter four
4.1 Results
After the connection of the physical system that was shown in the previous chapter, the system was put into
action and yielded relatively good results but still had some flaws. These results and flaws are discussed
throughout this chapter.
4.1.1 Sequencing
First the sequencing of the operations was perfect. The outputs from the PLC were excited as desired
according to different input patterns, these input patterns were all taken into consideration in chapter 3.
- The two DC motors started and stopped when the start switch was ‘ON’ and ‘OFF’ respectively.
- The stepper motor took its 90 degrees revolution when S1 and S2 where on.
- The LED connected to Q0.2 (arm) lighted when only S1 was ‘ON’
- The LED connected to Q0.3 (valve) lighted when S3 was ‘ON’
- The LED connected to Q1.0 (was) lighted when S4 was ‘ON’
- The system shutdown automatically after 100 readings for S4. This part was tedious in testing as S4
was put on ‘ON’ state then ‘OFF’ state exactly 100 times to test the system.
These results verified that the logic of the program code drives the application in the desired sequence of
events.
Second the speeds of the two motors were observed. This test was done by putting identical flags in both
motors and counting how many revolutions each flag took in 10 seconds. The result showed that DC motor 1
was faster than DC motor 2 as desired, but these speeds were not measured.
Then the speed of the stepper motor was tested. The results showed that the time for a 90 degree revolution
was slightly larger than that desired. The error was not constant throughout the tests and was in the range of
1 - 4 seconds approximately, the term ‘approximately’ was introduced because the timing measurement was
done by a stop watch thus not accurate but it was obvious that there was an error which was not constant.
47
Chapter four Results and Discussions
This timing error was not due to program fault but due to the mechanical nature of the physical PLC outputs.
After deeper investigation in the PLC structure it was found that the outputs of the PLC were relays which are
energized by internal small signals from the microprocessor of the PLC. These relays could not adapt to the
high switching frequency of the pulses suggested by the design which was 0.25 seconds. A test was made to
verify this point, the pulse times were slightly increased (decreasing motor speed) by changing the program
code and it was observed that the error has been reduced but not eliminated. The pulse time could only be
slightly increased as to keep the stepper motor from heating up thus being damaged. This fact was retrieved
from the stepper motor’s manual itself which suggested that the motor should be operated within a specific
range of speeds, slower speeds may damage the motor as more current is applied to it.
Unfortunately before a solution could be figured for this issue the stepper motor was damaged due to short
circuit that resulted from improper wiring. How this issue may be solved is discussed in the next section.
Note that this would have not been an issue in the outputs Q0.0 and Q0.1 as they were specially designed
with high-speed switching capabilities.
Also a delay of 2.5 second occurred before the stepper started operation as desired,
The LED on Q0.3 (valve) showed good results in its timing, it started after S3 was ‘ON’ and closed after
exactly 2 seconds.
In this section it’s shown what improvements could be added to the design and how these improvements
upgrade the performance of the system.
4.2.1 The stepper controller and the PTO (pulse train output)
A stepper controller is a device that receives a specific number of pulses from an external source through one
line, then this controller moves the stepper motor by a number of steps equal to the number of the pulses. It
does this by distributing the pulses among the four motor lines in increasing order. To clarify this point
suppose that the input was 6 pulses, the controller then puts a pulse in each of the lines in the following
sequence, 1 2 3 4 1 2. Also the width of the input pulses is equal to the width of each output pulse. A pulse
train is simply a sequence of pulses of 50% duty cycle as shown in figure 4.1.
Figure 4.1
48
Chapter four Results and Discussions
The S7-200 as was shown earlier supports pulse train output (PTO) through Q0.0 and Q0.1. Then this output
could be used as an input to the stepper controller. This method totally eliminates the timing error described
in section as the stepper controller was specially designed for accurate positional and speed control. Another
advantage of this method is that it reduces the number of outputs from the PLC needed to drive the stepper.
The stepper controller was not used in the design because of the inability to acquire it.
An analogue weight sensor could be used instead of the photoelectric sensor to sense the status of the exiting
bottles. This weight sensor is advantageous over the photoelectric sensor because the latter one measures only
the presence of a full bottle but cannot differentiate between a partially full bottle or no bottle, but the weight
sensor provides the ability to differentiate between a full bottle, an empty or partially filled bottle, and no
bottle. Thus if a weight sensor was used the logic of operation may be improved as follows. Instead of
opening the gate for each full bottle the photoelectric sensor reads, the gate will be normally open and closes
when a partially filled bottle is read by the weight sensor.
The reader should note that an analogue weight sensor provides an analogue signal relative to the measured
weight, such an input must be connected to the PLC indirectly through an analogue input module. Both the
analogue weight sensor and input module could not be acquired for use in the project.
49
Chapter five Project Evaluation
Chapter 5
Project Evaluation
5.1 Conclusion
After the project was fulfilled in all stages (design-simulation-implementation) several facts were
concluded. Next is shown why these conclusions were reached.
The project considered only part of the production line, thus it is extendable. Much more future
work can be done to complete the whole production line. When introducing new stages of the
production line for example the washing machine (which comes prior to the filling stage), as well
controlling the washing machine it must be synchronized with the filling machine. In the same
manner all processes of the production line must be synchronized as well as inter-process
synchronization which was considered in this project.
After finishing the whole production line design a further step could be taken that is to develop cost
estimation for the system. The cost estimation is an important stage that the control system engineer
is entitled to after finishing the design.
50
Chapter five Project Evaluation
Also a human machine interface (HMI) may be developed in order to monitor process variables and
system performance and apply changes remotely. Although an HMI system will be very useful it is
not recommended to apply to such an application. That’s because soft drink production lines are
considered to be a simple kind of production lines compared to other industrial applications such as
the car industry and petrochemical industry. Therefore the high cost of HMI installment makes the
HMI system undesired as the system can operate just fine without it.
51
References
References
[1] www.wikipedia.org
[2] www.howstuffworks.com
[7] www.imagesco.com
[10] Automating manufacturing systems with PLCs, version 5.0, Hugh Jack
[11] Towards automatic verification of ladder logic programs, Bohum Zoubek, Jean-Marc Roussel,
Marta Kwiatkowska
[12] Speed control and Positioning using standard drives, Micro Automation SET 1, SIEMENS
company
51
Appendix A main program code
A-1
Appendix A main program code
A-2
Appendix A main program code
A-3
Appendix B stepper motor subroutine
B-1
Appendix B stepper motor subroutine
B-2
Appendix B stepper motor subroutine
B-3
Appendix C
gate
DC motor 1
External switch
Appendix C – Wiring diagram of design
S2 (top sensor)
S3 (valve sensor)
valve
S4 (photosensor)
Conveyor 1 Conveyor 2
DC motor 2
S1 (bottom sensor)
arm
C-1