Sequential Function Charts for All

Implementing Sequential Function Chart Designs using Ladder Diagram Programming Language for Programmable Logic Controllers

by James McWhinnie
Napier University, Edinburgh, Scotland.

ABSTRACT

Sequential Function Charts (SFC’s) have long been established as a means of designing and implementing sequential control systems utilising programmable controllers. The Programming Standard IEC 61131-3 includes a graphical implementation of SFC’s in its suite of programming languages. 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 in terms of computational speed, programme size and programme control. This facility is therefore usually only offered on the larger more powerful controllers where execution speed and programme size are rarely an issue. This paper demonstrates how SFC’s may be implemented on any PLC including low cost PLC’s with the simple Ladder Diagram programming language, with little computational overhead. Thus allowing the user all the benefits of using SFC’s in the design process.

Keywords: Control, Finite State Machine(FSM), Sequential Function Charts(SFC), Programmable Logic Controller (PLC).

1.0 Introduction

Many systems have sequential operation requirements and Sequential Function Charts (SFC’s) have become a popular method of accurately specifying sequential control requirements. SFC’s have many advantages for software development both in the design stage as well as the implementation and testing, maintaining and fault finding stages.

Design Stage

  • Detailed clear graphical specification
  • Non software people can specify / verify

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

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 implementing SFC designs will be outlined and demonstrated.

Sequential Function Charts break a sequential task down into Steps, Transitions and Actions. These are drawn graphically to describe a sequence of interactions, as shown in Fig 1 below. Convention states that flow through an SFC is from top to bottom unless indicated by an arrow.


Figure 1: Sequential Function Chart Example

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


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.


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 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.


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.


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.).


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.

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.


Hi. SFC is in IEC1131

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...

Missing point of article. In

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.

hey, we live in 2008, not

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 :)

Still relevant for many companies

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.

this article is very applicable for low cost hardware

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.

"Even Siemens has SFC." What

"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.