Method for updating PLC program without disturbance

The PLC host computer software and firmware jointly generate memory tree and memory instructions to realize disturbance-free update of the PLC program, solving the problems of shutdown and IO disturbance during PLC program update, ensuring the integrity of variable data and the continuity of production.

CN119247868APending Publication Date: 2025-01-03ZHEJIANG YUANCHUANG BUILDING INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411357031.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

When PLC program is updated, the existing technology requires downtime to download, resulting in production interruptions and IO disturbances, and there are problems such as loss of variable data and security risks.

Method used

Through the PLC host computer software and the PLC controller firmware work together, a memory tree is generated and compared, and memory instructions are generated to realize program updates without downtime, ensuring that variable data is not lost, and the memory allocator and memory instruction execution strategies are adopted to avoid IO disturbances. .

Benefits of technology

It realizes disturbance-free update of PLC programs, avoids production interruptions and variable data loss, improves safety and production reliability, and supports non-stop updates in food processing, chemical and other industries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119247868A_ABST
    Figure CN119247868A_ABST
Patent Text Reader

Abstract

The invention discloses a method for updating a PLC program without disturbance. Efficient data transmission and monitoring between RCP equipment and an upper computer are achieved through an RCP, efficient low-delay communication is achieved based on a UDP, routing information is added through a packaging layer, dynamic routing decisions are supported, and network adaptability is improved. Session table management ensures data integrity and reliability, and supports session recovery and data retransmission; the method has the remarkable advantages in the aspects of data processing efficiency, monitoring comprehensiveness, prediction intelligence, alarm accuracy and user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of Internet of Things, and in particular to a method for updating a PLC program without disturbance. Background Art

[0002] Programmable logic controller (PLC) is widely used in various automation control fields due to its reliability, scalability and stability. PLC was introduced into the field of industrial automation in the 1960s. As a programmable controller based on digital technology, PLC can realize flexible control logic, fast response and reliability, which has brought revolutionary progress to industrial automation. Since then, PLC has gradually replaced traditional hard-wired control and fixed-function electrical controllers and become the core control equipment of modern industrial automation. PLC has technical characteristics such as programmability, modular design and reliability. Manufacturers involved in automation will provide PLC products.

[0003] In automation control, there are a wide range of related functions such as sequential control, logical chain actions, pulse switches, alarms, etc., and these actions require a large number of variables to save the current state so as to enter the next step in the next program cycle or when the conditions are met. However, when the PLC program needs to be modified or updated to fix errors, implement new functions, adapt to process changes, etc., it is often necessary to re-download the program.

[0004] After the conventional program update method, the variable data is cleared because the memory is cleared. Therefore, in the production process, such as food processing and chemical industry, the production line needs to be shut down before downloading, resulting in production interruption. If the PLC program is updated directly in production, it will cause IO disturbance, resulting in uncontrollable dangers and risks to safe production. Summary of the invention

[0005] The object of the present invention is to provide a method for updating a PLC program without disturbance. The present invention has the advantage of being able to update without stopping the machine.

[0006] The technical solution of the present invention is a method for updating a PLC program without disturbance, including PLC host computer software and PLC controller firmware. The PLC program update process is as follows:

[0007] S1, PLC program update starts;

[0008] S2, the PLC host configuration software uploads the engineering configuration running in the PLC, parses and opens it;

[0009] S3, the PLC host configuration software generates a memory tree for the current project, and then performs the same operation on the program configuration currently running in the PLC to generate a memory tree; the two memory trees are compared and corresponding memory instructions are generated to perform corresponding operations;

[0010] S4, save all generated memory instructions to the download content, then the PLC host computer software initiates a program update instruction, suspends the next PLC program scheduling, and starts to download the updated program to the controller in sequence;

[0011] S5. The downloaded PLC program sequentially executes the memory instructions in the downloaded content, and sequentially completes the variable operations according to the parameters of the memory instructions;

[0012] S6. PLC update completed.

[0013] In the aforementioned method for updating the PLC program without disturbance, the PLC host computer software is used to program, download, run and configure the PLC;

[0014] The PLC controller firmware is used to parse the application downloaded by the PLC host computer software, and perform operations including running, stopping, and restarting according to the execution of the PLC host computer configuration software.

[0015] In the aforementioned method for updating the PLC program without disturbance, the PLC controller firmware cooperates with the PLC host computer software, and specifies part of the memory on the PLC heap in the link file of the PLC host computer configuration software as the variable area for PLC programming;

[0016] The PLC host computer software implements a memory allocator when performing programming operations, and finds a free area in the remaining allocatable memory that can store the current variable size, and points the variable to the address; the memory allocator provides a unique identifier for each variable.

[0017] In the aforementioned method for updating the PLC program without disturbance, the specific content of S3 is as follows:

[0018] The PLC host configuration software generates a memory tree for the current project, and then performs the same operation on the program configuration running in the PLC to generate a memory tree;

