Programmable logic controller program management method, device, equipment and storage medium

By managing the programs of multiple PLCs in the host computer and using reference count values ​​for online modification and incremental storage, the problem of low efficiency in traditional PLC program management is solved, achieving efficient program updates and stable equipment operation.

CN115756533BActive Publication Date: 2026-07-21SHENZHEN INOVANCE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN INOVANCE TECH CO LTD
Filing Date
2022-11-07
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Traditional PLC program management methods can only back up the last downloaded program and cannot modify PLCs that have not been downloaded previously online. This results in low program modification efficiency, and frequent full downloads cause equipment downtime and increase labor costs.

Method used

By determining the target reference data and preset download program data in the host computer, online modification can be performed. The reference count value is used to manage the programs of multiple PLCs, enabling incremental modification and disordered storage, thus avoiding full download.

Benefits of technology

It improves the efficiency and functionality of PLC program modification, reduces equipment downtime, lowers labor costs, and ensures stable operation of the production line.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115756533B_ABST
    Figure CN115756533B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of controllers and discloses a programmable logic controller program management method, device, equipment and storage medium, the method comprising the following steps: determining target reference data according to program information of a target programmable logic controller, and detecting whether online modification is needed according to the target reference data and preset download program data; if the online modification is needed, performing online modification on the target reference data according to the download program data to obtain modified reference data, and determining a reference count value corresponding to the modified reference data; storing the modified reference data as new reference data, and storing the reference count value and the new reference data in a memory for program online modification. The application improves the PLC program modification efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of controller technology, and in particular to a programmable logic controller program management method, apparatus, device, and storage medium. Background Technology

[0002] With the development of PLC (Programmable Logic Controller), on the one hand, the scale of business and the complexity of control logic undertaken by PLC are gradually increasing, and on the other hand, the number of devices controlled by PLC has increased significantly. Therefore, while ensuring the normal operation of PLC, higher requirements are also placed on PLC program management.

[0003] Traditional PLC program management methods involve either modifying the program online by downloading a backup of the previous program or downloading the entire program for modification. This method has significant drawbacks. Full downloads require large program sizes, and online modifications are only possible for PLCs with previously downloaded backups. In other words, because this method only supports backups of previously downloaded programs, it cannot modify PLCs that have not been previously downloaded; a full download is required, resulting in low program modification efficiency. Summary of the Invention

[0004] The main objective of this invention is to provide a programmable logic controller (PLC) program management method, apparatus, device, and storage medium, which aims to improve the efficiency of PLC program modification.

[0005] To achieve the above objectives, the present invention provides a programmable logic controller (PLC) program management method, the steps of which include:

[0006] Target reference data is determined based on the program information of the target programmable logic controller, and whether online modification is required is detected based on the target reference data and the preset download program data.

[0007] If online modification is required, the target reference data is modified online based on the downloaded program data to obtain modified reference data, and the reference count value corresponding to the modified reference data is determined.

[0008] The modified reference data is used as the new reference data, and the reference count value and the new reference data are stored in memory for online modification by the program.

[0009] Optionally, the step of determining the target reference data based on the program information of the target programmable logic controller includes:

[0010] Read the program information of the target programmable logic controller and determine the corresponding program identifier based on the program information;

[0011] Based on the program identifier, search for reference data in memory that matches the program identifier as the target reference data;

[0012] If no reference data matching the program identifier exists in the memory, then the reference data matching the program identifier is searched in the disk as the target reference data.

[0013] Optionally, after the step of searching the disk for reference data matching the program identifier as the target reference data, the method further includes:

[0014] The reference data in the memory is loaded into the disk, and the target reference data in the disk is loaded into the memory, so that the target reference data can be modified online in the memory to obtain the modified reference data.

[0015] Optionally, the step of modifying the target reference data online based on the downloaded program data to obtain modified reference data includes:

[0016] Identify the modified program in the downloaded program data, and determine the data to be modified corresponding to the modified program in the target reference data;

[0017] The modified reference data is obtained by modifying the data to be modified according to the modification procedure.

[0018] Optionally, after the step of modifying the target reference data online based on the download program data to obtain modified reference data, the method further includes:

[0019] Determine the target reference count value corresponding to the target reference data, and detect whether the target reference count value is 1;

[0020] If the target reference count is 1, then the target reference data is cleared;

[0021] If the target reference count value is not 1, then the value obtained by subtracting 1 from the target reference count value is used as the target reference count value corresponding to the target reference data.

[0022] Optionally, the step of determining the reference count value corresponding to the modified reference data includes:

[0023] Determine the data identifier of the modified reference data, and detect whether there is reference data in memory and / or disk that matches the data identifier, wherein the data identifier refers to the flag corresponding to the data;

[0024] If it does not exist, then the reference count value corresponding to the modified reference data is determined to be 1;

[0025] If it exists, determine the count value of the reference data that matches the data identifier, and add 1 to the count value as the reference count value corresponding to the modified reference data.

[0026] Optionally, after the step of modifying the target reference data online based on the download program data to obtain modified reference data, the method further includes:

[0027] Obtain program cycle information and detect whether the current time point matches the gap time point in the program cycle information;

[0028] If a match is found, the modified reference data is sent to the corresponding programmable logic controller.

[0029] Furthermore, to achieve the above objectives, the present invention also provides a programmable logic controller program management device, comprising:

