Data synchronization method and device, electronic equipment, storage medium and program product

By synchronizing the intermediate process data of the target controller to the simulation control program, the problem of lack of intermediate process data during the soft PLC startup is solved, and the accuracy of the simulation calculation is improved, making it closer to the actual operation results of the on-site PLC.

CN119414764APending Publication Date: 2025-02-11BEIJING WANWANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411551194.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-01
Publication Date
2025-02-11

AI Technical Summary

Technical Problem

The lack of intermediate process data during startup of the soft PLC, which leads to a large gap between its simulation calculation results and the on-site PLC, affecting the accuracy of the calculation.

Method used

By collecting the actual operating data of the target controller, including intermediate process data, and synchronizing it to the simulation control program, the simulation control program can perform subsequent logical operations based on this data.

Benefits of technology

This makes up for the defect that the simulation control program lacks intermediate process data in the early stage of startup, making the calculation results of the simulation control program closer to the actual operation results of the target controller, and improves the accuracy of the calculation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119414764A_ABST
    Figure CN119414764A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a data synchronization method and device, electronic equipment, a storage medium and a program product. According to the invention, the intermediate process data acquired from the target controller is synchronized to the simulation control program, so that the simulation control program can perform subsequent logical operation based on the intermediate process data, and the defect that the simulation control program lacks the intermediate process data at the initial starting stage is overcome; the calculation result of the simulation control program is closer to the calculation result of the target controller, and the calculation accuracy of the simulation control program is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a data synchronization method, device, electronic device, storage medium and program product. Background Art

[0002] Programmable Logic Controller (PLC) is a digital computing and operating electronic system that controls various types of mechanical equipment or production processes through digital or analog input and output. The historical data in the PLC, especially the intermediate process data, can record the information when the equipment is abnormal or fails, helping engineers to troubleshoot and accurately locate the cause of the failure. At present, the collection of intermediate process data is mainly carried out through polling or listening, but due to the influence of network bandwidth and the maximum communication load of PLC, it is impossible to obtain the full amount of data within the PLC data acquisition cycle in time. In this regard, the use of soft PLC to simulate the operation logic of the on-site PLC in order to simulate and calculate the full amount of data of the on-site PLC is an important way to obtain the full amount of PLC data.

[0003] Soft PLC is an executable program compiled by transplanting the field PLC project to an ordinary PC. Its code execution logic is the same as the logic of the PLC project. However, when the soft PLC is started, the field PLC has actually been running for a period of time. During this period, a large amount of intermediate process data is generated, and these intermediate process data will affect the logical operation of the field PLC intermediate program, and ultimately affect the operation results output by the field PLC. At the time of startup, the soft PLC has almost no intermediate process data. At this time, even if the input data and program logic of the soft PLC are the same as those of the field PLC, there will still be a large gap between the operation results of the soft PLC and the operation results of the field PLC, which affects the accuracy of the soft PLC simulation calculation.

[0004] Therefore, how to synchronize data between the soft PLC and the field PLC to ensure the accuracy of the soft PLC simulation calculation is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In order to solve the above technical problems, the present disclosure provides a data synchronization method, device, electronic device, storage medium and program product to improve the accuracy of simulation calculations.

[0006] In a first aspect, an embodiment of the present disclosure provides a data synchronization method, including:

[0007] Collecting actual operation data generated by the operation of the target control program of the target controller, the actual operation data at least including actual intermediate process data;

[0008] The actual operation data is synchronized to the simulation control program so that the actual operation data participates in the operation of the simulation control program. The simulation control program simulates the operation of the target control program and generates simulation operation data. The simulation operation data at least includes simulation intermediate process data.

[0009] In a second aspect, an embodiment of the present disclosure provides a data synchronization device, including:

[0010] A collection module, used for collecting actual operation data generated by the operation of the target control program of the target controller, wherein the actual operation data at least includes actual intermediate process data;

