Control Engineering Online Update for March 10, 2006

03/10/2006


Control Engineering Online Update - Technology

March 10, 2006

Highlights


Sponsored by Phoenix Contact


PLC programming tools have evolved greatly over the last 20 years. However, a great majority of PLC implementations have not. The reason: management is constantly faced with the dilemma that only certain technicians know how the program was written and are therefore the only individuals qualified to troubleshoot and/or modify it. Grafcet, also known as sequential function chart programming (SCF), offers an IEC 61131-1-compliant approach.





CLIPLINE Complete from Phoenix Contact
Four connection technologies work together via our patented dual bridge system, which accepts the same push-in jumpers and accessories. Screw clamp, spring-cage, auto-spring and insulation displacement connectors provide the right connection technology for any application. Visit phoenixcon.com/cliplinecomplete for more information on this innovative technology. www.phoenixcon.com/cliplinecomplete


Structured PLC Programming using Grafcet

Structured programming methodologies for PLCs have been present for decades and can even be implemented on legacy controllers. Most of these methodologies incorporate a graphical flowchart of the control sequence, which translates directly into controller logic. These flowcharts can be read, written and modified by non-programmers with the assurance that what has been conveyed graphically will be implemented verbatim in logic. Direct benefits to controller owners include:

• Shorter logic development cycle
• Accelerated testing and commissioning tasks
• Reduction of downtime due to enhanced diagnostics
• Easier offline simulation and factory acceptance testing

One of these programming methodologies is known as Grafcet—a graphical programming methodology founded in 1977 and further defined in IEC 60848 and IEC 61131-3 as sequential function chart programming (SFC). The term is a French acronym: Graphe Fonctionnel de Commande Etape-Transition, which means Functional Graph of a Step-Transition Command. Figure 1 below shows the base elements of a simple Grafcet.



The sequence begins at Step 0 where Action #1 is performed. The sequence then waits until Condition #1 is met before advancing to Step 1 where Action #2 is performed. The sequence stays on Step 1 until Condition #2 is met at which point it advances to Step 2. Once on Step 2, Action #3 is performed for one program scan and then the sequence returns to Step 0 where the cycle repeats.

There are two popular implementations of this structure in PLCs. Bit-based, or latch/unlatch style, and file-based or memory-table style.

Also sponsored by Moxa


Visit www.moxa.com to learn about Moxa’s 2-8 port Plug-N-Play Embedded Computers for Manufacturing Automation, Power/Utility, Transportation, POS/ATM, Environmental Monitoring, and more. Features: Linux and Windows support, Robust Fanless Design, LCM Display and keypad for HMI, Dual 10/100 Mbps Ethernet, and Intel Xscale processor. Call to learn more 888-MOXA-USA.

 


Bit-based Grafcet

The simplest implementation of the Grafcet flowchart can be done with basic latch-unlatch ladder logic. In this implementation, a subroutine is assigned to each Grafcet. Step transition logic is resolved at the top of the subroutine and step output or action logic is resolved immediately following.

To ensure that at least one program scan occurs between each step, both a transition word and a step word are employed for each Grafcet. Bits in the step word initiate actions whereas bits in the transition word initiate step transition. In this way, a step with no conditions will still insure that actions have a chance to execute. Figure 2 illustrates the required logic.

Figure 2


Resolving the transitional logic is a direct translation from the Grafcet. For our example from Figure 1, the transitional logic in Figure 3 could be used:

Figure 3


Typical step action logic to resolve the Grafcet from Figure 1 might appear as shown in Figure 4.

Figure 4


Advantages of this style of programming are:
• Easy to understand by electricians
• Can be implemented on virtually any PLC
• Rung/network number can directly relate to step number
• Forcing a step simply requires setting the step bit
• Conditions to pass step can be easily seen on one rung/network of logic
• Parallel branch execution is possible within same Grafcet
• Relatively low programming overhead required

Disadvantages include:
• Sequencing modifications require ladder-logic changes
• The larger the Grafcet, the more logic that is required
• Automatic step manipulation and recovery can be challenging

File-based Grafcet

Similar to the canned drum sequencer instructions found in many PLC controllers, file-based Grafcet attempts to implement this with standard logic while permitting flexibility not available in these instructions. Input and output conditions are stored in preset files. A step counter is used as an index into these files.

As a minimum, the following data words will be required:

STEP_COUNTER - holds the step number
INPUT_WORD - mapped to all required inputs
OUTPUT_WORD - activates required outputs
INPUT_XOR_RESULT - holds result of the input XOR

The following data files will also be required:

#INPUT_MASKS - holds required inputs for each step
#INPUT_STATES - holds required states for each input
#OUTPUT_PRESETS - holds required outputs for each step

Once the format is in place, step presets for virtually any aspect of an automatic sequence can be defined. Logic is minimal to incorporate other features. To implement our example from Figure 1, the mapping shown in Figure 5 could be used. The Grafcet could then be modified to match Figure 6.

Figure 5

 

Figure 6


Mapping inputs

Sequence input mapping would appear as shown in Figure 7:

Figure 7


Grafcet presets