[0030] The detection module is used to determine target reference data based on the program information of the target programmable logic controller, and to detect whether online modification is required based on the target reference data and the preset download program data.

[0031] The first processing module is used to modify the target reference data online according to the downloaded program data to obtain modified reference data if online modification is required, and to determine the reference count value corresponding to the modified reference data.

[0032] The second processing module is used to use the modified reference data as new reference data, and to store the reference count value and the new reference data in memory for online modification by the program.

[0033] In addition, to achieve the above objectives, the present invention also provides a programmable logic controller (PLC) program management device, comprising: a memory, a processor, and a PLC program management program stored in the memory and executable on the processor, wherein the PLC program management program, when executed by the processor, implements the steps of the PLC program management method described above.

[0034] In addition, to achieve the above objectives, the present invention also provides a programmable logic controller (PLC) program management storage medium, wherein the storage medium stores a PLC program management program, and the PLC program management program, when executed by a processor, implements the steps of the PLC program management method as described above.

[0035] This invention determines target reference data via a host computer based on the program information of the target programmable logic controller (PLC). It then checks whether online modification is required based on the target reference data and preset downloaded program data. If online modification is needed, the target reference data is modified online using the downloaded program data to obtain modified reference data, and the reference count value corresponding to the modified reference data is determined. This modified reference data is used as new reference data, and the reference count value and the new reference data are stored in memory for online program modification. By determining the target reference data through the program information of the target PLC, and then modifying the target reference data online based on the downloaded program data to obtain modified reference data, and saving the modified data as new reference data, this invention avoids the phenomenon in existing technologies where online modification can only be performed on one PLC from the last downloaded program backup. This PLC program management not only stores new reference data for all PLCs, thus improving program modification functionality, but also allows direct modification based on the stored new reference data, thereby improving program modification efficiency. Attached Figure Description

[0036] Figure 1 This is a schematic diagram of the programmable logic controller program management device structure of the hardware operating environment involved in the embodiments of the present invention;

[0037] Figure 2 This is a flowchart illustrating the first embodiment of the programmable logic controller program management method of the present invention;

[0038] Figure 3 This is a schematic diagram of the device module for programmable logic controller program management according to the present invention.

[0039] Figure 4 This is a schematic diagram illustrating the online modification of the programmable logic controller program management according to the present invention;

[0040] Figure 5 This is a schematic flowchart of an embodiment of the online modification of the programmable logic controller program management according to the present invention;

[0041] Figure 6 This is a schematic flowchart of an embodiment of the programmable logic controller program management, download, and login method of the present invention;

[0042] Figure 7 This is a schematic flowchart illustrating an embodiment of the programmable logic controller program managing other instructions according to the present invention.

[0043] The objectives, features, and advantages of this invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0044] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0045] Reference Figure 1 , Figure 1 This is a schematic diagram of the programmable logic controller program management device structure of the hardware operating environment involved in the embodiments of the present invention.

[0046] like Figure 1 As shown, the programmable logic controller (PLC) program management device may include: a processor 0003, such as a central processing unit (CPU), a communication bus 0001, an acquisition interface 0002, a processing interface 0004, and a memory 0005. The communication bus 0001 is used to enable communication between these components. The acquisition interface 0002 may include an information acquisition device or acquisition unit, such as a computer; optionally, the acquisition interface 0002 may also include a standard wired interface or a wireless interface. The processing interface 0004 may optionally include a standard wired interface or a wireless interface. The memory 0005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk storage device. Optionally, the memory 0005 may also be a storage device independent of the aforementioned processor 0003.

[0047] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the programmable logic controller program management device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0048] like Figure 1 As shown, the memory 0005, which serves as a storage medium, may include an operating system, an acquisition interface module, a processing interface module, and a programmable logic controller program management program.

[0049] exist Figure 1In the programmable logic controller (PLC) program management device shown, the communication bus 0001 is mainly used to realize the connection and communication between components; the acquisition interface 0002 is mainly used to connect to the backend server and communicate data with the backend server; the processing interface 0004 is mainly used to connect to the deployment end (user end) and communicate data with the deployment end; the processor 0003 and the memory 0005 in the PLC program management device of the present invention can be set in the PLC program management device. The PLC program management device calls the PLC program management program stored in the memory 0005 through the processor 0003 and executes the PLC program management method provided in the embodiment of the present invention.

[0050] Based on the above hardware structure, an embodiment of the programmable logic controller program management method of the present invention is proposed.

[0051] This invention provides a programmable logic controller (PLC) program management method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the programmable logic controller program management method of the present invention.

[0052] In this embodiment, the programmable logic controller program management method includes:

[0053] Step S10: Determine target reference data based on the program information of the target programmable logic controller, and detect whether online modification is required based on the target reference data and the preset download program data;

