Modbus-based data storage method and related device

By reading and verifying the parameter page data of the physical device layer separately in the Modbus protocol, and combining the redundant storage mechanism of master and slave devices, the problems of centralized data distribution and read/write errors are solved, thus realizing the correctness and reliability of data storage and improving the performance and reliability of embedded software.

CN119512982BActive Publication Date: 2026-04-28SHENZHEN INVIC INTELLIGENT TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN INVIC INTELLIGENT TECHNOLOGY CO LTD
Filing Date
2024-11-01
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

The existing Modbus protocol suffers from performance degradation due to centralized data distribution, read/write errors, and erroneous writes caused by bus interference during data transmission and storage. It cannot effectively guarantee the independent storage and reliable interaction of data verification in embedded software.

Method used

By reading and verifying the parameter page data of the physical device layer separately, synchronizing it to the synchronization cache layer, converting the format and writing it, and combining the redundancy storage mechanism of master and slave devices, heterogeneous storage devices are used for redundant storage, and parameter page verification is performed during reading to ensure the correctness and reliability of the data.

Benefits of technology

It ensures the correctness and reliability of data during read operation, supports redundant storage of heterogeneous storage devices, ensures the correctness and high reliability of parameter reading, and improves the data storage performance and reliability of the Modbus protocol.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512982B_ABST
    Figure CN119512982B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a Modbus-based data storage method and related device, which are used to provide reliability guarantee for read parameter data. The method of the embodiments of the present application comprises: reading parameter page data located at a physical device layer, and checking the parameter page data; if the parameter page data passes the check, synchronizing the parameter page data corresponding to the parameter page to a synchronization cache layer; when the parameter page data has been synchronized to the synchronization cache layer, performing format conversion on parameter data to be written in the parameter page data, to obtain a page physical address corresponding to the parameter data to be written and parameter page data to be checked, so as to write the parameter page data to be checked into the page physical address of the physical device layer; reading out the parameter page data to be checked located at the page physical address of the physical device layer, synchronizing the parameter page data to be checked to the synchronization cache layer, and checking the parameter page data to be checked; if the parameter page data to be checked passes the check, determining that the parameter data to be written in the parameter page data to be checked is written completely.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of embedded control, and more particularly to a data storage method and related devices based on Modbus. Background Technology

[0002] The Modbus protocol is an open communication protocol widely used in industrial automation systems to enable data exchange between devices. Currently, Modbus is one of the most commonly used serial communication protocols, widely applied in communication between monitoring and control devices. In short, it is a method for transmitting information over serial lines between electronic devices. In the process of developing this invention, the inventors discovered that the prior art has at least the following problems: data transmitted via the Modbus protocol is relatively concentrated, while embedded software verification information, when stored independently, requires independent reading, leading to reduced performance / efficiency. Furthermore, the Modbus protocol cannot prevent read / write errors during interaction with the main controller or the storage controller of the data acquisition system.

[0003] Therefore, there is an urgent need for a method based on the Modbus protocol to provide reliability guarantees for various types of embedded software. Summary of the Invention

[0004] This application provides a Modbus-based data storage method and related equipment to provide reliability assurance for the read parameter data.

[0005] The first aspect of this application provides a Modbus-based data storage method, including:

[0006] The parameter page data located in the physical device layer is read and verified respectively; wherein the parameter page data is located in the parameter page of the physical device layer and includes parameter data;

[0007] If the parameter page data verification passes, the parameter page data corresponding to the parameter page will be synchronized to the synchronization cache layer;

[0008] When the parameter page data has been synchronized to the synchronization cache layer, the parameter data to be written in the parameter page data is converted into a format to obtain the page physical address corresponding to the parameter data to be written and the parameter page data to be verified, so as to write the parameter page data to be verified into the page physical address of the physical device layer.

[0009] Read the parameter page data to be verified located at the page physical address in the physical device layer, synchronize the parameter page data to be verified to the synchronization cache layer, and verify the parameter page data to be verified.

[0010] If the verification of the parameter page data passes, it is determined that the writing of the parameter data to be written in the parameter page data is complete.

[0011] Optionally, the storage system further includes an application layer, wherein reading parameter page data located at the physical device layer includes:

[0012] When the application layer reads the parameter data to be read located in the physical device layer, it determines the register sequence address of the parameter data to be read, and obtains the physical address of the page to be read corresponding to the parameter data to be read based on the register sequence address;

[0013] Read the parameter page data corresponding to the parameter data to be read based on the physical address of the page to be read.

[0014] Optionally, verifying the parameter page data includes:

[0015] Analyze the page storage space of the parameter page data; wherein, the page storage format of the page storage space includes at least a first space address for storing the parameter data, a second space address for storing the register sequence number address, and a third space address for storing the target identification code, and the register sequence number address is associated with the parameter data;

[0016] The parameter data located at the first spatial address and the register number address located at the second spatial address are respectively subjected to format verification to obtain the verification identification code corresponding to the parameter data and the register number address.

[0017] The identification code to be verified is verified according to the target identification code;

[0018] If the identification code to be verified is the same as the target identification code, it is determined that the parameter page data verification is successful, so that the parameter data is read into the Modbus response frame data and synchronized to the synchronization cache layer.

[0019] Optionally, the method further includes:

[0020] If the physical device layer receives the parameter data to be modified, it splits the parameter data to be modified according to the format conditions corresponding to the first space address in the page storage space to obtain multiple sets of split parameter data to be modified.

[0021] Calculate the register sequence address of each set of split parameter data to be modified, so as to obtain the page data of the parameter data to be modified corresponding to each set of split parameter data according to the page storage space;

[0022] Determine the target page physical address of the parameter page data to be modified, and write the parameter page data to be modified into the target page physical address.

[0023] Optionally, the physical device layer includes a master physical layer corresponding to the master device and a slave physical layer corresponding to the slave device, the parameter page data includes master parameter page data corresponding to the master device and slave parameter page data corresponding to the slave device, and the method further includes:

[0024] When the main parameter page data verification fails, the slave parameter page data of the slave device is read, so that when the slave parameter page data verification passes, the slave parameter page data is written to the main parameter page located in the main physical layer corresponding to the main parameter page data;

