PLC incremental compiling method of BS architecture based on PLCope standard
By adopting the incremental compilation method based on the PLCopen standard in PLC programming, analyzing and compiling the changing parts of the PLC program, the problem of low compilation efficiency of traditional PLC is solved, programming and debugging efficiency is improved, compilation time is reduced, and the system is maintained stability and compatibility.
Patent Information
- Application Number
- CN202411298331.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-10
AI Technical Summary
Traditional PLC compilation methods have problems with incompile efficiency, especially under the browser-server architecture, which leads to long response time and affects user experience and system operation.
Using the incremental compilation method based on the PLCopen standard, through communication between the client IDE and the compilation server, the PLCopen XML specification and the IEC61131-3 programming model analyzes the program's modification content and dependencies, only the changing parts are compiled, and incremental compilation is generated. and link to generate the final execution file.
Significantly improves PLC programming and debugging efficiency, reduces compilation time, saves resources, ensures system stability and compatibility, and is suitable for large-scale projects.
Smart Images

Figure CN119292605A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of industrial automation, and in particular to a PLC incremental compilation method based on a BS architecture of the PLCcope standard. Background Art
[0002] With the rapid development of industrial automation, PLC (Programmable Logic Controller) has been widely used in various industrial control systems. Traditional PLC programming and debugging usually adopts CS (Client-Server) architecture, which requires the installation of special software on the client. With the development of Internet technology, BS (Browser-Server) architecture has gradually attracted attention due to its advantages of no need for client installation and easy maintenance and management. However, the traditional PLC compilation method usually adopts full compilation, that is, the system will recompile the entire program after each code change. This method has a significant problem of low compilation efficiency, especially under the BS architecture, the response time of the compilation process has a greater impact on user experience and system operation. Although the existing incremental compilation technology has been applied in general software development, in PLC programming, especially under the BS architecture, due to the high requirements of real-time performance and stability, the application of incremental compilation still has technical bottlenecks. And at present, PLC compilation software is basically provided by various PLC manufacturers, and the standards they follow are also different. Therefore, there is an urgent need for an incremental compilation method that can adapt to the characteristics of PLC, follow the unified international standard format, and run efficiently under the BS architecture to improve compilation efficiency and productivity. Summary of the invention
[0003] The technical problem to be solved by the present invention is: based on the problem of low compilation efficiency in the prior art, a PLC incremental compilation method based on the BS architecture of the PLCopee standard is provided to significantly improve the PLC programming development efficiency and debugging efficiency.
[0004] In order to solve the above technical problems, the present invention adopts the following technical solutions:
[0005] A PLC incremental compilation method based on the BS architecture of the PLCope standard includes the following steps:
[0006] S1. Initialize the PLC programming environment, establish a communication connection between the compile server and the client IDE (Integrated Development Environment), and load the relevant libraries and configuration files of the PLCopen XML specification.
[0007] S2. The client IDE formats the user program into a PLCopen XML structure and submits a PLC program compilation request. After receiving the compilation request, the compilation server uses the PLCopen standard format to analyze the program modification content and program dependencies.
[0008] S3. The compile server traverses the user program again according to the dependency relationship obtained in step S2 to determine the content that needs to be recompiled in the current project.
[0009] S4. The compiling server compiles the content that needs to be recompiled, generates intermediate content, and obtains a target file generated by incremental compilation.
[0010] S5. Link the target file generated by the incremental compilation with the target file of the unmodified part to generate a final execution file.
[0011] S6. Send the final executable file to the client IDE as a response to the compilation request.
[0012] S7. The client IDE receives the final executable file, downloads it to the connected PLC device, and starts running it to complete the incremental compilation.
[0013] Furthermore, the client IDE is a PLC programming editor.
[0014] Furthermore, in step S1, the compiling server is started by means of a daemon server, and a designated TCP / IP port is monitored; a TCP / IP persistent connection is established between the client IDE and the compiling server.
[0015] Furthermore, in step S2, analyzing the program modification content and program dependency includes the following sub-steps:
[0016] S201. According to the IEC61131-3 programming model and the PLCopen XML structure, the content of the PLCopen XML standard format of the user program in the current project is divided into three parts, including DUT (User-defined Data Type), all POUs related to the logic program and related configurations; among which, POU includes all functions, function blocks and programs in the current project.
[0017] S202, extract the three parts of XML content in step S201 respectively, and generate corresponding hash values, namely dutHash, pousHash and confHash.
[0018] S203, using the project name of the current project as the compilation directory name, check whether the compilation directory name exists, if not, create the compilation directory, start full compilation, and go to step S6; if it exists, start incremental compilation, and go to step S204.
[0019] S204, read the compilation cache file cache.csv in the current directory, the contents of the file are:
[0020] Hash values of all DUTs, hash values of all POUs, hash values of all related configurations, hash values of user-defined data type names, POUs of user-defined function categories, POUs of user-defined function block categories, POUs of user-defined program categories, and resources in project-related configurations.
[0021] S205. Compare the contents corresponding to the DUT field, POU field and CONFIGURATION field in the compilation cache file cache.csv with dutHash, pousHash and confHash respectively to determine whether the contents in the current project have changed. If changed, recompile and mark.
[0022] S206: Perform secondary judgment according to the marking situation in step S205 to obtain the program modification content and program dependency relationship, the specific content is:
[0023] S2061. When no DUT is marked as changed, it means that all DUTs have not changed, and go to step S2062. When a DUT is marked as changed, parse the PLCopen XML content corresponding to the DUT, compare the hash value corresponding to each data type in the DUT with the hash value in the compilation cache file, and mark whether each data type has changed. If the data type has changed, update the hash value of the data type in the compilation cache file and obtain its dependency.
[0024] S2062. When all POUs related to the unmarked logic program have changed, it means that all POUs related to the logic program and their dependencies have not changed, and go to step S2063; when the marked POU has changed, parse the PLCopen XML content corresponding to each single POU, compare the hash value corresponding to each single POU with the hash value corresponding to the current POU in the compilation cache file, and mark whether the current POU has changed; if the current POU has changed, update its hash value in the compilation cache file and obtain its dependencies; for the changed POU is a function or a function block, compare the interface hash value of the current POU in the compilation cache file with the interface hash value of the POU in the current project to determine whether the interface has changed; compare the function body hash value of the current POU in the compilation cache file with the function body hash value of the POU in the current project to determine whether the function body has changed.
[0025] S2063. When CONFIGURATION changes, parse the PLCopen XML content corresponding to CONFIGURATION, compare the hash value corresponding to each resource in CONFIGURATION with the hash value corresponding to the resource in the compilation cache file, and mark whether the current resource has changed; if the resource has changed, update its hash value in the compilation cache file and obtain its dependency; otherwise, it means that all configuration-related information has not changed.
[0026] S2064. When there is no hash value corresponding to a DUT, POU or resource in the compilation cache file, it means that the DUT, POU or resource is a new addition to the current project. The corresponding hash value and dependency relationship are stored in the compilation cache file, and the current item is marked as changed.
[0027] Furthermore, in step S203, the full compilation includes the following contents:
[0028] Step 1. Save dutHash, pousHash and confHash in the compilation cache file cache.scv.
[0029] Step 2: Parse each user-defined data type in the DUT, calculate its corresponding hash value and the dependency relationship between the current data type and other data types, and save them in the compilation cache file cache.scv; parse each single POU in all POUs related to the logic program, calculate its corresponding hash value and the dependency relationship between each single POU and other POUs and user-defined data types, and save them in the compilation cache file cache.scv; parse all resources in the relevant configuration, obtain the dependency relationship between each resource and the POU, and save them in the compilation cache file cache.scv.
[0030] Step 3: Start the compilation process to generate target files and execution files corresponding to each POU and each resource.
[0031] Furthermore, in step S205, the determination method is:
[0032] Step 1: Record the hash values corresponding to the DUT, all POUs related to the logic program and related configurations in the compilation cache file as dutCacheHash, pousCacheHash and confCacheHash.
[0033] Step 2: Compare dutHash and dutCacheHash to see if they are equal. If they are not equal, it means that the DUT has changed. Then, update dutCacheHash to the current dutHash and mark the DUT as changed. Otherwise, it means that the DUT has not changed.
[0034] Step 3: Compare pousHash and pousCacheHash to see if they are equal. If they are not equal, it means that all POUs related to the logic program have changed. Then, pousCacheHash is updated to the current pousHash, and all POUs related to the logic program are marked as changed. Otherwise, it means that all POUs related to the logic program have not changed.
[0035] Step 4: Compare confHash and confCacheHash to see if they are equal. If they are not equal, it means that the relevant configuration has changed. Then update confCacheHash to the current confHash and mark the relevant configuration as changed. Otherwise, it means that the relevant configuration has not changed.
[0036] Furthermore, in step S3, determining the recompiled content includes the following sub-steps:
[0037] S301. If the DUT changes, all modules that are marked as dependent on the data type will also change and need to be recompiled.
[0038] S302. If the interface in a function POU changes, the current function and all POUs that call the function are marked as changed and need to be recompiled; if only the function body changes, only the current function is marked as changed and needs to be recompiled, and the POU that calls the current function is judged based on whether it has changed.
[0039] S303. If the interface in a function block POU changes, the current function block and all POUs that call this function block are marked as changed and need to be recompiled; if only the function block execution logic body changes, the current function block is recompiled, and the POU using this function block is judged based on whether it has changed.
[0040] S304: If a program in a program POU changes, the current program and the resources for calling the program change, and need to be recompiled.
[0041] S305: If the resources in the related configuration are changed, it is marked that the current resources are changed and need to be recompiled.
[0042] Furthermore, the method further includes step S8: the client IDE submits a clear compilation request, and the compilation server receives the clear compilation request and clears all cache files generated by the current compilation.
[0043] Furthermore, in step S8, the compilation server receives the clear compilation request, deletes the compilation directory corresponding to the current project name, and after clearing the compilation, when submitting the compilation request again, full compilation will be used for compilation.
[0044] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:
[0045] 1. Improve the efficiency of PLC programming and debugging: By compiling only the changed parts, the efficiency of PLC programming and debugging can be effectively improved, and the compilation time can be greatly reduced, which is especially suitable for large projects.
[0046] 2. Save resources: Reduce the CPU and memory resources required for compilation and improve development efficiency.
[0047] 3. Fast feedback: Accelerate the compilation and testing cycle, provide developers with fast feedback, and promote iterative development.
[0048] 4. Maintain system stability: During the incremental compilation process, ensure that the unmodified parts remain unchanged to ensure the consistency and stability of the system.
[0049] 5. Compatibility and standardization: Follow PLCopen specifications to ensure code compatibility and standardization. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is an overall implementation flow chart of the present invention.
[0051] Figure 2 It is a schematic diagram of the interaction between the client IDE and the compile server of the present invention.
[0052] Figure 3 It is a schematic diagram of the full compilation of the present invention.
[0053] Figure 4 It is a schematic diagram of the cache file compiled last time in an embodiment of the present invention.
[0054] Figure 5 It is a schematic diagram of generating a final executable file in an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0056] To achieve the above object, the present invention proposes a PLC incremental compilation method based on the BS architecture of the PLCope standard, such as Figure 1 As shown, the specific steps are as follows:
[0057] S1. Initialize the PLC programming environment, establish the communication connection between the compile server and the client IDE, and load the relevant libraries and configuration files of the PLCopen specification. The specific contents are as follows:
[0058] S101. Start the compile server in the form of a daemon server and listen to a specified TCP / IP port.
[0059] S102, the client IDE is a PLC programming editor, and establishes a TCP / IP long connection with the compile server.
[0060] S2. The client IDE formats the user program into a PLCopen XML structure and submits a PLC program compilation request. After receiving the compilation request, the compilation server uses the PLCopen standard format to analyze the program modification content and program dependencies. After receiving the compilation request, the compilation server executes the following steps: Figure 2 The operations shown are specifically:
[0061] S201. According to the IEC61131-3 programming model and the PLCopen XML structure, the content of the PLCopen XML standard format of the user program in the current project is divided into three parts, namely DUT (User-defined Data Type), all POUs (Programming Organisation Units) related to the logic program, and CONFIGURATION (related configuration); among which, POU includes all functions, function blocks and programs in the current project.
[0062] S202, extract the three parts of XML content in step S201 respectively, and generate corresponding hash values, namely dutHash, pousHash and confHash.
[0063] S203, using the project name of the current project as the compilation directory name, check whether the compilation directory name exists. If it does not exist, it indicates that it is the first compilation, then create a compilation directory, start full compilation, and go to step S6; if it exists, it indicates that it is not the first compilation, start incremental compilation, and go to step S204.
[0064] Among them, the full compilation process is as follows Figure 3 As shown:
[0065] Step 1. Save dutHash, pousHash and confHash in the compilation cache file cache.scv.
[0066] Step 2: Parse each user-defined data type in the DUT, calculate its corresponding hash value and the dependency relationship between the current data type and other data types, and save them in the compilation cache file cache.scv; parse each single POU in all POUs related to the logic program, calculate its corresponding hash value and the dependency relationship between each single POU and other POUs and user-defined data types, and save them in the compilation cache file cache.scv; parse all resources in the relevant configuration, obtain the dependency relationship between each resource and the POU, and save them in the compilation cache file cache.scv.
[0067] Step 3: Start the compilation process to generate target files and executable files corresponding to each POU and each resource.
[0068] S204, read the compilation cache file cache.csv in the current directory, the contents of which are as follows Figure 4 As shown:
[0069] The DUT field corresponds to the hash value of all user-defined data types, which is 6142509188972423790; the POU field corresponds to the hash value of all program organization units, which is 791692840214104465; the CONFIGURATION field corresponds to the hash value of all related configuration instances, which is 14208343496912557329; the dut1 and dut2 fields represent the hash values of two user-defined data type names, respectively. There is no other information here except the hash value. Other fields indicate that these two data types do not depend on other user-defined data types; the func1 and func2 fields represent two POUs of user-defined function categories respectively. Taking the func1 field as an example, the hash value corresponding to the entire func1 is 14849871117901816076, the hash value corresponding to the func1 parameter is 510626549196253264, and the hash value corresponding to the func1 function body is 3100528644341196590. nc1 depends on the user-defined data type dut1; the fb1 and fb2 fields represent two user-defined function block category POUs respectively. Taking the fb1 field as an example, the hash value corresponding to the entire fb1 is 13232006234274430194, the hash value corresponding to the variable defined in fb1 is 4319442936672643692, and the hash value corresponding to the logical body corresponding to fb1 is 3149374162778649890. fb1 depends on func1; prg1, p The rg2 field represents two user-defined POUs of program categories. Taking the prg1 field as an example, the hash value corresponding to the entire prg1 is 11845386094242675210, and prg1 depends on fb1. The resource1 and resource2 fields represent the resources in the two project configurations respectively. Taking the resource1 field as an example, the hash value corresponding to resource1 is 17891372266443592110, and resource1 depends on prg1.
[0070] S205. Compare the contents corresponding to the DUT field, POU field and CONFIGURATION field in the compilation cache file cache.csv with dutHash, pousHash and confHash respectively to determine whether the contents in the current project have changed. If so, recompile is required. The determination method is as follows:
[0071] Step 1: The hash values corresponding to all POUs and CONFIGURATIONs related to the DUT and logic program in the compilation cache file are recorded as dutCacheHash, pousCacheHash, and confCacheHash.
[0072] Step 2: Compare dutHash and dutCacheHash to see if they are equal. If they are not equal, it means that the DUT has changed. Then, update dutCacheHash to the current dutHash and mark the DUT as changed. Otherwise, it means that the DUT has not changed.
[0073] Step 3: Compare pousHash and pousCacheHash to see if they are equal. If they are not equal, it means that all POUs related to the logic program have changed. Then, pousCacheHash is updated to the current pousHash, and the POU is marked as changed. Otherwise, it means that all POUs related to the logic program have not changed.
[0074] Step 4: Compare confHash and confCacheHash to see if they are equal. If they are not equal, it means that CONFIGURATION has changed. Then update confCacheHash to the current confHash and mark that CONFIGURATION has changed. Otherwise, it means that CONFIGURATION has not changed.
[0075] S206: Perform secondary judgment according to the marking situation in step S205, the specific content is:
[0076] S2061. When no DUT is marked as changed, it means that all DUTs have not changed, and go to step S2062. When a DUT is marked as changed, parse the PLCopen XML content corresponding to the DUT, compare the hash value corresponding to each data type in the DUT with the hash value in the compilation cache file, and mark whether each data type has changed. If the data type has changed, update the hash value of the data type in the compilation cache file and obtain its dependency.
[0077] S2062. When all POUs related to the unmarked logic program have changed, it means that all POUs related to the logic program and their dependencies have not changed, and go to step S2063; when the marked POU has changed, parse the PLCopen XML content corresponding to each single POU, compare the hash value corresponding to each single POU with the hash value corresponding to the current POU in the compilation cache file, and mark whether the current POU has changed; if the current POU has changed, update its hash value in the compilation cache file and obtain its dependencies; for the changed POU is a function or a function block, compare the interface hash value of the current POU in the compilation cache file with the interface hash value of the POU in the current project to determine whether the interface has changed; compare the function body hash value of the current POU in the compilation cache file with the function body hash value of the POU in the current project to determine whether the function body has changed.
[0078] S2063. When CONFIGURATION changes, parse the PLCopen XML content corresponding to CONFIGURATION, compare the hash value corresponding to each resource in CONFIGURATION with the hash value corresponding to the resource in the compilation cache file, and mark whether the current resource has changed; if the resource has changed, update its hash value in the compilation cache file and obtain its dependency; otherwise, it means that all configuration-related information has not changed.
[0079] S2064. When there is no hash value corresponding to a DUT, POU or resource in the compilation cache file, it means that the DUT, POU or resource is a new addition to the current project. The corresponding hash value and dependency relationship are stored in the compilation cache file, and the current item is marked as changed.
[0080] S3, the compile server traverses the user program again according to the dependency relationship obtained in step S2 to determine whether the content in the current project needs to be recompiled. The specific content is as follows Figure 5 As shown:
[0081] S301. If the DUT changes, all modules that are marked as dependent on the data type will also change and need to be recompiled.
[0082] In this embodiment, when the user data type 1 changes, the function 1 that depends on the data type 1 is also marked as changed.
[0083] S302. If the interface in a function POU changes, that is, the input, output, or input-output parameter of the function changes, the current function and all POUs that call the function are marked as changed and need to be recompiled; if the function interface does not change, but only the function body changes, only the current function is marked as changed and needs to be recompiled, and the POU that calls the current function is judged based on whether it has changed;
[0084] In this embodiment, it is assumed that function 1 changes because data type 1 is used in the interface, and function block 1 that calls this function also changes; while function 2 only changes its execution logic body, marking the current function change, but whether function block 2 that calls function 2 changes is determined based on whether function block 2 itself changes. Here, function block 2 has not changed.
[0085] S303. If the interface in a function block POU changes, that is, the variables defined in the function block (except temporary variables) change, the current function block and all POUs that call this function block are marked as changed and need to be recompiled; if only the function block execution logic body changes, the current function block is recompiled, and the POU using the function block is judged based on whether it has changed.
[0086] S304: If a program in a program POU changes, the current program and the resources for calling the program change, and need to be recompiled.
[0087] S305. If the resources in CONFIGURATION are changed, it is marked that the current resources are changed and need to be recompiled.
[0088] S4. The compiling server compiles the (code part) that needs to be recompiled, generates intermediate code, and obtains the target file generated by the incremental compilation.
[0089] In this embodiment, cpp is used as the intermediate code, and the gcc compiler is called to compile it into a target file .o file.
[0090] S5. Link the target file generated by the incremental compilation with the target file of the unmodified part to generate a final executable file.
[0091] S6. Send the generated executable file to the client IDE as a response to the compilation request.
[0092] S7. The client IDE receives the executable file, downloads it to the connected PLC device, and starts running it to complete the incremental compilation.
[0093] S8. The client IDE submits a clear compilation request. The compilation server receives the clear compilation request and deletes the compilation directory corresponding to the current project name, that is, deletes all compilation caches to reduce memory usage. After clearing the compilation, when the compilation request is submitted again, the full compilation process will be used for compilation.
[0094] Through the above embodiments, the present invention provides a PLC incremental compilation method based on the BS architecture of the PLCopen standard, which can effectively improve the efficiency of PLC programming and debugging, reduce the compilation time, and maintain the security and stability of the system.
[0095] The "one embodiment" or "embodiment" mentioned in this specification means that the specific features, structures or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present application. Therefore, the terms "in one embodiment" or "in an embodiment" appearing in various places in this specification do not necessarily refer to the same embodiment, but may refer to the same embodiment. In addition, in the various embodiments of the present application, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form a new embodiment according to their inherent logical relationship.
[0096] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A PLC incremental compilation method based on the BS architecture of the PLCope standard, characterized in that: include: S1, initialize the PLC programming environment, establish the communication connection between the compile server and the client IDE, and load the relevant libraries and configuration files of the PLCopen XML specification; S2. The client IDE formats the user program into a PLCopen XML structure and submits a PLC program compilation request. After receiving the compilation request, the compilation server analyzes the program modification content and program dependencies using the PLCopen standard format. S3, the compile server traverses the user program again according to the dependency relationship obtained in step S2, and determines the content that needs to be recompiled in the current project; S4, the compiling server compiles the content that needs to be recompiled, generates intermediate content, and obtains a target file generated by incremental compilation; S5, linking the target file generated by the incremental compilation with the target file of the unmodified part to generate a final execution file; S6. Send the final executable file to the client IDE as a response to the compilation request; S7. The client IDE receives the final executable file, downloads it to the connected PLC device, and starts running it to complete the incremental compilation.
2. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 1 is characterized in that: The client IDE is a PLC programming editor.
3. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 1 is characterized in that: In step S1, the compiling server is started by means of a daemon server, and a designated TCP / IP port is monitored; a TCP / IP persistent connection is established between the client IDE and the compiling server.
4. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 1 is characterized in that: In step S2, analyzing the program modification content and program dependency includes the following sub-steps: S201. According to the IEC61131-3 programming model and the PLCopen XML structure, the content of the PLCopen XML standard format of the user program in the current project is divided into three parts, namely, the user-defined data type, all POUs related to the logic program and related configurations; wherein the POU includes all functions, function blocks and programs in the current project; S202, extract the three parts of XML content in step S201 respectively, and generate corresponding hash values, namely dutHash, pousHash and confHash; S203, using the project name of the current project as the compilation directory name, checking whether the compilation directory name exists, if not, creating the compilation directory, starting full compilation, and proceeding to step S6; if it exists, starting incremental compilation, and proceeding to step S204; S204, read the compilation cache file cache.csv in the current directory, the contents of the file are: Hash values of all user-defined data types, hash values of all POUs, hash values of all related configurations, hash values of user-defined data type names, POUs of user-defined function categories, POUs of user-defined function block categories, POUs of user-defined program categories, and resources in project-related configurations; S205, compare the contents corresponding to the user-defined data type field, POU field and related configuration field in the compiled cache file cache.csv with dutHash, pousHash and confHash respectively to determine whether the contents in the current project have changed. If so, recompile and mark; S206: Perform secondary judgment according to the marking situation in step S205 to obtain the program modification content and program dependency relationship, the specific content is: S2061. When the unmarked user-defined data type changes, it indicates that all user-defined data types have not changed, and the process goes to step S2062. When the marked user-defined data type changes, the PLCopen XML content corresponding to the user-defined data type is parsed, the hash value corresponding to each data type in the user-defined data type is compared with the hash value in the compilation cache file, and each data type is marked whether it has changed. If the data type has changed, the hash value of the data type in the compilation cache file is updated, and its dependency relationship is obtained. S2062, when all POUs related to the unmarked logic program have changed, it means that all POUs related to the logic program and their dependencies have not changed, and go to step S2063; when the marked POU has changed, parse the PLCopen XML content corresponding to each single POU, compare the hash value corresponding to each single POU with the hash value corresponding to the current POU in the compilation cache file, and mark whether the current POU has changed; if the current POU has changed, update its hash value in the compilation cache file and obtain its dependencies; for the changed POU is a function or a function block, compare the interface hash value of the current POU in the compilation cache file with the interface hash value of the POU in the current project to determine whether the interface has changed; compare the function body hash value of the current POU in the compilation cache file with the function body hash value of the POU in the current project to determine whether the function body has changed; S2063. When CONFIGURATION changes, parse the PLCopen XML content corresponding to CONFIGURATION, compare the hash value corresponding to each resource in CONFIGURATION with the hash value corresponding to the resource in the compilation cache file, and mark whether the current resource has changed; if the resource has changed, update its hash value in the compilation cache file and obtain its dependency; otherwise, it means that all configuration-related information has not changed; S2064. When there is no hash value corresponding to a DUT, POU or resource in the compilation cache file, it means that the DUT, POU or resource is newly added to the current project. The corresponding hash value and dependency relationship are stored in the compilation cache file, and the current item is marked as changed.
5. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 4 is characterized in that: In step S203, the full compilation includes the following contents: Step 1. Save dutHash, pousHash and confHash in the compilation cache file cache.scv; Step 2: parse each user-defined data type in the user-defined data types, calculate its corresponding hash value and the dependency relationship between the current data type and other data types, and save them in the compilation cache file cache.scv; parse each single POU in all POUs related to the logic program, calculate its corresponding hash value and the dependency relationship between each single POU and other POUs and user-defined data types, and save them in the compilation cache file cache.scv; parse all resources in the relevant configuration, obtain the dependency relationship between each resource and POU, and save them in the compilation cache file cache.scv; Step 3: Start the compilation process to generate target files and execution files corresponding to each POU and each resource.
6. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 4 is characterized in that: In step S205, the determination method is: Step 1: Record the hash values corresponding to the user-defined data types, all POUs related to the logic program, and related configurations in the compiled cache file as dutCacheHash, pousCacheHash, and confCacheHash; Step 2: Compare dutHash and dutCacheHash to see if they are equal. If dutHash and dutCacheHash are not equal, it means that the user-defined data type has changed. Then, dutCacheHash is updated to the current dutHash, and the user-defined data type is marked to have changed. Otherwise, it means that the DUT has not changed. Step 3: Compare pousHash and pousCacheHash to see if they are equal. If pousHash and pousCacheHash are not equal, it means that all POUs related to the logic program have changed. Then, pousCacheHash is updated to the current pousHash, and the POU is marked as changed. Otherwise, it means that all POUs related to the logic program have not changed. Step 4: Compare confHash and confCacheHash to see if they are equal. If they are not equal, it means that the relevant configuration has changed. Then update confCacheHash to the current confHash and mark the relevant configuration as changed. Otherwise, it means that the relevant configuration has not changed.
7. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 1 is characterized in that: In step S3, determining the content to be recompiled includes the following sub-steps: S301. If the user-defined data type changes, all modules that are marked as dependent on the data type change and need to be recompiled; S302. If the interface in a function POU changes, the current function and all POUs that call the function are marked as changed and need to be recompiled; if only the function body changes, only the current function is marked as changed and needs to be recompiled, and the POU that calls the current function is judged based on whether it has changed; S303, if the interface in a function block POU changes, then the current function block and all POUs that call this function block are marked as changed and need to be recompiled; If only the function block execution logic body changes, the current function block is recompiled, and the POU using the function block is judged based on whether it has changed; S304, if a program in a program POU changes, the current program and the resources that call the program change, and need to be recompiled; S305: If the resources in the related configuration are changed, it is marked that the current resources are changed and need to be recompiled.
8. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 1 is characterized in that: The method further includes step S8: the client IDE submits a clear compilation request, and the compilation server receives the clear compilation request and clears all cache files generated by the current compilation.
9. The PLC incremental compilation method based on the BS architecture of the PLCope standard according to claim 8 is characterized in that: In step S8, the compile server receives the clear compilation request and deletes the compilation directory corresponding to the current project name. After clearing the compilation, when the compile request is submitted again, full compilation will be used for compilation.