[0054] In this embodiment, the host computer acquires data operation instructions and detects whether the data operation instructions contain program information of the target programmable logic controller (PLC). The data operation instructions refer to instructions that operate on the corresponding reference program of the PLC, which can be referred to... Figures 5-7 Data manipulation instructions can include online modification, opening / closing the project, and login commands. When the data manipulation instructions do not contain program information instructions for the target programmable logic controller, the reference program stored on disk / memory will not change. The reference program refers to identifiable data, such as... Figure 5 In program V0, the target reference data refers to the reference data that needs to be modified, for example... Figure 5 When modifying PLC0 online, the corresponding reference data program V0 for PLC0 becomes the target reference data. The modified reference data refers to the program after online modification, and the target programmable logic controller (PLC) is the PLC whose program needs modification, as mentioned above. Figure 5The PLC0 mentioned above is used for online modification. For example, if program V1 is obtained by online modification of PLC0, it becomes the modified reference data. Program V1 will be used as the new reference data, overwriting the previous reference data program V0 of PLC0. The new reference data program V1 will then be used as the reference data of PLC0 in the next operation. Existing online modification technology for PLC programs can only maintain a backup of the last downloaded program. This backup only corresponds to the last downloaded PLC. Therefore, in scenarios where the user program has been downloaded to two PLCs, after performing online modification more than twice on one PLC, it is no longer possible to perform online modification on the other PLC. For example, if online modification is performed on PLC0 and PLC1, and program a in PLC0 is modified (here and in this article, modification refers to online modification) to obtain a1, then only a1 can be modified online, and program b in PLC1 cannot be modified online. In this case, a full download (that is, downloading all of program b) is required, which requires the equipment to be shut down. For an operating production line, frequent start-ups and shutdowns not only waste time and materials but also increase labor costs and reduce production capacity. Therefore, this paper proposes a solution that manages multiple PLC programs on a single host computer without interrupting the control logic of the user code. This solution utilizes a reference-counting method to perform online modifications to multiple PLCs within a single host computer, and allows for out-of-order modification (multiple PLC programs can be stored for this purpose). On one hand, it provides feasible online program modification for project management, controller upgrades, and product iteration updates, eliminating the need for frequent start-ups and shutdowns of the production environment's controllers, thus preventing unnecessary losses. On the other hand, it has significant practical implications for efficient production on the production line. In this embodiment, if the data operation instruction contains an online modification instruction, the program corresponding to the PLC will be modified online according to the online modification instruction. This mainly involves determining the target reference data based on the program information of the target programmable logic controller. Here, program information refers to the instruction input by the user into the host computer for the PLC program corresponding to the target programmable logic controller. Identifiable data refers to the program corresponding to the PLC. To distinguish it from the source program, the PLC program is described as identifiable data. The target reference data refers to the reference identifiable data (reference data) that the online modification instruction needs to modify. For example, if the target programmable logic controller is PLC0, the program of PLC0 will be determined online based on the program information of the target programmable logic controller. Therefore, the reference program 'a' corresponding to PLC0 is the target reference data. Furthermore, when a clear instruction is received, all identifiable data inside the host computer will be cleared. This identifiable data includes the program in memory, on disk, or in the PLC (note: not the running program in the PLC).Once the target reference data is determined, it will be used to check whether online modification is needed based on the target reference data and the preset download program data. The download program data refers to the program after modification. In other words, the target reference data is existing identifiable data, for example. Figure 5 The first program in the diagram, V0, requires downloading program data, which is the program obtained after online modification. For example... Figure 5 The second diagram shows program V1. The step of determining the target reference data based on the program information of the target programmable logic controller includes:

[0055] Step C11: Read the program information of the target programmable logic controller and determine the corresponding program identifier based on the program information;

[0056] Step C12: Based on the program identifier, search for reference data in memory that matches the program identifier as the target reference data;

[0057] In this embodiment, after determining the program information of the target programmable logic controller (PLC), the program identifier in the program information is determined, and it is checked whether the program identifier matches a preset program identifier. The program identifier refers to the identifier of the PLC program corresponding to the online modification instruction. The preset index identifier refers to the identifier of the most recently modified PLC program, which is the identifier of the reference data stored in memory. The program information refers to the relevant information of the program referenced by the target PLC, such as program flags and counts. When the program identifier matches the preset program identifier, the reference data in memory is used as the target reference data. Here, the new reference data in memory refers to the reference identifiable data obtained after the most recent PLC modification. The reference data refers to the original modified program corresponding to each PLC. For example, program a in PLC0 is first modified online to obtain a1, and a1 is stored in memory as reference data. The index identifier A corresponding to PLC0 is used as the preset index identifier A. When an online modification instruction is received again, if index identifier A matches the preset index identifier A, it means that PLC0 needs to be modified, and the reference data a1 in memory is directly used as the target reference data. By matching index identifiers, the original program that needs to be modified online can be accurately located. Furthermore, reference data in memory can be directly extracted to ensure the efficiency of online modification.

[0058] Step C13: If no reference data matching the program identifier exists in the memory, then the reference data matching the program identifier is searched in the disk as the target reference data.

[0059] In this embodiment, when the program identifier does not match the preset program identifier, the program identifier of the reference data on the disk is detected, and the reference data on the disk is determined as the target reference data. That is, the index identifier is not the most recently modified PLC program, so a search needs to be performed on the disk. For example, program a in PLC0 is first modified online to obtain a1, and a1 is stored in memory as reference data. The index identifier A corresponding to PLC0 is used as the preset index identifier A. When an online modification instruction is received again, if index identifier B does not match the preset index identifier A, it means that the program to be modified is not PLC0. The search will continue in the reference data on the disk (where the index identifier B corresponding to PLC1 exists) to find reference data b that matches index identifier B as the target reference data. The search rules for the index identifier are as follows: If it exists in memory, the last downloaded program information is stored in memory; if it exists on the disk, before each download, the corresponding data is searched based on the identifier of the identifiable data. If it is not found in memory, it will be searched on the disk. The accuracy of online modification is improved by matching with reference data on the disk. Furthermore, the fact that the disk stores multiple reference data enhances the functionality of online modification, without the limitation of only being able to store the most recent identifiable data.

