Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Sequential Function Charts for All | PLCdev http://www.plcdev.

com/sequential_function_charts_all

Search

Tools for PLC programming

Recent Posts
Home Products Tutorial Directory Glossary Contrib
Ads by Google
PLC Software
Ladder Diagram
PLC SCADA Training
PLC Simulator Implementing Sequential Function Chart Designs using Ladder Diagram
Programming Language for Programmable Logic Controllers
PLC Programming
Handbooks by James McWhinnie
Allen Bradley Napier University, Edinburgh, Scotland.
Siemens
Modicon
ABSTRACT

Sequential Function Charts (SFC’s) have long been established as a means


of designing and implementing sequential control systems utilising
HMI / SCADA Solutions programmable controllers. The Programming Standard IEC 61131-3 includes
OPC, DA, XMLDA, UA
a graphical implementation of SFC’s in its suite of programming languages.
Status Vision Designer
www.StatusVision.com Many manufacturers offer programming environments that allow engineers
to programme controllers using graphical methods to implement the SFC’s.
However as well as the initial cost outlay there are overheads to be paid for
Simulink Interactive Kit in terms of computational speed, programme size and programme control.
Free kit includes Simulink This facility is therefore usually only offered on the larger more powerful
demos, product info,
examples, and more controllers where execution speed and programme size are rarely an issue.
www.mathworks.com This paper demonstrates how SFC’s may be implemented on any PLC
including low cost PLC’s with the simple Ladder Diagram programming
PLC ladder logic language, with little computational overhead. Thus allowing the user all the
examples benefits of using SFC’s in the design process.
PLC training and program
examples Anti-tie-down, Keywords: Control, Finite State Machine(FSM), Sequential Function
BCD, Monitoring Charts(SFC), Programmable Logic Controller (PLC).
www.machinetoolhelp.com

1.0 Introduction
IEC 61850 / IEC61131-3
Tools, development and Many systems have sequential operation requirements and Sequential
products for substation
Function Charts (SFC’s) have become a popular method of accurately
automation system
www.copalp.com specifying sequential control requirements. SFC’s have many advantages for
software development both in the design stage as well as the
Programmable implementation and testing, maintaining and fault finding stages.
Automation
Design Stage
Compact IO. Ethernet
interface. Programmable Detailed clear graphical specification
Automation Controller Non software people can specify / verify
www.mksinst.com

Implementation
Straight forward conversion from specification to code
Structured testing / debugging

Maintenance of Software
Readily understood by engineer modifying software

Machine Maintenance
Allows quick accurate fault diagnosis

11 කින් 1 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

Automation Geeks After a brief introduction of SFC’s to the reader, this paper will show how to
implement the charts using Ladder Diagram (LD) programming language.
Then will go on to discuss how fault diagnosis and predictive fault diagnosis
can be achieved.

2.0 Sequential Function Charts

This section will briefly explain the SFC and demonstrate how it can be used
to specify control requirements by an example. Then a method of
Popular Articles
PLC Timeline implementing SFC designs will be outlined and demonstrated.
Rockwell Automation's Sequential Function Charts break a sequential task down into Steps,
Retroincabulator!
Transitions and Actions. These are drawn graphically to describe a sequence
PLC Basics
PLC Simulators of interactions, as shown in Fig 1 below. Convention states that flow through
Cheap PLCs an SFC is from top to bottom unless indicated by an arrow.

Navigation
Book reviews
Online books
Recent posts
About

RSS
Feed Me! Firefox and

Thunderbird make it easy to keep

up on the latest articles from

PLCdev

User login
Username: *
Figure 1: Sequential Function Chart Example

Password: * The sequence is broken down into steps (or states) where actions are carried
out. The transition conditions define logical conditions that cause the process
Log in to move from the existing step to the next step. Actions contain three fields
Create new account as shown in Fig2.
Request new password

Figure 2: Actions

An Action consists of a qualifier which defines what type of action e.g. S for
set, R for reset and N for continuous while in step. A description of the action
or tag name and finally the address acted on. As the design progresses more
detail can be added as shown Fig 3. This detail would include memory (%M),
input (%I) and output (%Q) address information.

11 කින් 2 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

Figure 3: Detailed Sequential Function Chart Example

2.1 Implementation

It is important when designing software for a PLC that the designer is aware
of the operation of the ‘scan’. The PLC scan typically consists of the following
sequential operations: Reads in the states of external devices into an area of
memory designated input (I) memory. Evaluates user programme writing
output results to memory (M) and output memory (Q). The output memory
is then used to drive the real physical outputs, Fig 4.

Read Inputs to Input RAM


Execute Programme
Diagnostics and Communication tasks
Update Outputs from Output RAM
Repeat

