Sunteți pe pagina 1din 22


programming and Fault finding




1.1. Introduction
1.2. Inputs
1.3. Outputs
1.4. Flags
1.5. Addressing

2.1. Important Terminologies in S5 User program
2.2. Control Logic Operations
2.3. Working in the S5 Environment

3.1. Forms Of Logic Representation
3.2. Examples
3.2.1 Series/ Parallel Connections
3.2.2 Interlocking Contacts
3.2.3 Latching Contacts
3.2.4 Timers


4.1. Steps in Troubleshooting
4.2. Real life Problems

This module reviews what a skeletal control system looks like and brings to the fore
characteristics of inputs, flags, outputs and their addresses as regards Simatic S5 control
system. In summary, externals from the controller/ transmitter in the control process are

1.1 Introduction

Industrialization has paved way for the need of control systems to ensure enhanced
productivity among other reasons. A control system is, literally, any network of
elements implemented to replace or minimize human interference in industrialization.
Fig. 1 shows the 3 basic components of control system.

Fig. 1



Inputs in siemens S5 control system are divided into 2 viz Digital and Analog Inputs.
Digital Inputs are generated from mostly 2 sources : Contactor contacts or Controller
contacts. These inputs are so called because they can only exist in 2 states (0 or 1).
Compared to Analog inputs, these inputs make up about 70% of inputs in most siemens
S5 plc stations. Digital input cards exist in different models to receive digital inputs in
S5 processes. Digital Inputs are assigned operands with the letter I in the S5 program.
Analog inputs are those gotten from sensors in the field like RTDs, thermocouples,
flow meters, rotary encoders amongst many others. In Simatic s5, numeric values read
from these sensors are represented in different formats. The following formats will be
an interest to us in this paper.
KF ---- 16 bit fixed point numbers.
KH ------ 32 bit fixed point numbers.
KM --------- Binary numbers
KG ----------- Floating Point Numbers. Eg 2- 34

Negative values are actually read in the PLC as its 2’s complement. Reader can read
extensively about the ranges of these formats and examples on how they are used. The
important fact , however, is that recognition of these will definitely help in
troubleshooting analog signals. Analog cards exist in different models and modes to
interface analog inputs with the rest of the PLC station.

1.2 Outputs
Outputs are results of logic operations from the CPU. As inputs, they are classed into 2:
Digital and analog Outputs. Digital outputs are mostly used to drive contactor loads like
pumps while analog outputs may drive a variable (PID) control valve. Digital Outputs
are assigned operands with Letter O.

1.3 Flags

Flags are intermediate results from logic operations which are used in the program
and are not written to Output Cards. Buttons on Operator panels are usually
programmed as flags in Simatic S5 Program. Flag Operands are denoted by F.

1.4 Addressing

It is only logical to give addresses to every input and output in a process for
identification purposes. Bit, bytes, Word, Double Word are all concepts used in Simatic
s5 operand addressing.
Bit: This is the smallest unit of information in the program (1)
Byte: This comprises 8 Bits
Word: This comprises 16 bits or 2 Bytes
Double Word: This comprises 32 bits or 4 bytes.

A 0 or 1 can be completely described by a bit inferring that a digital input or output

requires bit addressing. Practically, most digital input/ output cards are made up of 8
terminals resulting in a byte e.g. I 7.0 to I 7.7. Recall in the section on analog inputs,
numeric representation was introduced. Analog signals require 16 to 32 bits to be
accurately represented e.g. FW 54 (means 54.0 --------- 55.7) will be followed in
address by FW 56 and not FW 55. It should be noted that the initial address values
depend solely on number of sensors in the process and programmer discretion but
consecutive address values depend on type of sensors to be read ( Analog or Digital).