[0060] Step S20: If online modification is required, the target reference data is modified online according to the downloaded program data to obtain modified reference data, and the reference count value corresponding to the modified reference data is determined.

[0061] In this embodiment, if online modification is required according to the previous detection, the target reference data will be modified online based on the downloaded program data to obtain modified reference data. Online modification here refers to the process of modifying the target reference data online based on the downloaded program data. Since the program in the PLC, containing the original program, only requires incremental modification, incremental modification (online modification) refers to adding, subtracting, or modifying steps based on the original program without stopping the system. Because the host computer's memory and disk store the most recent original program for each PLC, incremental modification can be performed simply by searching and retrieving it from the disk or memory. This avoids the phenomenon that existing technology can only store one most recent identifiable data, resulting in only sequential modification (modifying program a1 means only modifying a1, modifying a1 to a2 means only modifying a2). After the step of modifying the target reference data online based on the downloaded program data to obtain modified reference data, the following steps are included:

[0062] Step C21: Determine the target reference count value corresponding to the target reference data, and detect whether the target reference count value is 1;

[0063] Step C22: If the target reference count value is 1, then the target reference data is cleared;

[0064] In this embodiment, after downloading (online modification), the reference count of existing identifiable data (reference data) is updated. The counting rules include three aspects: Increasing the reference count: When a program is downloaded to a new PLC, the reference count of that program is incremented by one. Decreasing the reference count: When a program performs download / online modification on a PLC, the reference count of the program on that PLC is first decremented by one; after the download is complete, the reference count of the newly downloaded program is incremented by one. When the reference count of a program is 0, it indicates that the program is no longer referenced by any PLC, and the program will be cleared. On the other hand, the target reference data is processed. First, the target reference count value corresponding to the target reference data is determined, and simultaneously, it is checked whether the target reference count value is 1. Here, the target reference count value refers to the count value corresponding to the target reference data. When the target reference count value is 1, the target reference data (after online modification, the target reference count value corresponding to the target reference data is 0) is cleared from the host computer, thereby ensuring that the space occupied by identifiable data within the host computer is small and that each identifiable data is processed accurately.

[0065] Step C23: If the target reference count value is not 1, then the value obtained by subtracting 1 from the target reference count value is used as the target reference count value corresponding to the target reference data.

[0066] In this embodiment, when the target reference count value is not 1, it indicates that multiple PLCs are using the target reference data. Since the online modification to this target reference data reduces the number of PLCs using it, the value obtained by subtracting 1 from the target reference count value is used as the target reference count value corresponding to the target reference data. This allows for accurate processing of identifiable data within the host computer based on the target reference count value. On the other hand, the reference count value corresponding to the modified reference data is also processed. The step of determining the reference count value corresponding to the modified reference data includes:

[0067] Step C25: Determine the data identifier of the modified reference data, and detect whether there is reference data in memory and / or disk that matches the data identifier, wherein the data identifier refers to the flag corresponding to the data;

[0068] Step C26: If it does not exist, then determine that the reference count value corresponding to the modified reference data is 1;

[0069] In this embodiment, by determining the data identifier of the modified reference data, and simultaneously detecting whether there is reference data matching the data identifier in memory and / or disk, the data identifier here refers to the identifier of the identifiable data (reference data), which is different from the program identifier mentioned earlier. The program identifier refers to the identifier of the program corresponding to the identifiable data and the PLC. The reference count value refers to the number of PLCs using the identifiable data. When there is no reference data matching the data identifier, the reference count value is determined to be 1. That is, the host computer's memory and disk do not contain the modified reference data. For example, if the modified reference data is C, and the host computer's memory and disk do not contain the modified reference data C, the reference count value will be determined to be 1. This ensures the accuracy of the reference count value, facilitating subsequent processing of the identifiable data corresponding to the reference count value.

[0070] Step C27: If it exists, determine the count value of the reference data that matches the data identifier, and use the value obtained by adding 1 to the count value as the reference count value corresponding to the modified reference data.

[0071] In this embodiment, when reference data matching the data identifier exists, the count value of the reference data matching the data identifier is determined, and the value obtained by incrementing the count value by 1 is used as the reference count value corresponding to the modified reference data. Here, the count value refers to the number of reference data matching the data identifier (which is also the reference count value of the reference data matching that data identifier). For example, if the modified reference data is C, and the host computer's memory and disk contain reference data C matching the data identifier, and the reference count value of this reference data is 5, then the reference count value will be determined to be 6. This allows for accurate counting of the modified identifiable data obtained from each online modification.

[0072] Step S30: Use the modified reference data as new reference data, and store the reference count value and the new reference data in memory for online modification by the program.