Figure 4: Typical PLC Scan

When implementing SFC’s using Ladder Diagram (LD) the step and transition
logic can be treated separately from the action logic. The Ladder Diagram
logic for a typical step is shown in Fig 5.

Figure 5: SFC Step / Transition Logic

Each step can be entered from at least one step. If it can be entered from
more than one step then all possible previous steps must be reset.

Once the Step/Transition logic has been completed then the actions can

11 කින් 3 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

written. In a simple system outputs can be driven directly from the states as
shown in Fig 6.

Figure 6: SFC Actions

To illustrate the use of SFC and how they may be implemented let us
consider a simple example.

Two pistons as shown in Fig 7 have to be controlled using a PLC. The


operation requirements are as follows. When a normally open switch
(%I0.7) is closed momentarily and both pistons are home the following
sequence should occur:

Piston A has to be extended.


When A is extended piston B is extended.
After B is extended for 3 seconds piston A is retracted.
When A is retracted piston B is retracted.

The sequence does not operate until the switch is closed again i.e. it
operates every time the switch is closed and if piston A is in its home
position.

11 කින් 4 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

Figure 7: Example Piston Control

Taking the written description, a SFC can be drawn. As the inputs and
outputs have been assigned detailed memory information can be included, as
shown in Fig 8.

11 කින් 5 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

Figure 8: Detailed Sequential Function Chart (SFC)

From this the Step/Transition code can be written as shown in Fig 9. Note
the Step logic is entered in reverse order to ensure that a sequence is
entered for at least one PLC scan (ref.).

11 කින් 6 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

Figure 9: Step / Transition Logic

Step 1 Contains additional logic, the “InitSeq”, a one shot (is true for first
scan) signal is used to place the system into step 1 when the PLC is first
switched on or moved from stop to run and the Emergency Stop input is
used to drive the system into step 1 which in this case is considered to be
the safe state. Note also that all other states are reset, this is necessary as
for example an Emergency Stop could happen in any step.

Next is the software to drive the outputs. This is relatively simple as shown
in fig 9.

Figure 10: Action Logic

Logic is also required for sequence start condition logic.

11 කින් 7 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

3.0 Fault Diagnostics

The use of SFC’s has advantages when testing and commissioning control
system software. One of the features of Programmable Logic Controller
programming systems is the ability to monitor programmes and variables
online. This allows the engineer to monitor the step progress by viewing the
appropriate memory bits. If the machine stops the current step can be easily
identified and by viewing its logic network, it is a staright forward task to
identify which transition conditions are not being met. This can then identify
the areas requiring investigation.

The use of step/state monitoring can then be used to trigger alarm


conditions automatically. For example, each step/state duration may be
timed. If the duration exceeded limits this could be used to identify a fault
possibly either with the control action or transition signals.

More advanced analysis of the step/state times could be used to warn or


predict a failure mode or identify maintenance requirements. Consider the
above system; the duration the system is in Step 2 may indicate the health
of the pneumatic piston. i.e. if the time gets longer it may indicate an air
leak. This could be used to request maintenance to check at the next
opportunity. A combination of step time deviations may help predict a
looming specific component failure.

Add new comment


( categories: Programmable Logic Controllers Software )

Hi. SFC is in IEC1131

Submitted by bala nemate (not verified) on Sun, 2008-08-31 13:59.


Hi. SFC is in IEC1131 standard. Why bother to look for a way to replace it
with out-dated languange (LD)? Imho, it is masochism to do it...

reply

Missing point of article. In

Submitted by James McWhinnie on Fri, 2008-09-05 01:57.


In reply to comment. Reader is missing point of article. In practice not all
PLC's offer IEC61131-3 compliance, and in particular SFC's (not strictly a
language), however they almost all provide LD. This article just shows a
reliable method of implementing SFC designs.

reply

hey, we live in 2008, not

Submitted by bala nemate (not verified) on Mon, 2008-09-22 06:57.


hey, we live in 2008, not 1998. Even Siemens has SFC. IMHO,
author missed the point when he started to write this article - it is
late 5 to 10 years :)

reply

11 කින් 8 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

Still relevant for many companies

Submitted by PLC Mike (not verified) on Mon, 2008-09-29 09:39.


There are some very large global companies that actually require
this type of programming on supplied equipment. The old adage
of "the customer is always right" fits in here. I will program that
way if they are paying for it.

reply

this article is very applicable for low cost hardware

Submitted by Anonymous (not verified) on Mon, 2008-09-29


19:10.
There are many applications for low cost PLC's and the $150
smart relay's where this is very useful. Those devices do not
support SFC.

reply

"Even Siemens has SFC." What

Submitted by Anonymous (not verified) on Mon, 2008-10-27


