You are on page 1of 19

Lesson

Development of a PLC Program


16
Leaner Name ……………………………..Date ……………………
Objectives
By the end of this lesson, you should be able to:
1. Describe and use the documentation available to aid the development of a PLC program for a complex
machine.
2. Produce a tag list from an I/O assignment list with sensible device names that fully describe their
functions.
3. Interpret a program specification and supporting documentation to understand the required
operation of a machine.
4. Design a program to meet a specified industrial or simulated industrial process requirement using a
systematic approach and comply with Health and Safety considerations.
5. Make adequate use of advanced PLC functions, where appropriate to the task.

This lesson will enable you to partially complete assessment F of the EAL Unit 10. There is one main
programming exercise that you will need to complete to pass assessment F. The next lesson will show you how
to test and fully document the program.

1. Supporting System Documentation


Before beginning to develop a PLC program for a complex machine, the supporting documentation must be
examined in great detail. These may include the following:
a. A mechanical layout drawing and P&ID diagram (Process and Instrumentation Drawing)
b. A set of electrical drawings
c. I/O assignment list
d. Technical Data
e. Specification which may include a flow diagram or other functional description

2. Mechanical Layout of the Hydraulic Robot


The diagram of figure 1 shows the robot with four axes and a gripper. Each axis is controlled by two hydraulic
solenoid valves fed from a common manifold which contains pressurised oil produced by a pump and a sump
tank. The gripper is controlled by a single pneumatic solenoid valve.

CCW = DN
CW = UP
C
CCW = DN

CLOSE
B CW = UP
Gripper
D
OPEN
CCW CW
CCW CW

Figure 1: Mechanical Layout Drawing

1
The diagram of figure 2 shows how axis A is controlled by a PLC. The rotary actuator has two pistons, one
makes the actuator move clockwise (CW) and the other makes it move counter clockwise (CCW). These are
controlled by two digital outputs (DQ). The angle of the actuator is sensed by a potentiometer connected to an
analogue PLC input (AI). The pump is controlled by a relay from a digital output (DQ) and the flow of oil, which
determines the speed is controlled by a proportional valve connected to an analogue output (AQ).

DQ
CW solenoid valve
H

L L CW piston

Potentiometer
Rotary
L DQ actuator A AI

L L CCW piston
AQ
CCW solenoid valve
DQ DI
Proportional Valve
M
Motor relay and auxiliary contact

L L L Oil from sump tank

Accumulator Pump

Figure 2: P&ID diagram of axis A

The letter L is used to denote the lines are hydraulic, the dashed lines are electrical signals. The motor relay
sends a signal back to the PLC, from its auxiliary contact (DI), to tell it that the relay is closed; this is a safety
feature in case the relay fails.

3. Electrical Schematic Drawings for the PLC


There are three drawings shown on the next 3 pages. The first drawing (figure 3) shows the base unit of the
PLC which is a S7-1214 DC/DC/DC. This has 14 digital inputs, 2 analogue inputs, 10 digital outputs and a signal
board SB1232 AO with one analogue output. The IP address is given as 10.13.90.104.

The second drawing (figure 4) is of the expansion module SM1222 DC which has 16 digital outputs working at
24VDC. This where the solenoid valves are connected to operate the hydraulic actuators.

The third drawing (figure 5) shows the expansion module for the analogue values from the four angle sensors.
This is the SM1231 AI which has 4 configurable analogue inputs set up for 0 to 10VDC. The 10VDC supply is
provided by the voltage regulator fed from the 24VDC supply.

2
Figure 3: Electrical Drawings of the Hydraulic Robot – Base unit of the PLC
24VDC

Auto Mode

Start Pump

Stop Pump
A axis request

B axis request
Auxiliary contact

C axis request

D axis request
0VDC

Motor
EARTH

CCW
CW
DN
CW

DN

UP
CCW

UP
%I0.0

%I0.1

%I0.2

%I0.3

%I0.4

%I0.5

%I0.6

%I0.7

%I1.0

