Sequential Function Chart (SFC) Programming for Beginners
In this article, we’ll introduce you to a PLC programming language called Sequential Function Chart, or SFC for short.
The PLC programming standard IEC 61131-3 includes five programming languages:
– Sequential Function Chart
The SFC programming language is different compared to the four other languages. The SFC is used to program a sequence directly in the PLC.
What is a sequence in SFC?
A sequence is a step-by-step operation that should be used to perform a task. An example of a sequence can be a part painting process.
Here are the steps in a part painting process.
1) The first step is placing the part that needs to be painted in the machine.
2) And next step is the first coat of paint.
3) The next step is drying.
4) And the last step is the final coat of paint.
Now Let’s see how we can implement these steps easily using SFC programming. An SFC makes it easy to program the sequence directly in the PLC.
An SFC program is composed of graphic symbols. Each graphic symbol represents one step. A step is the same as a state.
Init step
The first graphic symbol is used for initialization. This is called the init step. This is a square that is double-lined.
Inside the square is a step name. The step name Step_1 is used to identify each step and this must be a unique name in your program.
When the PLC turns on the program will go into the initialization step and stay there.
Step or State
A Step is a single-lined square. The step shown is named Step_10.
Transition
Each step is connected to the next step by a connection line. And a small horizontal line is added and this is called the transition. At the transition line, there must be a condition.
Where B1 is a Boolean variable there can be TRUE or FALSE. When B1 is changed from FALSE to TRUE the program state changes from Step_10 to Step20.
The transition can also be a logic. When AND is added between B1 and B2, both B1 and B2 must be TRUE to change from Step_10 to Step20.
Another commonly used transition is the Delay transition. In SFC, a delay is a part of the step box, and therefore easy to use.
In the transition space, first, enter the step name followed by a dot. After the dot, enter t and then >. Then enter the delay time.
Enter t# indicating that the format is time, Finally, enter the delay time. In our example, we have entered 2, meaning 2 seconds.
Action and Qualifiers
An action can be added to a step if required. A line connects the Step to the Action.
Inside the action box is a qualifier letter N that indicates what to do with the VarName or variable name. The VarName is a Boolean variable.
An N qualifier means that the variable VarName is TRUE only when the step is active. Therefore you don’t need to set VarName to FALSE when leaving the Step_10 action.
Let’s look at 2 other important qualifiers to know.
When using S as a qualifier, a TRUE will be stored for VarName inside the memory. This is used to keep the VarName TRUE when leaving the step.
If you need to reset the stored VarName value, you can use R as a qualifier.
There are many other qualifiers and they will be explained in another article.
SFC example
Let’s look at an SFC example. We want a lamp to flash at 2 seconds interval.
To program the SFC we start with the init step.
We need to add two steps. The sequence includes one step for the lamp to turn on, and another step for the lamp to turn off.
There is always a transition between each step. If a condition always is full fit just enter TRUE as shown between Init and Step1. When right after entering Init step the program will go to Step1.
The program needs to be repeated, because of the continuous flashing. Draw a line from Step 2 to the end before step 1.
The lamp needs to flash at 2 seconds intervals. Therefore, a time delay of 2 seconds between the steps is needed. The on-time and the off-time are the same therefore same delay time is used.
Then the action to control the lamp is to be added. The qualifier letter N is used because the lamp must be turned on only in Step1. The lamp turns automatically off when leaving Step1 when using the qualifier letter N.
No action is needed for Step2 because the lamp is turned off when entering step 2.
The variable name or TAG name is Lamp and is assigned to the output module where the physical lamp is wired.
Another solution for implementing a flashing lamp is to use the qualifier S to turn the lamp on and the qualifier R to turn the lamp off.
Summary
In this article, you learned the basic graphic symbols used in SFC.
We have:
– Init step
– Step (or State)
– Transition
– Action
– Qualifiers
I Hope this article helped you learn some new skills to become a better PLC programmer.
Join the Top 1% of Automation Engineers
Start Your 7-day Free TrialLearn from Industry Experts
With a 7-day trial, then €25/month