Industrial Automation
Industrial Automation | Europe

myKnowledge

Main > Product Type > Software > Programming
Minimize Text   Default    Enlarge Text
 

Print
E-mail

What Is SFC?


  • The objective of this document is to introduce the basics of SFC. This is NOT supposed to be a full training for SFC !!  There are whole books dedicated to this topic.  However, this document should explain if SFC could be the right language for you, and if further training or reading would be valuable
  • The target audience for this document is project designers, experienced control engineers or technicians that have not used SFC, but want to understand if it would be applicable for them
  • The document is intended to be manufacturer neutral (although figures and examples are provided using Omron’s CX-Programmer)

Introduction

SFC stands for “Sequential Function Chart”, and is a language defined by the IEC as part of the IEC 61131-3 specifications.  It is a sequential control system language that is used for process flow control especially for devices like Programmable Logic Controllers (PLC).  While PLCs have extensively been programmed in Ladder Logic for many decades, SFC is a sequential control system that, subject to system conditions, switches from one state of operation to the next.  Although SFC does have a textual format, it is almost entirely used in its graphical form which can be quick to visualise and easy to learn.

Basics of SFC diagrams

SFC diagrams consist of a number of basic diagram types that are used as building blocks to create a chart that describes the program flow.  The most important type is an SFC ‘Step’ which represents a single machine state or operation.  Steps are drawn as a rectangle with the Step name inside to describe the Step. Figure below shows sample steps for filling a tank, washing the contents, and spin drying.

Steps are always separated by an SFC ‘Transition’ which is the condition that must occur to change from one step to another.  The flow between Steps is drawn as a line with Transitions drawn as a horizontal line with the transition name and condition written.  Transition Bodies can also be written in Structured Text or Ladder logic.  For example a machine stops filling and starts washing when the water level is full and the ‘Full Switch’ is set.  The machine stops washing and starts spin drying when enough agitations have been completed.

 


 


Each Step usually has an SFC ‘Action’ linked to it and determines the action taken when the Step is active.  Steps often have multiple Actions defined which may be named and then also reused by multiple Steps. The Action can run continuously while the step is active, or just once.  In fact, there are many Action qualifiers defined including running the Action for a certain time, or starting after a certain time.  The body of the Action can simply set Boolean values (as below) or be written in any IEC language, for example Ladder Logic, Structured Text, Instruction List. When a Transition occurs and the next Step becomes Active, the Actions associated with the deactivating Step stop and any Actions linked to the newly Active Step are executed.

Further special SFC symbols allow complex diagram creation.  Every SFC diagram must have an ‘Initial Step’, which is drawn as a regular Step with double lines and is the first step to become active.  For clarity, diagram connections may be shown as Jumps, but can also branch apart and join together.  Conditional branches can be added with ‘Divergence and Convergence’ (see Figure 4) and also perform ‘Sequential’ execution of Steps in parallel.  SFC Diagrams can also include nested ‘Subcharts’ like a SFC ‘Subroutine’ with further SFC diagrams embedded within.

When is it best to use SFC and why?

Sequential Function Chart is a powerful graphical language so will it replace other programming languages? No. SFC language complements the other IEC languages and is designed to be used along side them.  Ladder Logic still remains a concise and efficient language for Boolean logic and control tasks.  Structured Text makes complex mathematics, conditional structures and program loops easy to create.  However, SFC is designed for use in sequence management, and can incorporate the other languages in Actions and or Transitions as required when they are best suited.  For many systems, SFC makes an ideal ‘Top level’ overview of the system.  Showing the key states on 1 small diagram allows instant monitoring and highlighting of the Active Step.  Using Subcharts allows hiding of detailed sequences, and zooming in when interested.

At a deeper program level SFC could be used for example, handling communications to an external device where a sequence of commands must be sent, depending on the device’s response.  In short, SFC is applicable anywhere where sequence control is required.

SFC: Better for development

As control applications grow in size and complexity, fewer development companies can rely on a single system ‘guru’.  Multi-engineer development and even multi-site development means design communication between developers is essential and SFC is ideal during both the ‘Top down’ design discussion phase and can be taken straight into the programming phase. Sequential Function Charts often follow the real flow of the machine already known to the users.  SFC’s building block based nature also naturally lends to defining detailed sub tasks of a known role that can then be developed individually.  Using Function Blocks and Object Oriented style techniques like data encapsulation, data can be kept private which prevents unexpected side affects by use of other tasks, often only found during the integration phase.  This whole structured design methodology supports multi user developments and helps shorten development time and reduce development mistakes - shortening commissioning time.

SFC: Better for maintenance

Because of the intuitive and human readable nature of SFC, it is often described as self documenting.  Maintenance engineers can quickly and easily understand the program to resolve a problem.  Coupled with a good design and data encapsulation this can help reduce downtime during unscheduled maintenance.

SFC for reuse

SFC is excellent for reusing designed and tested charts on new projects.  By building a library of Charts, Subcharts and Actions designed and tested for your applications, this library can be reused when building similar systems with no need to retest their sequential function.  It is a common misconception though that ‘standard programming’ means ‘standard programs’ and that a single SFC program can be executed on any manufacturer's system.  Although there is a textual SFC standard often used for exporting and importing programs, most hardware manufacturers require OEM extensions specific to the hardware.  This is inevitable and means true portability can never be achieved.  However, the development skills for SFC are reusable, as any tool must create the same diagrams.  It is also true that the system design can be reused between manufacturers so with good design and clever use of Function Blocks it is possible to minimise any refactoring time.

Summary  

  • Consider using SFC at the ‘Top’ programming level i.e. at the highest point of the design and the initial starting point and anywhere else sequential control is required
  • Using SFC can reduce development effort, and helps design communication especially of large, complex or multi developer projects
  • SFC is self documenting and can reduce maintenance time
  • SFC programs are rarely portable between manufacturers, although SFC engineering skills and program designs are

References

See the “CX-Programmer User Manual” for more information about creating SFC diagrams in CX-Programmer
R. W. Lewis “Programming industrial control systems using IEC 1131” is an excellent book about all IEC 61131-3 languages including SFC in detail.  It assumes no previous knowledge and covers topics in an easy style.  ISBN 0-85296-950-3.
More information on IEC 61131 can be found from the PLCOpen website (www.plcopen.org) or the IEC website (http://iec.ch) although this information can be very technical e.g. Specifications, and not always directly relevant to control engineers.

Glossary

Action An SFC element describing the ‘action’ or operation to be carried out during this step of the program
IEC International Electrotechnical Commission, standards body
IEC 1131 Old name for IEC 61131 before the change in numbering system by IEC
IEC 61131 IEC standard for Programmable Logic Controllers (PLCs)
Ladder Logic A common programming language for PLCs where the 2 vertical connections and many horizontally wired instructions somewhat resembles rungs on a ladder
PLC Programmable Logic Controller, a flexible device to perform a control function, where the function and control logic are customisable and programmable
PLCOpen Organisation for discussing open PLC standards
SFC Sequential Function Chart, an IEC 61131 graphical programming language
Step A key SFC element representing a fixed state or operation.  An SFC program moves from Step to Step as it executes
Structured Text an IEC 61131 textual programming language, somewhat similar to the PASCAL language
Transition An SFC element that determines the condition to be met to move from Step to Step
Top Down A common design technique, where the whole system is first designed at top level, with minimal detail, before then designing the detailed component parts



Attachments

TechNote_What_is_SFC.pdf - Size: 1705432


Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2008-05-12
Modified 2009-07-07
Views 11885

 

You are not logged in.