[0019] The memory tree is composed of the address and length of each variable;

[0020] By expanding a variable in tree form, all variables are grouped together to generate a memory tree for the entire project.

[0021] In the aforementioned method for updating the PLC program without disturbance, the memory tree comparison described in S3 is specifically as follows:

[0022] During the memory tree comparison, corresponding memory instructions are generated to move memory data. Different moving strategies are required for different situations.

[0023] If the variable type is changed and is not considered the same variable, a memory instruction MemoryAssign is generated. The content of this instruction requires the PLC firmware to write the specified data to the specified memory address, thus completing the variable initialization action.

[0024] For the internal transposition of the structure, first allocate a free space C on the controller to store it, and then generate MemorySwap instructions in sequence to copy A to C, B to A, and C to A, completing the exchange of the two values;

[0025] For variable deletion, no processing is required because no variable references the address.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] The present invention does not affect the original logic and can flexibly adjust the update strategy according to the actual situation. For example, it is stipulated that certain variables do not retain their values ​​even if the program is updated, which has extremely high flexibility.

[0028] Since the memory instructions are executed by the updated PLC program, the PLC firmware does not need to care about the new memory instructions that may appear in the new strategy. It only needs to hand over the downloaded content to the updated PLC program. The updated PLC program is generated by the PLC host computer. Therefore, the changes to the memory instructions do not require the participation of the PLC firmware at all. Only the host computer program can be modified to be compatible.

[0029] Since the host computer can merge and optimize the instructions after generating them, the speed at which the firmware executes the memory instructions can be optimized to be very fast, so that the controller can complete the update within the operation cycle without losing the variable data, thus achieving disturbance-free update of the PLC program.

[0030] The PLC download method based on this method avoids the shortcomings of the old method, such as IO disturbance and variable loss. It has the advantages of non-stop updates and high reliability in food processing, chemical and other assembly lines.

[0031] In summary, the present invention has the advantage of being able to implement updates without stopping the machine.

[0032] Instruction Manual

[0033] Figure 1 It is a memory allocation diagram;

[0034] Figure 2 This is a schematic diagram of the memory tree generation structure. DETAILED DESCRIPTION

[0035] The present invention is further described below in conjunction with the accompanying drawings and embodiments, but they are not intended to limit the present invention.

[0036] Embodiment: A method for updating a PLC program without disturbance includes PLC host computer software and PLC controller firmware. The PLC program update process is as follows:

[0037] S1, PLC program update starts;

[0038] S2, the PLC host configuration software uploads the engineering configuration running in the PLC, parses and opens it;

[0039] S3, the PLC host configuration software generates a memory tree for the current project, and then performs the same operation on the program configuration currently running in the PLC to generate a memory tree; the two memory trees are compared and corresponding memory instructions are generated to perform corresponding operations;

[0040] S4, save all generated memory instructions to the download content, then the PLC host computer software initiates a program update instruction, suspends the next PLC program scheduling, and starts to download the updated program to the controller in sequence;

[0041] S5. The downloaded PLC program sequentially executes the memory instructions in the downloaded content, and sequentially completes the variable operations according to the parameters of the memory instructions;

[0042] S6. PLC update completed.

[0043] The PLC host computer software is used to program, download, run and configure the PLC;

[0044] The PLC controller firmware is used to parse the application downloaded by the PLC host computer software, and perform operations including running, stopping, and restarting according to the execution of the PLC host computer configuration software.

[0045] The PLC controller firmware cooperates with the PLC host computer software to specify part of the memory on the PLC heap in the link file of the PLC host computer configuration software as a variable area for PLC programming;

[0046] The PLC host computer software implements a memory allocator when performing programming operations, and finds a free area in the remaining allocatable memory that can store the current variable size, and points the variable to the address; the memory allocator provides a unique identifier for each variable.

[0047] The specific contents of S3 are as follows:

[0048] The PLC host configuration software generates a memory tree for the current project, and then performs the same operation on the program configuration running in the PLC to generate a memory tree;

[0049] The memory tree is composed of the address and length of each variable;

[0050] If it is a structure type, it should also contain sub-elements, and the same applies to nested types;

[0051] By expanding a variable in tree form, all variables are grouped together to generate a memory tree for the entire project.

[0052] The memory tree comparison described in S3 is as follows:

[0053] During the memory tree comparison, corresponding memory instructions are generated to move memory data. Different moving strategies are required for different situations.

[0054] If the variable type is changed and is not considered the same variable, a memory instruction MemoryAssign is generated. The content of this instruction requires the PLC firmware to write the specified data to the specified memory address, thus completing the variable initialization action.

[0055] For the internal transposition of the structure (A to B, B to A), first allocate a free space C on the controller to store it, and then generate MemorySwap instructions in sequence to copy A to C, B to A, and C to A, completing the exchange of the two values;