[0073] In this embodiment, multiple PLCs are modified online in an unordered manner by referencing different identifiable data in the same host computer. The identifiable data is mainly stored in two locations: the identifiable data of the currently modified controller is stored in memory, and the identifiable data of other controllers not involved in the current modification is stored on disk. The stored data is associated and mapped using the identifiers of the identifiable data. Therefore, unordered operations can be performed each time the controller is modified online. Finally, the modified reference data is used as the new reference data, and the reference count value and the new reference data are stored in memory for use in online program modifications. This mainly refers to providing the original program for the next online modification. For multiple consecutive modifications to the same PLC program, it facilitates retrieval from memory for subsequent modifications. For modifications to different PLC programs, the program can be searched on disk before modification. Furthermore, if the PLC has sufficient storage space, identifiable data can be stored in the PLC, while the host computer software only stores the data's index identifier. If the PLC's memory space is limited, the identifiable data and its index can be stored in the host computer. If the host computer's memory is limited, the currently identifiable data is only stored on the disk and not retained in memory; it is reloaded from the disk each time it is needed. (See reference...) Figure 4 , Figure 4This diagram illustrates online modification of a programmable logic controller (PLC) program. In traditional control programs, each user program stores only one identifiable data. Referring to Figure a, when the host computer makes online modifications, it submits the identifiable data to the PLC. Considering that online modifications of multiple PLCs require saving multiple identifiable data, the host computer will have multiple identifiable data. When the user program performs online modifications on the current controller (PLC0) (the identifiable data of PLC0 is in memory), the identifiable data of other controllers (PCL1, PLC2) should be saved on the disk. Referring to Figure b, when the user makes online modifications to other control programs (PCL1, PLC2), the previous controller (PLC0) is in normal operating state at this time (after modifying PLC0, the identifiable data saved in memory is the identifiable data corresponding to the modified PLC0, which also serves as the new reference data for the next online modification of PLC0. The identifiable data is distinguished based on the following: before the online modification, the identifiable data of the PLC to be modified is determined as the target reference data; after the modification is completed, it is used as the modified reference data; finally, after determining the reference count value, it is used as the new reference data for that PLC. Therefore, the data searched in the disk or memory is the new reference data). At this point, the identifiable data of PLC0 is saved to disk, and the identifiable data of PLC1 is loaded into memory for online modification. This embodiment of a multi-PLC online modification program management method based on reference counting ensures both unordered modification of the program during runtime and simultaneous management of different controllers, thereby further guaranteeing the normal debugging, updating, release, stable operation, and version switching of online equipment. It provides feasible solutions for PLC management, PLC modification, and product upgrades, thus avoiding the need for frequent startups and shutdowns of the production line for full downloads during user debugging and program version iterations. This has significant implications for the efficiency and safety of actual on-site production.

[0074] Furthermore, this embodiment also provides a flowchart illustrating an embodiment of online modification of programmable logic controller (PLC) program management, referring to... Figure 5In this embodiment, each small diagram corresponds to one step, resulting in a total of thirteen steps. First, when the host computer logs in and generates 'Program v0', this data identifies that it contains references to PLC0-2, so the reference count of 'Data v0' is 3 at this time. Login means sending the V0 version of the program to the controller, which here refers to PLC0-2. Second, after the online modification of PLC0 is completed (compiling 'Data v0' in memory to obtain 'Program v1' and sending 'Program v1' to PLC0), a new 'Program v1' is generated based on the current controller's (PLC0) data identifier and 'Program v0'. The data identifier refers to the correspondence between the program and the PLC. At this time, 'Program v1' only contains data from PLC0, while 'Program v0' only contains data from PLC1 and PLC2. Therefore, the reference count of 'Program v0' is 2, and the reference count of 'Program v1' is 1. It is worth noting that the online modified program is stored in memory, and only one modified version of the program is in memory at a time. The online modification process is as follows: First, obtain the current program version from the controller to be modified and store it in memory for modification. Second, modify the program to generate a new version. Third, during the intervals of the controller program's cycle (downloading after the previous program finishes execution), download the new version to the controller, achieving a non-stop update (i.e., online modification). Before the entire online modification is complete, the original control logic continues to execute normally without being affected. The third step involves re-modifying PLC0 online. After logging in, 'Program v2' is generated. At this point, 'Program v2' only contains data from PLC0. Because the reference count of 'Program v1' is 0, 'Program v1' is cleared. Now, the reference count of 'Program v0' is 2, and the reference count of 'Program v2' is 1. The fourth step involves completing the online modification of PLC1. After logging in, a new 'Program v3' is generated based on the current controller's (PLC1) data identifier. At this point, 'Program v3' only contains data from PLC1, so the reference counts of 'Program v0', 'Program v2', and 'Program v3' are all 1. (Refer to...) Figure 6 , Figure 6This is a flowchart illustrating an embodiment of programmable logic controller (PLC) program management, download, and login. Based on the results of step four above, PLC2 is logged in and downloaded. A new program, 'Program v4', is generated according to the current controller's (PLC2) data identifier and 'Program v0'. At this point, 'Program v4' only contains PLC2 data, and 'Program v0' is cleared. The reference count for 'Program v0' is now 0, the reference count for 'Program v2' is 1, the reference count for 'Program v3' is 1, and the reference count for 'Program v4' is 1. For example, if 'Program v4' is edited and the code is generated, 'Program v4' only contains PLC2 data, and the reference count remains unchanged. On the other hand, if no modifications are made, logging into PLC0 does not result in online modification, so no new identifiable data is generated; the reference count remains unchanged. If you subsequently modify PLC1 online, after logging in, you will generate 'Program v5'. At this point, 'Program v5' only contains data from PLC1. The reference count for 'Program v2' will be 1, the reference count for 'Program v3' will be 0 and cleared, the reference count for 'Program v4' will be 1, and the reference count for 'Program v5' will also be 1. (Refer to...) Figure 7 , Figure 7 This is a flowchart illustrating an embodiment of managing other instructions in a programmable logic controller (PLC) program. The instruction is to close / open the project. Since no modifications have been made, no new identifiable data is generated; the reference count remains unchanged. However, when modifying PLC0 online, after logging in, 'Program v6' is generated. Only 'Program v6' contains data from PLC0, so the reference count of 'Program v2' is 0 and cleared, while the reference counts of 'Program v4', 'Program v5', and 'Program v6' are all 1. Next, without modifications, logging into PLC1 again results in no new identifiable data being generated, and the reference count remains unchanged. Finally, if the 'Clear' command is executed, all programs are cleared, and no identifiable data is retained; all reference counts are reset to 0. As can be seen from the above embodiment, this solution's PLC program modification can store all new reference data for all PLCs, thus improving the functionality of program modification. Furthermore, it can directly modify the program based on the stored new reference data, thereby improving the efficiency of program modification.