[0025] Alternatively, when the slave parameter page data verification fails, the master parameter page data of the master device is read, so that when the master parameter page data verification passes, the master parameter page data is synchronized to the slave parameter page located in the slave physical layer corresponding to the slave parameter page data.

[0026] Optionally, the method further includes:

[0027] When both the primary parameter page data and the secondary parameter data fail the verification, the initial parameter data located in the read-only data area of ​​the synchronization cache layer is synchronized to the primary parameter data of the primary parameter page data and the secondary parameter data of the secondary parameter page data.

[0028] The synchronized master parameter page data is obtained based on the master parameter data, and the synchronized slave parameter page data is obtained based on the slave parameter data.

[0029] Write the synchronized master parameter page data into the master parameter page, and write the synchronized slave parameter page data into the slave parameter page.

[0030] Optionally, after verifying the parameter page data to be verified, the method further includes:

[0031] If the data verification of the parameter page to be verified fails, verify all the main parameter pages of the physical device layer, and determine that the main parameter page that failed the verification is an error page;

[0032] Read the target slave parameter page corresponding to the error page from the slave device; when the target slave parameter page data verification passes, write the target slave parameter page data into the error page.

[0033] Alternatively, the step of synchronizing the initial parameter data located in the read-only data area of ​​the synchronization cache layer to the main parameter data of the main parameter page data is performed, so as to write the synchronized main parameter page data into the error page.

[0034] A second aspect of this application provides a Modbus-based data storage system, comprising:

[0035] A reading unit is configured to read parameter page data located in the physical device layer and verify the parameter page data respectively; wherein the parameter page data is located in the parameter page of the physical device layer and includes parameter data;

[0036] A synchronization unit is used to synchronize the parameter page data corresponding to the parameter page to the synchronization cache layer when the parameter page data verification passes.

[0037] The acquisition unit is used to convert the format of the parameter data to be written in the parameter page data when the parameter page data has been synchronized to the synchronization cache layer, so as to obtain the page physical address and the parameter page data to be verified corresponding to the parameter data to be written, and then write the parameter page data to be verified into the page physical address of the physical device layer.

[0038] The verification unit is used to read the parameter page data to be verified located at the page physical address in the physical device layer, synchronize the parameter page data to be verified to the synchronization cache layer, and verify the parameter page data to be verified.

[0039] The determining unit is used to determine that the writing of the parameter data to be written in the parameter page data has been completed when the verification of the parameter page data to be verified passes.

[0040] The Modbus-based data storage system provided in the second aspect of this application is used to execute the Modbus-based data storage method described in the first aspect.

[0041] A third aspect of this application provides a Modbus-based data storage device, comprising:

[0042] Central processing unit, memory, input / output interfaces, wired or wireless network interfaces, and power supply;

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

[0044] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the Modbus-based data storage method described in the first aspect.

[0045] A fourth aspect of this application provides a computer-readable storage medium including instructions that, when executed on a computer, cause the computer to perform the Modbus-based data storage method described in the first aspect.

[0046] A fifth aspect of this application provides a computer program product, the computer program product including instructions that, when executed on a computer, cause the computer to perform the Modbus-based data storage method described in the first aspect.

[0047] As can be seen from the above technical solutions, the embodiments of this application have the following advantages: The Modbus-based data storage method disclosed in this application ensures the correctness of read data when the storage system is in a read state. Furthermore, when reading parameter data from a single parameter page, it can also perform verification checks on the parameter data of that page, ensuring the correctness and reliability of parameter reading. Moreover, since the parameter data supports redundant storage on heterogeneous storage devices, the high reliability of the parameters is further ensured. Attached Figure Description

[0048] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings.

[0049] Figure 1 This is a schematic diagram of the structure of a redundant storage device disclosed in an embodiment of this application;

[0050] Figure 2 This is a schematic flowchart of a Modbus-based data storage method disclosed in an embodiment of this application;

[0051] Figure 3 This is a schematic flowchart of another Modbus-based data storage method disclosed in an embodiment of this application;

[0052] Figure 4 This is a schematic flowchart of another Modbus-based data storage method disclosed in an embodiment of this application;

[0053] Figure 5 This is a schematic flowchart of another Modbus-based data storage method disclosed in an embodiment of this application;

[0054] Figure 6 This is a schematic diagram of the spatial structure of a page storage format disclosed in an embodiment of this application;

[0055] Figure 7This is a schematic diagram of the structure of a Modbus-based data storage system disclosed in an embodiment of this application;

[0056] Figure 8 This is a schematic diagram of the structure of a Modbus-based data storage device disclosed in an embodiment of this application. Detailed Implementation

[0057] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0058] It should be noted that the use of terms such as "first" and "second" in this application is for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of those features. Furthermore, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, such a combination of technical solutions should be considered non-existent and not within the scope of protection claimed in this application.

[0059] Currently, existing technologies have three main problems: 1. Data is relatively concentrated, and verification information is stored independently and needs to be read independently, which leads to reduced performance / efficiency; 2. It cannot prevent read / write errors during the interaction with the storage controller; 3. It does not fully consider erroneous writes caused by bus interference during the read process.

[0060] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0061] Please see Figure 1 , Figure 1This is a schematic diagram of the structure of a redundant storage device disclosed in an embodiment of this application.

[0062] It should be noted that the embodiments of this application are applied to a storage system, which includes a physical device layer (physical layer), a synchronous cache layer (synchronization layer), and an application layer that are interconnected. Furthermore, the storage system mainly comprises three parts (functions): 1) read / write switching management; 2) parameter format conversion; and 3) device redundancy access. Further details will follow... Figures 2 to 5 The embodiments shown are described in detail here, and will not be repeated here. For Figure 1 The main focus is on describing its read / write switching functionality. Specifically, Figure 1 The storage device 1 or storage device 2 shown can be understood as a primary storage device or a secondary storage device. The control unit (MCU) is connected to the storage device via general-purpose input / output (GPIO). Each storage device has an independent write-protection pin, which is pulled up in hardware to ensure that the device is in read-only mode initially and in idle state. The connector (WP) level signal is switched to write-protected disabled state only when a write operation is required, and the write-protection level is switched back immediately after the write is completed.

