6 Standards for Good PLC Programs

6 Standards for Good PLC ProgramsWeChat Search6 Standards for Good PLC ProgramsJicheng Training

Now, let’s invite our professional technical engineers to introduce what constitutes a good PLC program. What characteristics does a good PLC program have? Generally, they include the following aspects:

6 Standards for Good PLC Programs

1. Correctness (Low Debugging Cost)

The PLC program must work correctly and meet the actual control process requirements. This is fundamental to the PLC program; if this cannot be achieved, everything else is meaningless.

6 Standards for Good PLC Programs

2. Reliability (Low Maintenance Cost)

It must not only be correct but also reliable. It should not have frequent issues.

Reliability reflects the long-term stability of the PLC program, which is also a basic requirement. Some PLC programs can work correctly under normal working conditions or legitimate operations, but fail under abnormal conditions (such as temporary power outages followed by quick reconnection) or illegal operations (such as pressing buttons out of order or pressing several buttons simultaneously). Such programs are considered unreliable or unstable, hence not good programs. A good PLC program can recognize the occurrence of abnormal working conditions and connect them with normal conditions, allowing the program to adapt to various situations. A good PLC program rejects illegal operations without leaving any “traces.” It only accepts legitimate operations, which is preventive and robust programming. Interlocking is a common method to reject illegal operations, often used in relay circuits, and can also be inherited by PLC and system integrators.

6 Standards for Good PLC Programs

3. Readability (Low Learning Cost)

The designed program should have good readability, making it easy to understand, debug, and for others to read and use your program, facilitating maintenance; if necessary, the program can also serve as a standard template for promotion.

To ensure good readability:

1) The design context of the program should be as clear as possible, with a structured hierarchy;

2) Function layers should be modularized or designed using object-oriented methods;

3) Use some standard designs and general-purpose designs;

4) Use symbolic names for variable layers as much as possible;

5) Set parameter values immediately before using them (i.e., set and use);

6) I/O address allocation should follow a regular pattern for easier memory and understanding;

7) The use of internal devices should also follow a pattern, ensuring that addresses for the same function maintain a certain discontinuous “gap” (for example, if the address for function x is assigned to k, then the address for the next function should not start from k+1 but from k+n) to prevent functional changes;

8) If necessary, make some comments; readability should be considered from the beginning of program design. This is not easy to achieve, as the addition and reduction of instructions and changes in the use of internal devices during the debugging process may make the originally clear program somewhat chaotic. Therefore, during the design phase, leave some room for adjustments during debugging, and then tidy up after debugging to ensure the program has higher quality.

6 Standards for Good PLC Programs6 Standards for Good PLC Programs

4. Conciseness (Low Storage Cost)

Making the PLC program as concise as possible is also a goal to pursue.

A concise program can save the user’s storage space; in most cases, it can also save execution time and improve the response speed to inputs, as well as enhance the program’s readability. The conciseness of a program is generally measured by the number of instructions used; fewer instructions naturally result in a more concise program.

From a broader perspective, pay attention to the program structure, extract commonalities from code segments that achieve the same function, and use subroutines or interrupts to reduce code volume; simplify the program using flow control instructions to reduce workload at certain points in time, avoiding unnecessary tasks and minimizing those that can be reduced;

From a narrower perspective, use strong instructions with multi-processing capabilities to replace weak single-processing instructions (using higher-level data instead of lower-level data or data structures, such as using byte, word, double-word operands instead of bit operands, fault words, status words, control words, communication words, etc.; using indirect addressing instead of continuous address storage units for the same operation; using block transfer instructions instead of multiple byte, word, double-word transfer instructions, which can be summarized as “batch processing” operations) and pay attention to the arrangement order of instructions while ensuring program readability.

6 Standards for Good PLC Programs

5. Time Efficiency (Low Operating Cost)

A concise program may save execution time, but conciseness and time efficiency are not entirely the same.

Execution time is related not only to the number of instructions in the program but also to the types of instructions used, which is related to the program algorithm. Different PLC algorithms have different execution times. Furthermore, some instructions execute differently depending on whether the logical condition is ON or OFF. Additionally, due to the use of flow control instructions, not all instructions need to be executed in the program.

Therefore, calculating the execution time of a program is quite complex. However, it is necessary to require that the average time is short, and the maximum time is not too long. This can improve the response speed of Beijing Tiantuo Sifang Technology Co., Ltd., a core distributor (first-level agent) and system integrator of Siemens Industrial Automation and Drive Group PLC. The key to saving time is to effectively use flow control instructions. Determine some necessary instructions to execute based on the situation, keeping them as essential parts, while the rest can be executed selectively as per the program or designed for time-sharing work to avoid excessively long maximum times.

6 Standards for Good PLC Programs

6. Modifiability (Low Change Cost)

The program should be easy to modify.

One of the characteristics of PLC is convenience, allowing flexible adaptation to various situations. This is achieved through modifying or redesigning the program. Redesigning the program is necessary to change the PLC process requirements, which entails reprogramming and I/O reallocation. In most cases, reprogramming is not needed, and minor modifications suffice. This requires the program to be modifiable and easy to change. Modifiability means elasticity, requiring only minimal changes to achieve the purpose of changing parameters or actions.

1) Parameter settings should preferably use indirect assignment methods, and constant parameter values should use symbolic names to convey meaning easily;

2) Control should preferably use intermediate storage (such as M, W) as a medium or intermediary layer to isolate I/O from direct logical coupling, facilitating logical changes;

3) Implement functional plug-in modules wherever possible, allowing users to “freely configure” to achieve immediate addition and use. In the process of designing PLC programs, it is essential to balance and consider the above requirements simultaneously, avoiding neglecting one aspect for another, leading to inefficiency.

Disclaimer: This article is reproduced from the internet, and the copyright belongs to the original author. If there are any copyright issues, please contact us for removal. Thank you!

Get Free

Today, the editor has compiled Siemens case studies and learning materials, Mitsubishi case studies and learning materials, popular simulation software, PLC training materials and other essential materials for electrical engineers. Scan the QR code below to receive them!

HISTORY/Previous Recommendations

2023 Complete Question Bank for Beginner Electricians (Including Answers)

Three must-have tools for electrical workers, easily accessible with WeChat!

Collect The “Path” of a Ten-Year Veteran Electrician, Secrets to Earning Over Ten Thousand a Month!

Five Major Electrical Drawing Software (CAD, Eplan, CADe_simu…), which one do you pick?

Latest Electrical CAD Drawing Software with Detailed Installation Tutorial!

Latest Electrical Drawing Software EPLAN with Detailed Installation Tutorial!

Common Issues for Beginners Using S7-200 SMART Programming Software (Includes Download Links)

Comprehensive Electrical Calculation EXCEL Sheets, Automatically Generated! No Need for Electrical Calculations!

Bluetooth Headsets, Books for Electricians/PLC Beginners Available for Free? Come and Claim Your Electrical Gifts!

Basic Skills in PLC Programming: Ladder Diagrams and Control Circuits (Includes 1164 Practical Mitsubishi PLC Cases)

If You Still Can’t Understand Electrical Diagrams? Basics of Electrical Diagram Recognition, Simulation Software Available, Quickly Get Started with Theory and Practice!

12 Free Electrical Video Courses, 10GB Software/E-books, 30 Days of Free Electrical Live Classes!

Don’t forget to like + see!6 Standards for Good PLC Programs6 Standards for Good PLC Programs Click “Read Original” to Learn PLC/Electrician Courses for Free!

Leave a Comment