Online downloading method and related equipment

By obtaining and comparing the memory description information of the PLC, generating data copy functions and description information generation codes, the problems of data disorder and jitter during online download in the prior art are solved, and more flexible and stable compiled data updates are achieved.

CN119758864AActive Publication Date: 2025-04-04SHENZHEN LEAD CNC SYST +1
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411948896.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-04-04
Estimated Expiration
2044-12-27

AI Technical Summary

Technical Problem

The compilation of compiled data during online download of the existing technology is not flexible enough, resulting in data confusion and jitter, affecting the stability of real-time control.

Method used

By obtaining the memory description information of the programmable logic controller PLC, comparing the local storage information with the PLC information, generating data copy functions and description information generation code, updating the compiled data, realizing the flexibility and stability of online downloads.

Benefits of technology

Reduces data jitter and disorder during compilation data replacement, and improves system flexibility and stability of real-time control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119758864A_ABST
    Figure CN119758864A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an online downloading method and related equipment, which are used for describing data by utilizing a memory so as to reduce the problems of data jitter and disorder caused by compiling data replacement. The method provided by the embodiment of the invention comprises the following steps: after a project downloading instruction of a user from a programmable logic controller (PLC) is received, acquiring memory description information of the PLC; comparing whether the locally stored memory description information is the same as the memory description information of the PLC or not; if the locally stored memory description information is different from the memory description information of the PLC, compiling and generating a data copy function and description information generation codes according to the locally stored memory description information, and obtaining modified compiled data; and when the PLC loads the modified compiled data to the memory storage space and the current scheduling task of the PLC for the compiled data is completed, calling a data copy function, updating a current storage address pointed by the current scheduling task of the PLC, loading description information to generate a code, and completing downloading of the PLC project.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of programmable logic controllers, and in particular to an online downloading method and related equipment. Background Art

[0002] In the current programmable logic controller (PLC) solution, the user project can be edited using the PLC programming software, so that the compiled data generated after editing can be obtained. The compiled data is then downloaded to the PLC and run on the PLC, and the PLC loads and executes the logic. When downloading online, the PLC can continue to run without stopping the logic execution of the user project. The programming software downloads the new compiled data at the same time, and the new compiled data is synchronously loaded when the PLC is running, and then the running logic is replaced to achieve the purpose of online downloading.

[0003] However, in the case of online download, the comparison of compiled data is not flexible enough, and after multiple modifications, it is easy to cause data confusion and limit downloading. At the same time, it is also easy to cause jitter when compiling data is replaced, which is not allowed in real-time control. Summary of the invention

[0004] The embodiments of the present application provide an online download method and related equipment for utilizing memory description data to reduce data jitter and confusion problems caused by replacement of compiled data.

[0005] A first aspect of an embodiment of the present application provides an online download method, which is applied to a programming platform, and the method includes:

[0006] After receiving a project download instruction from a user on a programmable logic controller (PLC), obtaining memory description information of the PLC; wherein the memory description information is used to characterize address distribution information of compiled data when the PLC runs the PLC project;

[0007] Comparing the locally stored memory description information with the memory description information of the PLC to see if they are the same;

[0008] If there is a difference between the locally stored memory description information and the PLC memory description information, compile and generate a data copy function and a description information generation code according to the locally stored memory description information, and generate modified compiled data;

[0009] When the PLC loads the modified compiled data into the memory storage space and the PLC completes the current scheduling task for the compiled data, the data copy function is called and the current storage address pointed to by the current scheduling task of the PLC is updated, so that the PLC loads the description information to generate code and completes the download of the PLC project.

[0010] Optionally, comparing whether the locally stored memory description information is the same as the memory description information of the PLC includes:

[0011] Analyze the memory description information of the PLC to obtain data type information of the compiled data and a memory storage address of the memory storage space; wherein the memory storage address is used to point to the memory address position of any variable in the compiled data;

[0012] Comparing whether the address position of any variable pointed to by the local storage address in the locally stored memory description information is the same as the memory address position;

[0013] and / or, comparing the data type information of the locally stored memory description information to determine whether it is the same as the data type information of the memory description information of the PLC;

[0014] If they are not the same, the steps of compiling and generating a data copy function and a description information generation code according to the locally stored memory description information and obtaining the modified compiled data are executed.

[0015] Optionally, compiling and generating a data copy function and a description information generation code according to the memory description information of the PLC includes:

[0016] In combination with the locally stored memory description information, the memory storage address and the data type information in the memory description information of the PLC are compiled to generate the description information generation code; wherein the description information generation code is used to represent the program code for the address distribution information in the compiled data;

