A method for applying fragmentation and alternate storage of data

CN115657936BActive Publication Date: 2026-09-04NANJING GUODIAN NANZI WEIMEIDE AUTOMATION CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211125685.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-16
Publication Date
2026-09-04
Estimated Expiration
2042-09-16

Smart Images

  • Figure CN115657936B_ABST
    Figure CN115657936B_ABST
Patent Text Reader

Abstract

The application discloses a kind of application data fragmentation and alternate storage method, fragmentation storage method includes when initialization, to the classification division of each functional block of logic algorithm in distributed control system;According to the application data of each class functional block, generate corresponding data block, and index map is constructed to data block;In the normal operation of distributed control system, utilize the gap of logic algorithm execution according to index map index data block that needs to be stored and store the application data of this data block;Alternate storage method includes using the above fragmentation storage method and storing the application data of each functional block of logic algorithm as first application data file and second application data file in turn;The method of fragmentation in the application stores application data using the fragmentation time of the gap of logic algorithm execution, both save complete application program, also can save the state data needed.And using alternate storage method, file failure problem caused by unexpected failure can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a method for fragmenting and alternating storage of application data, belonging to the field of data storage technology. Background Technology

[0002] Distributed Control Systems (DCS) employ the design principles of distributed control and centralized operation, and are widely used in industrial control fields such as power and chemical industries. A DCS system consists of workstations, a communication network, distributed controllers, and input / output modules. The distributed controller is the core component of the DCS system, responsible for data acquisition, running control logic and algorithms, and control output. It also needs to interact with workstations via network communication for command and data exchange, monitor heartbeats and synchronize data between primary and backup controllers, and perform its own status monitoring and anomaly handling. To avoid having to restart the downloaded program every time a power outage occurs, the controller needs the ability to save application data after power failure. Typically, data is saved directly to disk files.

[0003] Typically, there are strict time limits (on the order of tens of milliseconds) for the execution logic cycle of the controller. Therefore, the time spent directly saving data to the disk file cannot be too long, otherwise it will cause the logic algorithm to time out, and a short period of loss of control may lead to the paralysis of the entire system. The usual practice is to save only a simplified application, reduce the amount of data to be saved, and complete the operation in one save. Secondly, if an unexpected failure such as a sudden power failure of the controller occurs during the saving process, the saved file will be incomplete, resulting in the problem of data loss. Summary of the Invention

