What design requirements must the PLC program meet?

Publisher:平静宁静Latest update time:2024-03-08 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

81c27df4-6a99-11ee-939d-92fbcf53809c.jpg

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.

[1] [2]
Reference address:What design requirements must the PLC program meet?

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

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号