[0017] Generate code according to the description information, and compile to generate the data copy function.

[0018] Optionally, obtaining the modified compiled data includes:

[0019] Based on the locally stored memory description information, the memory description information of the PLC in the compiled data is parsed, and a code is generated according to the description information to modify the parsed compiled data to generate the modified compiled data.

[0020] Optionally, before calling the data copy function, the method further includes:

[0021] Based on the current scheduling task, an engineering update instruction is issued to control the PLC to enter an update state;

[0022] When the PLC enters the update state and the scheduling task of the PLC executing the compiled data of the PLC project is completed, the task state of the current scheduling task is marked as an idle state;

[0023] When the task states of all currently scheduled tasks are the idle state, the replacement state is entered, and the step of calling the data copy function is executed.

[0024] Optionally, calling the data copy function and updating the current storage address pointed to by the current scheduling task of the PLC according to the address distribution information in the locally stored memory description information to load the description information to generate code and complete the download of the PLC project, including:

[0025] Calling the data copy function to adjust the memory data of the PLC according to the modified memory description information of the PLC; wherein the memory data is used to describe the running data of the modified compiled data when the PLC is running;

[0026] The current storage address pointed to by the current scheduling task of the PLC is replaced with the code address of the description information generation code in the memory storage space to load the description information generation code.

[0027] Optionally, after the description information is loaded to generate the code, the method further includes:

[0028] When all description information generation codes and all locally stored memory description information are replaced in the PLC, the update state is exited and the download of the PLC project is terminated.

[0029] A second aspect of an embodiment of the present application provides an online download system, including:

[0030] An acquisition unit is used to acquire memory description information of a programmable logic controller (PLC) after receiving a project download instruction from a user; wherein the memory description information is used to characterize address distribution information of compiled data when the PLC runs a PLC project;

[0031] A comparison unit, used to compare whether the locally stored memory description information is the same as the memory description information of the PLC;

[0032] A generating unit, configured to compile and generate a data copy function and a description information generating code according to the locally stored memory description information when there is a difference between the locally stored memory description information and the memory description information of the PLC, and to generate modified compiled data;

[0033] A calling unit is used to call the data copy function when the PLC loads the modified compiled data into the memory storage space and the PLC completes the current scheduling task for the compiled data, and updates the current storage address pointed to by the current scheduling task of the PLC, so that the PLC loads the description information to generate code and completes the download of the PLC project.

[0034] The online downloading system provided in the second aspect of the embodiment of the present application is used to execute the online downloading method described in the first aspect.

[0035] A third aspect of the embodiments of the present application provides an online downloading device, including:

[0036] CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply;

[0037] The memory is a short-term storage memory or a persistent storage memory;

[0038] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the online downloading method described in the first aspect.

[0039] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes instructions. When the instructions are executed on a computer, the computer executes the online downloading method described in the first aspect.

[0040] A fifth aspect of the embodiments of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer, the computer executes the online downloading method described in the first aspect.

[0041] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: through an online download method disclosed in the embodiments of the present application, the memory description data is separated from the compiled data, thereby improving the flexibility of the system. Furthermore, by comparing the memory description data, only the difference before the modification and the final modification needs to be compared, and the intermediate modifications are ignored. At the same time, the code can also be updated in real time without being affected when downloading the compiled data. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.

[0043] Figure 1 A logic schematic diagram for online download disclosed in an embodiment of the present application;

[0044] Figure 2 A schematic diagram of a flow chart of an online downloading method disclosed in an embodiment of the present application;

[0045] Figure 3 A flowchart of another online downloading method disclosed in an embodiment of the present application;

[0046] Figure 4 A flowchart of another online downloading method disclosed in an embodiment of the present application;

[0047] Figure 5 A schematic diagram of a flow chart of another online downloading method disclosed in an embodiment of the present application;

[0048] Figure 6 A schematic diagram of the structure of an online download system disclosed in an embodiment of the present application;

[0049] Figure 7 A schematic diagram of the structure of an online downloading device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0050] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0051] Combined with the above background technology, the existing technical means mainly have the problem that the comparison of compiled data is not flexible enough, and after multiple modifications, it is easy to cause data confusion and limit downloading. In addition, it is easy to cause jitter when replacing. In order to solve the above technical problems, please refer to Figure 1 , Figure 1 A logic schematic diagram for online download disclosed in an embodiment of the present application.