[0011] The data synchronization module is used to synchronize the actual operation data to the simulation control program so that the actual operation data participates in the operation of the simulation control program. The simulation control program simulates the operation of the target control program and generates simulation operation data, and the simulation operation data at least includes simulation intermediate process data.

[0012] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:

[0013] Memory;

[0014] Processor; and

[0015] Computer programs;

[0016] The computer program is stored in the memory and is configured to be executed by the processor to implement the method of the first aspect.

[0017] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, and the computer program is executed by a processor to implement the method of the first aspect.

[0018] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the method of the first aspect is implemented.

[0019] The data synchronization method, device, electronic device, storage medium and program product provided by the embodiments of the present disclosure synchronize the intermediate process data collected from the target controller to the simulation control program so that the simulation control program can perform subsequent logical operations based on the intermediate process data, thereby compensating for the lack of intermediate process data in the initial startup of the simulation control program, making the calculation results of the simulation control program closer to the calculation results of the target controller, and improving the accuracy of the simulation control program calculation. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0022] Figure 1 A flow chart of a data synchronization method provided by an embodiment of the present disclosure;

[0023] Figure 2 A schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0024] Figure 3 A schematic diagram of a second cycle process provided by an embodiment of the present disclosure;

[0025] Figure 4 A schematic diagram of the structure of a data synchronization device provided by an embodiment of the present disclosure;

[0026] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0027] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0028] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0029] The present disclosure provides a data synchronization method, which is described below in conjunction with a specific embodiment.

[0030] Figure 1 A flow chart of a data synchronization method provided in an embodiment of the present disclosure. The method can be applied to Figure 2The application scenario shown includes a target controller 21 and a device 22; wherein the target controller 21 may be a hardware PLC, in which a target control program is running; and a simulation control program is running in the device 22. Optionally, the device 22 may be a handheld computer, a tablet computer, a desktop computer, a laptop computer, an all-in-one computer, etc., or a redundant central processing unit (CPU) in a redundant PLC machine or a hardware PLC, or a data acquisition module integrated in a hardware PLC. It is understandable that the data synchronization method provided in the embodiment of the present disclosure may also be applied in other scenarios.

[0031] Combine the following Figure 2 The application scenario shown is Figure 1 The data synchronization method shown in the figure is introduced, and the specific steps of the method are as follows:

[0032] S101. Collecting actual operation data generated by the operation of a target control program of a target controller, where the actual operation data at least includes actual intermediate process data.

[0033] The target controller 21 is a physical controller, in which a target control program is running, and the target control program controls various types of configuration devices in the field through digital or analog input and output data. The target controller can be any controller that can be used for device control, such as a programmable logic controller (PLC), a distributed control system (DCS), etc.

[0034] Configuration devices can be understood as devices that are connected to and controlled by the target controller, including but not limited to sensors, cameras, motors, inverters, robots and other automation equipment in industrial sites. These devices are controlled by the controller and execute in an orderly manner according to predetermined programs.

[0035] During the operation of the target control program, various types of data will be generated, which are called actual operation data, including actual intermediate process data.

[0036] Optionally, the actual operation data also includes actual input data and actual output data. The actual input data refers to the data sent by the configuration device to the target controller, such as I data; the actual output data refers to the data sent by the target controller to the configuration device, such as Q data; the actual intermediate process data refers to the intermediate processing data generated by logical operations based on the actual input data during the operation cycle or scan cycle of the target controller, including temporary data (temp data), M data, DB data, C data, T data, etc.

[0037] Among them, M data refers to data located in the M area of ​​the target controller 21 memory, which is the bit memory of the target controller 21 and is used to store data such as pulse signals; DB data refers to data located in the D area and is used to store relevant data of the background data block; C data is data located in the C area and is used to store relevant data of the calculator; T data is data located in the T area and is used to store relevant data of the timer.

[0038] S102, synchronizing the actual operation data to the simulation control program so that the actual operation data participates in the operation of the simulation control program, the simulation control program simulates the operation of the target control program and generates simulation operation data, the simulation operation data at least includes simulation intermediate process data.