%I1.1

%I1.2

%I1.3

X11
L+ M E L+ M 1M 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 .0 .1 .2 .3 .4 .5 2M 0 1
X10

24VDC 24VDC DI a DI b AI
IN OUT 24VDC DIGITAL INPUTS ANALOGUE INPUTS

Siemens S71214C - DC/DC/DC


Siemens SB1232 AO 1
ANALOGUE OUTPUT 24VDC DIGITAL OUTPUTS
AQ DQ a DQ b
X12
X19

0M 0 E NC NC NC 3L 3M .0 .1 .2 .3 .4 .5 .6 .7 .0 .1

%Q0.0

%Q0.4
%QW80

PROPORTIONAL VALVE AMPLIFIER

MOTOR RELAY

GRIPPER CLOSE
24VDC

0VDC 3
Figure 4: Electrical Drawings of the Hydraulic Robot – Additional module SM1222 DC – 16 channel digital output module
0VDC

24VDC

%Q8.0

%Q8.1

%Q8.2

%Q8.3

%Q8.4

%Q8.5

%Q8.6

%Q8.7
X10

X11
L+ M NC .0 .1 .2 .3 E NC NC .4 .5 .6 .7

24VDC DQ a
IN 24VDC DIGITAL OUTPUTS

Siemens SM1222 DC - 16 channel


Digital Output Module
24VDC DIGITAL OUTPUTS
DQ b
X12

X13
NC NC NC .0 .1 .2 .3 NC NC NC .4 .5 .6 .7
%Q9.0

%Q9.2

%Q9.4

%Q9.6
%Q9.1

%Q9.3

%Q9.5

%Q9.7
A AXIS CW SOLENOID

A AXIS CCW SOLENOID

B AXIS UP SOLENOID

B AXIS DN SOLENOID

C AXIS UP SOLENOID

C AXIS DN SOLENOID

D AXIS CW SOLENOID

D AXIS CCW SOLENOID


4
Figure 5: Electrical Drawings of the Hydraulic Robot – Additional module SM1231 AI - 4 channel analogue input module

24VDC

0VDC

A - AXIS
ANGLE SENSOR

%IW96

%IW98
X10

L+ M E 0+ 0- 1+ 1- 3 2 1

24VDC AI B - AXIS LM 7810


IN 0 – 10VDC ANALAOGUE INPUTS ANGLE SENSOR

VOLTAGE REGULATOR
10V
Siemens SM1231 AI - 4 channel
Analogue Input Module
0 – 10VDC ANALAOGUE INPUTS
C - AXIS
AI ANGLE SENSOR
X11

NC NC NC 2+ 2- 3+ 3-
%IW100

%IW102

D - AXIS
ANGLE SENSOR

5
4. Technical Data
Usually, this information is available in manuals, datasheets, websites or within the TIA Portal program.

a. Potentiometer
This information is needed to know the angle of rotation of each axis and therefore the relationship
between voltage and degrees of rotation. Typically, the potentiometers used have a maximum
rotation angle of 270O. The relationship is therefore 10/270 = 37.03 mV per degree.

b. Analogue Input Range


This is found from the datasheet for the SM1231 module. Each analogue channel samples the voltage
at 12-bit resolution (plus 1 for sign) giving a range of values between 0 and +/- 212-1 (=4095). However,
this is scaled inside the module to give a range up to +/- 27648. This means that each analogue input
needs to be scaled by multiplying it by 270 and dividing by 27648, or simply by multiplying by
0.009766. The negative range is unused in this system. The addresses of the raw analogue inputs are
%IW96, %IW98, %IW100 and %IW102.

c. Analogue Output Range


This is found from the datasheet for the SB1232 single channel analogue output signal module. The
conversion is 11 bits plus 1 for sign giving an output range of 0 to +/- 10Vdc. The internal scaled value
range is -27648 to +27648. However, only the positive range is used in this system. In order for the
valve to open to 100 percent, a value of 27648 must be moved into register %QW80. For any other
percentage opening, the value must be scaled by multiplying by 27648/100 = 276.48.