1. Input and output Operands are denoted by ---------- and --------------- respectively
2. A byte is equal to --------------- double word
3. Fill in the following 2 consecutive addresses FW 15,----- , --------,
4. 105 in Binary form is ------------- and – 105 in 2’s complement is ---------------
5. 2F3A in binary form is ---------------
6. Floating Point numbers are represented by ---------- while Binary numbers are
represented by ------------------
7. A contactor contact is normally programmed as ---------------- while a rotary
encoder signal is normally programmed as ---------------
8. -------------- are intermediate results of logic operation and also used as -----------
9. A process with 24 contact sensors has a beginning address of I 56.0, the last
address in its PLC station is I -----------
10. An analog output can be used to directly drive a single phase motor. (True or
This module deals with some terminologies, logic operations and usage of the S5 user
program. Practical use of the PG is required to complete this module. Reader should
become conversant with the S5 programming environment and the basics of logic
operations upon mastery of this module. However, external materials should be gleaned
if necessary.

2.1 Some important Terminologies in the S5 User Program

The following will be defined with respect to Simatic S 5 program

1. Assignment lists: This is a display in the program showing operands and

associated descriptive comments for the entire program project.
2. Symbols Table: This is a display in the program describing operands for
specific segments of the program
3. Program Block: This is a part of the user program where most of the control
logic for the program is coded. It is used for non routine tasks.
4. Function Blocks: This is apart of the user program where coding of routine
tasks for the process are done.
5. Cross Reference Tables: This relates a selected operand with different blocks
where it is used in the entire program.
6. Interface: This is the connection environment between the PG and the CPU.
7. Comments: These are statements used in the program for descriptive
purposes alone and not part of the program.
8. Operators: These are commands that act on operands using specified rules of
logic. Examples of Operators are AND, OR, COMPARE, NOT, LOAD,
9. Project: This is the entire program for a specified process.
10. Data blocks: These are areas in the program where process set points,
operator panel data, timer values and sensor input values are stored.
11. Program Segments: This is a sub division of a block in a program
12. RLO: Result of Logic operation.
13. Accumulators: These are temporary data storage points in the CPU where
data to be processed immediately is Kept

2.2 Control Logic Operations

The essence of control in industry is to manage a combination of conditions by
which the process was created. Logic helps achieve this uniform goal of control.
Some control logic operations that are needful for this course are defined below.
AND Operation: This operation ensures that the output of the logic operation is 1
only when its inputs are all 1

OR Operation: This operation ensures that the output of the logic operation is 0
ONLY when its inputs are 0
NOT Operation: This ensures that the output of the logic operation is an inverse
of the input

COMPARE Operation: This compares two variables ( =, ≤,≥, <, >) and outputs a
1 when the operation conditions are true.

LOAD Operation: This calls data from the data block for processing

TRANFER Operation: This sends data to the data block after processing

TIMER Operation: This times the output triggered by an input based on certain
timing conditions. There are basically, 5 types of timers viz On delay, Off delay,
Pulse timer, Extended pulse Timer and Stored on Delay Timer. Time values are
loaded with the symbol KT. The next section deals on programming timers.

SET Operation: This operation gives an output of 1 when ever its input is a pulse
edge form 0 to 1.

RESET Operation: This operation gives an output of 0 whenever its input is a

pulse edge from 0 to 1.

There are many other operations but these will suffice. Reader should ensure
proper understanding of the mentioned operations as this will aid in
troubleshooting faults through program.

2.3 Working in Simatic S5 Environment

In this section, some important operations in the S5 Environment are highlighted.



I. Copy project number from CPU in the PLC Station.

II. Open S5 program to its home page from the Windows 95 OS.
III. Click on File, then Project, then load.
IV. Press F3, or click select
VI. Click on first pop up item in the box on the left of the screen ( it just came up)
VII. Press the enter key continually for every dialog box until you return to the
home page


VIII. From Home page; Click on File, then project, then Set
IX. Click on Blocks and confirm similarity with chosen program. If not similar,
Select block through similar procedure as program load (IV – VII)
X. Click on Symbols and confirm similarity with chosen program. If not similar,
Select associated symbol through similar procedure as program load.( IV –

NOTE: If there is sameness amongst your loaded program, symbols, blocks and
the program on the CPU, then the program has been adequately loaded else this
procedure (I – X) should be repeated.
The program load procedure is extremely important as it ensures proper
interfacing between PG and CPU. It should be practiced by reader again and
again till gotten properly.


1. From Homepage, click File, then Project, then Set
2. Click on PLC, then Double Click on Offline
3. Press the Enter Key to return to home page

1. Repeat steps 1 and 2
2. Confirm online status on PLC page

NOTE: Going online makes it possible to interface the PG with CPU. However,
the program load procedure precedes going online. It should be noted that the
PG contains a bank of programs in its hard disk. When one is online, one could
view either the program in the CPU of the PLC station or the one in the data
bank in the PG.
1. From home page, click TEST
2. Enter Specific Block and segment in the Specified Fields
3. Press Enter Key to go to Block segment


1. From any program segment, Press F2 twice

2. Type in specific operand and press F2

NOTE: Cross referencing is an extremely powerful tool as it helps in navigating

the program stream from outputs to inputs. See section 2.1 for information on
cross reference tables.


1. From home page, press shift + F2

2. Press F3
3. Click on sought for Data block and press ENTER Key

NOTE: Data blocks should be handled with extreme caution. Don’t access them
if you don’t have a need for them. You should do so when you are interested in
accessing set points in the process.


1) *Make Sure you are Online

2) Put CPU to stop mode
3) From the Home page, Click on File, then Blocks, then delete
4) In the selection frame, click on Block list and Type A in the field
5) Click on Delete