[0056] For variable deletion, no processing is required because no variable references the address.

[0057] In the present invention, a variable memory area is allocated for a PLC program in a PLC controller, a memory allocator is implemented in a PLC host computer, a variable memory tree is written, a memory tree comparison algorithm is implemented, and a memory instruction is generated. The PLC controller only needs to implement the memory instruction, and after the program is updated, the memory movement can be executed according to the update instruction, so that the PLC program can be updated without disturbance.

[0058] When implementing a PLC controller, a fixed stack address should be allocated for the PLC variable area in the firmware to prevent the variables on the stack from being lost after a program update.

[0059] When the host computer software is written, a memory allocator needs to be implemented to uniformly manage the internal variables of the PLC. A unique identifier and a unique address are assigned to the variable, and the unique address corresponds to the offset of the heap address of the variable area of ​​the PLC firmware.

[0060] When the PLC host computer initiates a PLC program update, the project in the controller is uploaded. Then, according to the variable unique identifier, type, and address, the corresponding memory tree structure is generated for the current project. Then, the memory tree structure is also generated for the project in the controller, and then the memory tree comparison algorithm is used to calculate the addresses of the modified and newly added variables.

[0061] According to the modified part of the PLC program, the corresponding memory instructions are generated, and then the PLC application is updated. At this time, since the PLC variables are stored in the PLC variable area, they will not be affected by the update of the PLC application. However, the content of the PLC variable area is still the same as the last PLC application. For the newly added variables, deleted variables, and moved variables, the data in the variable memory area is still wrong.

[0062] After the PLC program is downloaded, the data in the PLC variable area is moved according to the memory instruction. After the move is completed, the data in the memory area pointed to by the variable is correct, and the update process ends.

[0063] The non-disturbance update of the present invention will not lose any data after the download is completed. Therefore, after the PLC program is updated, it can be quickly restored without downtime to avoid interruption. At the same time, the effect of the program after downloading can be observed in real time, which is convenient for locating problems and solving them. For some infrastructure, non-disturbance update can also ensure upgrades and maintenance under continuous operation, improving safety.

[0064] In such an industry context, the present invention innovates the update process of the PLC host computer and PLC firmware, supports disturbance-free update of PLC variables of complex structures, requires only a small amount of modification to the PLC firmware, and has the advantages of clear implementation route and ease of use.

Claims

1. A method for updating a PLC program without disturbance, characterized in that: Including PLC host computer software and PLC controller firmware, the PLC program update process is as follows: S1, PLC program update starts; S2, the PLC host configuration software uploads the engineering configuration running in the PLC, parses and opens it; S3, the PLC host configuration software generates a memory tree for the current project, and then performs the same operation on the program configuration running in the PLC to generate a memory tree; Compare the two memory trees and generate corresponding memory instructions to perform corresponding operations; S4, save all generated memory instructions to the download content, then the PLC host computer software initiates a program update instruction, suspends the next PLC program scheduling, and starts to download the updated program to the controller in sequence; S5. The downloaded PLC program sequentially executes the memory instructions in the downloaded content, and sequentially completes the variable operations according to the parameters of the memory instructions; S6. PLC update completed.

2. The method for updating a PLC program without disturbance according to claim 1, characterized in that: The PLC host computer software is used to program, download, run and configure the PLC; The PLC controller firmware is used to parse the application downloaded by the PLC host computer software, and perform operations including running, stopping, and restarting according to the execution of the PLC host computer configuration software.

3. The method for updating a PLC program without disturbance according to claim 2, characterized in that: The PLC controller firmware cooperates with the PLC host computer software to specify part of the memory on the PLC heap in the link file of the PLC host computer configuration software as a variable area for PLC programming; The PLC host computer software implements a memory allocator when performing programming operations, and finds a free area in the remaining allocatable memory that can store the current variable size, and points the variable to the address; the memory allocator provides a unique identifier for each variable.

4. A method for updating a PLC program without disturbance according to claim 1, characterized in that: The specific contents of S3 are as follows: The PLC host configuration software generates a memory tree for the current project, and then performs the same operation on the program configuration running in the PLC to generate a memory tree; The memory tree is composed of the address and length of each variable; By expanding a variable in tree form, all variables are grouped together to generate a memory tree for the entire project.

5. A method for updating a PLC program without disturbance according to claim 4, characterized in that: The memory tree comparison described in S3 is as follows: During the memory tree comparison, corresponding memory instructions are generated to move memory data. Different moving strategies are required for different situations. If the variable type is changed and is not considered the same variable, a memory instruction MemoryAssign is generated. The content of this instruction requires the PLC firmware to write the specified data to the specified memory address, thus completing the variable initialization action. For the internal transposition of the structure, first allocate a free space C on the controller to store it, and then generate MemorySwap instructions in sequence to copy A to C, B to A, and C to A, completing the exchange of the two values; For variable deletion, no processing is required because no variable references the address.