[0075] This embodiment determines target reference data based on the program information of the target programmable logic controller (PLC) using a host computer. It then checks whether online modification is needed based on the target reference data and preset downloaded program data. If online modification is required, the target reference data is modified online using the downloaded program data to obtain modified reference data, and the reference count value corresponding to the modified reference data is determined. The modified reference data is used as new reference data, and the reference count value and the new reference data are stored in memory for online program modification. By determining the target reference data through the program information of the target PLC, and then modifying the target reference data online based on the downloaded program data to obtain modified reference data, and saving the modified data as new reference data, this avoids the phenomenon in existing technologies where online modification can only be performed on one PLC from the last downloaded program backup. This PLC program management not only stores new reference data for all PLCs, thus improving program modification functionality, but also allows direct modification based on the stored new reference data, thereby improving program modification efficiency.

[0076] Furthermore, based on the first embodiment of the programmable logic controller (PLC) program management method of the present invention, a second embodiment of the PLC program management method of the present invention is proposed, the PLC program management method comprising:

[0077] Furthermore, after the step of searching the disk for reference data matching the program identifier as the target reference data, the process includes...

[0078] Step a: Load the reference data in the memory into the disk, and load the target reference data in the disk into the memory, so as to modify the target reference data online in the memory to obtain the modified reference data.

[0079] In this embodiment, when the reference data in memory is the required target reference data, online modification can be performed directly based on the reference data in memory. When the reference data in memory is not the required target reference data, the reference data in memory is loaded into disk, and the reference data matching the index identifier in disk is loaded into memory. Because online updates need to be performed in memory, the found target reference data needs to be stored in memory. Then, the step of modifying the target reference data online according to the online modification instruction to obtain modified reference data is executed in memory. That is, the target reference data is modified online in memory to obtain modified reference data.

[0080] In this embodiment, by loading the reference data in the memory into the disk and loading the target reference data in the disk into the memory, the target reference data is modified online in the memory to obtain the modified reference data. By storing the target reference data in memory for online modification, the accuracy and efficiency of online modification can be guaranteed.

[0081] Furthermore, the step of modifying the target reference data online based on the downloaded program data to obtain modified reference data includes:

[0082] Step e: Determine the modified program in the downloaded program data, and determine the data to be modified corresponding to the modified program in the target reference data;

[0083] Step f: Modify the data to be modified according to the modification procedure to obtain modified reference data.

[0084] In this embodiment, when modifying the target reference data online (incremental modification), the main process involves determining the modification program in the downloaded program data, identifying the data to be modified within the target reference data, and finally modifying the data to be modified according to the modification program to obtain the modified reference data. Here, the modification program refers to the program that needs to be modified, and the data to be modified refers to the position or program segment of that program within the target reference data. For example, when the target reference data is a basketball scoring program, if the modification program in the online modification instruction changes a 1-point system to a 2-point system, the modification position in the target reference data corresponding to the modification program would be the counting and addition program within that target reference data. This could mean modifying the +1 function in the program to +2, or it could mean adding a delay. Therefore, the conventional modification position is the beginning of the program, so a delay function can be added to the beginning of the program in the target reference data. Another aspect is that the modification program identifier in the online modification instruction can be directly determined. Based on the modification program identifier, the program identifier of the new reference data in memory is searched to see if it matches the modification program identifier. When they match, the index identifier of the new reference data in memory is determined, and the index identifier in the online modification instruction is also determined. The index identifier in the online modification instruction is then directly modified to the index identifier of the new reference data in memory. Conversely, if they do not match, the process continues, searching for a match between the program identifier of the new reference data in memory and the modification program identifier. When they match, the index identifier of the new reference data on disk is determined, and the index identifier in the online modification instruction is also determined. The index identifier in the online modification instruction is then directly modified to the index identifier of the new reference data on disk. If they do not match, the step of determining the target reference data corresponding to the online modification instruction is executed. Here, the modification program identifier refers to the program identifier corresponding to the identifiable data to be modified. For example, if the index identifier for PLC0 is A, and the modification program identifier for PLC1 in the online modification instruction is also A, then the new reference data corresponding to PLC0 can be directly used as the new reference data for PLC1. In short, PLC0 is the timing program, and PLC1 is the display program. When it's necessary to change the PLC1 program to a timing program, the original display program needs to be modified. However, the identifiers of the modified code are consistent with those of the PLC0 program. Therefore, the online modification capability of PLC1 can be determined directly based on the identifiable data of the PLC0 program. After modification, the new reference data of PLC0 is incremented by 1, significantly reducing the online modification time. Batch modifications can be performed on all PLCs without requiring a large amount of time.