[0063] To resolve the technical issues described above, please refer to [link / reference]. Figure 2 , Figure 2 This is a flowchart illustrating a Modbus-based data storage method disclosed in an embodiment of this application. It includes steps 201-205.

[0064] 201. Read the parameter page data located in the physical device layer respectively, and verify the parameter page data respectively.

[0065] For the redundant access function of the storage system, this embodiment proposes a heterogeneous redundant storage device structure, where one device is used as the master and the other as the slave. In the parameter application system, due to the existence of a parameter synchronization layer (synchronization layer) at the upper layer, the entire access process involves only two operations: initial loading and parameter writing. Specifically, during the initial loading phase, parameter page data located at the physical device layer (physical layer) can be read and verified separately. It should be noted that the parameter page data is located in the parameter pages of the physical device layer and includes parameter data.

[0066] In one specific embodiment, whether it is a master device (master storage device) or a slave device (slave storage device), the data is stored through parameter page data, that is, in the form of parameter pages, which will be described in detail later.

[0067] Furthermore, in this embodiment, the parameter pages, i.e. the parameter page data, can be read one by one, and then the parameter page data can be verified (it can be verified one by one or simultaneously, and there is no specific restriction here).

[0068] 202. If the parameter page data verification passes, synchronize the parameter page data corresponding to the parameter page to the synchronization cache layer.

[0069] Therefore, based on step 201, when the parameter page data verification passes, the parameter page data corresponding to the parameter page can be synchronized to the synchronization cache layer.

[0070] In one specific embodiment, the verification code of the parameter page data can be checked to see if it conforms to the rules. Furthermore, it can be checked whether the parameter data in the parameter page data is the parameter data that should be set and saved in that parameter page data. It should be noted that the parameter data refers to the stored data or callable data corresponding to parameters available for the storage system to run at the application layer, or other logical parameters.

[0071] Furthermore, after the parameter page data is validated, the parameter page data of the corresponding parameter page can be synchronized to the parameter cache, which is located in the synchronization cache layer.

[0072] 203. When the parameter page data has been synchronized to the synchronization cache layer, the parameter data to be written in the parameter page data is converted into a format to obtain the page physical address corresponding to the parameter data to be written and the parameter page data to be verified, so as to write the parameter page data to be verified into the page physical address of the physical device layer.

[0073] Based on step 202, when the parameter page data has been synchronized to the synchronization cache layer, the parameter data to be written in the parameter page data can be formatted to obtain the page physical address corresponding to the parameter data to be written and the parameter page data to be verified. Thus, the parameter page data to be verified can be written to the page physical address of the physical device layer.

[0074] In one specific embodiment, after the parameter page data has been synchronized to the synchronization cache layer, the parameter writing stage begins. Specifically, the parameter writing steps are described in steps 203-205. In this embodiment, before writing the parameter data from the parameter page data to the physical device layer, the parameter data to be written (i.e., the parameter data to be written to the physical device layer) needs to be formatted to obtain the page physical address corresponding to the parameter data to be written. Then, the storage system can read the parameter page data (described here as the parameter page data to be verified) at the page physical address obtained at this time. It should be noted that the page physical address at this time is the storage address in the physical device layer that stores the parameter page (and the parameter page data corresponding to that parameter page). Thus, the parameter page data to be verified can be written to the storage address corresponding to the page physical address on the physical device layer. Specifically, the parameter page data to be verified is written to the page physical address (physical address segment) of the storage device.

[0075] Furthermore, since the physical address of the parameter page data should be consistent across different layers (including the physical device layer and the synchronization cache layer), the parameter page data can be read based on the physical address of the page.

[0076] 204. Read the parameter page data to be verified located at the physical address of the page in the physical device layer, synchronize the parameter page data to be verified to the synchronization cache layer, and verify the parameter page data to be verified.

[0077] Based on step 203, the parameter page data to be verified can be read from the page physical address in the physical device layer, thereby synchronizing the parameter page data to be verified to the synchronization cache layer and verifying the parameter page data.

[0078] In one specific embodiment, the parameter page data to be verified at the physical address of the page corresponding to the parameter page can be read, and the parameter page data to be verified can be synchronized to the synchronization cache layer. It should be noted that the parameter page data is stored in the form of a parameter page at the storage address. Therefore, the parameter page data to be verified is stored in the form of a parameter page at the physical address of the page (the corresponding parameter page data to be verified can be described as a parameter page to be verified).

[0079] 205. If the data verification of the parameter page to be verified passes, it is determined that the parameter data to be written in the parameter page to be verified has been written.

[0080] Based on step 204, when the data verification of the parameter page to be verified passes, it can be determined that the parameter data to be written in the parameter page to be verified has been written.

[0081] In one specific embodiment, if the parameter page data to be verified passes the verification, then all the data in the parameter page data has been successfully written to the physical device layer. Thus, it can be concluded that the parameter data to be written has also been successfully written.

[0082] Furthermore, if the execution party writing the above parameters is the primary storage device, then the same process can be used to write from the storage device. Details will not be elaborated here.

[0083] Therefore, in this embodiment, redundant storage can be achieved using homogeneous or heterogeneous storage devices such as EEPROM and Nor Flash. The upper layer then controls parameter read / write operations through parameter change synchronization logic. The stored data follows the data format outlined in the scheme, and the correctness of each information field in the page data is verified, ensuring the correctness of the checksum. In case of anomalies, parameter rollback or reset of default parameters is triggered. The parameter rollback mechanism can roll back correct parameters from the slave device to the master device.

[0084] The Modbus-based data storage method disclosed in this embodiment ensures the correctness of read data when the storage system is in read mode. Furthermore, it performs verification checks on the parameter data of a single parameter page during each read, ensuring the correctness and reliability of the parameter reads. Moreover, since the parameter data supports redundant storage on heterogeneous storage devices, the high reliability of the parameters is further ensured.

[0085] From the above Figure 2 Step 201 is shown below. Further details can be found in [reference needed]. Figure 3 , Figure 3 This is a flowchart illustrating another Modbus-based data storage method disclosed in an embodiment of this application. It includes steps 301-309.

