Perfect PLC program

Sep 11, 2024 Leave a message

A complete PLC program is not just as simple as enabling the system to run, it also requires complete annotation, fine architecture, good scalability, a complete alarm and protection system, and a simulation system before operation.

 

Simplicity


Make the PLC program as simple as possible. Simplicity means using a standardized program framework as much as possible and using simple instructions as much as possible.


To make the program simple, it is necessary to optimize the program structure and simplify the program with flow control instructions in a big way, and to replace single-function instructions with powerful ones and pay attention to the order of instructions in a small way.


Readability


Requirements of the designed program readability should be good. This not only facilitates the program designer to deepen the understanding of the program, to facilitate debugging, but also to facilitate others to read and understand your program, to facilitate user maintenance. If necessary, the program can also be made to promote.


To make the program readable, the designed program should be as clear as possible. Pay attention to hierarchy and implement modularity to the point of designing with object-oriented methods. To use more standard designs.

If you use language programming in special cases, please use ladder programming in most cases for easy reading.


Then the I/O allocation should be regular, easy to memorize and understand. If necessary, also do some annotation work. The use of internal devices should also be regular, do not just use them randomly.


Readability should be noted at the beginning of the program design. This is not easy to do. Because in the process of program debugging, the increase or decrease of instructions, the use of internal device changes, may make the original clearer program, become a bit chaotic. So in the design of the debugging on the increase or decrease to leave some room, and then debugging is completed and then do a bit of organization, so that the design of the program has a higher quality.

 

Program notes, at least there should be the following aspects:

 

A, system comments: the copyright company of the entire program and the use of this set of programs

B, program block comments: the main purpose of this program block and author

C, paragraph comments: the use of this section of code

D, variable comments: the importance of needless to say, including I / O comments, intermediate variable comments

As for confidentiality considerations, I think we should consider the program's encryption algorithm or block encryption, and should not use to reduce the comments of this clever to achieve.
 

Correctness


PLC program must be correct, and should be verified by the actual work, prove that it can work correctly. This is the most fundamental requirement for the PLC program, if this can not be done, the other is no good.


To make the program correct, must be accurate use of instructions, the correct use of internal devices. Accurate use of instructions and accurate understanding of the instructions are linked to the meaning of the instructions and the use of the conditions must be clear. If necessary, you can program some small programs to test some unclear instructions.


For the same instruction, some details of the instruction may be different due to the different batches of PLC from the factory or the different models of PLC series, so you should check the programming manual carefully.

 

It is also important that internal devices are used correctly. If some PLCs have power-down protection, some PLCs do not. It must be done that the power-down protection must be used to protect the device of power-down protection, and vice versa can not be used.


In short, to accurately use the instructions, the correct use of internal devices, so that the program can operate correctly, which is the most fundamental requirement of the PLC program.


As a simple example, the rising and falling edges of Siemens require the use of variables with storage functions as intermediate variables, such as M-points or DB-points, if you use the temp variable of FC, you will have problems.

 

Reliability


Programs should not only be correct, but also reliable. Reliability reflects the stability of the PLC program, which is a basic requirement for PLC programs.


Some PLC programs, under normal operating conditions or legal operation can work correctly, and the emergence of non-normal operating conditions (such as temporary power outage, and then quickly re-energized) or illegal operation (such as a number of buttons out of order, or at the same time, press a number of buttons), the program can not work properly. This kind of program, it is not very reliable, or unstable, is a bad program.


Good PLC program on the emergence of non-normal operating conditions, can be identified, and can make it with the normal conditions of convergence, can make the program to adapt to a variety of situations. Good PLC program can be rejected for illegal operation, and does not leave "traces". Only legal operations are accepted.


Interlocking is a common means of rejecting illegal operations, relay circuits commonly used in this way, PLC can also inherit this method.

 

Ease of Modification


It is important to make the program easy to change, which means that it should be easy to modify.


One of the features of PLCs is that they are convenient and can be flexibly adapted to various situations. The way to do this is by modifying or redesigning the program.


Redesigning the program is used in cases where the usage requirements of the PLC process are changed, and not only is the program reprogrammed, but the I/Os are also reassigned. Most cases do not require reprogramming, and some modifications are sufficient. This requires the program to be easy to change.


Ease of modification is also the flexibility, the requirements as long as very few changes can be made to achieve the purpose of changing parameters or easy to change the action.


Extensibility


Many programs may have been programmed before entering the scene, but to the scene, may also need to add another program, in order to avoid disrupting the structure of the whole system, you need to reserve a certain amount of space in each functional area as a backup.


Hardware to leave enough margin, software in the preparation of manual, automatic, semi-automatic considerations, position left out.


Complete alarm system


PLC systems are often used in industrial environments, each accident will cause large or small losses, in order to do the accident pre-treatment or in the accident will minimize the loss, we must pay attention to the PLC alarm and protection, which will be extracted here as an important part of the system.


Program Simulation


In order to ensure that the commissioning progress on site or to the customer to show, often before entering the scene, to their own programs to carry out fully automated simulation. For this purpose it is necessary to include a simulation section in the program, which is disconnected after normal on-site operation. In order to equip the program with the simulation function, the following tasks need to be done:


(1) Convert the actual PLC I/O points into PLC intermediate variables or data block variables;

(2) Write the simulation program for each device according to the process requirements.


In the process of designing a PLC program, the one that can meet the requirements of the above aspects can be called a good program.

Send Inquiry

whatsapp

Phone

E-mail

Inquiry