[0085] In this embodiment, by determining the modification program in the online modification instruction and the corresponding data to be modified in the target reference data, the modified reference data is obtained by modifying the data to be modified according to the modification program. This allows for incremental modification based on the original program (target reference data) to the greatest extent possible, thereby ensuring download efficiency (reducing unnecessary full downloads).

[0086] Furthermore, after the step of modifying the target reference data online based on the downloaded program data to obtain modified reference data, the method further includes:

[0087] Step m: Obtain program cycle information and check whether the current time point matches the gap time point in the program cycle information;

[0088] Step n: If a match is found, the modified reference data is sent to the corresponding programmable logic controller.

[0089] In this embodiment, after obtaining the modifiable data (i.e., after the online modification of the PLC program is completed), the modifiable data is downloaded to the corresponding PLC. The system acquires the collected program cycle information and checks whether the current time point matches the gap time point in the program cycle information. If they do not match, the system continuously checks whether the current time point matches the gap time point in the program cycle information. Here, program cycle information refers to the cycle-related information of the existing program of the programmable logic controller to be downloaded; the current time point refers to the current time; and the gap time point refers to the idle time period after the existing program in the program cycle information has finished executing. When the current time point matches the gap time point in the program cycle information, the modifiable data is downloaded to the corresponding programmable logic controller. If the current gap time is insufficient to complete the program update, the system continues to check whether the current time point matches the gap time point in the program cycle information until the program update is completed using the gap time. For example, if only 10% of the program is updated in the first program execution gap, the remaining 90% will be updated in subsequent program execution gaps until the update is complete. In other words, this application downloads the modified program to the programmable logic controller (PLC) during the idle time of the existing program execution. The corresponding PLC can be determined according to the index identifier in the online modification instruction. Since the index identifier identifies the correspondence between the PLC and the new reference data, it also indicates the corresponding PLC. Thus, the download and update can be performed during the interval when the existing program of the PLC is completed, without affecting the execution of the current program or requiring the system to stop for the update due to program download.

[0090] In this embodiment, by acquiring program cycle information and detecting whether the current time point matches the gap time point in the program cycle information, if the current time point matches the gap time point in the program cycle information, the modified reference data is sent to the corresponding programmable logic controller. The program that needs to be updated is downloaded and updated through the gap time point. On the one hand, this can ensure the accuracy of PLC operation, and on the other hand, it can avoid the phenomenon of PLC downloading the program while executing the program, which may cause the PLC to crash or the current operation to malfunction.

[0091] The present invention also provides a schematic diagram of a device module for programmable logic controller program management, referring to... Figure 3 The programmable logic controller program management device includes:

[0092] The detection module A01 is used to determine the target reference data based on the program information of the target programmable logic controller, and to detect whether online modification is required based on the target reference data and the preset download program data.

[0093] The first processing module A02 is used to modify the target reference data online according to the downloaded program data to obtain modified reference data if online modification is required, and to determine the reference count value corresponding to the modified reference data.

[0094] The second processing module A03 is used to use the modified reference data as new reference data, and store the reference count value and the new reference data in memory for online modification by the program.

[0095] Optionally, the detection module A01 is further configured to:

[0096] Read the program information of the target programmable logic controller and determine the corresponding program identifier based on the program information;

[0097] Based on the program identifier, search for reference data in memory that matches the program identifier as the target reference data;

[0098] If no reference data matching the program identifier exists in the memory, then the reference data matching the program identifier is searched in the disk as the target reference data.

[0099] Optionally, the detection module A01 is further configured to:

[0100] The reference data in the memory is loaded into the disk, and the target reference data in the disk is loaded into the memory, so that the target reference data can be modified online in the memory to obtain the modified reference data.

[0101] Optionally, the first processing module A02 is further configured to:

[0102] Identify the modified program in the downloaded program data, and determine the data to be modified corresponding to the modified program in the target reference data;

[0103] The modified reference data is obtained by modifying the data to be modified according to the modification procedure.

[0104] Optionally, the first processing module A02 is further configured to:

[0105] Determine the target reference count value corresponding to the target reference data, and detect whether the target reference count value is 1;

[0106] If the target reference count is 1, then the target reference data is cleared;

[0107] If the target reference count value is not 1, then the value obtained by subtracting 1 from the target reference count value is used as the target reference count value corresponding to the target reference data.

[0108] Optionally, the first processing module A02 is further configured to:

[0109] Determine the data identifier of the modified reference data, and detect whether there is reference data in memory and / or disk that matches the data identifier, wherein the data identifier refers to the flag corresponding to the data;

[0110] If it does not exist, then the reference count value corresponding to the modified reference data is determined to be 1;

[0111] If it exists, determine the count value of the reference data that matches the data identifier, and add 1 to the count value as the reference count value corresponding to the modified reference data.