[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method for fragmenting and alternating storage of application data, thereby solving the technical problems of small data storage volume and easy data failure due to faults in existing distributed control systems.

[0005] To achieve the above objectives, the present invention is implemented using the following technical solution:

[0006] In a first aspect, the present invention provides a method for fragmented storage of application data, comprising:

[0007] During the initialization of the distributed control system, the functional blocks of the logic algorithm are categorized and divided.

[0008] Generate corresponding data blocks based on the application data of each type of functional block, and construct an index graph for the data blocks;

[0009] During the normal operation of the distributed control system, the gaps in the execution of the logic algorithm are used to index the data blocks that need to be stored according to the index diagram and store the application data of the data blocks.

[0010] Optionally, the classification and division of the functional blocks of the logical algorithm includes:

[0011] Obtain the priority of each functional block in the logical algorithm and classify them based on the priority.

[0012] Optionally, constructing an index graph for the data blocks includes:

[0013] The priority of the data block to which the function block belongs is determined by the priority of the function block;

[0014] Data blocks are numbered according to their priority.

[0015] Set update bits, check bits, and save bits for each data block;

[0016] An index map is generated by saving the storage bits of each data block in numerical order;

[0017] Among them, the update bit, check bit, and save bit satisfy:

[0018] When a user modifies the application data of any function block, the update bit of the corresponding data block changes.

[0019] When the logic algorithm executes and modifies the application data of any functional block, the check bit of the corresponding data block changes.

[0020] When the update bit or parity bit of a data block changes, save position 1; when the update bit or parity bit of a data block does not change, save position 0.

[0021] Optionally, the step of using the gaps in the execution of the logical algorithm to index the data blocks that need to be stored according to the index graph and storing the application data of the data blocks includes:

[0022] During the intervals between n logical algorithm executions, the index map is indexed in numerical order to obtain the storage location of the data block corresponding to the number.

[0023] If the save bit of any data block is 1, then the application data of that data block is saved, and the indexing operation continues after the saving is completed.

[0024] If the save bit of any data block is 0, the application data of that data block is not saved, and the indexing operation continues.

[0025] If the indexing operation of the index graph is not completed during the interval between n logical algorithm executions, the indexing operation will continue during the interval between n+1 logical algorithm executions until the indexing operation of the index graph is completed.

[0026] Secondly, the present invention provides a fragmented storage system for application data, the system comprising:

[0027] The classification and partitioning module is used to classify and partition the functional blocks of the logic algorithm during the initialization of the distributed control system.

[0028] The index building module is used to generate corresponding data blocks based on the application data of each type of functional block, and to build an index graph for the data blocks;

[0029] The index storage module is used to index the data blocks that need to be stored according to the index diagram and store the application data of the data blocks during the intervals of logic algorithm execution in the normal operation of the distributed control system.

[0030] Thirdly, the present invention provides fragmented storage of application data, including a processor and a storage medium;

[0031] The storage medium is used to store instructions;

[0032] The processor is configured to operate according to the instructions to perform the steps according to the method described above.

[0033] Fourthly, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method.

[0034] Fifthly, the present invention provides a method for alternating storage of application data, comprising:

[0035] The fragmented storage method described above is used to store the application data of each functional block of the logic algorithm in a first application data file and a second application data file in sequence.

[0036] Compared with the prior art, the beneficial effects achieved by the present invention are as follows:

[0037] This invention provides a method for fragmenting and alternating storage of application data. 1) The fragmentation storage method divides and combines application data into functional blocks and uses a block index graph structure to manage the data, which forms the basis for fragmentation operations and also helps to improve the efficiency of inspection; 2) Update bits and check bits are set for data blocks, and the comparison operation of memory data verification calculation is used to replace the circular disk write operation, which greatly shortens the operation time and extends the life of the disk; 3) The fragmentation and saving operation of data blocks is carried out by utilizing the interval time of logic execution, avoiding the logic execution timeout problem caused by long-term saving operations, and effectively ensuring the stable operation of the system; 4) The alternating storage method adopts the method of alternating storage of data files, which avoids the situation where data files become invalid due to unexpected failures during the file saving process, resulting in the controller having no valid data files to resume operation after startup. Attached Figure Description

[0038] Figure 1This is a flowchart of a fragmented storage method for application data provided in Embodiment 1 of the present invention;

[0039] Figure 2 This is a schematic diagram of a data block and its index diagram provided in Embodiment 1 of the present invention;

[0040] Figure 3 This is a schematic diagram of the execution cycle of the logic algorithm provided in Embodiment 1 of the present invention. Detailed Implementation

[0041] The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and should not be used to limit the scope of protection of the present invention.

[0042] Example 1:

[0043] like Figure 1 As shown, this embodiment of the invention provides a method for fragmented storage of application data, including:

[0044] 1. During the initialization of the distributed control system, the functional blocks of the logic algorithm are categorized and divided.

[0045] In this embodiment, to ensure that data is not lost due to a fault, a priority-based classification method is used. Specifically, the priority of each functional block in the logical algorithm is obtained, and the classification is performed based on the priority.

[0046] 2. Generate corresponding data blocks based on the application data of each type of functional block, and construct an index graph for the data blocks;

[0047] (1) When the user completes the design of the logic algorithm, a download tool is needed to download it. When the download tool issues a download command, the controller starts to receive the downloaded logic algorithm and the application data of each functional block of the logic algorithm while building data blocks and index graphs.

[0048] (2) The size of the data block is determined based on the application data length of the function block. For example, the data length of a digital function block is 4 bytes, and the data length of an analog function block is 40 bytes. Multiple function blocks can be combined into one data block. In this way, a logic algorithm containing thousands of function blocks can be divided into dozens of data blocks. This allows several data blocks to be saved during the intervals between each execution of the logic algorithm, preventing the controller from being stuck by long disk operations. This fragmented saving method avoids timeouts in the execution of the logic algorithm.

[0049] (3) Figure 2 As shown, after the data blocks are constructed, an index graph is built for the data blocks, specifically including:

[0050] The priority of the data block to which the function block belongs is determined by the priority of the function block;