[0052] Depend on Figure 1As shown, the user can compile the user project running on the PLC on the programming software (installed on the programming program platform), and then generate compilation data and memory description data on the compilation software, and the memory description data is part of the compilation data. Then, the compilation software sends the compilation data to the PLC device through a communication connection. The PLC device can translate the compilation data into engineering data (data of the user project executing the PLC, which can be stored and synchronized in real time on the PLC device) during operation, and then run based on the engineering data. At the same time, when the PLC is running, the operation data during the actual operation process can also be obtained, that is, various signals generated by the PLC operation, etc., which are not limited here.

[0053] Specifically, in the technical solution of the present application, the compilation software can be a Leadsys software, which is a programming software for writing and debugging PLC programs and is installed in the upper computer. The PLC device is a digital electronic device with a microprocessor, a digital logic controller for automatic control, which can load control instructions into the memory for storage and execution at any time and is installed in the lower computer. The programmable controller is modularly composed of an internal CPU, instruction and data memory, input and output units, power supply modules, digital simulation and other units. In the technical solution of the present application, the Leadsys software and the PLC program are connected to each other in communication. Furthermore, a local engineering file service is provided in the Leadsys software, and the engineering file service specifically refers to a means of implementing file reading, writing, checking or saving. For the convenience of description, it will not be repeated later. In addition, when the compilation information file corresponding to the PLC device is not saved on the local device.

[0054] To achieve Figure 1 See the logic diagram shown in Figure 2 , Figure 2 This is a flow chart of an online downloading method disclosed in an embodiment of the present application, including steps 201 to 204.

[0055] 201. After receiving a project download instruction from a user on a programmable logic controller (PLC), obtain memory description information of the PLC.

[0056] In this embodiment, after the programming platform receives the project download instruction uploaded by the user in the PLC device, the programming platform can obtain the memory description information of the PLC stored in the PLC device. It should be noted that the memory description information is used to characterize the address distribution information of the compiled data when the PLC runs the PLC project.

[0057] In one of the specific embodiments, after the user successfully logs in to the PLC, the relevant PLC project may need to be modified later. Furthermore, when the user opens the project file on the programming software (the file opened and modified by the programming software), the relevant project download command can be sent to the PLC, so that the PLC generates the relevant project download instruction according to the project download command, thereby starting the project download service. It should be noted that in this embodiment, the project download command is to command the PLC to perform the project download operation. Among them, the PLC can download the project data of the currently running PLC project and upload it to the programming program platform (which can be consulted or compiled on the programming software). Among them, the compilation software can monitor the operating status and data of the current PLC in real time.

[0058] Furthermore, in combination with the above Figure 1 As shown, the project data also includes the memory description information of the PLC. The memory description information can compare the memory data distribution of the previous and next user projects, and calculate the new data arrangement method through an algorithm. In one of the feasible technical solutions, the memory description data includes the data type definition, the address location of each variable and other information, which is not limited here.

[0059] 202. Compare the locally stored memory description information with the PLC memory description information to see if they are the same.

[0060] Furthermore, it is possible to compare whether the memory description information stored locally in the programming platform is the same as the memory description information of the PLC.

[0061] In one specific embodiment, since the memory description information can use a string to describe the variable and type information, the difference between the variable and type information can be used as a comparison between the locally stored memory description information and the PLC memory description information. Figure 3 The embodiment shown.

[0062] 203. If there is a difference between the locally stored memory description information and the PLC memory description information, compile and generate a data copy function and a description information generation code according to the locally stored memory description information, and generate modified compiled data.

[0063] Therefore, when there is a difference between the locally stored memory description information and the PLC memory description information, a data copy function and a description information generation code can be compiled based on the locally stored memory description information, and modified compiled data can be generated.

[0064] In one of the specific embodiments, in the process of comparing the locally stored memory description information with the memory description information of the PLC, if it is found that there is a difference in the description variable or type information, it can be determined that there is a difference between the memory description information of the local storage and the PLC. Therefore, if the complete compilation data (which can also be understood as engineering data, because the data is ultimately run in the PLC project) is to be compiled, it is necessary to compile the difference between the locally stored memory description information and the memory description information of the PLC. Among them, the compiled data is composed of multiple data segments, such as code segments, text segments, program segments, configuration segments, or data segments describing objects. However, for the memory description information, it mainly represents the variables or type information of the compiled data, and then, the content of the memory description information is mainly located in the code segment. Thus, the difference part of the memory description information can be compiled, so as to compile the generated description information generation code and the data copy function corresponding to the generated code.

[0065] Furthermore, in other feasible technical solutions, the method for obtaining the modified compiled data can be referred to Figure 4 The embodiments shown are not described in detail here.