[0112] Optionally, the first processing module A02 is further configured to:

[0113] Obtain program cycle information and detect whether the current time point matches the gap time point in the program cycle information;

[0114] If a match is found, the modified reference data is sent to the corresponding programmable logic controller.

[0115] The methods executed by the above-mentioned program modules can be referred to in the various embodiments of the programmable logic controller program management method of the present invention, and will not be repeated here.

[0116] The present invention also provides a programmable logic controller program management device.

[0117] The device of the present invention includes: a memory, a processor, and a programmable logic controller (PLC) program management program stored in the memory and executable on the processor. When the PLC program management program is executed by the processor, it implements the steps of the PLC program management method as described above.

[0118] The present invention also provides a storage medium.

[0119] The present invention stores a programmable logic controller (PLC) program management program on a storage medium, which, when executed by a processor, implements the steps of the PLC program management method described above.

[0120] The method implemented when the programmable logic controller program management program running on the processor is executed can be referred to in various embodiments of the programmable logic controller program management method of the present invention, and will not be repeated here.

[0121] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.

[0122] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0123] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0124] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A programmable logic controller (PLC) program management method, characterized in that, The programmable logic controller program management method includes the following steps: Target reference data is determined based on the program information of the target programmable logic controller, and whether online modification is required is detected based on the target reference data and the preset download program data. If online modification is required, the target reference data is modified online based on the downloaded program data to obtain modified reference data, and the reference count value corresponding to the modified reference data is determined. The modified reference data is used as new reference data, and the reference count value and the new reference data are stored in memory for online modification by the program. The step of determining the target reference data based on the program information of the target programmable logic controller includes: Read the program information of the target programmable logic controller and determine the corresponding program identifier based on the program information; The program identifier is used to search for reference data in memory that matches the program identifier as target reference data, wherein the memory stores the most recent reference data of the currently modified programmable logic controller. If no reference data matching the program identifier is found in the memory, then reference data matching the program identifier is searched in the disk as the target reference data. The disk stores the most recent reference data of other programmable logic controllers besides the currently modified programmable logic controller.

2. The programmable logic controller program management method as described in claim 1, characterized in that, After the step of searching the disk for reference data matching the program identifier as the target reference data, the method further includes: The reference data in the memory is loaded into the disk, and the target reference data in the disk is loaded into the memory, so that the target reference data can be modified online in the memory to obtain the modified reference data.

3. The programmable logic controller program management method as described in claim 1, characterized in that, The step of modifying the target reference data online based on the downloaded program data to obtain the modified reference data includes: Identify the modified program in the downloaded program data, and determine the data to be modified corresponding to the modified program in the target reference data; The modified reference data is obtained by modifying the data to be modified according to the modification procedure.

4. The programmable logic controller program management method as described in claim 1, characterized in that, After the step of modifying the target reference data online based on the downloaded program data to obtain the modified reference data, the method further includes: Determine the target reference count value corresponding to the target reference data, and detect whether the target reference count value is 1; If the target reference count is 1, then the target reference data is cleared; If the target reference count value is not 1, then the value obtained by subtracting 1 from the target reference count value is used as the target reference count value corresponding to the target reference data.

5. The programmable logic controller program management method as described in claim 1, characterized in that, The step of determining the reference count value corresponding to the modified reference data includes: Determine the data identifier of the modified reference data, and detect whether there is reference data in memory and / or disk that matches the data identifier, wherein the data identifier refers to the flag corresponding to the data; If it does not exist, then the reference count value corresponding to the modified reference data is determined to be 1; If it exists, determine the count value of the reference data that matches the data identifier, and add 1 to the count value as the reference count value corresponding to the modified reference data.

6. The programmable logic controller program management method as described in claim 1, characterized in that, After the step of modifying the target reference data online based on the downloaded program data to obtain the modified reference data, the method further includes: Obtain program cycle information and detect whether the current time point matches the gap time point in the program cycle information; If a match is found, the modified reference data is sent to the corresponding programmable logic controller.

7. A programmable logic controller (PLC) program management device, characterized in that, The programmable logic controller program management device includes: The detection module is used to determine target reference data based on the program information of the target programmable logic controller (PLC), and to detect whether online modification is required based on the target reference data and preset downloaded program data; read the program information of the target PLC, and determine the corresponding program identifier based on the program information; search for reference data matching the program identifier in memory as the target reference data, wherein the memory stores the most recent reference data of the currently modified PLC; if no reference data matching the program identifier exists in memory, then search for reference data matching the program identifier in disk as the target reference data, wherein the disk stores the most recent reference data of other PLCs besides the currently modified PLC; The first processing module is used to modify the target reference data online according to the downloaded program data to obtain modified reference data if online modification is required, and to determine the reference count value corresponding to the modified reference data. The second processing module is used to use the modified reference data as new reference data, and to store the reference count value and the new reference data in memory for online modification by the program.

8. A programmable logic controller (PLC) program management device, characterized in that, The programmable logic controller (PLC) program management device includes: a memory, a processor, and a PLC program management program stored in the memory and executable on the processor. When the PLC program management program is executed by the processor, it implements the steps of the PLC program management method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium stores a programmable logic controller (PLC) program management program, which, when executed by a processor, implements the steps of the PLC program management method as described in any one of claims 1 to 6.