[0039] The simulation control program is a program running in the device 22. The simulation control program can simulate the operation of the target control program, that is, the simulation control program has the same or similar operation logic as the target control program.

[0040] Optionally, the simulation control program can run on a hardware redundant controller (such as a redundant PLC device, a redundant DCS device, etc.), on a data acquisition module integrated in a hardware controller, or on any electronic device that can run a simulation control program. The simulation control program can be a soft PLC, which is not limited here.

[0041] After the actual operation data is collected from the target controller, the actual operation data is stored in the corresponding storage space in the simulation control program, so that the simulation control program can run based on the actual operation data and generate corresponding simulation operation data.

[0042] Specifically, the simulation operation data at least includes simulation intermediate process data. The simulation intermediate process data refers to the intermediate processing data generated by logical operations based on the actual operation data during the operation cycle or scanning cycle of the simulation controller, including temporary data (temp data), M data, DB data, C data, T data, etc.

[0043] Optionally, the simulation operation data also includes simulation input data and simulation output data. The simulation input data is the same as the actual input data, which refers to the data sent by the configuration device to the target controller, such as I data; the simulation output data refers to the data generated by the simulation control program after simulation operation, and the simulation output data is not sent to the configuration device for control of the configuration device.

[0044] The simulated intermediate process data and simulated output data are not sent to the configuration device for the control of the configuration device, but can be used for statistical analysis of industrial big data, determining the root cause of field equipment failure, or optimizing field equipment.

[0045] The disclosed embodiment synchronizes the actual operation data collected from the target controller to the simulation control program so that the simulation control program can perform subsequent logical operations based on the actual operation data, thereby compensating for the lack of operation data, especially intermediate process data, in the initial startup of the simulation control program. This makes the calculation results of the simulation control program closer to the actual operation results of the target controller, thereby improving the accuracy of the simulation control program calculations.

[0046] In some embodiments, before collecting actual data generated by the operation of the target control program of the target controller used for device control, the method also includes: synchronizing the clock corresponding to the preset operating environment for running the simulation control program so that the clock corresponding to the simulation control program is synchronized with the clock corresponding to the target control program of the target controller.

[0047] Since there is a difference in hardware quality between the clock corresponding to the simulation control program and the clock corresponding to the target control program, there may be errors in the timing accuracy between the two. Therefore, it is necessary to synchronize the clocks of the two to provide the same time reference for the calibration of the pulse signal during data synchronization.

[0048] Specifically, an acquisition request is initiated to a clock server used by the target controller to obtain the current time, and the system time of the preset running environment of the simulation control program is set as the current time.

[0049] Optionally, the clock synchronization step is performed once every preset time during the data synchronization process, so as to avoid the long-term accumulation of errors between the clock corresponding to the simulation control program and the clock corresponding to the target control program, resulting in a large time error.

[0050] On the basis of the above embodiment, actual operation data generated by the operation of the target control program of the target controller for device control is collected, and the actual operation data at least includes actual intermediate process data, and also includes: parsing the engineering file of the target controller to obtain a variable table, the variable table contains variable information of multiple variables corresponding to the actual operation data, the variable information includes the name and length of each variable; or the name, length and address information of each variable; based on the variable information in the variable table, the actual operation data generated by the operation of the target control program is collected.

[0051] The project file of the target controller is used to store configuration information related to the target control program, such as control logic, input and output configuration, variable information, etc. The project file is parsed to obtain a variable table containing variable information of multiple variables.

[0052] The variable information in the variable table corresponds to the actual operation data, that is, the actual operation data includes the values ​​of one or more variables.

[0053] The variables contained in the variable table are divided into two types. One type is variables with address information, such as input data, output data, and some actual intermediate process data such as non-optimized DB blocks, M area data, C area data, T area data, etc. For this type of variables, the variable information of the variable table at least includes their name, length and address information. The other type is variables without address information, such as optimized DB blocks or variables without address offset in DB blocks. For this type of variables, the variable information of the variable table at least includes their name and length.