[0066] 204. When the PLC loads the modified compiled data into the memory storage space and the PLC completes the current scheduling task for the compiled data, the data copy function is called and the current storage address pointed to by the current scheduling task of the PLC is updated, so that the PLC loads the description information to generate the code and completes the download of the PLC project.

[0067] Then, when the PLC loads the modified compiled data into the memory storage space and the current scheduling task of the PLC for the compiled data is completed, the PLC can call the data copy function in the compiled data to update the current storage address pointed to by the current scheduling task of the PLC, thereby enabling the PLC to load the description information generation code and complete the download of the PLC project. Among them, the current storage address pointed to by the current scheduling task is the modified memory code segment of the PLC, and the code segment is part of the description information generation code.

[0068] In one of the specific embodiments, after the PLC receives the modified compiled data issued by the programming platform, the modified compiled data will be stored in the memory storage space of the PLC. Then, the programming platform can prepare the International Electrotechnical Commission (IEC) task, which can be understood as a scheduling task in this embodiment. In this embodiment, the IEC task needs to load a new code segment. Among them, the code segment belongs to a part of the description information generation code. Specifically, when the PLC downloads the new compiled data, because the original PLC project may still be running on the original IEC task, the new IEC task can first handle the loading of the code. Thus, after the original IEC task scheduling is completed, the data copy function issued by the programming platform can be scheduled, and then the pointer of the program organization unit (POU, Programming Organisation Unit) of the new IEC task can be updated, and then the relevant function address can be updated or modified, so that the PLC loads the difference between the locally stored memory description information and the memory description information of the PLC, that is, the description information generation code (further, it can be understood as loading the modified compiled data, one is incremental download, and the other is full download). It should be noted that the pointer of the POU refers to the function address, which is also the address of the execution code. One POU corresponds to one function, and each function has an address (pointer).

[0069] Through the online download method disclosed in this embodiment, the memory description data and the compilation data are separated, thereby improving the flexibility of the system. Furthermore, by comparing the memory description data, only the difference before the modification and the final modification need to be compared, and the intermediate modifications are ignored. At the same time, the code can also be updated in real time without being affected when downloading the compilation data.

[0070] Furthermore, since the embodiment of the present application adds memory description information, it is necessary to additionally compare the memory data distribution of the PLC project before and after. Figure 3 , Figure 3 This is a flow chart of another online downloading method disclosed in an embodiment of the present application, including steps 301 to 304.

[0071] 301. Analyze the memory description information of the PLC to obtain the data type information of the compiled data and the memory storage address of the memory storage space.

[0072] Combined with the above Figure 2As shown, the memory description information of the PLC can be analyzed to obtain the data type information of the compiled data and the memory storage address of the memory storage space. It should be noted that the memory storage address is used to point to the memory address position of any variable in the compiled data.

[0073] In one specific embodiment, the memory description data is analyzed separately in this embodiment, specifically, the data type information contained in the memory description information and the memory storage address of the memory storage space pointed to by the memory description information can be analyzed. The memory storage address points to the address information of each variable.

[0074] 302. Compare the address position of any variable pointed to by the local storage address in the locally stored memory description information to see whether it is the same as the memory address position.

[0075] Furthermore, in combination with step 301, in one of the feasible technical solutions, it is possible to compare whether the address position of any variable pointed to by the local storage address in the locally stored memory description information is the same as the memory address position.

[0076] In one specific embodiment, the address position of the variable pointed to by the local storage address can be analyzed to see whether it is the same as the address position of the variable pointed to by the memory storage address (PLC), and if there is a difference, step 304 is executed. If the two are the same, there is no need to modify the memory description information at this time.

[0077] Specifically, by analyzing the address location information of the variable address stored locally in the programming program platform and the memory description information stored in the memory of the PLC, it is determined whether there is a difference between the two.

[0078] In addition, since the memory description information is a text-based description format, rather than just address information, there may be other description information content, and thus, the intermediate modifications can be ignored, and only the difference before and after the modification needs to be compared. Furthermore, the description file can also be replaced by JSON or XML, which is not limited here.

[0079] 303. Compare the data type information of the locally stored memory description information to see whether it is the same as the data type information of the PLC memory description information.

[0080] In contrast to step 302 , the data type information of the locally stored memory description information may also be compared to see whether it is the same as the data type information of the PLC memory description information.

[0081] In one of the specific embodiments, by analyzing the object description data of the program object of the PLC project in the memory description information, or the data type of the description object such as the logical description data of the logical function and the logical object, it can also be the description format of the text segment of the program code and other format types, which will not be described in detail here. Then, when there is a difference in data type information between the locally stored memory description information and the PLC memory description information, it can be determined that there is a difference in one or more of the text segment, program segment, configuration segment or data segment of the compiled data, and then step 304 is executed.

