PLC Programming Handbooks
Sequential Function Charts for All
Implementing Sequential Function Chart Designs using Ladder Diagram Programming Language for Programmable Logic Controllers
by James McWhinnie
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).
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.
Maintenance of Software
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.
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.
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.
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.
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.
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.
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:
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.
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.
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.).
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.
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.