[0054] Furthermore, different methods are used for collecting actual operation data according to different variable types. The following introduces the actual operation data collection methods corresponding to different types of variables.

[0055] In some embodiments, when the variable information of the variable includes address information, a first acquisition process is performed based on the address information and the length until each variable with address information participates in forming a data acquisition unit.

[0056] Among them, a data acquisition unit is a data set, which corresponds to at least one variable. In the data acquisition process, a single data acquisition unit is taken as a whole in each scanning cycle, and the actual operation data corresponding to each variable contained therein is collected to obtain the actual operation data corresponding to the data acquisition unit. The sum of the lengths of at least one variable contained in the data acquisition unit is less than or equal to the preset threshold.

[0057] The first acquisition process includes: starting from the candidate variable with the smallest starting address, if the sum of the lengths of the N adjacent address candidate variables is less than or equal to the preset threshold, and the sum of the lengths of the N+1 adjacent address candidate variables is greater than the preset threshold, then the N adjacent address candidate variables are used as a data acquisition unit, N is an arbitrary positive integer, the candidate variable is a variable that does not participate in the formation of the data acquisition unit, and the preset threshold is the maximum length of the data acquisition unit acquired by the target controller in a single time.

[0058] For variables with address information, multiple variables with adjacent variable addresses can be combined into a data acquisition unit whose length does not exceed a preset threshold, that is, the sum of the lengths of the multiple variables constituting the data acquisition unit does not exceed the maximum length of the data acquisition unit collected by the target controller in a single time.

[0059] Specifically, according to the variable table obtained by parsing the project file, all variables in the interval corresponding to the variable with address information are obtained, and the name, length and address information of each variable are determined, wherein the address information of the variable includes the starting address of the variable.

[0060] The maximum length of the data acquisition unit collected by the target controller at a single time corresponding to the preset threshold is the length of the Protocol Data Unit (PDU), which represents the maximum length of data that can be provided at a single time during the external communication process of the PLC in one scan cycle, such as the maximum byte length. Organizing multiple variables with address information into data acquisition units, and the length of each data acquisition unit is less than the preset threshold, can ensure that the actual operation data corresponding to the entire data acquisition unit is obtained in one scan cycle.

[0061] The variables that do not participate in forming the data collection unit are called candidate variables. The candidate variable with the smallest starting address is determined according to the address information. The candidate variable with the smallest starting address is taken as the first candidate variable, and each candidate variable is traversed backward while accumulating the length of each candidate variable. When the sum of the lengths of N consecutive candidate variables with adjacent addresses is less than or equal to the preset threshold, and the sum of the lengths of N+1 consecutive candidate variables with adjacent addresses is greater than the preset threshold, the N candidate variables that have been traversed are taken as a data collection unit.

[0062] At this time, the N+1th candidate variable becomes the candidate variable with the smallest starting address, and the above process is continued from this candidate variable to obtain the next data acquisition unit; and so on, until all variables with address information participate in forming the data acquisition unit.

[0063] In other embodiments, when the variable information of a variable does not include address information, if the length of the variable is less than or equal to a preset threshold, the variable is used as a data acquisition unit; or, if the length of the variable is greater than the preset threshold, the variable is used as a target variable, and a second loop process is executed based on the variable name and length until each variable that does not include address information participates in the formation of a data acquisition unit.

[0064] For variables that do not include address information, if the length of the variable is less than or equal to the preset threshold, that is, the actual operating data corresponding to the variable can be obtained within a single scanning cycle, the variable is directly used as a data acquisition unit; if the length of the variable is greater than the preset threshold, that is, the actual operating data corresponding to the variable cannot be obtained within a single scanning cycle, then the variable needs to be used as the target variable to be traced, and at least one level of sub-member variables of the target variable is traced through the second loop process, and a data acquisition unit is constructed based on the sub-member variables until each variable that does not include address information participates in the construction of the data acquisition unit.