[0082] Furthermore, if the two are the same, there is no need to modify the memory description information at this time.

[0083] 304. In combination with the locally stored memory description information, the memory storage address and data type information in the memory description information of the PLC is compiled to generate a description information generation code, and the code is generated according to the description information to compile and generate a data copy function.

[0084] Then, the memory storage address and data type information in the memory description information of the PLC can be compiled in combination with the locally stored memory description information, thereby generating a description information generation code. At the same time, the description information generation code can also be compiled to generate a data copy function. It should be noted that the description information generation code is used to represent the program code for the address distribution information in the compiled data.

[0085] In one specific embodiment, the locally stored memory description information can be combined, and then the difference between the PLC memory description information and the locally stored memory description information can be compiled. Specifically, the locally stored memory description information can be combined with the memory storage address in the PLC memory description information and the data type information that differs between the two to compile, and then compile to generate the description information generation code.

[0086] Furthermore, the code is generated by describing the information, and the address of the generated code and the storage address pointing to the relevant compiled data are determined, thereby generating a data copy function.

[0087] In other feasible technical solutions, the address pointed to by the compiled data may not be changed, so a data copy function may also be generated based on the memory description information of the PLC (the original memory description data).

[0088] Through an online download method disclosed in this embodiment, variables and type information can be described in string form as a comparison between the previous and subsequent states. At the same time, the description file can also be replaced by JSON or XML. Furthermore, the memory description data is separated, which improves the flexibility of the system. A text-based description format is used instead of only address information, and intermediate modifications can be ignored. Only the difference before and after the modification needs to be compared, which improves the feasibility of the solution.

[0089] Combined with the above Figure 2 and Figure 3 , because the compiled data also contains memory description data, the way the compiled data is generated also changes, see Figure 4 , Figure 4 This is a flow chart of another online downloading method disclosed in an embodiment of the present application, including step 401.

[0090] 401. Based on the locally stored memory description information, the memory description information of the PLC in the compilation data is parsed, and a code is generated according to the description information to modify the parsed compilation data to generate modified compilation data.

[0091] It should be noted that the modified compiled data in this embodiment can be obtained by modifying the compiled data, the description information generation code and the locally stored memory description information by the programming program platform.

[0092] In one specific embodiment, the memory description information of the PLC in the original compiled data is parsed through the locally stored memory description information, and then, a code is generated according to the description information to modify the address of the PLC project pointed to in the parsed compiled data, thereby obtaining the modified compiled data.

[0093] Furthermore, in this embodiment, the generation method of the compiled data is similar to the conventional method, and the specific details are not repeated here. However, since the memory description information belongs to the compiled data, the obtained compiled data (derived from the PLC) can be modified by the difference between the locally stored memory description information and the memory description information of the PLC, and the address positions of various functions or variables can be adjusted. In addition, since the memory description information can compare the memory data distribution of the PLC project, the arrangement of the new data can be calculated by an algorithm, and the latest arrangement can be used to generate the description information generation code, thereby modifying or replacing the original compiled data, thereby obtaining the modified compiled data.

[0094] In other feasible technical solutions, when modifying or replacing the original compiled data, the local memory description information can also be adjusted in order according to the memory description information of the PLC. For example, the memory description information of the PLC contains variable objects A, variable objects B, variable objects C and their order, while the variable objects in the local memory description information are in the order of B, A, C. Then the variable objects B, A, C in the local memory description information will be adjusted in order to A, B, C.

[0095] Through an online download method disclosed in this embodiment, compiled data after adding memory description data can be obtained, and the original compiled data can be replaced, thereby improving the feasibility of the solution.

[0096] Furthermore, combined with the above Figure 2 , Figure 3 and Figure 4 , during the download of new compilation data, refer to Figure 5 , Figure 5 This is a flow chart of another online downloading method disclosed in an embodiment of the present application, including steps 501 to 504.

[0097] 501. Issue an engineering update instruction based on the current scheduling task to control the PLC to enter an update state.

[0098] It should be noted that in this embodiment, steps 501 to 504 are performed after the PLC receives the modified compiled data. Specifically, the programming platform issues an engineering update instruction based on the current scheduling task to control the PLC to enter the update state.

[0099] In one specific embodiment, the programming program platform can first set the PLC scheduling task, and then determine the loading data of subsequent compilation data through the scheduling task, or the running order of the corresponding PLC project (when the PLC runs the compilation data, the compilation data can also be called project data).