[0086] 301. When the application layer reads parameter data to be read from the physical device layer, it determines the register sequence address of the parameter data to be read and obtains the physical address of the page to be read corresponding to the parameter data to be read based on the register sequence address.

[0087] It should be noted that the steps in this embodiment are mainly for... Figure 2 Further description of step 201 in the illustrated embodiment. It should be noted that this embodiment also needs to be applied to the application layer of the storage system. Specifically, this embodiment can be understood as a format conversion step. In this embodiment, when the application reads the parameter data to be read located at the physical device layer, it is necessary to first determine the register sequence address of the parameter data to be read, and then obtain the physical address of the page to be read corresponding to the parameter data based on the register sequence address.

[0088] In one specific embodiment, there is only one type of space in the parameter storage, and all parameters are stored in units of pages. Data and information are stored in the same page (parameter page). For ease of understanding, please refer to [link to relevant documentation]. Figure 6 , Figure 6 This is a schematic diagram of the spatial structure of a page storage format disclosed in an embodiment of this application. Figure 6 As can be seen, parameter storage is mostly done in the form of parameter pages (parameter page-1, parameter page-2, ..., parameter page-n). Each parameter page includes at least the device ID, function code, starting register address, number of registers, parameter length, parameter data, CRC, or reserved bits. The specific content of each parameter page is not limited here. Correspondingly, each parameter page can store 64 bytes of content. Specifically, the register address / sequence number occupies 2 bytes, and 1 to 24 parameter data items can be stored, typically occupying 48 bytes (24 parameter data items, each occupying 2 bytes). However, in this embodiment, if the upper layer (i.e., the application layer) needs to read any parameter data (i.e., the parameter data to be read described in this embodiment), it needs to first determine the register address (sequence number) of the parameter data to be read. It should be noted that the register address (sequence number) corresponding to each parameter data item should be determined. For example, if there are 60 parameter data in a parameter storage space, and the 18th parameter data needs to be read, then the register address (sequence number) of the parameter data to be read is the address corresponding to the 18th sequence number.

[0089] Then, the physical address of the page containing the parameter data to be read (i.e., the physical address of the page to be read described above) can be obtained based on the register sequence number address. Specifically, since this embodiment sets the parameter page to store 64 bytes of content, and since the 18th bit of the sequence number should be in parameter page - 1, the address corresponding to the 18th bit of the sequence number should be the physical address of the page containing parameter page - 1.

[0090] In short, assuming 24 parameters (48 bytes) are stored within a page, and the read / write request address passed from the upper-layer application is a logical sequence number of 16 bits of data, denoted as A, then the conversion formula is:

[0091] Page number = Register address(page number) / 24

[0092] Page physical address = Page sequence number × 64 = (Register address (sequence number) / 24) × 64

[0093] Therefore, the physical address of the page to be read can be determined using the above conversion formula.

[0094] In other feasible technical solutions, the Modbus RTU 0x10 instruction (which writes multiple holding registers consecutively, but the total number cannot exceed 48) can be directly interfaced to achieve data format conversion at the application layer.

[0095] 302. Read the data of the parameter page corresponding to the parameter data to be read based on the physical address of the page to be read.

[0096] Then, after obtaining the physical address of the page to be read, the page data containing the parameter data to be read can be read sequentially.

[0097] In one specific embodiment, as can be seen from step 301 above, since the page physical address stores parameter page data, the parameter page data to be read (which stores the parameter data to be read) can be read after the page physical address to be read is known.

[0098] Furthermore, if multiple parameter data need to be read in the preceding steps, the physical addresses of the pages corresponding to different parameter data can be read sequentially, thereby reading multiple parameter pages. In short, the page physical address is first calculated using the address translation formula, and then the parameter page data is read page by page.

[0099] 303. Analyze the page storage space of the parameter page data.

[0100] As described above, in verifying parameter page data, it is necessary to first analyze the page storage space of the parameter page data. Figure 6 As can be seen, the page storage format includes at least the first space address for storing parameter data (generally, there are 1 to 24 parameters, occupying 28 bytes), the second space address for the register sequence number (generally occupying 2 bytes), and the third space address for the target identification code (i.e., a 16-bit CRC, generally occupying 2 bytes). Furthermore, as described above, there is a correlation between the register sequence number address and the parameter data. Therefore, the various data included in the parameter page data can be determined, such as the device ID, function code, starting register address, number of registers, parameter length, parameter data, CRC, or reserved bits.

[0101] 304. Perform format verification on the parameter data located at the first space address and the register number address located at the second space address respectively to obtain the verification identification code corresponding to the parameter data and the register number address.

[0102] Based on step 303, the format verification can be performed on the parameter data located at the first space address and the register number address located at the second space address, thereby obtaining the verification identification code corresponding to the parameter data and the register number address.

[0103] In one specific embodiment, the register address (serial number) and parameter data in the parameter page are verified by an algorithm to obtain a verification code in the same format as CRC.

[0104] Furthermore, algorithm verification can be performed separately or uniformly on each piece of data in the parameter page data. That is, weighted operations or encryption operations can be performed on the device ID, function code, starting register address, number of registers, parameter length, parameter data, CRC or reserved bits, etc., to obtain a verification identification code in the same format as CRC. There are no restrictions on the method of generating the verification identification code here.

[0105] 305. Verify the identification code to be verified based on the target identification code.

[0106] Therefore, the identification code to be verified can be verified based on the target identification code in the parameter page data after format verification.

[0107] In one specific embodiment, step 306 or step 306 is executed respectively by verifying whether the target identification code and the identification code to be verified are the same. Figure 4 The relevant steps of the illustrated embodiment (i.e., see the redundant storage section).

[0108] 306. If the identification code to be verified is the same as the target identification code, the parameter page data verification is confirmed to be successful. The parameter data is then read into the Modbus response frame data and synchronized to the synchronization buffer layer.

[0109] Based on step 305, when the identification code to be verified is the same as the target identification code, it can be determined that the parameter page data verification is successful, and the parameter data in the parameter page data is read into the Modbus response frame data and synchronized to the synchronization cache layer.