NOTE: Confirm information on the other frames in the page before you delete.
You must not do this except you have your strong reasons and has mastered this
procedure because there are two risks – stopping a working process or deleting
the back up program in the PG. BE SURE OR DON’T TRY THIS.

1. From the home page, Click File, then Blocks, then Transfer
2. Click on Block list
3. Type A in the field and click transfer command button

NOTE: Transfers always come after delete operations. Make sure you transfer
the right program. BE SURE OR DON’T TRY THIS.


1. ---------------- relates an operand with program block segments where it is

used in the entire program
2. ------------------ may necessarily not be an output
3. Values used as inputs to a compare operation are called from a -------------
4. You should ---------------- and -------------------- before deleting a program
in the plc.
5. The load operation is a ---------------- of the ----------------------- operation
6. From the Home page of the Program, clicking on PLC icon leads to
checking the online status of the PG. ( True or False)
7. ----------------- action precedes the “delete program action” while ----------
------ action comes after the “program load action”
8. Timers are represented numerically by the symbol ----------------
9. A PG troubleshooter who is tasked with loading a program 1800A1 in
ALSCON smelter must follow a location path : ----------> ALSCON> ----
10. In a certain process, an output Q 5.0 should be on only when all but one
of its input conditions is on. ----------- and -------------- operations must be
used in the responsible program block to achieve this.

This module will deal with program coding in Simatic S5 in 2 parts. First, the
representation of logic and secondly the coding itself using some generic cases
in electrical engineering applications.

Representation of Logic

It should be mentioned here that logic is represented in three modes in

Simatic S5 user program. This is so for convenience of the user and nothing
more. Nevertheless good troubleshooting requires ones understanding of all
modes because sometimes there are not all available for certain blocks in the
user program.
The three forms are explained below

1. STATEMENT LIST (STL): This is the traditional mode of representation

in S5. Like the usual programming methods, commands are written line
after line.
2. LADDER LOGIC (LAD): This is a representation of logic in ladder form
as the name goes. Ladder logic is one of the first ways electrical logic was
representation expresses logic through electronic symbols which are
familiar with.