[0100] Furthermore, the programming platform can prepare an IEC task, that is, prepare to load a new code segment (the content of the compiled code segment). The new code segment is the modified compiled data. Since the PLC mainly runs in binary code during operation, the compiled data needs to be translated into a binary code, and the specific translation process is not described in detail here.

[0101] 502. When the PLC enters the update state and the scheduling task of the PLC executing the compiled data of the PLC project is completed, the task state of the current scheduling task is marked as an idle state.

[0102] Then, after preparing the IEC task, the PLC enters the update state. At this time, the PLC will execute the original scheduling task of the PLC project, specifically loading the compiled data that has not been loaded in the previous compilation data, that is, executing the original PLC project (real-time task). Then, after the PLC completes the original PLC project, each real-time task will mark the post-mark of the latest set IEC task, that is, the task state, as idle after scheduling is completed.

[0103] It should be noted that the real-time task does not need to be stopped during the execution of the switching code, that is, after each real-time task is scheduled, the task state of the IEC task associated with the real-time task can be marked as idle. For example, for tasks with high real-time requirements such as motion control and bus communication, the IEC task also needs to set a corresponding execution process. Furthermore, in the real-time tasks of the original PLC project, a certain motion control is executed, at this time, the task state corresponding to the motion control in the IEC task can be marked as idle.

[0104] 503. When the task status of all currently scheduled tasks is idle, enter the replacement state, call the data copy function, adjust the PLC's memory data according to the modified PLC's memory description information, and replace the current storage address pointed to by the PLC's current scheduled task with the code address of the description information generation code in the memory storage space to load the description information generation code.

[0105] Furthermore, when the task status of all currently scheduled tasks is in the idle state, the replacement state can be entered. At this time, the data copy function is called to adjust the memory data of the PLC according to the modified memory description information of the PLC, and the current storage address pointed to by the current scheduled task of the PLC is replaced with the code address of the description information generation code in the memory storage space, thereby loading the description information generation code. It should be noted that the memory data is used to describe the running data of the modified compiled data when the PLC is running. In other words, the memory data is the real-time running data in the PLC.

[0106] In one specific embodiment, after the task status of all currently scheduled tasks in the PLC is in the idle state, the replacement state can be entered. Specifically, the data copy function can be called to determine the code address of the description information generation code pointing to the new code segment in the memory storage space, thereby replacing the code address of the code segment pointed to in the pre-set IEC task with the code address of the new code segment, so that the PLC loads the description generation code, that is, runs the new PLC project.

[0107] Specifically, it can be understood that by calling the data copy function, the memory data of the PLC is copied to the correct memory data according to the modified memory description information (in the PLC). Among them, the engineering data (compiled data) is the data required when the PLC is running, and it is static on the disk. The memory data is initialized by the engineering data, stored in the memory, and is data that will change with the operation of the PLC. Combined with the above changes, thus, the task with low real-time performance can receive the jitter caused by data copying. It can also be understood that in the process of replacing all real-time tasks, since the data operation or storage requires a spatial address, the POU pointer of the IEC task is updated, so that in the data replacement process, only the data address of the required referenced data needs to be replaced, and the data replacement can be completed. In this embodiment, the data with high real-time requirements can be arranged in a fixed position. When the data with high real-time requirements is used in other tasks with low real-time performance, the reference method is used, which can not only quickly copy the data, but also ensure data security.

[0108] 504. When all description information generation codes and all locally stored memory description information are replaced in the PLC, the update state is exited and the download of the PLC project is terminated.

[0109] Then, when all description information generation codes and all locally stored memory description information are replaced in the PLC, the update state is exited and the download of the PLC project is terminated.

[0110] In one specific embodiment, when all currently scheduled tasks are completed, that is, when all description information generation codes and all locally stored memory description information are replaced in the PLC, the update state can be exited, thereby ending the download of the PLC project.

[0111] Furthermore, in other feasible technical solutions, the replacement process may time out, or the update state may be exited and the download of the PLC project may be terminated, which will not be described in detail here.

[0112] By using an online download method disclosed in this embodiment, global replacement is adopted to reduce the operation logic error problem caused by data inconsistency caused by data copying. At the same time, the memory copy problem of the real-time task is solved by using the memory reference method, that is, there is no need to copy this part of the data. The real-time requirement can be guaranteed without stopping the real-time task, which improves the feasibility of the solution.

[0113] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0114] See also Figure 6 , Figure 6 A schematic diagram of the structure of an online download system disclosed in an embodiment of the present application.

[0115] The acquisition unit 601 is used to acquire the memory description information of the programmable logic controller (PLC) after receiving the project download instruction from the user; wherein the memory description information is used to represent the address distribution information of the compiled data of the PLC running the PLC project;