[0051] Data blocks are numbered (1 to N) according to their priority;

[0052] Set the update bit U, check bit CRC, and save bit for each data block;

[0053] An index map is generated by saving the storage bits of each data block in numerical order;

[0054] Among them, the update bit, check bit, and save bit satisfy:

[0055] When a user modifies the application data of any function block, the update bit of the corresponding data block changes; when a logical algorithm executes and modifies the application data of any function block, the check bit of the corresponding data block changes; when the update bit or check bit of a data block changes, the save bit is set to 1; when the update bit and check bit of a data block do not change, the save bit is set to 0.

[0056] (4) When the distributed control system initialization is complete, i.e., after the download is finished, the download tool sends a signal indicating that the download is complete. The controller immediately stores the application data of each functional block of its logic algorithm completely using the traditional method. Because users usually set the device to local operation mode during the download operation, i.e., the controller is disconnected from the device, and the distributed control system does not operate with the device, even if the storage time is long enough for the logic algorithm to time out, it will not affect the operation of the device. However, when the distributed control system is running normally, the controller will operate with the device, so a fragmented storage method is required.

[0057] 3. During the normal operation of the distributed control system, the data blocks that need to be stored are indexed according to the index diagram during the gaps in the execution of the logic algorithm, and the application data of the data blocks are stored.

[0058] In the normal operation of a distributed control system, such as Figure 3 As shown, assuming the logic algorithm requires an execution cycle of 20ms, of which 10ms is needed for logic execution, the remaining 10ms can be used to store application data.

[0059] 3.1 During the intervals between n executions of the logical algorithm, perform indexing operations on the index map in numerical order to obtain the storage location of the data block corresponding to the number;

[0060] 3.2 If the save bit of any data block is 1, then save the application data of that data block. After saving, continue the indexing operation.

[0061] 3.3 If the save bit of any data block is 0, the application data of that data block will not be saved, and the indexing operation will continue.

[0062] 3.4 If the indexing operation of the index graph is not completed during the interval between n logical algorithm executions, the indexing operation will continue during the interval between n+1 logical algorithm executions (starting from the number of the unfinished data block) until the indexing operation of the index graph is completed.

[0063] 3.4 Once all data blocks have been saved, update the version number and timestamp of the stored application data file, and switch to the next application data file for the next round of storage operations.

[0064] Using an indexed graph reduces lookup operations, shortening the time spent in this stage and allowing more application data blocks to be stored in the same amount of time. Instead of using a circular save-to-disk method, it retrieves the data blocks to be stored (i.e., when the application data of a function block changes, its corresponding data block needs to be stored) because disk save operations take 2-3 orders of magnitude longer than the time required for verification calculations and comparisons of data in memory. Minimizing disk operations not only shortens save operation time but also extends the lifespan of the disk.

[0065] Example 2:

[0066] This invention provides a fragmented storage system for application data, the system comprising:

[0067] The classification and partitioning module is used to classify and partition the functional blocks of the logic algorithm during the initialization of the distributed control system.

[0068] The index building module is used to generate corresponding data blocks based on the application data of each type of functional block, and to build an index graph for the data blocks;

[0069] The index storage module is used to index the data blocks that need to be stored according to the index diagram and store the application data of the data blocks during the intervals of logic algorithm execution in the normal operation of the distributed control system.

[0070] Example 3:

[0071] Based on Embodiment 1, this embodiment of the invention provides fragmented storage of application data, including a processor and a storage medium;

[0072] Storage media are used to store instructions;

[0073] The processor is used to perform operations according to instructions to execute the steps according to the method described above.

[0074] Example 4:

[0075] Based on Embodiment 1, this embodiment of the invention provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.

[0076] Example 5:

[0077] Based on Embodiment 1, this invention provides a method for alternating storage of application data, including:

[0078] The fragmented storage method described above is used to sequentially store the application data of each functional block of the logical algorithm into a first application data file and a second application data file. That is, after storing the first application data file, it is then stored into the second application data file; in the next round of storage operations, it switches back to storing into the first application data file, and so on.