07:04.
"Even Siemens has SFC." What on Earth does this mean?
I remember using SFCs in Siemens S5 equipment 20 years ago
with their software package Graph 5. OK so it wasn't IEC61131
compliant but IEC1131 (or its predecessor for SFCs IEC948)
didn't even exist then.

reply

who missed the point ???

Submitted by freelancer on Fri, 2009-01-02 07:46.


since Sun, 2008-08-31 13:59 , I was waiting for an enlightment
from 'bala nemate' , an alternative to James' article , wich I found
an intuitive synthesis on the SFC subject. This is what most
people are doing today : it is very easy and convenient to deny
an article / statement instead offerring better alternative to it.
Thank you , James , what you said , remains . All the rest ... is
sillence.
A Good Year , to all !

reply

Your comments are

Submitted by James McWhinnie on Fri, 2009-06-26 04:34.


Your comments are appreciated.

reply

11 කින් 9 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

More then one step in one scan

Submitted by Hillel Hachlili (not verified) on Mon, 2009-02-23 18:34.


I am using state machine in ladder logic for more then 20 years. I see some
problems with this "set / reset" implementation: 1)if all condition are true
you could have a few steps resolving in one PLC scan. As a result other part
of the program never see these steps. 2) Nothing prevent more than one
step bit (coils) to be on at the same time. 3) there is no simple way to
pause, or single step the state machine. 4) there is no one data register to
monitor the current step.
I have used the DECODE instruction to resolve all the above issues.

reply

Hillel Sorry I havent got

Submitted by James McWhinnie on Fri, 2009-06-26 04:22.


Hillel
Sorry I havent got back to you sooner have not checked site for a while.
I too have been programming PLC's and controllers for 20+ years and
this has worked well for me. Especially when under pressure its good to
have a proven design method to work with. I have used it from single
machines to complete Water treatment works with multiple networked
PLC's i.e. SFC's co-ordinating over the network.
Point 1) This is why the step logic is written in what appears to be
reverse i.e. step 6 logic first then, so that any step will be valid for at
least one scan even if the next transition is true.
Point 2)Only the logic controls this, however when you have parallel
branching more than one step needs to be true.
Point 3)You would need to add logic if this was an issue. However when
testing using a simulator which I would always do before going live, as
you are controlling the transition logic I have not found this to be a
problem. You can also force system into a step by writing to memory
byte/word containing step flags.
Point 4) Most PLC's allow you to monitor memory in runtime and
therefore you can follow the step progression. Also handy for relaying
machine status on SCADA.
Hope this answers your points.

reply

I still see some problems

Submitted by Hillel Hachlili (not verified) on Mon, 2009-09-07


16:57.
Thank you James, for your reply.
1)I still see a problem with your "reverse order". In many cases the
program jump back to an earlier step, not always forward. In large
program, writing in reverse could be confusing for someone else to
understand. In my approach I don't need to do this and it will never
have more then one step in one scan.
3)Pause and single steps are needed for the final product not only for
the programmer debug phase. In my approach it takes no additional

11 කින් 10 2010-01-16 6:08 ප.ව.


Sequential Function Charts for All | PLCdev http://www.plcdev.com/sequential_function_charts_all

programming, you just stop the decode function in order to pause, or


decode with a one shot to single step.
4)I use to store the last 50 steps of the state machine, by a shift
register that is shift when the step number is changed. This is very
helpful, to figure out what happened in a system that lead to a
problem. Again this is for the final product and not during debug.
Best regards, Hillel Hachlili

reply

I suggest you read my

Submitted by John Schop (not verified) on Wed, 2009-07-15 13:03.


I suggest you read my article here 'An introduction to grafcets', where
these issues are also resolved in a simple way. I do no know if this could
be applied to a Siemens PLC, but I like to believe that it is possible. It
gets rid of the SET/RESET functions, it prevents two steps in one cycle,
and also guarantees that every step is active for at least one cycle.

reply

SFC

Submitted by Anonymous (not verified) on Mon, 2009-06-15 11:52.


ladder is much simpler. I made a plc program to do this example in 12
rungs. Probably could do in less. I dont see the benefit.

reply

This simple exercise was

Submitted by James McWhinnie on Fri, 2009-06-26 04:27.


This simple exercise was only to illustrate the technique, of course it can
be done with less logic. If you programme more complex systems its very
easy to get confused and your code difficult to follow and fault find on,
especially with multiple SFC's interacting with each other. This just gives
a structured approach. If you don't need one great!

reply

Home

Terms of Use | Privacy Policy | About PLCdev | Contact Us | Write for us


Copyright © 2005-2010 plcdev.com | Hosting at HostPC

11 කින් 11 2010-01-16 6:08 ප.ව.

You might also like