[0110] In one specific embodiment, when the identification code to be verified is the same as the target identification code, the parameter data in the parameter page data can be read by combining the above steps. This parameter data can then be cached in the synchronization cache layer or extracted to the user parameter cache layer. Specifically, the parameter data can be synchronously cached or extracted in the form of a Modbus response frame.

[0111] 307. If the physical device layer receives the parameter data to be modified, it splits the parameter data to be modified according to the format conditions of the first space address corresponding to the page storage space to obtain multiple sets of split parameter data to be modified.

[0112] Furthermore, in other feasible technical solutions, when parameter data needs to be modified, the physical device layer receives the parameter data to be modified, and can then split the parameter data to be modified according to the format conditions of the first space address corresponding to the page storage space to obtain multiple sets of split parameter data to be modified.

[0113] In one specific embodiment, when modifying parameters through other means, the parameter data to be read or written is first received, i.e., the parameter data to be modified mentioned above. Then, it can be done as follows: Figure 3 The parameter data caching format shown involves splitting the parameter data to be modified into multiple sets of parameter pages (24 parameters per set). For example, if there are 23 parameters to be modified, they can all be placed into one parameter page. If there are 28 parameters to be modified, they need to be placed into two parameter pages.

[0114] 308. Calculate the register number address of each group of split parameter data to be modified, so as to obtain the page data of the parameter data to be modified corresponding to each group of split parameter data according to the page storage space.

[0115] Therefore, the register number address of each set of split parameter data to be modified can be calculated, and the page data of the parameter data to be modified corresponding to each set of split parameter data can be obtained according to the page storage space.

[0116] In one specific embodiment, the register address (i.e., register address) corresponding to the parameter data to be modified can be determined first based on the parameter data to be modified. Furthermore, based on this register address and related data, such as the device ID, function code, number of registers, parameter length, CRC, or reserved bits corresponding to the parameter data to be modified, as mentioned above, the split parameter page data to be modified can be obtained according to the storage format of the page storage space. Specifically, it can be done according to... Figure 6 The data is packaged using the page storage format.

[0117] 309. Determine the physical address of the target page for the parameter page data to be modified, and write the parameter page data to be modified to the target page physical address.

[0118] Therefore, based on step 308, the target page physical address of the parameter page data to be modified can be determined according to the conversion formula. The parameter page storing the parameter page data to be modified is then written to the target page physical address.

[0119] In one specific embodiment, after obtaining the physical address of the target page, the parameter pages to be modified can be written to the physical address of the target page on the storage device page by page.

[0120] The Modbus-based data storage method disclosed in this embodiment stores parameter data and the data stored in parameter pages compactly, allowing for the reading of complete page data in a single operation, thus ensuring high performance for parameter read / write. Furthermore, the use of page physical addresses supports distributed deployment and heterogeneous devices on redundant equipment, while also enabling rapid matching of parameter read / write operations with Modbus communication. Moreover, storing parameter page data using the Modbus frame format ensures that parameter anomalies can be identified.

[0121] Corresponding to the above Figure 2 Step 202 in the illustrated embodiment can be found in [reference needed]. Figure 4 , Figure 4 This is a flowchart illustrating another Modbus-based data storage method disclosed in an embodiment of this application. It includes steps 401-406.

[0122] 401. Verify parameter page data.

[0123] In this embodiment, step 401 is the same as the aforementioned Figure 2 Step 202 is similar and will not be described in detail here. However, it should be noted that in this embodiment, based on the verification result of step 401, steps 402, 403, or 404-406 can be executed respectively. It should also be noted that the physical device layer includes the main physical layer corresponding to the master device and the slave physical layer corresponding to the slave device, and the parameter page data includes the main parameter page data corresponding to the master device and the slave parameter page data corresponding to the slave device.

[0124] 402. When the main parameter page data verification fails, read the slave parameter page data from the slave device. When the slave parameter page data verification passes, write the slave parameter page data into the main parameter page located at the main physical layer that corresponds to the main parameter page data.

[0125] Based on step 401, when the main parameter page data verification fails, it is necessary to read the slave parameter page data of the slave device. Then, when the slave parameter page data verification passes, the slave parameter page data is written into the main parameter page located in the main physical layer that corresponds to the main parameter page data.

[0126] In one specific embodiment, when the master parameter page data of the master device fails verification, the data of the corresponding slave parameter page in the slave device is read and verified. If the verification passes, the parameter data or other data from the slave device is written to the corresponding master parameter page of the master device. It should be noted that the verification steps in this embodiment can be found in [reference needed]. Figure 3 The illustrated embodiment.

[0127] 403. When the data verification of the slave parameter page fails, read the master parameter page data of the master device, so that when the data verification of the master parameter page passes, the master parameter page data is synchronized to the slave parameter page located at the slave physical layer corresponding to the slave parameter page data.

[0128] Based on step 401, when the data verification of the slave parameter page fails, the master parameter page data of the master device is read, so that when the data verification of the master parameter page passes, the master parameter page data is synchronized to the slave parameter page located at the slave physical layer corresponding to the slave parameter page data.

[0129] In one specific embodiment, when a slave parameter page data from a slave device fails verification, the corresponding master parameter page data from the master device (which should be the data from a master parameter page that has passed verification) is read and verified. If the verification passes, the master device's parameter data or other data is synchronized to the corresponding slave parameter page of the slave device. It should be noted that the verification steps in this embodiment can be found in [reference needed]. Figure 3 The illustrated embodiment.

[0130] 404. When both the primary parameter page data and the secondary parameter data fail verification, the initial parameter data located in the read-only data area of ​​the synchronization cache layer is synchronized to the primary parameter data of the primary parameter page data and the secondary parameter data of the secondary parameter page data.

[0131] Based on step 401, if both the primary parameter page data and the secondary parameter data fail verification, the initial parameter data located in the read-only data area of ​​the synchronization cache layer will be synchronized to the primary parameter data of the primary parameter page data and the secondary parameter data of the secondary parameter page data.