The 3 modes of representation are shown through examples in the table below.
Reader should match them.
A I 0.1 -][------][------- ][---------( )
A I 0.2 I 0.1 I0.2 I0.3 Q 4.0 I 0.1
A I 0.3
= Q 4.0 I 0.2 Q 4.0


O I 3.4 --][------------------------( )
ON I 7.8 I 3.4 I 3.4--- !1
= Q 4.5 Q 4.5 ----- Q 4.5
---]/[------------- I 7.8--o
I 7.8

A( -][------------][------------( )
O I 7.0 I 7.0 I 7.3 Q 2.0 I 7.0-- !1
O I 7.1 ----
) -][------------][----- I 7.1--
A( I 7.1 I 7.4 -- & -----Q 2.0
O I 7.3 -- -
O I 7.4 I 7.3--- !1
) ----
= Q 2.0 I 7.4---


Series Connection

K1 K2 M2

13 14 21 22 A1 A2
This picture shows a process series connection with 3 contactors assigned K1, K2 and
M2. K1 with normally open contact, K2 with normally open contact and the coil of M2
are to be programmed either as a replacement of contacts in the circuit or a feed back.
Coding this connection in S5 is as shown

Assignment List
I 1.0 --------------------- Contact 13/14 K1
I 1.1 --------------------- Contact 21/22 K2
Q 1.0 --------------------- Output M2


I 1.0------ &
-------Q 1.0
I 1.1------

Parallel Connection

K1 K4
33 34

K2 A1 A2

23 24

Assignment List

Let I 8.0 be K1 33/34

I 8.1 be K2 23/24
Q 8.9 be K4 Drive Signal

I 8.0---- !1
------Q 8.9
I 8.1--o

As reader can see from the two examples so far, series connections are equivalent to
AND operation while parallel connections are equivalent to OR operation.

Safety Interlocks

Safety Interlocks are used extensively in instrumentation controls to ensure two or more
controls are not actuated at the same time.

K2 K1

K1 K2

Assignment list

Let I 2.0 be Contact K1

I 2.1 be Contact K2
Q 2.0 be K1 Drive
Q 2.1 be K2 Drive


I 2.0--- &
----Q 2.0
I 2.1--o

Segment 2

I 2.0--o &
----Q 2.1
I 2.1----

Latching Contacts

In some applications, it is necessary to retain the drive signal being that an impulse
generated it e.g. push button

S1----- K1

Assignment list
I 8.3 ----- S1
Q 3.8 ------ Drive K1 and contact K1


I 8.3------- !1
---------Q 3.8
Q 3.8-------

Here a major strength of the plc against hard wiring will be discussed which is the
ability to retain pulse signal to drive a load. Let us reconsider the hard wire latching
circuit above. Remove the latching contact of k1 and redraw circuit with only S1
driving coil K1. It should be clear that with the new circuit, K1 can only jog and not run
since there no retaining contact for the pulse of S1. However, with Simatic S5 program
this is possible as shown below using the same assignment list as before.

I 8.3----------S

R Q -----------Q 3.8

The above is known as the set/reset operation with set priority as the S is above the R.
Once there is an impulse I 8.3, Q 3.8 is set to 1 regardless of what happens after to I 8.3.
In practical applications another input condition is used at the R input to reset Q 3.8.
This application can be seen in push button on a pendant control used to drive a pump.
Reader should find out what is meant by set/ reset operation with reset priority and
understand the coding.

In the field of automation, one can not over emphasize the need for timers. Timers are
used to delay certain actions after the start of certain actions. For example, timers are
used in giving alarms before the start of say a conveyor belt system for safety purposes.
Like contactors, timers exist in electronic and physical forms and they can also be
programmed in the Simatic S5 which is more economical and effective. Let’s consider
the following problem

Write an S5 program for an automation process which requires that the blower fan be
on for 30 seconds after a three phase electric motor which is cooled by the fan has been
stopped for proper cooling of the motor coil.

Assignment List

Q 3.0 -------- Motor Drive

Q 4.0 -------- Blower fan Drive
T3 ------------ Off delay Timer



Q 3.0----- 0 I – I T

KT 30.2- T

------ Q 4.0

The important components of a timer symbol are the ones shown here. Two things are
worthy of note to a trouble shooter here. The first symbol in the box shows that this
timer is an off delay timer. Secondly, KT 30.2 means 30 X 1s. The number after the
decimal point is a multiplier or base. 1 = 0.1s, 2 = 1s, 3 = 10s. This number is also a
tolerance which implies that in the example above 29s ≤ Time ≤ 30s. Please find out
symbols for the other 4 timer operations defined in module 2 to aid you in interpretation
of S5 logic.


1. Translate the following program from CSF to STL

I 0.0

I0.2 &

2. Translate the following program from STL to Ladder logic

A I 9.6
AN I 10.7
O 1 2.3
ON I 2.4
= Q 5.0

3. An organizational Block ( OB) of an S5 program is mostly coded with ---------

representation mode of logic
4. State an assignment list and create a program in CSF for a bi directional motor
which upon two different commands moves in two different directions. Include a
safety interlock in your program.
5. State an assignment list and create a program in CSF for star/ delta starter with
delta timer of 5 seconds with emergency stop, stop and start controls
6. Write a program in CSF and STL describing the process below




7. Write a program in CSF describing the process graph below



8. In a water treatment process, level of water in a tank is read digitally. Write a
program in STL and CSF that stops pump from filling tank when the water level
is high and initiates an alarm which hoots till the operator acknowledges the
message. State your assignment list first.
9. In coding timers, the time value is denoted by KT a.b where the range of a is
from ---------- to ----------- while b stands for ------------ and ----------------
10. In a conveyor belt system, there are 3 conveyor belts C1, C2 and C3 from intake
to storage silo respectively. These conveyor belt automation system is governed
with the following control philosophy-

START: A Signal horn blows for 2 mins and stops after which C3 starts. C2 starts
10 mins after C3 had started.C1 starts 15 mins after C2 had started.

STOP: Conveyor belt system will be stopped if silo is full (HH), there is belt
misalignment checked by a proximity switch, or the operator presses the stop
button. A signal horn blows 3 mins and stops after which C1 stops. C2 stops 15
mins after C1 had stopped. C3 stops 20 mins after C2 had stopped.

State your assignment list and create a program in any representation mode of your
choice to initiate the start and stop sequence of this conveyor belt automation
system. Note that your program will need multiple segments but you need to
maintain consistency.
The preceding modules where all to prepare us for this stage so make sure you
understand them. This module is actually practical but general steps in troubleshooting
an S5 distributed control system are discussed.

4.1 Steps in Troubleshooting

1. Know the Process: In the writers view, this is the most important step because
there are many industrial processes. Sometimes, operational errors lead to
temporary system failure so the process must be understood generically.
2. Locate the Missing Output: Majorly, faults in an automation system are outputs.
Locate this output both in circuit diagram and on the assignment list in the PG
3. Cross reference Missing Output to Responsible Input: Using cross reference
procedure, trace from output to input. This is very tricky and most be done
patient and with adequate knowledge of logic interpretation. Please don’t assume
you know when you don’t. Go back to previous modules or get further help on
this somewhere else.

An acronym, PLC can be used to remind one of this important and cost saving steps
compiled by experience. Remember, practice will definitely make perfect in this case.

4.2 Problems
The following problems are drawn from processes in the Smelter. Real program
numbers are included.