[0116] A comparison unit 602 is used to compare whether the locally stored memory description information is the same as the memory description information of the PLC;

[0117] A generating unit 603 is used to compile and generate a data copy function and a description information generation code according to the locally stored memory description information when there is a difference between the locally stored memory description information and the PLC memory description information, and to generate modified compiled data;

[0118] The calling unit 604 is used to call the data copy function when the PLC loads the modified compiled data into the memory storage space and the PLC completes the current scheduling task for the compiled data, and updates the current storage address pointed to by the current scheduling task of the PLC, so that the PLC loads the description information to generate code and completes the download of the PLC project.

[0119] Exemplarily, the system further includes: an analysis unit 605 and an execution unit 606;

[0120] The analyzing unit 605 is used to analyze the memory description information of the PLC to obtain the data type information of the compiled data and the memory storage address of the memory storage space; wherein the memory storage address is used to point to the memory address position of any variable in the compiled data;

[0121] The comparison unit 602 is specifically used to compare whether the address position of any variable pointed to by the local storage address in the locally stored memory description information is the same as the memory address position;

[0122] And / or, the comparison unit 602 is further used to compare the data type information of the locally stored memory description information to see whether it is the same as the data type information of the memory description information of the PLC;

[0123] If they are not the same, the execution unit 606 is used to execute the steps of compiling and generating a data copy function and a description information generation code according to the locally stored memory description information, and obtaining the modified compiled data.

[0124] Exemplarily, the system further includes: a compiling unit 607;

[0125] A compiling unit 607 is used to compile the memory storage address and data type information in the memory description information of the PLC in combination with the locally stored memory description information to generate a description information generation code; wherein the description information generation code is used to represent the program code for the address distribution information in the compiled data;

[0126] The compiling unit 607 is further used to generate codes according to the description information, and compile and generate a data copy function.

[0127] Exemplarily, the system further includes: a parsing unit 608;

[0128] The parsing unit 608 is used to parse the memory description information of the PLC in the compiled data based on the locally stored memory description information, and to modify the parsed compiled data by generating codes according to the description information to generate modified compiled data.

[0129] Exemplarily, the system further includes: a control unit 609 and a marking unit 610;

[0130] The control unit 609 is used to issue an engineering update instruction based on the current scheduling task to control the PLC to enter the update state;

[0131] The marking unit 610 is used to mark the task state of the current scheduling task as an idle state when the PLC enters the update state and the scheduling task of the PLC executing the compiled data of the PLC project is completed;

[0132] The execution unit 606 is further configured to enter a replacement state and execute a step of calling a data copy function when the task states of all currently scheduled tasks are in an idle state.

[0133] Exemplarily, the system includes:

[0134] The calling unit 604 is specifically used to call the data copy function to adjust the memory data of the PLC according to the modified memory description information of the PLC; wherein the memory data is used to describe the running data of the modified compiled data when the PLC is running;

[0135] The generating unit 603 is specifically used to replace the current storage address pointed to by the current scheduling task of the PLC with the code address of the description information generation code in the memory storage space, so as to load the description information generation code.

[0136] Exemplarily, the system further includes:

[0137] The execution unit 606 is also used to exit the update state and terminate the download of the PLC project when all description information generation codes and all locally stored memory description information are replaced in the PLC.

[0138] See below Figure 7 , a schematic diagram of the structure of an online downloading device disclosed in an embodiment of the present application includes:

[0139] CPU 701, memory 705, input / output interface 704, wired or wireless network interface 703 and power supply 702;

[0140] The memory 705 is a temporary storage memory or a permanent storage memory;

[0141] The CPU 701 is configured to communicate with the memory 705 and execute the instructions in the memory 705 to perform the aforementioned Figures 2 to 5 The online downloading method in any of the illustrated embodiments.

[0142] The embodiment of the present application also provides a chip system, the chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected through a line, and the at least one processor is used to run a computer program or instruction to execute the aforementioned Figures 2 to 5 The online downloading method in any of the illustrated embodiments.

[0143] The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium includes instructions, when the instructions are executed on a computer, the computer executes the aforementioned Figures 2 to 5 The online downloading method in any of the illustrated embodiments.

[0144] The present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the aforementioned Figures 2 to 5 The online downloading method in any of the illustrated embodiments.

[0145] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0146] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0147] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0148] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0149] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.

Claims