d. Proportional Valve and Amplifier


The valve operates in the range of 0 to 100% open in response to a 0 to 24Vdc analogue signal. The
amplifier is based on a MOSFET IRF530N. The analogue output from the above module is connected to
the input of the amplifier. The amplifier is connected to the proportional valve which then determines
the speed of the movement of the robot by the flow rate of pressurised oil into the manifold.

5. I/O Assignment List and PLC Tags Names


Using the above information, the following four lists can be compiled:
(some have been entered, you must complete the rest of them and then delete this writing)

Digital Inputs

Address Tag Name Device Comment


This input comes on when the motor relay is
%I0.0 Motor Auxiliary Contact closed and provides feedback to show the
pump is running.

6
Digital Outputs

Address Tag Name Device Comment


This output controls the motor relay that runs
%Q0.0 Motor Relay
the hydraulic pump.

Analogue Inputs

Address Tag Name Device Comment


This integer word holds the raw value of the A-
%IW96 A - axis analogue input word
axis angle from the potentiometer.

Analogue Outputs

Address Tag Name Device Comment

%QW80

7
6. Specification
In this section, the program requirements will be given in detail. These must be translated into a working
program using a suitable programming language or languages with the aid of a software package such as TIA
Portal.

a. Modes of operation
This system must work in two modes: manual and auto.

b. Manual mode
The manual switches must be used to move the robot in any direction within the safe limits of
movement provided the pump is running.

c. Automatic mode
Having scaled the raw axis values into degrees (PV = Process Variable), there must be 4 setpoint values
stored in memory (SP = Set Point). The difference between each of the SP and PV must be calculated
to find the ERROR. If this is positive, the axis must move in the CW direction but if negative, in the CCW
direction between the limits of movement as for manual mode. This applies to axes A and D. For axes
B and C, this would be UP and DOWN for positive and negative errors respectively.

Figure 6: Flow chart for automatic control of axis solenoid valves

Read axis raw value

Convert raw axis angle to real

Calculate the angle error


ERROR = SP - PV

POSITIVE Check the NEGATIVE


sign of the
error

Minimum
Maximum angle reached? YES YES angle
reached?

NO NO

Switch ON CW solenoid Switch OFF CW solenoid Switch OFF CCW solenoidSwitch ON CCW solenoid

8
d. Pump Control
The pump must be run when the start button is pressed and held on only if the auxiliary contact has
closed. The pump must stop running when the stop button is pressed.

e. Proportional Valve
This valve must be fully open to 100% once the pump is running and closed when the pump is
switched off.

f. HMI Controls
A simple screen must be created to store the SP and PV for each axis together with the state of each
output.

g. Health and Safety Features


It is vital that your system is safe. This means that features must be incorporated to prevent damage to
people or the machine itself. The following safety features are included:
(1) The pump motor relay has a feedback signal to check that it is energised to prevent the pump
from working in a haphazard way.
(2) There is an emergency stop button near the machine that cuts off all power.
(3) The stop button uses a normally closed contact for fail safe.
(4) The axes movements are limited by maximum and minimum values

9
7. Programming Advice
The following suggestions will help you write the program.