[0132] In one specific embodiment, when the verification of the master parameter page data and the slave parameter page data in both the master and slave devices fails, the initial parameter data (or default parameters) located in the read-only data area of ​​the synchronization cache layer can be synchronized to the parameter data portion of the parameter page (master parameter page corresponds to master parameter data, slave parameter page corresponds to slave parameter data), i.e. Figure 6 The corresponding 1 to 24 parameter data in the page storage format shown can be directly written into the parameter data.

[0133] 405. Obtain the synchronized master parameter page data based on the master parameter data, and obtain the synchronized slave parameter page data based on the slave parameter data.

[0134] Therefore, based on step 404, the synchronized master parameter page data can be obtained from the master parameter data, and the synchronized slave parameter page data can be obtained from the slave parameter data.

[0135] In one specific embodiment, after the parameter data synchronization is completed, the synchronized main parameter page data can be obtained in the main parameter data section of the main parameter page, and the synchronized slave parameter page data can be obtained in the slave parameter data section of the slave parameter page.

[0136] 406. Write the synchronized master parameter page data to the master parameter page, and write the synchronized slave parameter page data to the slave parameter page.

[0137] Then, the synchronized master parameter page data can be written to the master parameter page, and the synchronized slave parameter page data can be written to the slave parameter page.

[0138] In one specific embodiment, the synchronized master parameter page data and the synchronized slave parameter page data can be written back to the corresponding parameter pages of the master device and slave device in sequence.

[0139] The Modbus-based data storage method disclosed in this embodiment supports distributed deployment and heterogeneous devices. Furthermore, the solution in this embodiment has strong compatibility, supports distributed deployment, supports heterogeneous devices on redundant devices, and can quickly match parameter reading and writing in the Modbus communication mode.

[0140] Combination Figure 4 The illustrated embodiment, in conjunction with the above... Figure 2 For step 204 in the illustrated embodiment, please refer to [link / reference]. Figure 5 ,exist Figure 5 This is a flowchart illustrating another Modbus-based data storage method disclosed in an embodiment of this application. It includes steps 501-504.

[0141] 501. Verify the data on the parameter page to be verified.

[0142] In this embodiment, step 501 is the same as the aforementioned Figure 2 Step 204 is similar, and will not be elaborated here.

[0143] 502. If the data verification of the parameter page to be verified fails, verify all main parameter pages in the physical device layer and determine that the main parameter page that failed the verification is an error page.

[0144] Therefore, based on step 501, when the data verification of the parameter page to be verified fails, all main parameter pages of the physical device layer are verified, and the main parameter pages that fail verification are determined to be error pages.

[0145] In one specific embodiment, Figure 2In the verification method described above in the illustrated embodiment, if the data verification of the parameter page to be verified fails, a full-chip verification is performed, that is, all master parameter pages in the physical device layer are verified (this embodiment uses the master device as an example; the steps for the slave device are the same as for the master device), thereby identifying the master parameter pages that failed verification as error pages. In other words, this error page can also be understood as a type of miswritten page.

[0146] 503. Read the target slave parameter page corresponding to the error page from the slave device. When the target slave parameter page data passes the verification, write the target slave parameter page data to the error page.

[0147] Based on step 502, the target slave parameter page corresponding to the error page of the slave device can be read, and when the target slave parameter page data verification passes, the target slave parameter page data is written to the error page.

[0148] In one specific embodiment, for an error page, the corresponding slave parameter page in the slave device, i.e., the target slave parameter page, can be read. After the parameter page data (target slave parameter page data) of the target slave parameter page passes verification, it can be processed as described above. Figure 4 The writing method described in the illustrated embodiment writes the target data from the parameter page to the error page.

[0149] 504. Perform the step of synchronizing the initial parameter data located in the read-only data area of ​​the synchronization cache layer to the main parameter data of the main parameter page, so as to write the synchronized main parameter page data to the error page.

[0150] Based on step 502, the following can be executed: Figure 4 Step 404, as shown, writes the synchronized master parameter page data to the error page; the specifics are not elaborated here.

[0151] The Modbus-based data storage method disclosed in this embodiment supports independent rollback of a single parameter and overall reset in cases where rollback is not possible, based on redundant storage, thus improving the feasibility of the solution. Furthermore, the rollback mechanism of redundant storage and the independent reset mechanism ensure that parameters are always valid and not lost (historical values).

[0152] In combination with the above Figures 2 to 5 As can be clearly seen from the embodiments shown, the embodiments of this application can realize local heterogeneous redundant access and distributed heterogeneous redundant access.

[0153] Specifically, for local heterogeneous redundant access:

[0154] 1) A single board can simultaneously carry EEPROM (as master) and Nor Flash (as slave), and both chips can be enabled by pin control for write protection, ensuring write protection is enabled in idle state; 2) The upper layer manages parameter changes through a parameter synchronization system; 3) The parameters of this scheme are written to the parameter change management system (callback when parameter changes are detected); 4) Both storage devices reserve bad block spare areas to maximize the reliability of parameters to 99% and extend their lifespan as much as possible (to cope with scenarios with frequent parameter changes).

[0155] For distributed heterogeneous redundant access:

[0156] 1) The board does not have a local storage device; 2) There is a separate storage unit or a remote storage unit; 3) The storage unit and the parameter application system interact through any communication method, such as TCP, RTU, etc.; 4) The communication callback on the storage device side responds to parameter read and write requests and executes according to the initial loading or parameter writing logic in the scheme; 5) The storage device can be two independent storage units or it can be concentrated into one.

[0157] Therefore, by using the two heterogeneous redundant access schemes described above, the following can be achieved: 1. High parameter reliability: Parameter page data is stored in Modbus frame format, ensuring that parameter anomalies can be identified; 2. High data compactness: Parameters and information are stored compactly, and complete page data can be read in a single operation, ensuring the performance of parameter read and write; 3. Support for distributed deployment and heterogeneous devices: The scheme has strong compatibility, supports distributed deployment, and also supports heterogeneous devices on redundant devices, and can quickly match parameter read and write using Modbus communication; 4. High parameter robustness: Through the rollback mechanism of redundant storage and the independent reset mechanism, the effect of parameters always being valid and not lost (historical values) is ensured.

[0158] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0159] Please see Figure 7 , Figure 7This is a schematic diagram of the structure of a Modbus-based data storage system disclosed in an embodiment of this application.