[0065] Optionally, the variable may be an array type variable, and the types of the multiple sub-member variables contained therein are the same; or, the variable may be a composite type variable, and the types of the multiple sub-member variables contained therein are different.

[0066] The second loop process includes: determining the length of each sub-member variable contained in the target variable; if the length information of the sub-member variable is less than or equal to the preset threshold, the sub-member variable is used as a data acquisition unit; or, if the length information of the sub-member variable is greater than the preset threshold, the sub-member variable is used as the target variable, the sub-member variable is the descendant node of the variable in the tree structure, and the preset threshold is the maximum length of the data acquisition unit collected by the target controller in a single time.

[0067] Among them, the tree structure records the parent-child relationship between the variable and its multi-level child member variables, and the node corresponding to each level of child member variables is the descendant node of the node corresponding to the variable. For example, for a primary variable, the multiple secondary variables it contains, and the tertiary variables contained in each secondary variable are all multi-level child member variables of the primary variable, and at the same time, the nodes corresponding to each of the secondary variables and the nodes corresponding to each of the tertiary variables are all descendant nodes of the node corresponding to the primary variable. It can be understood that in this embodiment, there is no restriction on the number of levels of variables, and only the three-level variables are used for exemplary description.

[0068] Since the length of the target variable is greater than the preset threshold, it cannot be directly used as a data collection unit. At this time, at least one child member variable of the target variable is traced back according to the tree structure, and it is determined whether the length of each child member variable exceeds the preset threshold.

[0069] For a sub-member variable whose length is less than or equal to the preset threshold, the sub-member variable is used as a data collection unit and is no longer traced downward; for a sub-member variable whose length is greater than the preset threshold, the sub-member variable is used as the target variable and the sub-member variables of the target variable are traced downward; the above process is repeated until each variable participates in the formation of a data collection unit.

[0070] Figure 3 A schematic diagram of a second cycle process provided by an embodiment of the present disclosure, such as Figure 3 As shown, the second cycle process includes:

[0071] S301. Determine the length of each sub-member variable contained in the target variable.

[0072] S302: for each sub-member variable, determine whether the length of the sub-member variable is greater than a preset threshold. If yes, execute S303; if no, execute S304.

[0073] S303. Use the child member variable as the target variable and jump to S301.

[0074] S304. Use the child member variable as a data collection unit.

[0075] For example, a primary variable contains multiple secondary variables. If the length of the primary variable is less than or equal to a preset threshold, the primary variable is directly used as a data collection unit; if the length of the primary variable is greater than the preset threshold, the length of each secondary variable contained in the primary variable is determined, and one or more secondary variables whose length is less than or equal to the preset threshold are used as a data collection unit respectively; for each secondary variable whose length is greater than the preset threshold, each tertiary variable contained in the secondary variable is traversed, and so on.

[0076] After at least one data acquisition unit is obtained through the first cycle process and / or the second cycle process, actual operation data corresponding to the data acquisition unit generated by the operation of the target control program is acquired for each data acquisition unit.

[0077] Taking the data acquisition unit as a unit, the actual operation data corresponding to one data acquisition unit is obtained in each scanning cycle, and finally the full amount of actual operation data is obtained.

[0078] Furthermore, for the actual operation data collected in batches, according to the preset storage address, the actual operation data is stored in real time in the storage space corresponding to the variable. For example, for a variable with address information, its actual operation data is stored in the storage space pointed to by the address information; for a variable without address information, the developer pre-configures the location information of its storage space, and its actual operation data is stored in the storage space pointed to by the pre-configured location information.

[0079] The disclosed embodiment organizes variables into data acquisition units for acquisition, and adopts different methods to acquire different types of variables, and further stores the actual operation data acquired in each scanning cycle into a preset address, and finally obtains the full amount of actual operation data, so that the simulation control program calculated based on the actual operation data is as similar as possible to the target control program of the actual operation, thereby improving the accuracy of the calculation of the simulation control program.