1. An online downloading method, characterized in that: Applied to a programming platform, the method comprises: After receiving a project download instruction from a user on a programmable logic controller (PLC), obtaining memory description information of the PLC; wherein the memory description information is used to characterize address distribution information of compiled data when the PLC runs the PLC project; Comparing the locally stored memory description information with the memory description information of the PLC to see if they are the same; If there is a difference between the locally stored memory description information and the PLC memory description information, compile and generate a data copy function and a description information generation code according to the locally stored memory description information, and generate modified compiled data; When the PLC loads the modified compiled data into the memory storage space and the PLC completes the current scheduling task for the compiled data, the data copy function is called and the current storage address pointed to by the current scheduling task of the PLC is updated, so that the PLC loads the description information to generate code and completes the download of the PLC project.

2. The online downloading method according to claim 1, characterized in that: The comparing whether the locally stored memory description information is the same as the memory description information of the PLC includes: Analyze the memory description information of the PLC to obtain data type information of the compiled data and a memory storage address of the memory storage space; wherein the memory storage address is used to point to the memory address position of any variable in the compiled data; Comparing whether the address position of any variable pointed to by the local storage address in the locally stored memory description information is the same as the memory address position; and / or, comparing the data type information of the locally stored memory description information to determine whether it is the same as the data type information of the memory description information of the PLC; If they are not the same, the steps of compiling and generating a data copy function and a description information generation code according to the locally stored memory description information and obtaining the modified compiled data are executed.

3. The online downloading method according to claim 2, characterized in that: The step of compiling and generating a data copy function and a description information generation code according to the memory description information of the PLC includes: In combination with the locally stored memory description information, the memory storage address and the data type information in the memory description information of the PLC are compiled to generate the description information generation code; wherein the description information generation code is used to represent the program code for the address distribution information in the compiled data; Generate code according to the description information, and compile to generate the data copy function.

4. The online downloading method according to claim 1, characterized in that: The obtaining of the modified compiled data includes: Based on the locally stored memory description information, the memory description information of the PLC in the compiled data is parsed, and a code is generated according to the description information to modify the parsed compiled data to generate the modified compiled data.

5. The online downloading method according to claim 1, characterized in that: Before calling the data copy function, the method further includes: Based on the current scheduling task, an engineering update instruction is issued to control the PLC to enter an update state; When the PLC enters the update state and the scheduling task of the PLC executing the compiled data of the PLC project is completed, the task state of the current scheduling task is marked as an idle state; When the task states of all currently scheduled tasks are the idle state, the replacement state is entered, and the step of calling the data copy function is executed.

6. The online downloading method according to claim 5, characterized in that: The calling of the data copy function and updating the current storage address pointed to by the current scheduling task of the PLC according to the address distribution information in the locally stored memory description information to load the description information to generate code and complete the download of the PLC project include: Calling the data copy function to adjust the memory data of the PLC according to the modified memory description information of the PLC; wherein the memory data is used to describe the running data of the modified compiled data when the PLC is running; The current storage address pointed to by the current scheduling task of the PLC is replaced with the code address of the description information generation code in the memory storage space to load the description information generation code.

7. The online downloading method according to claim 6, characterized in that: After the description information is loaded to generate the code, the method further includes: When all description information generation codes and all locally stored memory description information are replaced in the PLC, the update state is exited and the download of the PLC project is terminated.

8. An online downloading system, characterized in that: Applied to a programming platform, the system comprises: An acquisition unit is used to acquire memory description information of a programmable logic controller (PLC) after receiving a project download instruction from a user; wherein the memory description information is used to characterize address distribution information of compiled data when the PLC runs a PLC project; A comparison unit, used to compare whether the locally stored memory description information is the same as the memory description information of the PLC; A generating unit, configured to compile and generate a data copy function and a description information generating code according to the locally stored memory description information when there is a difference between the locally stored memory description information and the memory description information of the PLC, and to generate modified compiled data; A calling unit is used to call the data copy function when the PLC loads the modified compiled data into the memory storage space and the PLC completes the current scheduling task for the compiled data, and updates the current storage address pointed to by the current scheduling task of the PLC, so that the PLC loads the description information to generate code and completes the download of the PLC project.

9. An online downloading device, characterized in that: The device comprises: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a transient storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the online downloading method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes instructions, and when the instructions are executed on a computer, the computer executes the online downloading method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for compiling PLC (Programmable Logic Controller) program code into WebAssembly code

    CN114661300A

  • PLC program compiling method and device based on array mapping memory address

    CN117806607A

  • Online login method and related equipment

    CN119166156A

  • Memory comparison of a programmable logic controller

    DE102021112165A1

  • Programmable controller system, and support device and program thereof

    JP2015022511A