The Essentials of Structured PLC

09/01/2001






This sequencer defines a part fixturing control program, which receives a part from a pick and place unit, clamps it in two axes, then passes control to the process (at state 6). The two ladder rungs illustrate corresponding state 2 transition and action rungs. See the on-line tutorial at www.controleng.com for details.

T he essentials of structured PLC Those who have written PLC code for controlling motors and other automation are thinking structured Ladder is an oxymoron-ladder code is inherently unstructured or worse.

Even so, Ladder, as any other software language, can-and should-follow principles of structured programming. These principles include modularity, top-down design, single entry/exit points, and bottom up testing (see also "Software Toolbox Overflows for Control Programmers," in this issue).

Certain essentials can help in developing PLC code that you and others can read and support once the project is signed off. This scheme is called Station Mapped Programming (SMP), and the four steps are described below. For elaboration and details, see the accompanying web-based tutorial at www.controleng.com.

The first step is to divide the project into its subsystems, or stations. Unless a system is so basic (fewer than, say, 16 I/O points), it can be segregated into modules or subtasks. For example, consider a conveyor-fed process involving a pallet fixture, a pick and place station, and a process step once the part is secured. The process step (or one of many) can be a vision system. Once the part is inspected, the pick and place puts it back on the pallet. The conveyor takes it downstream and brings in a new part.

This system may be divided into task areas or stations. Number these sequentially (0 to? 9), beginning with the input stage (conveyor) and continue to the output stage (the vision process). Using 10 stations will take care of most PLC-embedded systems, and the digits 0,9 readily map to each station's memory designation.

Next, design each process using state-machine representation. Taking one station at a time, bring together all available information, such as system specifications, truth tables, servo control protocols, SCADA requirements, customer specifications, etc. Develop a state-machine representation of each station's function(s). Use multiple sequencers when station processing is complex.

Reasons for using state-machine modeling are:

  • Design decisions are made up front, before labor has been spent on coding;

  • Project principals may review the design and make changes before coding;

  • The representation holds a one to one correspondence with the ladder;

  • The project is self-documenting since state diagrams represent the control specification; and

  • With state diagrams, it's easier to explain to those not intimate with the project what will take place.

The actual ladder coding is almost an afterthought since the state diagram is the ladder. Once one sequencer is built in ladder, it's only a matter of changing the state word/bit descriptions to reflect new actions, and coding the state transitions/ actions. Having a sequencer template and station mapped memory; the programmer just does an indexed cut and paste for the next process. Time is spent designing the process, not laboring over complex rung structures. The on-line tutorial illustrates the state-machine sequencer implementation in ladder.

An important advantage to sequencer control is the ease of bottom-up test and debug. First, isolate the utility files, driver files, and common files and test them separately. Then, having confidence in these, enable the larger more complex process files one at a time. Sequencers allow single steps through the code so race conditions and logic errors can be identified methodically, rather than the less predictable (though definitely more exciting): "OK folks, I'm going to put it in RUN mode. Stand back!"

Dadla Ponizil is a San Diego-based electrical engineer. He has designed control software for industries ranging from semiconductor fabs to eyeglass manufacturers.




Comments? E-mail: dponizil@connectnet.com djohnson@cahners.com





The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers. Vote now (if qualified)!
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Maximize ROI with integrated control system approach; Microcontrollers vs. PLCs; Power quality; Accelerate and rewire IIoT; Traits for excellent engineers
HMI effectiveness; Distributed I/O; Engineers' Choice Award finalists; System Integrator advice; Inside Machines
Women in engineering; Engineering Leaders Under 40; PID benefits and drawbacks; Ladder logic; Cloud computing
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. As we know, PLCs aren’t the only option for making decisions in a control loop, but they are likely why you’re here.
This digital report explains how plant engineers and subject matter experts (SME) need support for time series data and its many challenges.
This article collection contains several articles on how advancements in vision system designs, computing power, algorithms, optics, and communications are making machine vision more cost effective than ever before.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Control room technology innovation; Practical approaches to corrosion protection; Pipeline regulator revises quality programs
Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers. Vote now (if qualified)!
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Maximize ROI with integrated control system approach; Microcontrollers vs. PLCs; Power quality; Accelerate and rewire IIoT; Traits for excellent engineers
HMI effectiveness; Distributed I/O; Engineers' Choice Award finalists; System Integrator advice; Inside Machines
Women in engineering; Engineering Leaders Under 40; PID benefits and drawbacks; Ladder logic; Cloud computing
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. As we know, PLCs aren’t the only option for making decisions in a control loop, but they are likely why you’re here.
This digital report explains how plant engineers and subject matter experts (SME) need support for time series data and its many challenges.
This article collection contains several articles on how advancements in vision system designs, computing power, algorithms, optics, and communications are making machine vision more cost effective than ever before.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Control room technology innovation; Practical approaches to corrosion protection; Pipeline regulator revises quality programs
Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
The Engineers' Choice Awards highlight some of the best new control, instrumentation and automation products as chosen by Control Engineering subscribers. Vote now (if qualified)!
The System Integrator Giants program lists the top 100 system integrators among companies listed in CFE Media's Global System Integrator Database.
Each year, a panel of Control Engineering and Plant Engineering editors and industry expert judges select the System Integrator of the Year Award winners in three categories.
This eGuide illustrates solutions, applications and benefits of machine vision systems.
Learn how to increase device reliability in harsh environments and decrease unplanned system downtime.
This eGuide contains a series of articles and videos that considers theoretical and practical; immediate needs and a look into the future.
Maximize ROI with integrated control system approach; Microcontrollers vs. PLCs; Power quality; Accelerate and rewire IIoT; Traits for excellent engineers
HMI effectiveness; Distributed I/O; Engineers' Choice Award finalists; System Integrator advice; Inside Machines
Women in engineering; Engineering Leaders Under 40; PID benefits and drawbacks; Ladder logic; Cloud computing
Programmable logic controllers (PLCs) represent the logic (decision) part of the control loop of sense, decide, and actuate. As we know, PLCs aren’t the only option for making decisions in a control loop, but they are likely why you’re here.
This digital report explains how plant engineers and subject matter experts (SME) need support for time series data and its many challenges.
This article collection contains several articles on how advancements in vision system designs, computing power, algorithms, optics, and communications are making machine vision more cost effective than ever before.

Find and connect with the most suitable service provider for your unique application. Start searching the Global System Integrator Database Now!

Control room technology innovation; Practical approaches to corrosion protection; Pipeline regulator revises quality programs
Cloud, mobility, and remote operations; SCADA and contextual mobility; Custom UPS empowering a secure pipeline
Infrastructure for natural gas expansion; Artificial lift methods; Disruptive technology and fugitive gas emissions
Automation Engineer; Wood Group
System Integrator; Cross Integrated Systems Group
Jose S. Vasquez, Jr.
Fire & Life Safety Engineer; Technip USA Inc.
This course focuses on climate analysis, appropriateness of cooling system selection, and combining cooling systems.
This course will help identify and reveal electrical hazards and identify the solutions to implementing and maintaining a safe work environment.
This course explains how maintaining power and communication systems through emergency power-generation systems is critical.
click me