[0080] In some embodiments, after the actual process data participates in the operation of the simulation control program, the method also includes: collecting actual operation data of the target control program, the actual operation data includes actual intermediate process data and / or actual output data; obtaining simulated operation data generated by the simulation control program simulating the operation of the target control program, the simulated operation data includes simulated intermediate process data and / or simulated output data; if the actual operation data is inconsistent with the simulated operation data, replacing the simulated operation data in the simulation control program with the actual operation data.

[0081] After the actual process data participates in the operation of the simulation control program, the accuracy of the simulation control program needs to be tested and calibrated, and the data in the simulation control program needs to be updated to continuously improve its accuracy, ultimately achieving complete synchronization with the target control program or infinitely close to it.

[0082] Specifically, the actual operation data of the target control program is compared with the simulated operation data of the simulation control program. If the two are consistent, it proves that the simulation control program is synchronized with the target control program; if the two are inconsistent, it proves that the simulation control program is not synchronized with the target control program and the simulation control program needs to be calibrated.

[0083] Optionally, compare the actual output data with the simulated output data. If the two are consistent, it proves that the simulated control program is synchronized with the target control program; if the two are inconsistent, it proves that the simulated control program is not synchronized with the target control program. The actual intermediate process data shall prevail and the simulated intermediate process data shall be replaced with the actual intermediate process data.

[0084] Optionally, compare the actual intermediate process data with the simulated intermediate process data. If the two are consistent, it proves that the simulated control program is synchronized with the target control program; if the two are inconsistent, it proves that the simulated control program is not synchronized with the target control program. The actual intermediate process data shall prevail and the simulated intermediate process data shall be replaced with the actual intermediate process data.

[0085] Optionally, compare the actual output data with the simulated output data, and compare the actual intermediate process data with the simulated intermediate process data. If both data are consistent, it proves that the simulation control program is synchronized with the target control program; if there is at least one inconsistent data, it proves that the simulation control program is not synchronized with the target control program. The actual intermediate process data shall prevail, and the simulated intermediate process data shall be replaced with the actual intermediate process data.

[0086] Optionally, on the basis of replacing the simulated intermediate process data with the actual intermediate process data, the simulated output data may also be replaced with the actual output data.

[0087] Optionally, in the process of comparing the actual operation data with the simulated operation data, the comparison can be made in units of single variables or in units of data acquisition units. When comparing single variables, if they are inconsistent, the data of the variable in the actual operation data is directly written into the corresponding storage space in the simulated control program.

[0088] On the basis of the above embodiment, in the case where the simulation control program is out of synchronization with the target control program, after replacing the simulation operation data with the actual operation data, multiple rounds of data comparison are continued, and the simulation operation data is replaced with the actual operation data each time the comparison results are inconsistent; when the number of rounds of data comparison exceeds the preset round number threshold, if the simulation control program is still out of synchronization with the target control program, a warning message needs to be generated to remind the developer to check.

[0089] The disclosed embodiment compares the actual operation data with the simulation operation data in real time during the process of the simulation control program performing calculations based on the actual operation data obtained by collection to determine whether the simulation control program is synchronized with the target control program, and replaces the simulation operation data with the actual operation program when the two are not synchronized, thereby making the simulation control program gradually approach the target control program, continuously improving the accuracy of the simulation control program, and finally being able to synchronize with the target control program.

[0090] Figure 4 The data synchronization device provided by the embodiment of the present disclosure can execute the processing flow provided by the data synchronization method embodiment, such as Figure 4 As shown, the data synchronization device 40 includes: a first acquisition module 41 and a data synchronization module 42; wherein the first acquisition module 41 is used to acquire actual operation data generated by the operation of the target control program of the target controller, and the actual operation data at least includes actual intermediate process data; the data synchronization module 42 is used to synchronize the actual operation data to the simulation control program so that the actual operation data participates in the operation of the simulation control program, and the simulation control program simulates the operation of the target control program and generates simulated operation data, and the simulated operation data at least includes simulated intermediate process data.

