Plc program processing method, device and server
By acquiring and comparing user programs for PLC devices and project file services on a local server, the problem of insufficient storage space for PLC devices is solved, achieving more efficient storage space utilization and reducing communication pressure.
Patent Information
- Application Number
- CN202211533167.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-01
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-12-01
AI Technical Summary
PLC devices have limited storage space, and frequent downloads of project files affect communication services. Existing technologies cannot effectively manage user programs for PLC devices, resulting in low storage space utilization.
The user programs of PLC devices and project file services are obtained and compared through a local server, reducing the amount of data downloaded to the PLC devices. The user programs of PLC devices are managed by the storage of the local server, including online and offline comparisons, detecting program differences and merging the user programs after the differences are merged.
It improves the storage space utilization of PLC devices, reduces the communication pressure on PLC devices, and optimizes the management and comparison process of project documents.
Smart Images

Figure CN115903642B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of industrial automation control, and in particular to a PLC program processing method and device and server. BACKGROUND
[0002] Generally, the user application program of the PLC needs to be continuously modified and debugged, and the version difference is compared.
[0003] At present, the engineering of the PLC runtime has the following two key points: firstly, the user engineering file is downloaded to the PLC device, and at the time of user triggering comparison, the engineering file in the device is uploaded to the local server for comparison. Secondly, the line text and program segment text in the engineering file are taken as comparison units to detect whether there is a difference in the engineering file.
[0004] However, in order to realize the backup and engineering comparison functions of the engineering file, the engineering file is downloaded to the PLC device for storage, which occupies the limited storage space of the PLC device. In the runtime, the file is frequently uploaded from the device, which affects other businesses that rely on communication. SUMMARY
[0005] The main purpose of the present application is to propose a PLC program processing method, device and server, which aims to manage the user program of the PLC device by using the storage of the local server, reduce the data downloaded to the PLC device, and improve the storage space utilization rate of the PLC device.
[0006] In order to achieve the above purpose, the present application provides a PLC program processing method, which is applied to a local server, the local server includes an engineering file service and at least one local engineering service, and the PLC program processing method includes the following steps:
[0007] When receiving an engineering comparison instruction, a first user program is obtained from the local engineering service, and a second user program is obtained from the engineering file service;
[0008] The first user program and the second user program are compared.
[0009] Preferably, the local server is in communication connection with a PLC device, the engineering comparison instruction includes an online comparison instruction, and the step of obtaining the first user program from the local engineering service and obtaining the second user program from the engineering file service when receiving the engineering comparison instruction includes:
[0010] When receiving the online comparison instruction, the identification information corresponding to the PLC device is obtained from the PLC device, wherein the identification information includes the engineering identification of the current running version user program of the PLC device and the device identification of the PLC device.
[0011] acquire a first user program corresponding to the engineering identification from the local engineering service, and acquire a second user program corresponding to the identification information from the engineering file service.
[0012] Preferably, the engineering comparison instruction comprises an offline comparison instruction, and the step of acquiring the first user program from the local engineering service and the second user program from the engineering file service upon receiving the engineering comparison instruction comprises:
[0013] acquiring the first user program from the engineering file service and the second user program from the local engineering service upon receiving the offline comparison instruction; wherein the second user program is a temporary version user program established in the local engineering service.
[0014] Preferably, the step of comparing the first user program and the second user program comprises:
[0015] detecting whether an object in the first user program is missing, adding an object missing mark of the missing object to obtain a third user program if it is detected that the object in the first user program is missing, and detecting whether an object in the second user program is missing, adding an object missing mark of the missing object to obtain a fourth user program if it is detected that the object in the second user program is missing;
[0016] comparing the third user program and the fourth user program.
[0017] Preferably, the step of comparing the first user program and the second user program comprises:
[0018] acquiring a first variable declaration feature of the first user program; and acquiring a second variable declaration feature of the second user program; wherein the first variable declaration feature and the second variable declaration feature comprise at least one of a range, a name, a type, an address, a power failure, and a comment;
[0019] comparing the first variable declaration feature and the second variable declaration feature.
[0020] Preferably, the step of comparing the first user program and the second user program comprises:
[0021] performing a text comparison on the first user program and the second user program;
[0022] if it is detected that there is a difference in line text in the first user program and the second user program, acquiring a character string corresponding to the line text with the difference;
[0023] Compare the strings corresponding to the lines with differences.
[0024] Preferably, the local server is in communication connection with the PLC device, and before the steps of obtaining the first user program from the local engineering service and obtaining the second user program from the engineering file service upon receiving the engineering comparison instruction, the method further comprises:
[0025] Obtaining the engineering identification of the user program and the device identification of the PLC device;
[0026] Associating the engineering identification and the device identification;
[0027] Sending the associated engineering identification and device identification to the engineering file service.
[0028] Preferably, after the step of comparing the first user program and the second user program, the method further comprises:
[0029] If it is detected that there are differences between the first user program and the second user program, performing difference merging on the first user program and the second user program to obtain a difference-merged user program;
[0030] Sending the difference-merged user program to the engineering file service and updating the difference-merged user program as the second user program.
[0031] In addition, to achieve the above-mentioned purpose, the application further provides a PLC program processing device, which comprises:
[0032] An obtaining module, configured to obtain a first user program from a local engineering service and a second user program from an engineering file service upon receiving an engineering comparison instruction;
[0033] A comparison module, configured to compare the first user program and the second user program.
[0034] In addition, to achieve the above-mentioned purpose, the application further provides a server, which comprises:
[0035] At least one processor; and,
[0036] A memory in communication connection with the at least one processor; wherein,
[0037] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the PLC program processing method as described above.
[0038] The application provides a PLC program processing method, device and server. BRIEF DESCRIPTION OF DRAWINGS
[0039] Figure 1 Figure 1 is a device structure schematic diagram of a hardware running environment involved in an embodiment of the application;
[0040] Figure 2 Figure 2 is a flowchart of a first embodiment of the PLC program processing method of the application;
[0041] Figure 3 Figure 3 is an interaction schematic diagram of the engineering file service and the local engineering service of the PLC program processing method of the application;
[0042] Figure 4 Figure 4 is a sub-flowchart of the first embodiment of the PLC program processing method of the application;
[0043] Figure 5 Figure 5 is an online comparison schematic diagram of the PLC program processing method of the application;
[0044] Figure 6 Figure 6 is an offline comparison schematic diagram of the PLC program processing method of the application;
[0045] Figure 7 Figure 7 is a flowchart of a second embodiment of the PLC program processing method of the application;
[0046] Figure 8 Figure 8 is a flowchart of a third embodiment of the PLC program processing method of the application;
[0047] Figure 9 Figure 9 is a flowchart of a fourth embodiment of the PLC program processing method of the application;
[0048] Figure 10 Figure 10 is an effect schematic diagram of adding an object lacking in a current project of the PLC program processing method of the application;
[0049] Figure 11 Figure 11 is an effect schematic diagram of comparing objects with the same ID of the PLC program processing method of the application;
[0050] Figure 12 Figure 12 is a flowchart of a fifth embodiment of the PLC program processing method of the application;
[0051] Figure 13 Sequence variation diagram for comparison of variable declaration area of PLC program processing method of the present application;
[0052] Figure 14 Sequence and partial attribute variation diagram for comparison of variable declaration area of PLC program processing method of the present application;
[0053] Figure 15 Flow diagram of the sixth embodiment of the PLC program processing method of the present application;
[0054] Figure 16 Intra-row comparison diagram after line existence difference of the PLC program processing method of the present application;
[0055] Figure 17 Flow diagram of the seventh embodiment of the PLC program processing method of the present application;
[0056] Figure 18 Decoupling diagram of user program and PLC device of the PLC program processing method of the present application;
[0057] Figure 19 Function module diagram of the first embodiment of the PLC runtime engineering comparison system of the present application.
[0058] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0059] It should be understood that the specific embodiments described herein merely serve to explain the present application and are not intended to limit the present application.
[0060] As Figure 1 shown, Figure 1 is a device structure diagram of a hardware running environment involved in the embodiment scheme of the present application.
[0061] The device of the embodiment of the present application can be a mobile terminal or a server device.
[0062] As Figure 1As shown in the figure, the device can include a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection communication between the components. The user interface 1003 can include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 can also include a standard wired interface, a wireless interface. The network interface 1004 can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 1005 can be a high-speed RAM memory, or a stable memory (non-volatile memory) such as a disk memory. The memory 1005 can also be an independent storage device from the aforementioned processor 1001.
[0063] Those skilled in the art can understand that Figure 1 The device structure shown in the figure does not constitute a limitation on the device, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.
[0064] As Figure 1 As shown in the figure, the memory 1005 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a PLC program processing program.
[0065] The operating system is a program that manages and controls terminal devices and software resources, supports the running of network communication modules, user interface modules, PLC program processing programs, and other programs or software; the network communication module is used to manage and control the network interface 1002; the user interface module is used to manage and control the user interface 1003.
[0066] In Figure 1 In the device shown in the figure, the device calls the PLC program processing program stored in the memory 1005 through the processor 1001, and executes the operations in each embodiment of the PLC program processing method described below.
[0067] Based on the above hardware structure, the PLC program processing method embodiments of the present application are proposed.
[0068] Referring to Figure 2 , Figure 2 The flowchart of the first embodiment of the PLC program processing method of the present application is shown in the figure. The PLC program processing method includes:
[0069] Step S10, when receiving the project comparison instruction, obtaining a first user program from the local project service, and obtaining a second user program from the project file service.
[0070] In the embodiment, the PLC program processing method is applied to a local server, which comprises an engineering file service and at least one local engineering service.
[0071] The engineering file service is used to save historical versions of user programs required to be downloaded by users. When the engineering comparison is triggered, the corresponding version of the user program can be searched from the engineering file service for comparison.
[0072] The local engineering service comprises user programs edited in the local server.
[0073] Referring to Figure 3 , Figure 3 FIG. 1 is a schematic diagram of interaction between the engineering file service and the local engineering service; in Figure 3 , the engineering file service can be connected to multiple local engineering services; for example, the engineering file service is connected to a local engineering service 1 (IDE1) and a local engineering service n (IDEn). The user program in the local engineering service 1 can be uploaded to the engineering file service, and the latest version of the user program in the engineering file service can be updated and downloaded to the local engineering service 1 (IDE1).
[0074] The engineering comparison refers to version difference comparison of different versions of the same user program in the process of modification and debugging of the user program, so as to identify the difference between different versions of the same user program; the engineering comparison can comprise online comparison of user program runtime engineering, and can also comprise offline comparison.
[0075] The online comparison is the engineering comparison triggered when the local server is in communication connection with the PLC device.
[0076] The offline comparison is the engineering comparison triggered when there is no communication connection between the local server and the PLC device.
[0077] The engineering comparison can be comparison of the user program in the engineering file service with the corresponding different versions of the user program in the local engineering service.
[0078] Upon receiving the engineering comparison instruction, the first user program to be compared is obtained from the local engineering service, and the second user program to be compared of the corresponding version is obtained from the engineering file service.
[0079] Step S20, comparing the first user program and the second user program.
[0080] In the embodiment, after the first user program and the second user program are obtained, the first user program and the second user program can be compared in terms of text and program segment text, and then the difference between the first user program and the second user program can be compared.
[0081] Further, with reference to Figure 4 In an embodiment, after step S20, the PLC program processing method can further include the following steps:
[0082] Step S30, if it is detected that the first user program and the second user program have differences, the first user program and the second user program are merged to obtain a merged user program after differences;
[0083] Step S40, the merged user program after differences is sent to the engineering file service, and the merged user program after differences is updated as the second user program.
[0084] In this embodiment, after comparing the first user program and the second user program, when it is detected that the first user program and the second user program have differences, the first user program and the second user program can be merged after differences to obtain a corresponding merged user program after differences; and then the merged user program after differences can be uploaded to the engineering file service, and the merged user program after differences is updated as the second user program.
[0085] As an example, with reference to Figure 5 , Figure 5 is a schematic diagram of online comparison; after the first user program and the second user program are compared online, when it is detected that the first user program and the second user program have differences, the first user program and the second user program are merged after differences to obtain a corresponding merged user program after differences; and then the merged user program after differences is uploaded to the engineering file service, and the merged user program after differences is updated as the second user program.
[0086] As another example, with reference to Figure 6 , Figure 6 is a schematic diagram of offline comparison; after the first user program and the second user program are compared offline, when it is detected that the first user program and the second user program have differences, the first user program and the second user program are merged after differences to obtain a corresponding merged user program after differences; and then the merged user program after differences is uploaded to the engineering file service.
[0087] Further, the next time the engineering comparison is triggered, the updated second user program in the engineering file service can be compared. Thus, by using the local server to manage the user program of the PLC device, the storage space utilization rate of the PLC device can be improved, and the communication pressure of the PLC device can be reduced.
[0088] The embodiment obtains a first user program from a local engineering service and a second user program from an engineering file service when receiving an engineering comparison instruction, and compares the first user program and the second user program, thereby managing the user program of the PLC device by using the storage of the local server, reducing the data downloaded to the PLC device, and improving the storage space utilization rate of the PLC device.
[0089] Further, based on the first embodiment, the second embodiment of the PLC program processing method is provided.
[0090] Reference Figure 7 In the embodiment, the step S10 can include the following sub-steps:
[0091] The sub-step S11 obtains the identification information corresponding to the PLC device from the PLC device when receiving the online comparison instruction, wherein the identification information includes the engineering identification of the current running version user program of the PLC device and the device identification of the PLC device.
[0092] Wherein, when the local server is in communication connection with the PLC device, the engineering comparison instruction can include an online comparison instruction.
[0093] The online comparison refers to comparing the user program currently running in the PLC device with the corresponding different version user program in the local engineering service.
[0094] The identification information can include the engineering identification of the current running version user program of the PLC device and the device identification of the PLC device.
[0095] The engineering identification refers to the version number of the user program, and the same version of the user program is unique.
[0096] The device identification refers to the number of the PLC device, and each PLC device corresponds to a unique device identification.
[0097] When receiving the online comparison instruction, the identification information corresponding to the PLC device can be obtained from the PLC device, and then the engineering identification of the current running version user program of the corresponding PLC device and the device identification of the PLC device can be determined according to the identification information.
[0098] The sub-step S12 obtains the first user program corresponding to the engineering identification from the local engineering service, and obtains the second user program corresponding to the identification information from the engineering file service.
[0099] In the embodiment, the corresponding first user program can be acquired from the local engineering service through the engineering identification, and the corresponding second user program can be acquired from the engineering file service through the identification information, and then the first user program and the second user program can be compared.
[0100] In the embodiment, when the online comparison is triggered, the corresponding identification information is acquired from the PLC device, and then the corresponding first user program is acquired from the local engineering service and the corresponding second user program is acquired from the engineering file service according to the identification information, so that the storage management of the local server is fully utilized to realize the engineering comparison of the PLC runtime, and the communication pressure of the PLC device is reduced.
[0101] Further, based on the first embodiment, the third embodiment of the PLC program processing method is provided.
[0102] Reference Figure 8 In the embodiment, the step S10 can further include the following sub-steps:
[0103] The sub-step S13, when the offline comparison instruction is received, the first user program is acquired from the engineering file service, and the second user program is acquired from the local engineering service, wherein the second user program is a temporary version user program established in the local engineering service.
[0104] In the embodiment, when the local server is not in communication connection with the PLC device, the engineering comparison instruction can include an offline comparison instruction.
[0105] The second user program is a temporary version user program established in the local engineering service.
[0106] As an example, the user program A, the user program B, the user program C and the user program D are included in the engineering file service. The user program A is downloaded from the engineering file service to the local engineering service, and the user program A is continuously edited in the local engineering service, and the corresponding user program A1 is generated after editing, which is a temporary version user program established in the local engineering service.
[0107] When the offline comparison instruction is triggered, the corresponding version of the first user program is acquired from the engineering file service, and the corresponding version of the second user program is acquired from the local engineering service. Then the first user program and the second user program can be compared.
[0108] In the embodiment, when the offline comparison is triggered, the corresponding first user program is acquired from the engineering file service, and the corresponding second user program is acquired from the local engineering service, so that the storage management of the local server is fully utilized to realize the offline comparison of the PLC user program, and the communication pressure of the PLC device is reduced.
[0109] Further, based on the first, second and third embodiments, the fourth embodiment of the PLC program processing method of the present application is proposed. Referring to Figure 9 , the step S20 can include the following sub-steps:
[0110] Sub-step 21, detecting whether the objects in the programs compared by the first user are missing, if the objects in the first user program are detected to be missing, adding the object missing mark of the missing objects to obtain the third user program; and detecting whether the objects in the second user program are missing, if the objects in the second user program are detected to be missing, adding the object missing mark of the missing objects to obtain the fourth user program.
[0111] Firstly, whether the objects in the first user program and the second user program are missing can be detected.
[0112] When the objects in the first user program are detected to be missing, the currently missing objects are added in the first user program, and the object missing mark of the missing objects is added to obtain the corresponding third user program.
[0113] As an example, referring to Figure 10 , Figure 10 is the effect diagram of adding the objects missing in the current project; in the left diagram of Figure 10 , the folder 1 in the PLC_1 user program is missing the object POU_2, and the corresponding object missing mark POU_2 (missing) is added at the position of the object POU_2.
[0114] When the objects in the second user program are detected to be missing, the currently missing objects are added in the second user program, and the object missing mark of the missing objects is added to obtain the corresponding fourth user program.
[0115] As another example, referring to Figure 10 , Figure 10 is the effect diagram of adding the objects missing in the current project; in the right diagram of Figure 10 , the folder 1 in the PLC_1 user program is missing the object POU_1, and the corresponding object missing mark POU_1 (missing) is added at the position of the object POU_1.
[0116] Sub-step 22, comparing the third user program and the fourth user program.
[0117] In this embodiment, after obtaining the third user program and the fourth user program, the third user program and the fourth user program can be compared for the objects with the same ID.
[0118] As an example, refer to Figure 11 , Figure 11 schematic diagram of the effect of comparing objects with the same ID; compare POU_1id_1 of folder 1 in the PLC_1 user program in the left side of Figure 11 with POU_11id_1 of folder 1 in the PLC_1 user program in the right side of Figure 11 .
[0119] By comparing the third user program and the fourth user program, the object-level comparison can be met, and it is ensured that the objects compared with each other are historical versions of the original objects. Thus, the problem that non-historical versions of objects are compared when the positions of folders and object nodes with the same name in the PLC user program objects are different in the prior art is solved.
[0120] In the embodiment, the objects in the first user program and the second user program are detected to determine whether the objects are missing, and if the objects in the first user program are detected to be missing, object missing marks of the missing objects are added to obtain a third user program; and the objects in the second user program are detected to determine whether the objects are missing, and if the objects in the second user program are detected to be missing, object missing marks of the missing objects are added to obtain a fourth user program; the third user program and the fourth user program are compared; thus, the problem that non-historical versions of objects are compared when the positions of folders and object nodes with the same name in the PLC user program objects are different in the prior art is solved.
[0121] Further, based on the first, second and third embodiments, a fifth embodiment of the PLC program processing method of the application is provided. Refer to Figure 12 , step S20 can further include the following sub-step:
[0122] Sub-step 23: obtaining first variable declaration features of the first user program; and obtaining second variable declaration features of the second user program; wherein the first variable declaration features and the second variable declaration features include at least one of a range, a name, a type, an address, a power failure and a comment.
[0123] The variable declaration features are properties of variable declaration in a structured (ST) text language, and can include at least one of a range, a name, a type, an address, a power failure and a comment.
[0124] The first variable declaration features of the first user program are obtained, and the second variable declaration features of the second user program are obtained.
[0125] Sub-step 24: comparing the first variable declaration features and the second variable declaration features.
[0126] After the first variable declaration feature of the first user program and the second variable declaration feature of the second user program are acquired, the first variable declaration feature and the second variable declaration feature are compared.
[0127] As an example, refer to Figure 13 , Figure 13 for the sequence change diagram of variable declaration area comparison; when the sequence change of the variable in the first variable declaration feature and the second variable declaration feature is detected, it is determined that there is no difference between the first variable declaration feature and the second variable declaration feature; that is, there is no difference in the POU variable declaration area of the first user program and the second user program.
[0128] As another example, refer to Figure 14 , Figure 14 for the sequence and partial attribute change diagram of variable declaration area comparison; when the type change of the same variable in the first variable declaration feature and the second variable declaration feature is detected, it is determined that there is a difference between the first variable declaration feature and the second variable declaration feature; that is, there is a difference in the POU variable declaration area of the first user program and the second user program.
[0129] By comparing the variable declaration features of the first user program and the second user program, the difference points of the POU variable declaration area of the first user program and the second user program are accurately analyzed.
[0130] In this embodiment, by acquiring the first variable declaration feature of the first user program and the second variable declaration feature of the second user program, the first variable declaration feature and the second variable declaration feature are compared; thereby, by comparing the variable declaration features of the first user program and the second user program, the difference points of the POU variable declaration area of the first user program and the second user program are accurately analyzed.
[0131] Further, based on the first, second and third embodiments, the sixth embodiment of the PLC program processing method of the present application is proposed. Refer to Figure 15 , step S20 can further include the following sub-steps:
[0132] Sub-step 25, text comparison is performed on the first user program and the second user program.
[0133] Among them, the line text and the program segment text of the first user program and the second user program are compared to detect whether there is a difference in the line text of the first user program and the second user program.
[0134] Sub-step 26, if it is detected that there is a difference in the line text of the first user program and the second user program, the corresponding string of the line text with the difference is acquired.
[0135] In the embodiment, when it is detected that there is difference in the line texts in the first user program and the second user program, the line texts with the difference are marked, and the corresponding string of the line texts with the difference is acquired; then, the specific variable of the line texts with the difference is further identified according to the string.
[0136] Sub-step 27, comparing the string corresponding to the line texts with the difference.
[0137] In the embodiment, after the string corresponding to the line texts with the difference is determined, the delay calculation is started, and the in-line string comparison is triggered, so that the string corresponding to the line texts with the difference can be compared.
[0138] As an example, refer to Figure 16 , Figure 16 The schematic diagram of triggering in-line comparison after the line with the difference is found; in the case that it is detected that there is difference in the line texts in the first user program and the second user program, the line with the difference in the first user program and the second user program is marked; at the same time, the in-line string comparison for the line texts with the difference is triggered; then, the specific variable in the line texts with the difference is identified, and the specific position of the variable can be accurately to a certain column.
[0139] In the embodiment, the first user program and the second user program are compared in text; if it is detected that there is difference in the line texts in the first user program and the second user program, the string corresponding to the line texts with the difference is acquired; the string corresponding to the line texts with the difference is compared; so that the first user program and the second user program are compared in text, and when there is difference in the line texts in the first user program and the second user program, the in-line string comparison is triggered, and the accuracy of variable comparison is improved.
[0140] Further, based on the first embodiment, the seventh embodiment of the PLC program processing method is provided.
[0141] Refer to Figure 17 , before step S10, the PLC program processing method can further include the following steps:
[0142] Step A10, acquiring the engineering identifier of the user program and the device identifier of the PLC device;
[0143] Step A20, associating the engineering identifier and the device identifier;
[0144] Step A30, sending the associated engineering identifier and device identifier to the engineering file service.
[0145] Wherein, the engineering identifier refers to a version number of the user program, and the user program of the same version is unique.
[0146] The device identifier refers to a number of the PLC device, and each PLC device corresponds to a unique device identifier.
[0147] Before receiving the engineering comparison instruction for the user program, the engineering identifier of the user program and the device identifier of the PLC device can be acquired; then the engineering identifier and the device identifier can be associated; and the associated engineering identifier and device identifier are sent to the engineering file service.
[0148] Referring to Figure 18 , Figure 18 The decoupling diagram of the user program and the PLC device is shown; the engineering identifier of the user program and the device identifier of the PLC device are associated, and the associated engineering identifier and device identifier are sent to the engineering file service.
[0149] As an example, when the PLC device downloads a user program of a certain version from the engineering file service, the PLC device only needs to download the version number of the user program, that is, the engineering identifier corresponding to the current user program.
[0150] As another example, when downloading the user program of the same version in the engineering file service to different PLC devices, the engineering file service can record the engineering identifier of the user program through the device list recorder, and does not save multiple copies of the user program of the same version in the engineering file service.
[0151] In the embodiment, by acquiring the engineering identifier of the user program and the device identifier of the PLC device, associating the engineering identifier and the device identifier, and sending the associated engineering identifier and device identifier to the engineering file service, the engineering identifier of the user program and the device identifier of the PLC device are associated, and then when the user program comparison is performed, the corresponding version of the user program can be acquired through the association relationship between the engineering identifier and the device identifier.
[0152] The application also provides a PLC runtime engineering comparison device. Referring to Figure 19 , the PLC runtime engineering comparison device comprises:
[0153] The acquisition module 10 is used for acquiring a first user program from the local engineering service and a second user program from the engineering file service when receiving an engineering comparison instruction;
[0154] The comparison module 20 is used for comparing the first user program and the second user program.
[0155] Optionally, the acquisition module 10 can further comprise:
[0156] a first unit, configured to acquire identification information corresponding to the PLC device from the PLC device when the online comparison instruction is received, wherein the identification information comprises an engineering identification of a current running version user program of the PLC device and a device identification of the PLC device;
[0157] a second unit, configured to acquire a first user program corresponding to the engineering identification from the local engineering service and acquire a second user program corresponding to the identification information from the engineering file service.
[0158] Optionally, the acquisition module 10 can further include:
[0159] a third unit, configured to acquire the first user program from the engineering file service and acquire the second user program from the local engineering service when the offline comparison instruction is received; wherein the second user program is a temporary version user program established in the local engineering service.
[0160] Optionally, the comparison module 20 can further include:
[0161] a detection unit, configured to detect whether an object in the first user program is missing, add an object missing mark of the missing object to obtain a third user program if it is detected that the object in the first user program is missing, and detect whether an object in the second user program is missing, add an object missing mark of the missing object to obtain a fourth user program if it is detected that the object in the second user program is missing;
[0162] an object unit, configured to compare the third user program and the fourth user program.
[0163] Optionally, the comparison module 20 can further include:
[0164] a variable unit, configured to acquire a first variable declaration feature of the first user program and acquire a second variable declaration feature of the second user program; wherein the first variable declaration feature and the second variable declaration feature comprise at least one of a range, a name, a type, an address, a power failure and a comment;
[0165] a feature unit, configured to compare the first variable declaration feature and the second variable declaration feature.
[0166] Optionally, the comparison module 20 can further include:
[0167] a line text unit, configured to perform text comparison on the first user program and the second user program.
[0168] a difference unit, configured to acquire a character string corresponding to the line text if it is detected that there is a difference in the line text between the first user program and the second user program;
[0169] a character string unit, configured to compare the character string corresponding to the line text with a difference.
[0170] Optionally, the PLC runtime engineering comparison device can further include:
[0171] a flag module, configured to acquire an engineering flag of a user program and a device identification of the PLC device;
[0172] an association module, configured to associate the engineering flag and the device identification;
[0173] a sending module, configured to send the associated engineering flag and the device identification to the engineering file service.
[0174] Optionally, the PLC runtime engineering comparison device can further include:
[0175] a merging module, configured to perform difference merging on the first user program and the second user program if it is detected that there is a difference between the first user program and the second user program, to obtain a user program after difference merging;
[0176] an updating module, configured to send the user program after difference merging to the engineering file service, and update the user program after difference merging as the second user program.
[0177] In addition, the present application further provides a computer readable storage medium, which has a PLC runtime engineering comparison program stored thereon, and the PLC runtime engineering comparison program is executed by a processor to implement the steps of the PLC program processing method.
[0178] The method implemented by the PLC runtime engineering comparison program executed on the processor can refer to the embodiments of the PLC program processing method, and will not be described here.
[0179] It should be noted that, in this document, the terms “comprising”, “including” or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article or system. Without more limitations, the element defined by the statement “including a…” does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0180] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0181] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and the necessary general hardware platform, of course, they can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) as described above, and includes a plurality of instructions for causing a terminal device (which can be a computer, a server, or a network device) to execute the methods described in the various embodiments of the present application.
[0182] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, is also included in the patent protection scope of the present application.
Claims
1. A PLC program processing method characterized by comprising: The PLC program processing method is applied to a local server, the local server comprising an engineering file service and at least one local engineering service, the PLC program processing method comprising the following steps: Upon receiving an engineering comparison instruction, obtaining a first user program from the local engineering service and a second user program from the engineering file service; Comparing the first user program and the second user program; In the case that the local server is in communication connection with a PLC device, the engineering comparison instruction comprises an online comparison instruction, and the step of, upon receiving an engineering comparison instruction, obtaining a first user program from the local engineering service and a second user program from the engineering file service comprises: Upon receiving the online comparison instruction, obtaining identification information corresponding to the PLC device from the PLC device, the identification information comprising an engineering identification of a current running version user program of the PLC device and a device identification of the PLC device; Obtaining the first user program corresponding to the engineering identification from the local engineering service and the second user program corresponding to the identification information from the engineering file service.
2. The method of claim 1, wherein, The step of comparing the first user program and the second user program comprises: Detecting whether an object is missing in the first user program, adding an object missing mark of the missing object if it is detected that the object is missing in the first user program to obtain a third user program, and detecting whether an object is missing in the second user program, adding an object missing mark of the missing object if it is detected that the object is missing in the second user program to obtain a fourth user program; Comparing the third user program and the fourth user program.
3. The method of claim 1, wherein, The step of comparing the first user program and the second user program comprises: Obtaining a first variable declaration feature of the first user program and a second variable declaration feature of the second user program; wherein the first variable declaration feature and the second variable declaration feature comprise at least one of a range, a name, a type, an address, a power failure and a comment; Comparing the first variable declaration feature and the second variable declaration feature.
4. The method of claim 1, wherein, The step of comparing the first user program and the second user program comprises: Performing text comparison on the first user program and the second user program; If it is detected that there is a difference in line text in the first user program and the second user program, obtaining a character string corresponding to the line text with the difference; Comparing the character string corresponding to the line text with the difference.
5. The method of claim 1, wherein, Before the step of, upon receiving an engineering comparison instruction, obtaining a first user program from the local engineering service and a second user program from the engineering file service, the method further comprises: Obtaining an engineering identification of a user program and a device identification of the PLC device; Associating the engineering identification and the device identification; Sending the associated engineering identification and device identification to the engineering file service.
6. The method of claim 1, wherein, After the step of comparing the first user program and the second user program, the method further comprises: If it is detected that the first user program and the second user program are different, the first user program and the second user program are merged to obtain a merged user program; The merged user program is sent to the engineering file service, and the merged user program is updated as the second user program.
7. A PLC program processing apparatus characterized by comprising: The PLC program processing device is applied to a local server, the local server includes an engineering file service and at least one local engineering service, and the PLC program processing device includes: An acquisition module is configured to, when receiving an engineering comparison instruction, acquire a first user program from a local engineering service and a second user program from an engineering file service; In a case where the local server is in communication connection with a PLC device, the engineering comparison instruction includes an online comparison instruction, and the acquisition module is further configured to, when receiving the online comparison instruction, acquire identification information corresponding to the PLC device from the PLC device, the identification information including an engineering identification of a current running version user program of the PLC device and a device identification of the PLC device, acquire the first user program corresponding to the engineering identification from the local engineering service, and acquire the second user program corresponding to the identification information from the engineering file service; A comparison module is configured to compare the first user program and the second user program.
8. A server, characterized by The server includes: at least one processor; and a memory in communication connection with the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the steps of the PLC program processing method in any one of claims 1 to 6.
Citation Information
Patent Citations
Method for providing engineering tool services
CN101388101A
Multi-version code sign-in control method and device, client and storage medium
CN112947986A