How to write a PLC program in structure?


Program structure of a PLC program can be understood from the flowchart. But here are some consideration to made to write a program.

Program Structure:

One should try to get a structured program with definite sections dealing with specific areas of operation. By adopting this approach, the programs developed are reliable and can be easily understood. These sections can be broadly categorised as follow:

  • Operating Modes
  • Process operation / Sequence Logic
  • Signal Outputs
  • Status / Indicator output

Operating Modes:

It is likely that all automated equipment has an initial or start position. This is the position that all its actuators will adopt before the operation of the equipment. Therefore, to indicate and initialize a basic position for the equipment, the initial position of each actuator can be combined logically and programmed as a step in a sequential process.

Enabling / Reset conditions:

Most industrial processes and equipment have the manual start and stop controls incorporated into the programmable logic controller program. By means of interlocking, a proper and safe start-up and stopping of the process or equipment is ensured. Reset control is also included in the case of the system hang. It is normally used to reset the equipment to its basic position upon activation.

Process operation / sequence:

This is the main section of the program that determines the correct operation of the operation. This is achieved through the use of combinational and sequential networks. The resulting outputs do not normally drive the actuators directly but are used to operate intermediate marker relays.

Signal output:

The output signals to process the actuators are formed by interconnecting the resulting operation sequence output with any enabling condition that exists in the above mentioned operating modes.

Status/indicator outputs:

Process status is often displayed using indicator lamps or alarms, etc. Such elements are programmed in this section of the software.

Combinational Logic Control Design:

Boolean algebra can be used as a tool to help in the design of logical networks. The circuit or original logic program is first converted into a Boolean equation. Based on the rules that govern the Boolean algebra, the equation is simplified and a more economical or elegant solution is obtained, in terms of logical functions.