a. Use the CONVERT instruction to change each raw analogue input from the integer addresses %IW96,
%IW98, %IW100 and %IW102 into real value addresses %MD1000, %MD1004, %MD1008 and
%MD1016. Notice that each address is 4 bytes apart. Create tags for these addresses with the word
“real” at the end.
b. Scale these real values into angles at addresses %MD1020, %MD1024, %MD1028 and %MD1032 by
multiplying by a suitable scaling factor. Create suitable tag names for each, such as “A-axis PV”, etc..
c. Store the position setpoints for each axis in 4 more reals, with suitable tags names such as “A-axis SP”,
etc..
d. Store 8 more reals for the maximum and minimum values of the axes positions. These could be named
as ”A-axis PV max”, “A-axis PV min”, etc..
e. Add 3 displays on the HMI for each axis and tag them to the above tags.
f. Add indictors to the HMI screen to show the state of each output
g. For the CW solenoid of axis A, put the AUTO mode button as a normally closed contact (which means
manual mode selected) in series with the CW request switch (N/O contact), in series with a
comparison instruction that ensures the PV is less than the PV maximum. This is how the A-axis CW
solenoid coil is to be operated manually. For the automatic mode, use the AUTO mode button as a
normally open contact in series with a comparison instruction that check if the A-axis ERROR is
positive (>0), these two can be placed in parallel with the manual controls.
h. For the CCW solenoid of axis A, put the AUTO mode button as a normally closed contact (which means
manual mode selected) in series with the CCW request switch (N/O contact), in series with a
comparison instruction that ensures the PV is greater than the PV minimum. This is how the A-axis
CCW solenoid coil is to be operated manually. For the automatic mode, use the AUTO mode button as
a normally open contact in series with a comparison instruction that check if the A-axis ERROR is
negative (<0), these two can be placed in parallel with the manual controls.
i. The above can be repeated for the other 3 axes.
j. For the pump control, use the SET instruction to latch on the motor relay coil when the start button is
pressed (use N/O contact). If the stop button is pressed or the relay auxiliary is not made, the motor
relay coil should be reset. To do this, use a N/C contact for the stop button in parallel with a N/C
contact for the auxiliary contact to control the RESET coil instruction.

10
8. Memory Element Tag List
Use the following table for your memory tag list. There should be 20 double words (each occupying 4 bytes).

Address Tag Name Device Comment

%MD1000

11
9. Writing the Program
Use the following pages to create the program. The instructions have been created below. You will need to
copy and paste them into the program sheets. Each instruction can be edited so as to insert addresses. (DO
NOT USE CTRL-click-drag as this will cause problems and ruin your drawing. This is a bug within MS Word).

BASIC INSTRUCTIONS
%I0.0 %I1.3
MOTOR AUXILIARY CONTACT STOP PUMP

%Q0.0 %Q0.0 %Q0.0


MOTOR RELAY MOTOR RELAY MOTOR RELAY

S R

TIMER 1 TIMER 2 TIMER 3


TON TOF TONR
Time Time Time

IN Q IN Q IN Q
   
t#2s PT ET t#2s PT ET R   ET

t#2s PT

COUNTER 1 COUNTER 2 COUNTER 3


CTU CTD CTUD
Int Int Int

CU Q CD Q CU QU

R   CV LD   CV CU
QD
10 PV 10 PV R  

LD CV

10 PV

12
ADVANCED INSTRUCTIONS CONV
Int to Real

EN ENO

%IW96 IN OUT %MD1000


Tag Name Tag Name

ADD
Auto (Real)

EN ENO
MUL
%MD1000 IN1   OUT %MD1000 Auto (Real)
Tag Name Tag Name

%MD1000 IN2 EN ENO


Tag Name

%MD1000 IN1   OUT %MD1000


Tag Name Tag Name

SUB %MD1000 IN2


Auto (Real) Tag Name

EN ENO

%MD1000 IN1   OUT %MD1000


Tag Name Tag Name
DIV
Auto (Real)
%MD1000 IN2
Tag Name
EN ENO

%MD1000 IN1   OUT %MD1000


Tag Name Tag Name

%MD1000 IN2
Tag Name
MOVE

EN ENO
 
VALUE IN
OUT 1 %QW80
Tag Name

%MD1000 %MD1000 %MD1000 %MD1000


Tag Name Tag Name Tag Name Tag Name

> <  <  > 


Real Real Real Real

%MD1000 %MD1000 VALUE VALUE


Tag Name Tag Name

13
CONV %I0.0
Int to Real MOTOR AUXILIARY CONTACT

EN ENO
 
%IW96 IN OUT %MD1000
Tag Name Tag Name

%MD1000
Tag Name


Real

%MD1000
Tag Name

14
15
16
17
18
19

You might also like