The status of the real inputs is compared against the conditions, which are expected to pass step (presets). For this article, both an input file (mask bits) and a state file (is the input ON or OFF) are used. By turning on a bit in the Mask file, the sequence is being told that the user expects to look at that input on that step in order to pass step. By setting the associated state bit in the State file, it is indicated that the user expects to see that input turn ON in order to pass step. Similarly, by setting a bit in the Output file, it is indicated that the associated output condition should be activated on that step. Absence of a set bit for an output on a step will force the output off on that step.

Table 1 shows the presets required to implement the Grafcet defined in Figure 6:

#INPUT_MASKS

Bit #:

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

Word 0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

Word 1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

Word 2

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

1

Word 3

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

1

#INPUT_STATES

Word 0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

Word 1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

Word 2

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

1

Word 3

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

#OUTPUT_PRESETS

Word 0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

Word 1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

1

1

Word 2

0

0

0

0

0

0

0

0

0

0

0

0

0

1

0

0

Word 3

0

1

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Table 1


Step evaluation

The logic required to evaluate real inputs against the preset files and to advance a step if they are met is key to the File-based Grafcet architecture. Figure 8 demonstrates how this is implemented on a PLC:

Figure 8


Passing step

Once the XOR result evaluates to zero, the Grafcet can then pass step by incrementing the step counter as shown in Figure 9.

Figure 9


Setting outputs

Setting the output word from the preset stored for the current step is shown in Figure 10.

Figure 10


Real outputs are then set by the images of the output word as shown in Figure 11.

Figure 11


Advantages of File-based Grafcet are:

• One set of logic executes all steps
• Preset files can be used for any aspect of a sequence including:



• Step changes can be made directly in the data table
• Steps can be advanced and repeated with ease
• Once the stepping logic is proven, it will work for any number of steps
• Can be implemented on any PLC that supports indirect addressing, AND, OR and XOR functions
• Real I/O changes are easily accommodated in the mapping logic
• Diagnostic and preset conditions are easily visualized

Disadvantages include:
• Requires more overhead than Bit-based Grafcet
• Electricians may require additional training to understand the indirect addressing model

Why Grafcet?

Through utilization of IEC 61131-1 compliant software and techniques such as Grafcet, programs can be written which will be easier to troubleshoot, maintain and re-deploy for different applications. The Grafcet techniques demonstrated in this article have been implemented on a wide assortment of PLCs including those from Rockwell Automation, Siemens, Omron, Modicon, Idec, Mitsubishi and Westinghouse. The Grafcet chart is easy to understand and can be interpreted and even revised by non-programmers ensuring that the machine cycle will function as anticipated by all stakeholders the first time.

Online resources

Grafcet home page: www.lurpa.ens-cachan.fr/grafcet.html

IEC 60848 Standard: tc3.iec.ch/txt/147.htm

Petri Nets: lamspeople.epfl.ch/decotignie/G7RdPgb.pdf

SFC defined in IEC 1131-1: www.61131.com/sfc.htm


By Mike Voll, controls manager, Manufacturing/Industrial, Stantec Consulting Ltd.





No comments
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by...
Each year, a panel of Control Engineering editors and industry expert judges select the System Integrator of the Year Award winners.
Control Engineering Leaders Under 40 identifies and gives recognition to young engineers who...
Learn more about methods used to ensure that the integration between the safety system and the process control...
Adding industrial toughness and reliability to Ethernet eGuide
Technological advances like multiple-in-multiple-out (MIMO) transmitting and receiving
Big plans for small nuclear reactors: Simpler, safer control designs; Smarter manufacturing; Industrial cloud; Mobile HMI; Controls convergence
Virtualization advice: 4 ways splitting servers can help manufacturing; Efficient motion controls; Fill the brain drain; Learn from the HART Plant of the Year
Two sides to process safety: Combining human and technical factors in your program; Preparing HMI graphics for migrations; Mechatronics and safety; Engineers' Choice Awards
The Ask Control Engineering blog covers all aspects of automation, including motors, drives, sensors, motion control, machine control, and embedded systems.
Join this ongoing discussion of machine guarding topics, including solutions assessments, regulatory compliance, gap analysis...
News and comments from Control Engineering process industries editor, Peter Welander.
IMS Research, recently acquired by IHS Inc., is a leading independent supplier of market research and consultancy to the global electronics industry.
This is a blog from the trenches – written by engineers who are implementing and upgrading control systems every day across every industry.
Anthony Baker is a fictitious aggregation of experts from Callisto Integration, providing manufacturing consulting and systems integration.
Integrator Guide

Integrator Guide

Search the online Automation Integrator Guide
 

Create New Listing

Visit the System Integrators page to view past winners of Control Engineering's System Integrator of the Year Award and learn how to enter the competition. You will also find more information on system integrators and Control System Integrators Association.

Case Study Database

Case Study Database

Get more exposure for your case study by uploading it to the Control Engineering case study database, where end-users can identify relevant solutions and explore what the experts are doing to effectively implement a variety of technology and productivity related projects.

These case studies provide examples of how knowledgeable solution providers have used technology, processes and people to create effective and successful implementations in real-world situations. Case studies can be completed by filling out a simple online form where you can outline the project title, abstract, and full story in 1500 words or less; upload photos, videos and a logo.

Click here to visit the Case Study Database and upload your case study.