[0160] The reading unit 701 is used to read parameter page data located in the physical device layer and verify the parameter page data respectively; wherein, the parameter page data is located in the parameter page of the physical device layer and includes parameter data;

[0161] Synchronization unit 702 is used to synchronize the parameter page data corresponding to the parameter page to the synchronization cache layer when the parameter page data verification passes.

[0162] The acquisition unit 703 is used to convert the format of the parameter data to be written in the parameter page data when the parameter page data has been synchronized to the synchronization cache layer, so as to obtain the page physical address corresponding to the parameter data to be written and the parameter page data to be verified, and write the parameter page data to be verified to the page physical address of the physical device layer.

[0163] The verification unit 704 is used to read the parameter page data to be verified located at the page physical address in the physical device layer, synchronize the parameter page data to be verified to the synchronization cache layer, and verify the parameter page data to be verified.

[0164] The determination unit 705 is used to determine that the writing of the parameter data to be written in the parameter page data has been completed when the verification of the parameter page data passes.

[0165] For example, the system includes:

[0166] The determining unit 705 is specifically used to determine the register sequence address of the parameter data to be read when the application layer reads the parameter data to be read located in the physical device layer, and to obtain the physical address of the page to be read corresponding to the parameter data to be read based on the register sequence address;

[0167] The reading unit 701 is specifically used to read the data of the parameter page corresponding to the parameter data to be read based on the physical address of the page to be read.

[0168] For example, the system further includes: an analysis unit 706;

[0169] Analysis unit 706 is used to analyze the page storage space of parameter page data; wherein, the page storage format of the page storage space includes at least a first space address for storing parameter data, a second space address for register sequence number address and a third space address for target identification code, and the register sequence number address is associated with the parameter data;

[0170] The verification unit 704 is specifically used to perform format verification on the parameter data located at the first space address and the register number address located at the second space address, respectively, to obtain the verification identification code corresponding to the parameter data and the register number address.

[0171] The verification unit 704 is also used to verify the identification code to be verified based on the target identification code;

[0172] The determining unit 705 is also used to determine that the parameter page data verification is successful when the identification code to be verified is the same as the target identification code, so as to read the parameter data into the Modbus response frame data and synchronize it to the synchronization buffer layer.

[0173] For example, the system further includes: a computing unit 707;

[0174] The acquisition unit 703 is also used to split the parameter data to be modified according to the format conditions of the first space address corresponding to the page storage space when the physical device layer receives the parameter data to be modified, so as to obtain multiple sets of split parameter data to be modified.

[0175] The calculation unit 707 is used to calculate the register number address of each group of split parameter data to be modified, so as to obtain the page data of the parameter data to be modified corresponding to each group of split parameter data according to the page storage space.

[0176] The determining unit 705 is also used to determine the target page physical address of the parameter page data to be modified, and write the parameter page data to be modified that stores the parameter page data to be modified to the target page physical address.

[0177] For example, the physical device layer includes a master physical layer corresponding to the master device and a slave physical layer corresponding to the slave device, the parameter page data includes master parameter page data corresponding to the master device and slave parameter page data corresponding to the slave device, and the system further includes:

[0178] The reading unit 701 is also used to read the slave parameter page data of the slave device when the master parameter page data verification fails, so that when the slave parameter page data verification passes, the slave parameter page data is written to the master parameter page located in the master physical layer corresponding to the master parameter page data.

[0179] Alternatively, the reading unit 701 is also used to read the master parameter page data of the master device when the slave parameter page data verification fails, so as to synchronize the master parameter page data to the slave parameter page located at the slave physical layer corresponding to the slave parameter page data when the master parameter page data verification passes.

[0180] For example, the system further includes: a writing unit 708;

[0181] The synchronization unit 702 is also used to synchronize the initial parameter data located in the read-only data area of ​​the synchronization cache layer to the main parameter data of the main parameter page data and the slave parameter data of the slave parameter page data when both the main parameter page data and the slave parameter data fail to pass the verification.

[0182] The acquisition unit 703 is also used to obtain synchronized master parameter page data based on master parameter data and synchronized slave parameter page data based on slave parameter data;

[0183] The write unit 708 is also used to write the synchronized master parameter page data to the master parameter page and the synchronized slave parameter page data to the slave parameter page.

[0184] For example, the system further includes: an execution unit 709;

[0185] The verification unit 704 is also used to verify all main parameter pages of the physical device layer when the data verification of the parameter page to be verified fails, and to determine that the main parameter page that failed the verification is an error page;

[0186] The reading unit 701 is also used to read the target slave parameter page corresponding to the error page of the slave device, and when the target slave parameter page data verification passes, write the target slave parameter page data into the error page;

[0187] Alternatively, execution unit 709 is used to perform the step of synchronizing the initial parameter data located in the read-only data area of ​​the synchronization cache layer to the main parameter data of the main parameter page, so as to write the synchronized main parameter page data to the error page.

[0188] Please refer to the following: Figure 8 The schematic diagram of a Modbus-based data storage device disclosed in this application includes:

[0189] Central processing unit 801, memory 805, input / output interface 804, wired or wireless network interface 803, and power supply 802;

[0190] Memory 805 is either a short-term storage memory or a persistent storage memory;

[0191] The central processing unit 801 is configured to communicate with the memory 805 and execute instructions stored in the memory 805 to perform the aforementioned operations. Figure 5 The Modbus-based data storage method shown in the embodiment.

[0192] This application also provides a chip system, characterized in that the chip system includes at least one processor and a communication interface, the communication interface and the at least one processor are interconnected via a circuit, and the at least one processor is used to run computer programs or instructions to perform the aforementioned... Figures 2 to 5 A Modbus-based data storage method in any of the illustrated embodiments.

[0193] This application also provides a computer-readable storage medium, which includes instructions that, when executed on a computer, cause the computer to perform the aforementioned actions. Figures 2 to 5A Modbus-based data storage method in any of the illustrated embodiments.

[0194] This application also provides a computer program product containing instructions, which, when run on a computer, causes the computer to perform the aforementioned... Figures 2 to 5 A Modbus-based data storage method in any of the illustrated embodiments.

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

