The best evaluation standard for PLC programs is practice. See whether the program can achieve the expected purpose. But this is not enough. Because there are good and bad programs that can achieve the purpose. What kind of program is considered a good program? Generally speaking, there are the following aspects:
1. Brevity
Making the PLC program as short as possible is also a goal that should be pursued.
Short programs save user storage area; in most cases, they also save execution time, increase the response speed to input, and improve the readability of the program.
Whether a program is short or not can generally be measured by the number of instructions used by the program. The fewer instructions used, the shorter the program will naturally be.
To make the program shorter, from a broad perspective, we need to optimize the program structure and use flow control instructions to simplify the program. From a detailed perspective, we also need to replace single-function instructions with more powerful instructions and pay attention to the order in which the instructions are arranged.
2. Time saving
A short program can save program running time, but short and time saving are not exactly the same thing. Because the program running time is related to the number of instructions in the program, but also to the instructions used. Different PLC instructions have different execution times. Moreover, some instructions have different execution times when the logic condition is ON and when it is OFF. In addition, due to the use of process control instructions, not all instructions in the program need to be executed. Therefore, the calculation of the program running time is more complicated. 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 the PLC.
The key to saving time is to use the process control instructions well. According to the situation, determine some instructions that must be executed as necessary parts, and the rest can be carried out according to the program, executed selectively, or some time-sharing work design can be made to avoid the maximum time being too long.
3. Readability
The designed program should be readable. This will not only help the programmer to deepen his understanding of the program and debug it, but also make it easier for others to understand your program and for users to maintain it. If necessary, the program can also be promoted.
To make the program readable, the program should be designed as clearly as possible. Pay attention to the hierarchy, implement modularization, and use object-oriented methods for design. Use more standard designs.
Readability should be taken into consideration at the beginning of program design. This is not easy to achieve completely. Because during the process of program debugging, the increase or decrease of instructions and the change of the use of internal devices may make the original clear program become a little messy. Therefore, when designing, leave some room for debugging increase or decrease, and then do some sorting after debugging is completed, so that the designed program has higher quality.
4. Correctness
The PLC program must be correct and must be verified by actual work to prove that it can work correctly. This is the most fundamental requirement for the PLC program. If this cannot be achieved, no matter how good the other programs are, they will be useless.
To make the program correct, you must use the instructions accurately and use the internal devices correctly. Accurate use of instructions is related to accurate understanding of instructions, so the meaning of instructions and usage conditions must be made clear. If necessary, you can write some small programs to test some unclear instructions.
For the same instruction, some instruction details may be different due to different PLC factory batches or different PLC series models. Please refer to the programming manual carefully.
It is also important to use the internal components correctly. For example, some PLCs have power-off protection, (information source: http://www.dqjsw.com.cn) some PLCs do not. It is important to use the components that have power-off protection, otherwise it cannot be used.
In short, it is necessary to use instructions accurately and use internal devices correctly so that the compiled program can be executed correctly. This is the most fundamental requirement for PLC programs.
5. Reliability
The program must not only be correct, but also reliable. Reliability reflects the stability of the PLC program, which is also the basic requirement for the PLC program.
Some PLC programs can work correctly under normal working conditions or legal operations, but they cannot work properly when abnormal working conditions (such as temporary power failure and quick power-on) or illegal operations (such as pressing some buttons out of sequence or pressing several buttons at the same time) occur. Such programs are not very reliable, or unstable, and are bad programs.
A good PLC program can identify abnormal working conditions and link them with normal conditions, so that the program can adapt to a variety of situations. A good PLC program can reject illegal operations without leaving any "traces". Only legal operations are accepted.
Interlocking is a commonly used means to prevent illegal operations. Relay circuits often use this method, and PLCs can also inherit this method.
6. Easy to modify
To make the program easy to change, it should be easy to modify.
One of the characteristics of PLC is its convenience and flexibility in adapting to various situations by modifying or redesigning the program.
Redesigning the program is used to change the use requirements of the PLC process. Not only the program needs to be rewritten, but the I/O needs to be reallocated. In most cases, rewriting the program is not necessary, and some modifications are sufficient. This requires the program to be easy to modify.
Easy to modify means flexibility, which requires only a few changes to achieve the purpose of changing parameters or modifying actions.
In the process of designing PLC programs, a program that can meet the above 6 requirements can be called a good program.
Previous article:Method of using PLC to judge the fault of switch signal
Next article:Basic Design Steps of PLC Control System
Recommended ReadingLatest update time:2024-11-16 11:43
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications