SFC (Sequential Function Chart) is a visual structured graphical language that utilizes PLC (Programmable Logic Controller) to organize application programs using flowcharts based on the processing order. SFC divides the application program into two main components: ‘Steps’ and ‘Transitions,’ providing a method to link them. Each ‘Step’ is associated with a specific ‘Action’, while each ‘Transition’ is connected to a ‘Transition Condition.’
We will program our first Sequential Function Chart (SFC) in our LS Electric XGB PLC. SFC programming is commonly used in industries such as manufacturing, automotive, and process control, where complex sequences of operations need to be coordinated. It allows the programmer to visually organize the control logic, making it easier to design, understand, and maintain the control system (Troubleshooting.)
SFC programming is beneficial for applications with many interrelated components and where the sequence of operations is critical to the system’s overall functioning.
This post will explore the fundamentals of programming an XGB PLC using Sequential Function Chart programming. We will be programming our lighted pushbuttons to control a start-stop circuit. This will show the basics of this IEC programming language. Let’s get started.
Previously in this LS Electric XGB series, we have done the following:
Transform Automation with LS XGB PLC: The Solution
– Unboxing and Powering Video
Install & Com w/ XG5000 PLC – Video
LS Electric XGB PLC Variables and Scope – Video
Wiring Discrete I/O to an XGB PLC – Video
XGB PLC Ladder Logic First Program – Video
XGB PLC Simulator Ladder Logic Diagram – Video
XGB PLC Structured Text First Program – Video
XGB PLC Simulator Structured Text (ST) – Video
See the list of references for the XGB PLC, including the frequently asked questions (FAQ) at the end of this post.
Start a New Project
Run the XG5000 programming software for the LS Electric PLC controllers. Under the main menu | Project, select ‘New Project.’ This can also be selected using the shortcut key combination of Ctrl + N. There is also a new project icon on the main screen. The New Project window will now be displayed.
Give the project a name. The directory where this program is to be stored can also be set. Under the PLC section, select the PLC that we will be programming. The CPU series is an XGB (IEC), the type is an XEM-DxxxH2, and we will leave the default name LSPLC. Under the program heading, we can name the SFC program and select SFC as the programming language. A project description can also be put into the new project window to document what we are trying to do. Select OK.
SFC Command Summary
The new Block program that we named will now be displayed. This is where we will program our sequential function chart code.
Under the main menu | Edit | Tools |, a list of all SFC instructions will be displayed. This is also shown in the top menu icons and the corresponding shortcut keys.
Step F3
In relation to ‘Action’, ‘Step’ functions as a control unit for sequences. When ‘Step’ is activated, the corresponding content of ‘Action’ is executed. You must first activate the initial step.
Transition
A transition indicates the conditions required for execution between steps. Each transition condition must be expressed using PLC language, either in Structured Text (ST) or Ladder Diagram (LD).
The result of the transition condition must always be of the BOOL type, and the variable name should be ‘TRANS’ for any transition. If the transition condition evaluates to true (1), the current step is deactivated, and the next step is activated. Transitions are mandatory between steps.
Action F4
Each step can connect to up to two actions. A step without any action is considered a “Waiting Action,” which means it waits until the next transition condition becomes true (1).
An action is defined using PLC languages such as Ladder Diagram (LD), Sequential Function Chart (SFC), or Structured Text (ST), and the action executes while the step is active. An action qualifier is used to control the action. When an action is deactivated after being activated, any output contacts activated during the action will revert to 0.
Action Qualifier
Action qualifiers are used whenever an action is applied. According to the assigned qualifier, the action related to a step defines an execution point and time.
The types of action qualifiers are as follows:
– N (Non-Stored)- Action is executed only when the step is activated.
– S (Set)– As the step is activated, the action is kept executed until the R qualifier is executed.
– R (Overriding Reset)- It terminates executing an action previously started by the S, SD, SL, or DS qualifier.
– L (Time Limited)- After the step activation, Action is executed until the step becomes inactivated or until the set time elapses.
– D (Time Delayed)- After the step activation, Action is executed from the moment the set time elapsed until the step is inactivated.
– P (Pulse)- Action is executed only for one scan when the step is activated.
– SD (Stored & Time Delayed)- After the step activation, Action is executed from the moment the set time elapsed until the R qualifier is executed. However, if the R qualifier is executed before the elapse of set time, the action does not execute.
– DS (Delayed & Stored)- After the step activation, Action is executed from the moment the set time has elapsed until the R qualifier is executed. However, if the R qualifier is executed or the step is inactivated before the elapse of the set time, the action does not execute.
– SL (Stored & Timed Limited)- After the step activation, Action is executed until the set time has elapsed or the R qualifier is executed.
Block Step F5
When the block step is activated, the specified SFC (Sequential Function Chart) program within the block is executed.
Only SFC programs are permitted; LD (Ladder Diagram) or ST (Structured Text) programs cannot be included. It is important to note that actions cannot be linked to block steps. When the block step is deactivated, the SFC program running within the block is also deactivated.
Labels can be placed in your Sequential Function Chart depending on the sequence of operation for your logic.
Jump F7
The Jump SFC instruction can return to a label within the sequence.
Left Branch F8 – Right Branch F9
When the upper step is activated, the next transition with a condition set to 1 is activated among multiple connected transitions. The executed branch is the first transition active reading from left to right.
In this example, if the transition condition of T4 and T5 is 1, the scan order is S1 -> S4 -> S3. The processor chooses the left-most path.
Create the Variable List
The first thing to do is create variables we will use in our program. Under the project window and the LSPLC, double-click on “Global/Direct Variables.”
This will call up the Global/Direct Variables window. We can now enter the physical inputs and outputs previously wired to our LS Electric XGB PLC.
Our sample SFC program will control a start-stop circuit. When the start pushbutton is pressed, the green LED will light up, and the red LED will be off. When the stop pushbutton is pressed, the red LED will light up, and the green LED will be off. Initially, the red LED will be on at the start of this SFC program. Save the program.
Create the SFC Program (XGB PLC)
Select the sample SFC program window. We can now create the sequential function chart code. All available commands for SFC are under the main menu | Edit | Tools. The shortcut function key is also listed to the right of each command. There are also SFC command icons on the main menu in the XG5000 programming software for your convenience.
Click the step command (F3) and move your mouse to the Sample_SFC program area. Click the spot where you would like to place this step and transition.
The step is set for the default of S0. Double-clicking on this step will allow you to change the label. We will leave this as the default S0.
Click the action command (F4). Select the S0 step for this action.
The action properties window will be displayed. Select the find to select the green LED variable and select OK. Since we were not finished with the step action, select the arrow (ESC) from the main menu icons. Double-click on the action for the step to recall the action properties window again. Change the qualifier from N (Non-Stored) to R (overriding Reset). Select OK.
Click the action command once again and select the previous action. This will again call up the Action Properties window. The default type is variable. Select the find button and select the red LED variable.
Change the qualifier to S (set). When the first step is executed, the green LED will be off, and the red LED will be on.
The transition to the next step is shown at the bottom of the previous step. Double-click on the box next to the transition. This will display the transition properties window. Select the Variable under the Type heading. Select find.
Select the “Start” variable to transition to the next step.
Select the step command again and click on the transition from the previous step. This will place the next step (S1) after the transition. Set the actions for this step so the qualifier will set the green LED and reset the red LED.
Select the transition after step 1. We will add the boolean variable Not_Stop for the transition condition.
Our SFC program is now complete. However, we need to define this latest Not_Stop variable now so it will change when required.
Right-click on the Scan Program. Under the Add Item menu, select program. The program properties window will now be displayed. Name this program and ensure the language is set for ladder logic (LD).
We can now set the condition for the Not_Stop contact so that the SFC program will transition back to Step 0.
Since the stop pushbutton is wired normally closed (NC), we will use the normally closed Stop contact to turn on the Not_Stop output.
This is the end of our program. Save the program. To check the program, select it from the main menu | View.
If we had an error, it would be shown as an Error or Warning in the Program Check dialogue.
Transfer the Program
Select main menu | Online | Connection Settings…
This will call up the Connection Settings window. Select network browsing and then expand the ethernet option. This will search our network for the LS Electric XGB PLC. Click on the IP address found and select OK.
Returning to the connection settings window, we can now select connect.
The bottom of the XG5000 programming window will be red. This tells us that we are communicating with our XGB PLC, which is in stop mode.
Transfer the SFC program to the XGB PLC by selecting Write from the main menu | Online. The Write to PLC window will be displayed. We will leave all the settings as their default and select OK.
Our program will now be transferred to the PLC. The write complete message can be acknowledged by selecting OK. The PLC connection will then be stopped, which is the blue bar at the bottom of the XG5000 programming software. Select Connect from the main menu | Online. We will once again be connected to the PLC.
Monitor / Modify the Program
Select the monitor icon on the main menu. This will show us the status of our program as it executes in the PLC.
Select the run icon on the main menu. Select Yes to verify that we want to change to RUN mode.
The bar at the bottom of the programming software is now green, indicating that we are communicating with the PLC and that the code is running.
Operate the green and red push buttons to verify the program’s operation. This Sequential Function Chart (SFC) program illustrates the basic control logic for a start-stop circuit.
Let’s now modify this start-stop circuit. Select Disconnect from the main menu | Online. Double-click on the action property for the green LED in step 1.
Change the qualifier to L (time limited). Under the time, change this to 10 seconds. If a syntax error like time format happens, a warning message will be displayed indicating the format expected. The XG5000 programming software is very intuitive. Select OK. Save, connect, and transfer the program again to the XGB PLC.
Monitor and test our new logic by operating the pushbuttons. You will now see that when the start pushbutton is pressed, it will only be on for 10 seconds or until the stop pushbutton is pressed. Let’s modify the Not_Stop condition in the ladder so that when the green LED light turns off after 10 seconds, then the transition is also activated.
Using online editing of the ladder logic code, we can add a trailing (negative) edge trigger for the green LED light in parallel with the stop button. Once we finish our online modification of the ladder, write the modified program to the PLC.
Monitor the new program and watch the operation. The step ends when the green light turns off after ten seconds or if the stop pushbutton is pressed.
Programming an XGB PLC using a Sequential Function Chart (SFC) language offers a powerful and flexible approach to designing control logic for industrial automation applications. You can develop robust and reliable control programs for XGB PLCs. With continuous learning and adaptation to new technologies, you can leverage SFC programming to create innovative industrial automation and control systems solutions. The XG5000 programming software allows you to troubleshoot with visual queues and aids quickly.
Now that you know SFC programming, click here to learn more about programming in Structured Text (ST). (Video)
Click here to see all of the available information for the XGB PLC from LS Electric.
Download the Start Stop Circuit Sample Program and try it yourself. Let me know how you make out in the comments below.
Watch on YouTube: XGB PLC Sequential Function Chart (SFC) First Program
LS XGB PLC Additional Information:
LS XGB PLC – Series
– FAQ – Frequently Asked Questions
Product Cut Sheet (XEM-DN32H2 Unit Specifications)
LS PLC Technical Specifications
Manuals:
Interactive Guide
LS PLC User Manual
Other Documents:
PLC Installation Guide
Product Brochure
PLC Statement of Direction
Software and Support:
XG5000 / XG-PM PLC Programming Software
XEM PLC Firmware
Quick Start Procedures
XEM Pulse Servo Wiring Diagrams
Example Applications Directory
If you have any questions or need further information, please contact me.
Thank you,
Garry
If you’re like most of my readers, you’re committed to learning about technology. Numbering systems used in PLCs are not challenging to know and understand. We will walk through the numbering systems used in PLCs. This includes Bits, Decimals, Hexadecimal, ASCII, and Floating Points.
To get this free article, subscribe to my free email newsletter.
Use the information to inform other people how numbering systems work. Sign up now.
The ‘Robust Data Logging for Free’ eBook is also available for free download. The link is included when you subscribe to ACC Automation.