Modbus-based data storage method and related equipment
By introducing a synchronous cache layer and verification mechanism in the storage system, the centralization, wrong pages and bus interference problems of the Modbus protocol when transmitting data is solved, and efficient and reliable data transmission is achieved.
Patent Information
- Application Number
- CN202411566140.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-01
AI Technical Summary
The existing Modbus protocol has data centralization, error writing problems caused by reading and writing errors caused by bus interference when transmitting data, resulting in reduced performance and efficiency.
By introducing a synchronization cache layer in the storage system, the parameter page data is read and verified separately, and after verification is passed, the data is synchronized to the synchronization cache layer for format conversion and writing, ensuring the correctness and reliability of data writing sex.
It realizes ensuring data accuracy when the storage system reads the state, improves the accuracy and reliability of parameter reading, and further ensures the high reliability of parameters through redundant storage of heterogeneous storage devices.
Smart Images

Figure CN119512982A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of embedded control, and in particular to a data storage method and related equipment based on Modbus. Background Art
[0002] The Modbus protocol is an open communication protocol, so it is widely used in industrial automation systems to achieve data exchange between devices. At present, the Modbus protocol is one of the most commonly used serial communication protocols, which is widely used in monitoring and controlling communications between devices. In short, it is a method for transmitting information on a serial line between electronic devices. In the process of implementing the present invention, the inventor found that the prior art has at least the following problems: the data transmitted through the Modbus protocol is distributed more concentratedly, and when the embedded software verification information is stored independently, it needs to be read independently, resulting in reduced performance / efficiency. At the same time, the Modbus protocol cannot prevent the occurrence of read / write error pages during the interaction with the main controller or the storage controller of the data acquisition system.
[0003] Therefore, there is an urgent need for a method to provide reliability assurance for various embedded software based on the Modbus protocol. Summary of the invention
[0004] The embodiment of the present application provides a data storage method and related equipment based on Modbus, which are used to provide reliability guarantee for the read parameter data.
[0005] A first aspect of an embodiment of the present application provides a data storage method based on Modbus, comprising:
[0006] Reading parameter page data located in the physical device layer respectively, and verifying the parameter page data 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;
[0007] If the parameter page data verification passes, synchronizing the parameter page data corresponding to the parameter page 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 formatted, and a page physical address corresponding to the parameter data to be written and the parameter page data to be verified are obtained, so as to write the parameter page data to be verified into the page physical address of the physical device layer;
[0009] Reading out the parameter page data to be verified located at the page physical address in the physical device layer, synchronizing the parameter page data to be verified to the synchronization cache layer, and verifying the parameter page data to be verified;
[0010] If the verification of the parameter page data to be verified passes, it is determined that the writing of the parameter data to be written in the parameter page data to be verified is completed.
[0011] Optionally, the storage system further includes an application layer, and the reading of parameter page data located at the physical device layer includes:
[0012] When the application layer reads the parameter data to be read located at the physical device layer, the register serial number address of the parameter data to be read is determined, and the physical address of the page to be read corresponding to the parameter data to be read is obtained according to the register serial number address;
[0013] The parameter page data to be read corresponding to the parameter data to be read is read according to the physical address of the page to be read.
[0014] Optionally, the 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 at least includes a first space address for storing the parameter data, a second space address for a register serial number address, and a third space address for a target identification code, and the register serial number address is associated with the parameter data;
[0016] Performing format checks on the parameter data located at the first space address and the register serial number address located at the second space address respectively, to obtain identification codes to be checked corresponding to the parameter data and the register serial number address;
[0017] Verifying the identification code to be 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 has passed, 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 comprises:
[0020] If the physical device layer receives the parameter data to be modified, the parameter data to be modified is split according to the format condition corresponding to the first space address in the page storage space to obtain a plurality of groups of split parameter data to be modified;
[0021] Calculating the register serial number address of each group of split parameter data to be modified, so as to obtain the parameter page data to be modified corresponding to each group of split parameter data to be modified according to the page storage space;
[0022] A target page physical address of the to-be-modified parameter page data is determined, and the to-be-modified parameter page storing the to-be-modified parameter page data is written into the target page physical address.
[0023] Optionally, the physical device layer includes a master physical layer corresponding to a master device and a slave physical layer corresponding to a 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 master parameter page data fails to be verified, the slave parameter page data of the slave device is read, so that when the slave parameter page data passes the verification, the slave parameter page data is written into a master parameter page corresponding to the master parameter page data located in the master physical layer;
[0025] Or, when the slave parameter page data fails verification, the master parameter page data of the master device is read, so that when the master parameter page data passes verification, the master parameter page data is synchronized to the slave parameter page corresponding to the slave parameter page data located in the slave physical layer.
[0026] Optionally, the method further comprises:
[0027] When both the master parameter page data and the slave parameter data fail to pass verification, synchronizing the initial parameter data in the read-only data area of the synchronization cache layer to the master parameter data of the master parameter page data and the slave parameter data of the slave parameter page data;
[0028] Obtain synchronized master parameter page data according to the master parameter data, and obtain synchronized slave parameter page data according to the slave parameter data;
[0029] The synchronized master parameter page data is written into the master parameter page, and the synchronized slave parameter page data is written 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 main parameter pages of the physical device layer, and determine that the main parameter page that fails the verification is an error page;
[0032] reading a target slave parameter page of the slave device corresponding to the error page, and when target slave parameter page data of the target slave parameter page passes verification, writing the target slave parameter page data into the error page;
[0033] Or, the step of synchronizing the initial parameter data in the read-only data area of the synchronization cache layer to the main parameter data of the main parameter page data is performed to write the synchronized main parameter page data into the error page.
[0034] A second aspect of an embodiment of the present application provides a data storage system based on Modbus, including:
[0035] A reading unit, used to read the parameter page data located in the physical device layer respectively, and verify the parameter page data 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;
[0036] A synchronization unit, configured to synchronize the parameter page data corresponding to the parameter page to the synchronization cache layer when the parameter page data passes verification;
[0037] an acquisition unit, configured to, when the parameter page data has been synchronized to the synchronization cache layer, perform format conversion on the parameter data to be written in the parameter page data, obtain a 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;
[0038] A verification unit, used for reading out the parameter page data to be verified located at the page physical address in the physical device layer, synchronizing the parameter page data to be verified to the synchronization cache layer, and verifying the parameter page data to be verified;
[0039] The determination unit is used to determine that the writing of the parameter data to be written in the parameter page data to be verified is completed when the parameter page data to be verified passes the verification.
[0040] The Modbus-based data storage system provided in the second aspect of the embodiment of the present application is used to execute the Modbus-based data storage method described in the first aspect.
[0041] A third aspect of an embodiment of the present application provides a data storage device based on Modbus, comprising:
[0042] CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply;
[0043] The memory is a short-term storage memory or a persistent storage memory;
[0044] The central processing unit is configured to communicate with the memory and execute instruction operations in the memory to perform the Modbus-based data storage method described in the first aspect.
[0045] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes instructions. When the instructions are executed on a computer, the computer executes the Modbus-based data storage method described in the first aspect.
[0046] A fifth aspect of an embodiment of the present application provides a computer program product, which includes instructions. When the instructions are executed on a computer, the computer executes the Modbus-based data storage method described in the first aspect.
[0047] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: through a data storage method based on Modbus disclosed in the embodiments of the present application, the correctness of the read data can be ensured when the storage system is in a reading state. At the same time, when the parameter data of a parameter page is read once, the parameter data of the parameter page can also be verified and checked, thereby ensuring the correctness and reliability of the parameter reading. In addition, since the parameter data supports redundant storage of heterogeneous storage devices, the high reliability of the parameters is further ensured. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0049] Figure 1 A schematic diagram of the structure of a redundant storage device disclosed in an embodiment of the present application;
[0050] Figure 2 A flow chart of a data storage method based on Modbus disclosed in an embodiment of the present application;
[0051] Figure 3 A flow chart of another Modbus-based data storage method disclosed in an embodiment of the present application;
[0052] Figure 4 A flow chart of another Modbus-based data storage method disclosed in an embodiment of the present application;
[0053] Figure 5 A flow chart of another Modbus-based data storage method disclosed in an embodiment of the present application;
[0054] Figure 6 A schematic diagram of the spatial structure of a page storage format disclosed in an embodiment of the present application;
[0055] Figure 7A schematic diagram of the structure of a data storage system based on Modbus disclosed in an embodiment of the present application;
[0056] Figure 8 This is a schematic diagram of the structure of a Modbus-based data storage device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0057] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0058] It should be noted that the descriptions involving "first", "second", etc. in this application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in this field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0059] Currently, there are three main problems with existing technical means: 1. Data distribution is relatively concentrated, and verification information is stored independently and needs to be read independently, resulting in reduced performance / efficiency; 2. It is impossible to prevent the occurrence of wrong page reading / writing during the interaction with the storage controller; 3. The erroneous writing caused by bus interference during the reading process is not fully considered.
[0060] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0061] See also Figure 1 , Figure 1A schematic diagram of the structure of a redundant storage device disclosed in an embodiment of the present application.
[0062] It should be noted that the embodiment of the present application is applied to a storage system, which includes a physical device layer (physical layer), a synchronization cache layer (synchronization layer), and an application layer that communicate with each other. Furthermore, the storage system mainly includes three parts (functions): 1) read-write switching management; 2) parameter format conversion; 3) device redundant access. Figures 2 to 5 The embodiment shown is described in detail and will not be described in detail here. Figure 1 Specifically, Figure 1 The storage device 1 or storage device 2 shown can be understood as a master storage device or a slave storage device. The control unit (MCU, Microcontroller Unit) is connected to the storage device through a general-purpose input / output (GPIO, General-purpose input / output). 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 when it is initially and idle. Only when writing is required is the level signal of the connector (WP, Word Press) switched to the write protection disabled state, and the write protection level is immediately switched back after writing is completed.
[0063] To resolve the technical issues described above, please refer to Figure 2 , Figure 2 The present invention is a flow chart of a Modbus-based data storage method disclosed in an embodiment of the present application, including steps 201 to 205.
[0064] 201. Read parameter page data located at 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, any one of which is used as a master device and the other as a slave device. In the parameter application system, since there is a parameter synchronization layer (synchronization layer) in the upper layer, there are only two operations in the entire access: initial loading and parameter writing. Specifically, in the initial loading stage, the parameter page data located in the physical device layer (physical layer) can be read respectively, and the parameter page data can be verified respectively. It should be noted that the parameter page data is located in the parameter page of the physical device layer, and the parameter page data 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 way of storing data is 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, ie, the parameter page data, may be read one by one, and then the parameter page data may be verified (either one by one or simultaneously, which is not limited here).
[0068] 202. If the parameter page data verification passes, the parameter page data corresponding to the parameter page is synchronized 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, it is possible to verify whether the verification code of the parameter page data complies with the rules, and whether the parameter data in the parameter page data is the parameter data that should be set and saved in the parameter page data. It should be noted that the parameter data is the parameter on the application layer that can be used for the storage system to run, or the storage data or callable data corresponding to other logical parameters.
[0071] Furthermore, after the parameter page data is verified, the parameter page data of the corresponding parameter page can be synchronized to the parameter cache, wherein the parameter cache 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 formatted to obtain a 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 format converted to obtain the page physical address corresponding to the parameter data to be written and the parameter page data to be verified, thereby, the parameter page data to be verified can be written to the page physical address of the physical device layer.
[0074] In one of the specific embodiments, after the parameter page data has been synchronized to the synchronization cache layer, the parameter writing stage is entered. Specifically, the parameter writing steps can refer to steps 203-205. In this embodiment, when the parameter data in the parameter page data is written into the physical device layer, it is necessary to first convert the format of the parameter data to be written in the parameter page data (i.e., the parameter data to be written into the physical device layer) 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 as the parameter page data to be verified at this time) on the written page physical address according to the page physical address obtained at this time. It should be noted that the page physical address at this time is the storage address of the parameter page (and the parameter page data corresponding to the parameter page) stored in the physical device layer. 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 page physical addresses corresponding to the parameter page data in different layers (including the physical device layer and the synchronization cache layer) should be consistent, the parameter page data can be read according to the page physical address.
[0076] 204 . Read out the parameter page data to be verified 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.
[0077] Based on step 203, the parameter page data to be verified located at the page physical address in the physical device layer can be read out, so as to synchronize the parameter page data to be verified to the synchronization cache layer, and verify the parameter page data to be verified.
[0078] In one of the specific embodiments, the parameter page data to be verified on the page physical address corresponding to the parameter page can be read out, and the parameter page data to be verified can be synchronized to the synchronization cache layer. It should be noted that the storage method of the parameter page data on the storage address is in the form of a parameter page, so the storage form of the parameter page data to be verified on the page physical address is a parameter page (the corresponding parameter page data to be verified can be described as a parameter page to be verified).
[0079] 205. If the verification of the parameter page data to be verified passes, it is determined that the writing of the parameter data to be written in the parameter page data to be verified is completed.
[0080] Based on step 204, when the verification of the parameter page data to be verified is passed, it can be determined that the writing of the parameter data to be written in the parameter page data to be verified is completed.
[0081] In one of the specific embodiments, if the parameter page data to be verified passes the verification, then various data in the parameter page data have been successfully written into the physical device layer, and thus, it can be obtained that the parameter data to be written has also been written.
[0082] Furthermore, if the execution party of the above parameter writing is the master storage device, then the writing of the slave storage device can be performed in the same process. The details are not repeated here.
[0083] It can be seen that in this embodiment, redundant storage can be performed through homogeneous or heterogeneous storage devices such as EEPROM and Nor Flash, and then the upper layer performs parameter read and write control through parameter change synchronization logic. The storage data is stored according to the data format in the scheme, and the correctness of each information field in the page data is checked, and the correctness of the check code is ensured, and parameter rollback or reset of default parameters is triggered in abnormal situations. The parameter rollback mechanism can roll back the correct parameters in the slave device and write them back to the master device.
[0084] Through the Modbus-based data storage method disclosed in this embodiment, the correctness of the read data can be ensured when the storage system is in a reading state. At the same time, when the parameter data of a parameter page is read once, the parameter data of the parameter page can also be verified and checked, thereby ensuring the correctness and reliability of the parameter reading. In addition, since the parameter data supports redundant storage of heterogeneous storage devices, the high reliability of the parameters is further ensured.
[0085] By the above Figure 2 Step 201 is shown, further, see Figure 3 , Figure 3 This is a flow chart of another Modbus-based data storage method disclosed in an embodiment of the present application, including steps 301 to 309.
[0086] 301. When the application layer reads the parameter data to be read located at the physical device layer, the register serial number address of the parameter data to be read is determined, and the physical address of the page to be read corresponding to the parameter data to be read is obtained according to the register serial number address.
[0087] It should be noted that the steps of this embodiment are mainly 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 serial number 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 to be read according to the register serial number address.
[0088] In one specific embodiment, there is only one type of space in the parameter storage, all parameters are stored in pages, and data and information are stored in the same page (parameter page). For ease of understanding, please refer to Figure 6 , Figure 6 Schematic diagram of the spatial structure of a page storage format disclosed in an embodiment of the present application. Figure 6 It can be seen that in parameter storage, it is mostly stored in the form of parameter pages (parameter page-1, parameter page-2, ..., parameter page-n), wherein any parameter page includes at least device ID, function code, starting register address, number of registers, parameter length, parameter data, CRC or reserved bits, etc., and the content contained in the parameter page is not specifically limited here. Correspondingly, any parameter page setting can store 64 bytes of content, wherein it needs to be specifically described that the register address / serial number actually occupies 2 bytes, and parameter data can be stored 1 to 24, generally occupying 48 bytes (24 parameter data, any parameter data occupies 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 is necessary to first determine the register address (serial number) of the parameter data to be read. It should be noted that the register address (serial number) corresponding to each parameter data should be determined. For example, there are 60 parameter data in a parameter storage space, and the 18th parameter data needs to be read. Then, the register address (serial number) of the parameter data to be read is the address corresponding to the 18th serial number.
[0089] Then, the page physical address of the parameter data to be read (i.e., the page physical address to be read described above) can be obtained according to the register serial number address. Specifically, since the parameter page is set in this embodiment to store 64 bytes of content, then, since the 18th bit serial number should be in parameter page -1, the address corresponding to the 18th bit serial number should be the page physical address where parameter page -1 is located.
[0090] In short, assuming that 24 parameters (48 bytes) are stored in a page, the read / write request address passed in by the upper-layer application is the logical sequence number of the 16-bit data, recorded as A, then the conversion formula is:
[0091] Page number = register address (number) / 24
[0092] Page physical address = page number × 64 = (register address (number) / 24) × 64
[0093] Therefore, the physical address of the to-be-read page of the to-be-read parameter data can be determined according to the above conversion formula.
[0094] In other feasible technical solutions, the Modbus RTU 0x10 instruction (continuously writing multiple holding registers, but the total number cannot exceed 48) can be directly connected to realize the data format conversion at the application layer.
[0095] 302 . Read the to-be-read parameter page data corresponding to the to-be-read parameter data according to the to-be-read page physical address.
[0096] Then, after obtaining the physical address of the page to be read, the parameter page data to be read including the parameter data to be read can be read out in sequence.
[0097] In one specific embodiment, it can be known from the above step 301 that since the page physical address stores the parameter page data, after knowing the page physical address to be read, the parameter page data to be read (which stores the parameter data to be read) can be read.
[0098] Furthermore, if multiple parameter data to be read need to be read in the previous step, the physical addresses of the pages to be read corresponding to different parameter data to be read can be read in sequence, thereby reading multiple parameter page data to be read. In short, the page physical address is first calculated by the address conversion formula, and then the parameter page data is read page by page.
[0099] 303. Analyze the page storage space of parameter page data.
[0100] From the above description, it can be seen that in verifying the parameter page data, it is necessary to first analyze the page storage space of the parameter page data. Figure 6 It can be seen that the page storage format at least includes the first space address for storing parameter data (generally there are 1 to 24 parameter data, occupying 28 bytes), the second space address for register serial number address (generally occupying 2 bytes) and the third space address for target identification code (i.e. 16-bit CRC, generally occupying 2 bytes). From the above description, it can be seen that there is an association between register serial number address and parameter data. Therefore, it is possible to determine the various data included in the parameter page data, such as device ID, function code, starting register address, number of registers, parameter length, parameter data, CRC or reserved bit, etc.
[0101] 304. Perform format checks on the parameter data located at the first space address and the register serial number address located at the second space address respectively to obtain identification codes to be checked corresponding to the parameter data and the register serial number address.
[0102] Based on step 303, the parameter data located at the first space address and the register serial number address located at the second space address can be format checked respectively, so as to obtain the identification code to be checked corresponding to the parameter data and the register serial number address.
[0103] In one specific embodiment, the register address (serial number) and parameter data in the parameter page are respectively verified by an algorithm, so as to obtain an identification code to be verified in the same format as CRC.
[0104] Furthermore, algorithm verification can be performed separately or uniformly on each 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 an identification code to be verified in the same format as CRC. The method of generating the identification code to be verified is not specifically restricted here.
[0105] 305. Verify the identification code to be verified according to the target identification code.
[0106] Thus, the identification code to be verified obtained after the format verification can be verified according to the target identification code in the parameter page data.
[0107] In one specific embodiment, by verifying whether the target identification code is the same as the identification code to be verified, step 306 or step 307 is performed respectively. Figure 4 The relevant steps of the illustrated embodiment (ie, see the redundant storage section).
[0108] 306. If the identification code to be verified is the same as the target identification code, it is determined that the parameter page data verification has passed, so that the parameter data is read into the Modbus response frame data and synchronized to the synchronization cache 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 has passed, so that 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 in combination with the above steps, so that the parameter data can be cached in the synchronization cache layer, or the parameter data can be extracted to the cache end of the user parameter. 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, the parameter data to be modified is split according to the format condition corresponding to the first space address in the page storage space to obtain multiple groups of split parameter data to be modified.
[0112] Furthermore, in other feasible technical solutions, when the parameter data needs to be modified, the physical device layer will receive the parameter data to be modified, so that the parameter data to be modified can be split according to the format condition of the first space address corresponding to the page storage space to obtain multiple groups of split parameter data to be modified.
[0113] In one specific embodiment, when modifying parameters by other means, the parameter data to be read or the parameter data to be written, i.e. the parameter data to be modified mentioned above, is first received. Figure 3 The cache format of the parameter data shown is to split the parameter data to be modified according to parameter pages (24 in one group), thereby obtaining multiple groups of parameter data to be modified after splitting. For example, if there are 23 parameter data to be modified, they can all be put into one parameter page. If there are 28 parameter data to be modified, they need to be put into two parameter pages.
[0114] 308. Calculate the register serial number address of each group of split parameter data to be modified, so as to obtain the parameter page data to be modified corresponding to each group of split parameter data to be modified according to the page storage space.
[0115] In this way, the register serial number address of each group of split parameter data to be modified can be calculated, so as to obtain the parameter page data to be modified corresponding to each group of split parameter data to be modified according to the page storage space.
[0116] In one of the specific embodiments, the register serial number address (i.e., register address) corresponding to the parameter data to be modified can be determined according to the parameter data to be modified. Furthermore, according to the register address and related data, such as the device ID, function code, number of registers, parameter length, CRC or reserved bit corresponding to the parameter data to be modified mentioned above, the parameter page data to be modified after the splitting of the parameter data to be modified can be obtained according to the storage format of the page storage space. Specifically, according to Figure 6 The page storage format is used to pack data.
[0117] 309 . Determine a target page physical address of the parameter page data to be modified, and write the parameter page to be modified storing the parameter page data to be modified into 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, so that the parameter page to be modified storing the parameter page data to be modified is written into the target page physical address.
[0119] In one specific embodiment, after obtaining the physical address of the target page, the parameter page to be modified may be written page by page to the physical address of the target page of the storage device.
[0120] Through a Modbus-based data storage method disclosed in this embodiment, parameter data and the data stored in the parameter page are compactly stored, and the complete page data can be read at a single time, ensuring the performance of parameter reading and writing. At the same time, through the page physical address method, distributed deployment can be supported, and heterogeneous devices can also be supported on redundant devices, and parameter reading and writing of the Modbus communication method can be quickly matched. Furthermore, the parameter page data is stored in the Modbus frame format, which ensures that the parameter abnormalities can be identified.
[0121] Corresponding to the above Figure 2 In the embodiment shown, step 202 can be found in Figure 4 , Figure 4 This is a flow chart of another Modbus-based data storage method disclosed in an embodiment of the present application, including steps 401 to 406.
[0122] 401. Verify parameter page data.
[0123] In this embodiment, step 401 is the same as the aforementioned Figure 2 The step 202 in the example is similar and will not be described in detail here. However, it should be noted that, in this embodiment, according to the verification result of step 401, step 402, step 403, or step 404-step 406 can be executed respectively. It should also be noted 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, and the parameter page data includes master parameter page data corresponding to the master device and slave parameter page data corresponding to the slave device.
[0124] 402. When the master parameter page data verification fails, the slave parameter page data of the slave device is read, and when the slave parameter page data verification passes, the slave parameter page data is written into the master parameter page corresponding to the master parameter page data located in the master physical layer.
[0125] Based on step 401, when the master parameter page data verification fails, it is necessary to read the slave parameter page data of the slave device, so that when the slave parameter page data verification passes, the slave parameter page data is written into the master parameter page corresponding to the master parameter page data located in the master physical layer.
[0126] In one specific embodiment, when encountering the master parameter page data of the master device that fails the verification, the data of the corresponding slave parameter page in the slave device is read out for verification. If the verification passes, the parameter data or other data of the slave device is written into the master parameter page corresponding to the master device. It should be noted that the verification step in this embodiment can be referred to in Figure 3 The embodiment shown.
[0127] 403. When the slave parameter page data verification fails, read the master parameter page data of the master device, and when the master parameter page data verification passes, synchronize the master parameter page data to the slave parameter page corresponding to the slave parameter page data located at the slave physical layer.
[0128] Based on step 401, when the slave parameter page data verification fails, the master parameter page data of the master device is read, so as to synchronize the master parameter page data to the slave parameter page corresponding to the slave parameter page data located in the slave physical layer when the master parameter page data verification passes.
[0129] In one specific embodiment, when encountering slave parameter page data of a slave device that fails verification, the data of the corresponding master parameter page in the master device is read out (which should be the data of the master parameter page that passes verification) and verified. If the verification passes, the parameter data or other data of the master device is synchronized to the slave parameter page corresponding to the slave device. It should be noted that the verification step in this embodiment can be referred to in Figure 3 The embodiment shown.
[0130] 404. When both the master parameter page data and the slave parameter data fail verification, the initial parameter data in the read-only data area of the synchronization cache layer is synchronized to the master parameter data of the master parameter page data and the slave parameter data of the slave parameter page data.
[0131] Based on step 401, when both the master parameter page data and the slave parameter data fail to pass verification, the initial parameter data in the read-only data area of the synchronization cache layer is synchronized to the master parameter data of the master parameter page data and the slave parameter data of the slave parameter page data.
[0132] In one specific embodiment, when the master parameter page data and the slave parameter page data in the master device and the slave device fail to pass the verification, the initial parameter data (or default parameters) in the read-only data area in the synchronization cache layer can be synchronized to the parameter data part of the parameter page (the master parameter page corresponds to the master parameter data, and the slave parameter page corresponds to the slave parameter data), that is, Figure 6 The 1 to 24 parameter data corresponding to the page storage format shown can be directly written into the parameter data.
[0133] 405. Obtain synchronized master parameter page data according to the master parameter data, and obtain synchronized slave parameter page data according to the slave parameter data.
[0134] Therefore, based on step 404, the synchronized master parameter page data can be obtained according to the master parameter data, and the synchronized slave parameter page data can be obtained according to the slave parameter data.
[0135] In one specific embodiment, after completing parameter data synchronization, synchronized master parameter page data can be obtained in the master parameter data portion of the master parameter page, and synchronized slave parameter page data can be obtained in the slave parameter data portion of the slave parameter page.
[0136] 406. 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.
[0137] Then, the synchronized master parameter page data can be written into the master parameter page, and the synchronized slave parameter page data can be written into the slave parameter page.
[0138] In one specific embodiment, the synchronized master parameter page data and the synchronized slave parameter page data may be written back to the corresponding parameter pages of the master device and the slave device in sequence.
[0139] The Modbus-based data storage method disclosed in this embodiment supports distributed deployment and heterogeneous devices. Furthermore, the solution of this embodiment has strong compatibility, supports distributed deployment, supports heterogeneous devices on redundant devices, and can quickly match the parameter reading and writing of the Modbus communication method.
[0140] Combination Figure 4 The embodiment shown, combined with the above Figure 2 In the embodiment shown, step 204 is shown in FIG. Figure 5 ,exist Figure 5 This is a flow chart of another Modbus-based data storage method disclosed in an embodiment of the present application, including steps 501 to 504.
[0141] 501. Verify the data of the parameter page to be verified.
[0142] In this embodiment, step 501 is the same as the aforementioned Figure 2 The process is similar to step 204, and will not be described in detail here.
[0143] 502. If 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 page that fails the verification is determined to be 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 page that fails the verification is determined to be an error page.
[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 the main parameter pages in the physical device layer are verified (this embodiment is illustrated by the master device, and the steps of the slave device and the master device are the same), so as to find the main parameter page that fails the verification as an error page. In other words, the error page can also be understood as a miswritten page.
[0146] 503. Read the target slave parameter page corresponding to the error page of the slave device, and when the target slave parameter page data of the target slave parameter page passes verification, write the target slave parameter page data into 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, so that when the target slave parameter page data of the target slave parameter page passes verification, the target slave parameter page data is written to the error page.
[0148] In one specific embodiment, for the error page, the slave parameter page corresponding to the error page in the slave device, that is, the target slave parameter page, can be read, so that after the parameter page data of the target slave parameter page (target slave parameter page data) is verified, the error page can be retrieved according to the 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 . Execute a step of synchronizing the initial parameter data in the read-only data area of the synchronization cache layer to the main parameter data of the main parameter page data, so as to write the synchronized main parameter page data into the error page.
[0150] Based on step 502, it is possible to execute Figure 4 In step 404 shown in , the synchronized main parameter page data is written into the error page, and the details are not repeated here.
[0151] The Modbus-based data storage method disclosed in this embodiment can support independent rollback of a single parameter and overall reset when rollback is not possible on the basis of redundant storage, thereby improving the feasibility of the solution. Furthermore, the redundant storage rollback mechanism and independent reset mechanism ensure that the parameters are always valid and not lost (historical value).
[0152] Combined with the above Figures 2 to 5 From the illustrated embodiments, it can be clearly seen that the embodiments of the present application can implement local heterogeneous redundant access and distributed heterogeneous redundant access.
[0153] Specifically, for local heterogeneous redundant access:
[0154] 1) EEPROM (as master) and Nor Flash (as slave) are installed on a single board at the same time, and both chips can be enabled by pin control of write protection, and write protection is enabled in the idle state; 2) The upper layer manages parameter changes through the parameter synchronization system; 3) The parameter writes of the scheme are connected to the parameter change management system (callback when parameter changes are identified); 4) Bad block spare areas are reserved in both storage devices to maximize the reliability of 99% of the parameters and the long life (to cope with scenarios where parameters are frequently changed).
[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 interacts with the parameter application system through any communication method, such as TCP, RTU, etc.; 4) The storage device responds to parameter read and write requests in the communication callback and executes according to the initial loading or parameter writing logic in the solution; 5) The storage device can be two independent storage units or concentrated into one.
[0157] Therefore, through the above two heterogeneous redundant access schemes, it can be achieved that 1. High parameter reliability: the parameter page data is stored in the Modbus frame format to ensure that parameter anomalies can be identified; 2. High data compactness: the parameters and information are compactly stored, and the complete page data can be read at a single time, ensuring the performance of parameter reading and writing; 3. Support for distributed deployment and heterogeneous devices: the scheme has strong compatibility and supports distributed deployment. It also supports heterogeneous devices on redundant devices and can quickly match the parameter reading and writing of the Modbus communication method; 4. High parameter robustness: through the rollback mechanism of redundant storage and the independent reset mechanism, it is guaranteed that the parameters are always valid and not lost (historical values).
[0158] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0159] See also Figure 7 , Figure 7This is a schematic diagram of the structure of a Modbus-based data storage system disclosed in an embodiment of the present application.
[0160] The reading unit 701 is used to read the parameter page data located in the physical device layer respectively, and verify the parameter page data 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;
[0161] A synchronization unit 702, configured 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, 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;
[0163] The verification unit 704 is used to read out the parameter page data to be verified 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 to be verified is completed when the verification of the parameter page data to be verified passes.
[0165] Exemplarily, the system includes:
[0166] The determining unit 705 is specifically used to determine the register serial number address of the parameter data to be read when the application layer reads the parameter data to be read located at the physical device layer, and obtain the physical address of the page to be read corresponding to the parameter data to be read according to the register serial number address;
[0167] The reading unit 701 is specifically configured to read the parameter page data to be read corresponding to the parameter data to be read according to the physical address of the page to be read.
[0168] Exemplarily, the system further includes: an analysis unit 706;
[0169] An analyzing unit 706 is used to analyze a page storage space of parameter page data; wherein the page storage format of the page storage space at least includes a first space address for storing parameter data, a second space address for register serial number address, and a third space address for target identification code, and the register serial 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 serial number address located at the second space address, respectively, to obtain the identification code to be verified corresponding to the parameter data and the register serial number address;
[0171] The verification unit 704 is further used to verify the identification code to be verified according to the target identification code;
[0172] The determination unit 705 is further configured to determine that the parameter page data verification has passed 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 cache layer.
[0173] Exemplarily, the system further includes: a calculation unit 707;
[0174] The acquisition unit 703 is further configured to split the parameter data to be modified according to the format condition corresponding to the first space address in the page storage space when the physical device layer receives the parameter data to be modified, so as to obtain multiple groups of split parameter data to be modified;
[0175] The calculation unit 707 is used to calculate the register serial number address of each group of split parameter data to be modified, so as to obtain the parameter page data to be modified corresponding to each group of split parameter data to be modified according to the page storage space;
[0176] The determining unit 705 is further configured to determine a target page physical address of the parameter page data to be modified, and write the parameter page to be modified storing the parameter page data to be modified into the target page physical address.
[0177] Exemplarily, 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 further used to read the slave parameter page data of the slave device when the master parameter page data verification fails, and to write the slave parameter page data into the master parameter page corresponding to the master parameter page data located in the master physical layer when the slave parameter page data verification passes;
[0179] Alternatively, the reading unit 701 is further 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 corresponding to the slave parameter page data located in the slave physical layer when the master parameter page data verification passes.
[0180] Exemplarily, the system further includes: a writing unit 708;
[0181] The synchronization unit 702 is further used to synchronize the initial parameter data in the read-only data area of the synchronization cache layer to the master parameter data of the master parameter page data and the slave parameter data of the slave parameter page data when both the master parameter page data and the slave parameter data fail to pass the verification;
[0182] The acquisition unit 703 is further used to obtain synchronized master parameter page data according to the master parameter data, and obtain synchronized slave parameter page data according to the slave parameter data;
[0183] The writing unit 708 is further used to 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.
[0184] Exemplarily, the system further includes: an execution unit 709;
[0185] The verification unit 704 is further configured to verify all main parameter pages of the physical device layer when the verification of the parameter page to be verified fails, and determine that the main parameter page that fails the verification is an error page;
[0186] The reading unit 701 is further used to read the target slave parameter page corresponding to the error page of the slave device, and write the target slave parameter page data into the error page when the target slave parameter page data passes the verification;
[0187] Or, the execution unit 709 is used to execute the step of synchronizing the initial parameter data in the read-only data area of the synchronization cache layer to the main parameter data of the main parameter page data, so as to write the synchronized main parameter page data into the error page.
[0188] See below Figure 8 , a structural diagram of a data storage device based on Modbus disclosed in an embodiment of the present application includes:
[0189] CPU 801, memory 805, input / output interface 804, wired or wireless network interface 803 and power supply 802;
[0190] The memory 805 is a temporary storage memory or a permanent storage memory;
[0191] The CPU 801 is configured to communicate with the memory 805 and execute the instructions in the memory 805 to perform the aforementioned Figure 5 The data storage method based on Modbus in the illustrated embodiment.
[0192] The embodiment of the present 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 through a line, and the at least one processor is used to run a computer program or instruction to execute the aforementioned Figures 2 to 5 A Modbus-based data storage method in any of the illustrated embodiments.
[0193] The embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium includes instructions, when the instructions are executed on a computer, the computer executes the aforementioned Figures 2 to 5A Modbus-based data storage method in any of the illustrated embodiments.
[0194] The present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the aforementioned Figures 2 to 5 A Modbus-based data storage method in any of the illustrated embodiments.
[0195] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0196] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0197] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0198] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0199] If the integrated unit is implemented in the form of 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 the present application is essentially 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, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
Claims
1. A data storage method based on Modbus, characterized in that: Applied to a storage system, the storage system includes a physical device layer and a synchronization cache layer that are communicatively connected to each other, and the method includes: Reading parameter page data located in the physical device layer respectively, and verifying the parameter page data 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; If the parameter page data verification passes, synchronizing the parameter page data corresponding to the parameter page 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 formatted, and a page physical address corresponding to the parameter data to be written and the parameter page data to be verified are obtained, so as to write the parameter page data to be verified into the page physical address of the physical device layer; Reading out the parameter page data to be verified located at the page physical address in the physical device layer, synchronizing the parameter page data to be verified to the synchronization cache layer, and verifying the parameter page data to be verified; If the verification of the parameter page data to be verified passes, it is determined that the writing of the parameter data to be written in the parameter page data to be verified is completed.
2. The data storage method based on Modbus according to claim 1, characterized in that: The storage system further includes an application layer, and the reading of parameter page data located at the physical device layer includes: When the application layer reads the parameter data to be read located at the physical device layer, the register serial number address of the parameter data to be read is determined, and the physical address of the page to be read corresponding to the parameter data to be read is obtained according to the register serial number address; The parameter page data to be read corresponding to the parameter data to be read is read according to the physical address of the page to be read.
3. The data storage method based on Modbus according to claim 1, characterized in that: The verifying 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 at least includes a first space address for storing the parameter data, a second space address for a register serial number address, and a third space address for a target identification code, and the register serial number address is associated with the parameter data; Performing format checks on the parameter data located at the first space address and the register serial number address located at the second space address respectively, to obtain identification codes to be checked corresponding to the parameter data and the register serial number address; Verifying the identification code to be 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 has passed, so that the parameter data is read into the Modbus response frame data and synchronized to the synchronization cache layer.
4. The data storage method based on Modbus according to claim 3, characterized in that: The method further comprises: If the physical device layer receives the parameter data to be modified, the parameter data to be modified is split according to the format condition corresponding to the first space address in the page storage space to obtain a plurality of groups of split parameter data to be modified; Calculating the register serial number address of each group of split parameter data to be modified, so as to obtain the parameter page data to be modified corresponding to each group of split parameter data to be modified according to the page storage space; A target page physical address of the to-be-modified parameter page data is determined, and the to-be-modified parameter page storing the to-be-modified parameter page data is written into the target page physical address.
5. The data storage method based on Modbus 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, and the method further includes: When the master parameter page data fails to be verified, the slave parameter page data of the slave device is read, so that when the slave parameter page data passes the verification, the slave parameter page data is written into a master parameter page corresponding to the master parameter page data located in the master physical layer; Or, when the slave parameter page data fails verification, the master parameter page data of the master device is read, so that when the master parameter page data passes verification, the master parameter page data is synchronized to the slave parameter page corresponding to the slave parameter page data located in the slave physical layer.
6. The data storage method based on Modbus according to claim 5, characterized in that: The method further comprises: When both the master parameter page data and the slave parameter data fail to pass verification, synchronizing the initial parameter data in the read-only data area of the synchronization cache layer to the master parameter data of the master parameter page data and the slave parameter data of the slave parameter page data; Obtain synchronized master parameter page data according to the master parameter data, and obtain synchronized slave parameter page data according to the slave parameter data; The synchronized master parameter page data is written into the master parameter page, and the synchronized slave parameter page data is written into the slave parameter page.
7. The data storage method based on Modbus 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 main parameter pages of the physical device layer, and determine that the main parameter page that fails the verification is an error page; reading a target slave parameter page of the slave device corresponding to the error page, and when target slave parameter page data of the target slave parameter page passes verification, writing the target slave parameter page data into the error page; Or, the step of synchronizing the initial parameter data in the read-only data area of the synchronization cache layer to the main parameter data of the main parameter page data is performed to write the synchronized main parameter page data into the error page.
8. A data storage system based on Modbus, characterized in that: Applied to a storage system, the storage system includes a physical device layer and a synchronization cache layer that are mutually communicatively connected, and the system includes: A reading unit, used to read the parameter page data located in the physical device layer respectively, and verify the parameter page data 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; A synchronization unit, configured to synchronize the parameter page data corresponding to the parameter page to the synchronization cache layer when the parameter page data passes verification; an acquisition unit, configured to, when the parameter page data has been synchronized to the synchronization cache layer, perform format conversion on the parameter data to be written in the parameter page data, obtain a 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; A verification unit, used for reading out the parameter page data to be verified located at the page physical address in the physical device layer, synchronizing the parameter page data to be verified to the synchronization cache layer, and verifying the parameter page data to be verified; The determination unit is used to determine that the writing of the parameter data to be written in the parameter page data to be verified is completed when the parameter page data to be verified passes the verification.
9. A data storage device based on Modbus, characterized in that: The device comprises: CPU, memory, input and output interfaces, wired or wireless network interfaces, and power supply; The memory is a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instruction operations 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, and when the instructions are executed on a computer, the computer is enabled to execute the Modbus-based data storage method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method, system and device for improving reading accuracy of flash memory
CN110232002A
Method and device for performing data synchronization control by multiple wire controllers
CN112162874A
Data synchronization method and device
CN117931938A
Worst-case memory latency reduction via data cache preloading based on page table entry read data
US20180336141A1
Method and system for adapting solid state memory write parameters to satisfy performance goals based on degree of read errors.
US20190348125A1