[0091] Optionally, the first acquisition module 41 includes a parsing unit and an acquisition unit; the parsing unit is used to parse the engineering file of the target controller to obtain a variable table, the variable table contains variable information of multiple variables corresponding to the actual operation data, the variable information includes the name and length of each variable; or the name, length and address information of each variable; the acquisition unit is used to collect the actual operation data generated by the operation of the target control program based on the variable information in the variable table.

[0092] Optionally, the acquisition unit is used to execute a first acquisition process based on the address information and the length when the variable information of the variable includes address information, until each variable with address information participates in constituting a data acquisition unit, the first acquisition process comprising: starting from the candidate variable with the smallest starting address, if the sum of the lengths of N candidate variables with adjacent addresses is less than or equal to a preset threshold, and the sum of the lengths of N+1 candidate variables with adjacent addresses is greater than the preset threshold, then the N candidate variables with adjacent addresses are taken as a data acquisition unit, N is an arbitrary positive integer, the candidate variable is a variable that does not participate in constituting a data acquisition unit, and the preset threshold is the maximum length of a data acquisition unit acquired by the target controller in a single acquisition; for each data acquisition unit, actual operation data corresponding to the data acquisition unit generated by the operation of the target control program is collected.

[0093] Optionally, the acquisition unit is used to, when the variable information of the variable does not include address information, if the length of the variable is less than or equal to a preset threshold, use the variable as a data acquisition unit; or, if the length of the variable is greater than the preset threshold, use the variable as a target variable, and execute a second loop process based on the variable name and length until each variable that does not include address information participates in the construction of the data acquisition unit, the second loop process includes: determining the length of each sub-member variable contained in the target variable; if the length information of the sub-member variable is less than or equal to the preset threshold, use the sub-member variable as a data acquisition unit; or, if the length information of the sub-member variable is greater than the preset threshold, use the sub-member variable as the target variable, the sub-member variable is a descendant node of the variable in the tree structure, and the preset threshold is the maximum length of the data acquisition unit acquired by the target controller in a single time; for each data acquisition unit, collect the actual operation data corresponding to the data acquisition unit generated by the operation of the target control program.

[0094] Optionally, the data synchronization device 40 also includes a second acquisition module, an acquisition module, and a replacement module; the second acquisition module is used to acquire actual operation data of the target control program after the actual process data participates in the operation of the simulation control program, and the actual operation data includes actual intermediate process data and / or actual output data; the acquisition module is used to acquire simulated operation data generated by the simulation control program simulating the operation of the target control program, and the simulated operation data includes simulated intermediate process data and / or simulated output data; the replacement module is used to replace the simulated operation data in the simulation control program with the actual operation data if the actual operation data is inconsistent with the simulated operation data.

[0095] Optionally, the data synchronization device 40 also includes a clock synchronization module, which is used to synchronize the clock corresponding to the preset operating environment of the simulation control program before collecting actual data generated by the operation of the target control program of the target controller used for equipment control, so as to synchronize the clock corresponding to the simulation control program with the clock corresponding to the target control program of the target controller.

[0096] Figure 4 The data synchronization device of the illustrated embodiment can be used to execute the technical solution of the above-mentioned method embodiment. Its implementation principle and technical effect are similar and will not be described in detail here.

[0097] Figure 5 The electronic device provided by the embodiment of the present disclosure can execute the processing flow provided by the data synchronization method embodiment, such as Figure 5 As shown, the electronic device 50 includes: a memory 51, a processor 52, a computer program and a communication interface 53; wherein the computer program is stored in the memory 51 and is configured so that the processor 52 executes the above data synchronization method.

[0098] In addition, an embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the data synchronization method of the above embodiment.

[0099] In addition, an embodiment of the present disclosure further provides a computer program product, which includes a computer program or instructions, and when the computer program or instructions are executed by a processor, the above data synchronization method is implemented.