[0079] If a hardware failure or system power loss occurs while saving one of the application data files, the other application data file can be used for system recovery. This avoids the controller reverting to its initial state upon startup and eliminates the need for the user to download data again. After a hardware failure or power loss, upon restarting the controller, the management program first checks the existence and validity of both data files. Then, it uses the version number and timestamp in the application data files to determine which file is newer. The updated application data file is then used to parse the logic algorithm and application data, restoring the controller's operation.

[0080] In summary, the fragmented storage method employed in this invention utilizes the fragmented time between controller logic algorithm executions to store application data. This preserves both the complete application program and necessary state data, facilitating analysis when the controller malfunctions. Furthermore, it avoids logic execution timeouts caused by prolonged save operations, effectively ensuring stable system operation. The bit verification comparison operation used shortens operation time and extends disk lifespan. The alternating storage method resolves file corruption issues caused by unexpected failures, preventing situations where the controller restarts without valid data files to resume operation.

[0081] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0082] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0083] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0084] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0085] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for fragmented storage of application data, characterized in that, include: During the initialization of the distributed control system, the functional blocks of the logic algorithm are categorized and divided. Generate corresponding data blocks based on the application data of each type of functional block, and construct an index graph for the data blocks; During the normal operation of the distributed control system, the gaps in the execution of the logic algorithm are used to index the data blocks that need to be stored according to the index diagram and store the application data of the data blocks. The construction of the index graph for the data blocks includes: The priority of the data block to which the function block belongs is determined by the priority of the function block; Data blocks are numbered according to their priority. Set update bits, check bits, and save bits for each data block; An index map is generated by saving the storage bits of each data block in numerical order; Among them, the update bit, check bit, and save bit satisfy: When a user modifies the application data of any function block, the update bit of the corresponding data block changes. When the logic algorithm executes and modifies the application data of any functional block, the check bit of the corresponding data block changes. When the update bit or parity bit of a data block changes, save position 1; when the update bit or parity bit of a data block does not change, save position 0.

2. The method for fragmented storage of application data according to claim 1, characterized in that, The classification and division of the functional blocks of the logical algorithm includes: Obtain the priority of each functional block in the logical algorithm and classify them based on the priority.

3. The method for fragmented storage of application data according to claim 1, characterized in that, The process of using logical algorithms to index the data blocks that need to be stored according to the index map and storing the application data of the data blocks includes: During the intervals between n logical algorithm executions, the index map is indexed in numerical order to obtain the storage location of the data block corresponding to the number. If the save bit of any data block is 1, then the application data of that data block is saved, and the indexing operation continues after the saving is completed. If the save bit of any data block is 0, the application data of that data block is not saved, and the indexing operation continues. If the indexing operation of the index graph is not completed during the interval between n logical algorithm executions, the indexing operation will continue during the interval between n+1 logical algorithm executions until the indexing operation of the index graph is completed.

4. A fragmented storage system for application data, characterized in that, The system includes: The classification and partitioning module is used to classify and partition the functional blocks of the logic algorithm during the initialization of the distributed control system. An index building module is used to generate corresponding data blocks based on the application data of each type of functional block, and to build an index graph for the data blocks; the construction of the index graph for the data blocks includes: The priority of the data block to which the function block belongs is determined by the priority of the function block; Data blocks are numbered according to their priority. Set update bits, check bits, and save bits for each data block; An index map is generated by saving the storage bits of each data block in numerical order; Among them, the update bit, check bit, and save bit satisfy: When a user modifies the application data of any function block, the update bit of the corresponding data block changes. When the logic algorithm executes and modifies the application data of any functional block, the check bit of the corresponding data block changes. When the update bit or parity bit of a data block changes, save position 1; when the update bit and parity bit of a data block do not change, save position 0. The index storage module is used to index the data blocks that need to be stored according to the index diagram and store the application data of the data blocks during the intervals of logic algorithm execution in the normal operation of the distributed control system.

5. A fragmented storage device for application data, characterized in that, Including processor and storage media; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to perform the steps of the method according to any one of claims 1-3.

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

7. A method for alternating storage of application data, characterized in that, include: The fragmented storage method described in any one of claims 1-3 is used to sequentially store the application data of each functional block of the logic algorithm into a first application data file and a second application data file.

Citation Information

Patent Citations

  • Method for amending logic algorithm routine of control system in online mode

    CN103529743A

  • Medical data processing method and system based on cloud computing

    CN112347055A