1. Design requirements that a perfect PLC program must meet
A complete PLC program is not as simple as just making the system run. It also requires complete annotations, sophisticated architecture, good scalability, a complete alarm protection system, and a pre-operation simulation system.
1. Simplicity
Make the PLC program as simple as possible. Simple means using a standardized program framework and simple instructions as much as possible.
To simplify the program, 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. 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.
If language programming is used under special circumstances, in most cases, ladder diagram programming is used for easy reading.
In addition, I/O allocation should be regular to facilitate memory and understanding. If necessary, some annotations should be made. The use of internal components should also be regular and not used casually.
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.
The comments of the program should at least include the following aspects:
A. System Notes: The copyright company of the entire program and the purpose of this program
B. Block comments: the main purpose and author of this block
C. Section comments: the purpose of this code
D. Variable annotation: The importance of this annotation is self-evident, including I/O annotation and intermediate variable annotation
As for confidentiality, I think it should be considered in the encryption algorithm of the program or the encryption of the blocks, rather than being achieved by clever tricks like reducing comments.
3. 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, while others do not. You must use components with power-off protection if necessary, otherwise you cannot use them.
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.
To give a simple example, the rising edge and falling edge of Siemens need to use variables with storage functions as intermediate variables, such as M point or DB point. If the temp variable of FC is used, there will be problems.
4. 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.
5. 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.
6. Scalability
Many programs may have been compiled before entering the site, but when you arrive at the site, you may need to add additional programs. In order to avoid disrupting the structure of the entire system, a certain amount of space needs to be reserved in each functional area as a backup.
Leave enough margin for the hardware, and consider manual, automatic, and semi-automatic functions when writing the software, and leave room for them.
7. Complete alarm system
PLC systems are often used in industrial environments. Every accident will cause losses, big or small. In order to pre-process accidents or minimize losses in accidents, it is necessary to pay attention to the alarm and protection of PLC. Here it is extracted as an important part of the system.
8. Program simulation
In order to ensure the progress of on-site debugging or to demonstrate to customers, it is often necessary to simulate your program fully automatically before entering the site. For this purpose, it is necessary to add a simulation program part to the program, and the simulation program part is disconnected after normal on-site operation. In order to make the program have simulation function, the following work needs to be done:
(1) Convert the actual PLC I/O points into PLC intermediate variables or data block variables;
(2) Write simulation programs for each device according to process requirements.
In the process of designing PLC programs, a program that can meet the above requirements can be called a good program.
2. PLC Program Design Specifications
1. Select the appropriate PLC model and I/O points, and select special function modules when special function requirements are required.
2. Be familiar with the selected PLC programming instructions and compilation software.
3. Plan soft components, including internal relays, holding relays, data registers, timers, counters, etc.
4. Carry out program planning, generally programming in the order of fault extraction, fault handling, manual handling, automatic handling, and output handling. Larger projects or equipment are processed in sections and blocks according to functional units. For example, if there are hoists, shifting, lifting and rotating devices in an automated production line, they should be programmed in sections and blocks according to the above units.
5. A brief segment comment should be added before the program written in sections and blocks to explain the function of this section of the program. If necessary, the corresponding process flow can be noted. The position order of the block or segmented program in the overall program should basically be arranged in the order of the process flow to facilitate the readability of the program.
6. Before designing the program, the equipment should be abstracted, and common factors such as stop, emergency stop, overload, over limit, timeout, safety light curtain, touch stop, door switch, etc. should be extracted and placed in the start loop or start the main control and interlocking loop as the premise of the entire program structure. On this basis, the program is divided into two major functional areas: automatic and manual.
7. Extract the common factors of the manual function area of the program structure, such as manual factors, factors endangering the personal safety of equipment, etc., and put them in the manual main control and interlocking loop to protect, shield and alarm the manual control.
8. Extract the common factors of the automatic function area of the program structure, such as automatic, over-limit, timeout and other factors, and put them in the automatic main control and interlocking loop to protect, shield and alarm the equipment under automatic control. A general principle is to strictly limit the entry of equipment and loosely limit the exit of equipment under the premise of ensuring safety.
9. When designing the program, a total reset function should be designed to facilitate users to restore the normal operation of the equipment as soon as possible in the event of a device failure. The total reset should fully consider the safety of equipment and personnel during the reset process.
Previous article:Analysis of the working principle of the forward and reverse rotation of the motor
Next article:Three control modes and wiring points of servo amplifier
- 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
- Flash (STM32) "Big Explanation"
- 【Live FAQ】Develop AI intelligent robots based on TI's newly released Robotics SDK
- ISA bus interface.pdf
- MCU Programming Ideas - State Machine
- Please explain the assembly program of digital voltmeter
- DSP structural characteristics and computing performance
- Touch screen interface definition
- Overview of 5G System Standard Development
- Could you please tell me how to find the maximum output duty cycle of a DCDC buck IC from its technical manual?
- How to change UDP point-to-point communication to UDP broadcast communication