[0100] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0101] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data synchronization method, characterized in that: The method comprises: Collecting actual operation data generated by the operation of the target control program of the target controller, wherein the actual operation data at least includes actual intermediate process data; The actual operation data is synchronized to a simulation control program so that the actual operation data participates in the operation of the simulation control program. The simulation control program simulates the operation of the target control program and generates simulation operation data, and the simulation operation data at least includes simulation intermediate process data.

2. The method according to claim 1, characterized in that The actual operation data generated by the target control program of the target controller for equipment control is collected, and the actual operation data at least includes actual intermediate process data, and also includes: Parsing the engineering file of the target controller to obtain a variable table, wherein the variable table contains variable information of a plurality of variables corresponding to the actual operation data, wherein the variable information includes the name and length of each variable; or the name, length and address information of each variable; Based on the variable information in the variable table, actual operation data generated by the operation of the target control program is collected.

3. The method according to claim 2, characterized in that The collecting actual operation data generated by the operation of the target control program based on the variable information in the variable table also includes: When the variable information of the variable includes address information, a first acquisition process is performed based on the address information and the length until each variable having the address information participates in forming a data acquisition unit, and the first acquisition process includes: Starting from the candidate variable with the smallest starting address, if the sum of the lengths of N candidate variables with adjacent addresses is less than or equal to a preset threshold, and the sum of the lengths of N+1 candidate variables with adjacent addresses is greater than the preset threshold, the N candidate variables with adjacent addresses are taken as a data acquisition unit, N is an arbitrary positive integer, the candidate variables are variables that do not participate in constituting a data acquisition unit, and the preset threshold is the maximum length of a data acquisition unit acquired by the target controller at a single time; For each of the data collection units, actual operation data corresponding to the data collection unit generated by the operation of the target control program is collected.

4. The method according to claim 2, characterized in that: The collecting actual operation data generated by the operation of the target control program based on the variable information in the variable table also includes: When the variable information of the variable does not include address information, if the length of the variable is less than or equal to a preset threshold, the variable is regarded as a data collection unit; or, If the length of the variable is greater than a preset threshold, the variable is used as a target variable, and a second loop process is performed based on the variable name and length until each variable that does not include address information participates in forming a data acquisition unit, and the second loop process includes: Determine the length of each sub-member variable contained in the target variable; If the length information of the sub-member variable is less than or equal to a preset threshold, the sub-member variable is used as a data collection unit; or, If the length information of the sub-member variable is greater than a preset threshold, the sub-member variable is used as the target variable, the sub-member variable is a descendant node of the variable in the tree structure, and the preset threshold is the maximum length of the data acquisition unit collected by the target controller in a single time; For each of the data collection units, actual operation data corresponding to the data collection unit generated by the operation of the target control program is collected.

5. The method according to claim 1, characterized in that After the actual process data participates in the running of the simulation control program, the method further includes: Collecting actual operation data of the target control program, wherein the actual operation data includes actual intermediate process data and / or actual output data; Acquire simulation operation data generated by the simulation control program simulating the operation of the target control program, wherein the simulation operation data includes simulation intermediate process data and / or simulation output data; If the actual operation data is inconsistent with the simulation operation data, the simulation operation data in the simulation control program is replaced by the actual operation data.

6. The method according to claim 1, characterized in that Before collecting actual data generated by the operation of the target control program of the target controller for equipment control, the method further includes: A clock corresponding to a preset operating environment for running the simulation control program is synchronized so that the clock corresponding to the simulation control program is synchronized with the clock corresponding to the target control program of the target controller.

7. A data synchronization device, characterized in that: include: A collection module, used for collecting actual operation data generated by the operation of the target control program of the target controller, wherein the actual operation data at least includes actual intermediate process data; A data synchronization module is used to synchronize the actual operation data to a simulation control program so that the actual operation data participates in the operation of the simulation control program. The simulation control program simulates the operation of the target control program and generates simulation operation data, and the simulation operation data at least includes simulation intermediate process data.

8. An electronic device, characterized in that: include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and is configured to be executed by the processor to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

10. A computer program product comprising a computer program or instructions, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.