[0196] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.

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

[0198] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0199] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A data storage method based on Modbus, characterized in that, Applied to a storage system, the storage system comprising a physical device layer and a synchronous cache layer interconnected with each other, the method includes: Read the parameter page data located in the physical device layer respectively, wherein the parameter page data is located in the parameter page of the physical device layer and the parameter page data includes parameter data; Verify the parameter page data; If the parameter page data verification passes, the parameter page data corresponding to the parameter page will be synchronized to the synchronization cache layer; When the parameter page data has been synchronized to the synchronization cache layer, the parameter data to be written in the parameter page data is converted into a format to obtain the page physical address corresponding to the parameter data to be written and the parameter page data to be verified, so as to write the parameter page data to be verified into the page physical address of the physical device layer. Read the parameter page data to be verified located at the page physical address in the physical device layer, synchronize the parameter page data to be verified to the synchronization cache layer, and verify the parameter page data to be verified. If the verification of the parameter page data passes, it is determined that the writing of the parameter data to be written in the parameter page data is complete.

2. The Modbus-based data storage method according to claim 1, characterized in that, The storage system also includes an application layer, wherein reading parameter page data located in the physical device layer includes: When the application layer reads the parameter data to be read located in the physical device layer, it determines the register sequence address of the parameter data to be read, and obtains the physical address of the page to be read corresponding to the parameter data to be read based on the register sequence address; Read the parameter page data corresponding to the parameter data to be read based on the physical address of the page to be read.

3. The Modbus-based data storage method according to claim 1 or 2, characterized in that, The verification of the parameter page data includes: Analyze the page storage space of the parameter page data; wherein, the page storage format of the page storage space includes at least a first space address for storing the parameter data, a second space address for storing the register sequence number address, and a third space address for storing the target identification code, wherein the register sequence number address is associated with the parameter data; The parameter data located at the first spatial address and the register number address located at the second spatial address are respectively subjected to format verification to obtain the verification identification code corresponding to the parameter data and the register number address. The identification code to be verified is verified according to the target identification code; If the identification code to be verified is the same as the target identification code, it is determined that the parameter page data verification is successful, so that the parameter data is read into the Modbus response frame data and synchronized to the synchronization cache layer.

4. The Modbus-based data storage method according to claim 3, characterized in that, The method further includes: If the physical device layer receives the parameter data to be modified, it splits the parameter data to be modified according to the format conditions corresponding to the first space address in the page storage space to obtain multiple sets of split parameter data to be modified. Calculate the register sequence address of each set of split parameter data to be modified, so as to obtain the page data of the parameter data to be modified corresponding to each set of split parameter data according to the page storage space; Determine the target page physical address of the parameter page data to be modified, and write the parameter page data to be modified into the target page physical address.

5. The Modbus-based data storage method according to claim 1, characterized in that, The physical device layer includes a master physical layer corresponding to the master device and a slave physical layer corresponding to the slave device. The parameter page data includes master parameter page data corresponding to the master device and slave parameter page data corresponding to the slave device. The method further includes: When the main parameter page data verification fails, the slave parameter page data of the slave device is read, so that when the slave parameter page data verification passes, the slave parameter page data is written to the main parameter page located in the main physical layer corresponding to the main parameter page data; Alternatively, when the slave parameter page data verification fails, the master parameter page data of the master device is read, so that when the master parameter page data verification passes, the master parameter page data is synchronized to the slave parameter page located in the slave physical layer corresponding to the slave parameter page data.

6. The Modbus-based data storage method according to claim 5, characterized in that, The method further includes: When both the primary parameter page data and the secondary parameter page data fail the verification, the initial parameter data located in the read-only data area of ​​the synchronization cache layer is synchronized to the primary parameter data of the primary parameter page data and the secondary parameter data of the secondary parameter page data. The synchronized master parameter page data is obtained based on the master parameter data, and the synchronized slave parameter page data is obtained based on the slave parameter data. Write the synchronized master parameter page data into the master parameter page, and write the synchronized slave parameter page data into the slave parameter page.

7. The Modbus-based data storage method according to claim 6, characterized in that, After verifying the parameter page data to be verified, the method further includes: If the data verification of the parameter page to be verified fails, verify all the main parameter pages of the physical device layer, and determine that the main parameter page that failed the verification is an error page; Read the target slave parameter page corresponding to the error page from the slave device; when the target slave parameter page data verification passes, write the target slave parameter page data into the error page. Alternatively, the step of synchronizing the initial parameter data located in the read-only data area of ​​the synchronization cache layer to the main parameter data of the main parameter page data is performed, so as to write the synchronized main parameter page data into the error page.

8. A Modbus-based data storage system, characterized in that, Applied to a storage system, the storage system includes a physical device layer and a synchronous cache layer that are interconnected, the system comprising: A reading unit is configured to read parameter page data located in the physical device layer, wherein the parameter page data is located in the parameter page of the physical device layer and includes parameter data; A verification unit is used to verify the parameter page data; A synchronization unit is used to synchronize the parameter page data corresponding to the parameter page to the synchronization cache layer when the parameter page data verification passes. The acquisition unit is used to convert the format of the parameter data to be written in the parameter page data when the parameter page data has been synchronized to the synchronization cache layer, so as to obtain the page physical address and the parameter page data to be verified corresponding to the parameter data to be written, and then write the parameter page data to be verified into the page physical address of the physical device layer. The verification unit is further configured to read the parameter page data to be verified located at the page physical address in the physical device layer, synchronize the parameter page data to be verified to the synchronization cache layer, and verify the parameter page data to be verified. The determining unit is used to determine that the writing of the parameter data to be written in the parameter page data has been completed when the verification of the parameter page data to be verified passes.

9. A Modbus-based data storage device, characterized in that, The device includes: Central processing unit, memory, input / output interfaces, wired or wireless network interfaces, and power supply; The memory is either a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the Modbus-based data storage method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed on a computer, cause the computer to perform the Modbus-based data storage method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for performing data synchronization control by multiple wire controllers

    CN112162874A

  • Data synchronization method and device

    CN117931938A