Data classification storage method and device based on dual-core smart meter
By obtaining the storage type of data to be stored and dividing the storage device area, the problem of inapplicable data storage method of the new generation of dual-core smart meter is solved, data storage efficiency is improved, and the software and hardware structure of the new generation of smart meter is suitable.
Patent Information
- Application Number
- CN202110018127.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-07
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-01-07
AI Technical Summary
The existing technology cannot effectively adapt to the software and hardware structure of the new generation of dual-core smart meters, resulting in inapplicable data storage methods and affecting data storage efficiency.
By obtaining the storage type of data to be stored, including data size and storage method, the storage device is divided into multiple areas, each area corresponds to a different storage type, the data is stored in the target area, and data is stored using the file system and original flash memory.
It realizes data storage that adapts to the new generation of dual-core smart meters, improves the efficiency of data storage, and is suitable for the software and hardware structure of the new generation of smart meters.
Smart Images

Figure CN112684987B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data classification and storage method, device, computer equipment and storage medium based on a dual-core smart meter. Background Art
[0002] Electricity meters are important tools for metering in my country's power system. At present, the dual-core method is widely used in China to develop electricity meters that meet the IR46 standard. The metering core is responsible for basic measurement and monitoring, and the electric energy metering function. The software in the metering core cannot be upgraded. The management core in the smart meter is mainly responsible for regularly reading the electric energy information provided by the metering core and performing secondary calculations to obtain various electric energy data that are ultimately used for billing, while completing functions such as fee control, display, communication, freezing, and event recording. In addition, in order to cope with the mid-term demand change requirements after the electric energy meter is connected to the network, the management core software supports controlled online upgrades, and the upgrade process does not affect the metering accuracy. In the upgrade of the smart meter management core, it is usually necessary to save the data, and the current storage method for data in smart meters is usually for the application to directly access the specified location of the memory. However, due to the differences in hardware and software structure between the new generation of smart meters and traditional smart meters, the current data storage method for traditional smart meters is not suitable for the new generation of smart meters.
[0003] Therefore, how to achieve data storage that is suitable for the software and hardware structure of the new generation of dual-core smart meters has become an urgent problem to be solved. Summary of the invention
[0004] Based on this, it is necessary to provide a data classification storage method, device, computer equipment and storage medium based on a dual-core smart meter that can adapt to the software and hardware structure of a new generation of dual-core smart meters in order to address the above technical problems.
[0005] A data classification and storage method based on a dual-core smart meter, the method comprising:
[0006] Acquire a storage type of the data to be stored; the storage type includes the data size and storage method of the data to be stored;
[0007] Determine a target storage area of the data to be stored in a storage device according to the storage type of the data to be stored; the storage device includes a plurality of storage areas, each storage area corresponds to the storage type;
[0008] The data to be stored is stored in the target storage area.
[0009] In one embodiment, obtaining the storage type of the data to be stored includes:
[0010] Acquire the historical data size of the data type corresponding to the data to be stored as the data size of the data to be stored;
[0011] Acquire a storage method of the data to be stored; the storage method includes continuous backward storage and insertion overwriting storage;
[0012] The data size and the storage method are used as the storage type of the data to be stored.
[0013] In one embodiment, the plurality of storage areas include: a file system and raw flash memory;
[0014] The step of determining a target storage area of the data to be stored in a storage device according to the storage type of the data to be stored includes:
[0015] Determine whether the change in the size of each historical data of the data type corresponding to the data to be stored is greater than a preset threshold;
[0016] If yes, and the storage mode of the data to be stored is continuous backward storage, determining that the target storage area of the data to be stored is a file system;
[0017] If not, and the storage method of the data to be stored is insertion overlay storage, it is determined that the target storage area of the data to be stored is the original flash memory.
[0018] In one embodiment, storing the data to be stored in the target storage area includes:
[0019] If the target storage area is a file system, obtaining the data name of the data to be stored;
[0020] The data to be stored is stored in the file system at a location corresponding to the data name.
[0021] In one embodiment, storing the data to be stored in the target storage area includes:
[0022] If the target storage area is an original flash memory, obtaining a storage sector corresponding to the data to be stored;
[0023] The data to be stored is stored in the location corresponding to the storage sector in the original flash memory.
[0024] In one embodiment, the storage device includes a plurality of sectors, the file system is arranged in a first area formed by a first number of sectors, and the raw flash memory is arranged in a second area formed by a second number of sectors;
[0025] The storing the data to be stored in the target storage area includes:
[0026] Acquire a target sector corresponding to the target storage area in the storage device;
[0027] The data to be stored is stored in the target sector through a serial peripheral interface standard drive.
[0028] In one embodiment, the method further comprises:
[0029] If the data to be stored includes multiple types of data, and the target storage areas for the multiple types of data include a file system and an original flash memory, after storing the data to be stored in the target storage area as the file system, the data to be stored in the target storage area as the original flash memory is stored, and / or, after storing the data to be stored in the target storage area as the original flash memory, the data to be stored in the target storage area as the file system is stored.
[0030] A data classification storage device based on a dual-core smart meter, the device comprising:
[0031] An acquisition module, used to acquire a storage type of the data to be stored; the storage type includes a data size and a storage method of the data to be stored;
[0032] A determination module, configured to determine a target storage area of the data to be stored in a storage device according to a storage type of the data to be stored; the storage device includes a plurality of storage areas, each storage area corresponding to the storage type;
[0033] The storage module is used to store the data to be stored in the target storage area.
[0034] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0035] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.
[0036] The above-mentioned data classification storage method, device, computer equipment and storage medium based on dual-core smart meters obtain the storage type of the data to be stored, wherein the storage type includes the data size and storage method of the data to be stored, and determines the target storage area of the data to be stored in the storage device according to the storage type of the data to be stored, wherein the storage device includes multiple storage areas, each storage area corresponds to the above-mentioned storage type, and stores the data to be stored in the above-mentioned target storage area. Compared with the data storage method for traditional meters, this scheme divides the storage device into multiple storage areas, and determines which storage area needs to be stored according to the storage type of the data to be stored, thereby realizing data storage that is adapted to the software and hardware structure of the new generation of dual-core smart meters and improving the storage efficiency of data storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is an application environment diagram of a data classification storage method based on a dual-core smart meter in one embodiment;
[0038] Figure 2 It is a flowchart of a data classification and storage method based on a dual-core smart meter in one embodiment;
[0039] Figure 3 A schematic diagram of the structure of a storage device chip in an embodiment;
[0040] Figure 4 A schematic diagram of the structure of a storage area in one embodiment;
[0041] Figure 5 A schematic diagram of a process of accessing a file system in one embodiment;
[0042] Figure 6 A schematic diagram of a process of accessing raw flash memory in one embodiment;
[0043] Figure 7 It is a structural block diagram of a data classification storage device based on a dual-core smart meter in one embodiment;
[0044] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The data classification and storage method based on the dual-core smart meter provided in this application can be applied to Figure 1In the application environment shown. Among them, the control unit 102 can communicate with the storage device 104 through the SPI (Serial Peripheral Interface) bus. The control unit 102 can obtain the storage type of the data to be stored, including the data size and storage method of the data to be stored, and can determine the target storage area of the data to be stored in the storage device 104 according to the storage type of the data to be stored, wherein the storage device 104 may include multiple storage areas, each storage area corresponds to the storage type of the above-mentioned data to be stored, and after determining the target storage area, the control unit 102 can store the data to be stored in the target storage area in the above-mentioned storage device 102 through the SPI bus. Among them, the control unit 102 can be set in the management core of the smart meter 106, the smart meter 106 can include a metering core and a management core, and the storage device 104 can be set in the smart meter 106. Specifically, the storage device 104 can be a MX25L51245G flash memory chip, and the storage device 104 can be composed of a single flash memory chip or a chip cluster formed by multiple flash memory chips.
[0047] In one embodiment, Figure 2 As shown, a data classification storage method based on a dual-core smart meter is provided, and the method is applied to Figure 1 The control unit in the example is used to illustrate, including the following steps:
[0048] Step S202, obtaining the storage type of the data to be stored; the storage type includes the data size and storage method of the data to be stored.
[0049] The data to be stored may be data to be stored in the smart meter 106, and the storage type may be a type corresponding to the storage method of the data to be stored. Specifically, the storage type may include data size and storage method, wherein the data size may be the data size of the data to be stored, and the storage method may be the storage method of the data to be stored when it is stored in the storage device 104. The data size may be determined based on the data size when the same data is stored multiple times. Specifically, the data size may be a fixed size or an irregular size, and the storage method may be based on the storage form of multiple data to be stored when they are stored in the storage device 104. The control unit 102 may obtain the storage type of the data to be stored when there is data to be stored, so that the data may be processed accordingly according to the storage type.
[0050] Step S204, determining a target storage area of the data to be stored in the storage device 104 according to the storage type of the data to be stored; the storage device 104 includes a plurality of storage areas, each storage area corresponding to a storage type.
[0051] The data to be stored may be data that needs to be stored in the smart meter 106, for example, data that needs to be stored generated by various components and basic applications in the smart meter 106, specifically, data that needs to be stored may include upgrade files, event records, frozen data, etc. of meter applications; other types of data may also be generated in the smart meter 106, which are not limited here. The control unit 102 may determine the target storage area of the data to be stored in the storage device 104 according to the storage type of the data to be stored, wherein the storage device 104 may include multiple storage areas, and each storage area may be used to store data in different forms. For example, the storage device 104 may be divided into two areas, each storage area may correspond to the storage type of the data to be stored, for example, one area may be provided with a file system, and the other area may be provided as a raw flash memory, that is, the storage area provided with the file system may store data that needs to be stored using the file system, and the control unit 102 may manage the data to be stored through the file system, and the area provided as the raw flash memory may store data that needs to be directly accessed to the sector for storage, and the control unit 102 may directly access the sector in the storage area.
[0052] Specifically, the structure of the storage device 104 can be as follows: Figure 3 As shown, Figure 3 1 is a schematic diagram of the structure of a storage device chip in an embodiment. The storage device 104 may be a MX25L51245G flash memory chip, which may have 16384 individually erasable sectors, each sector having 4096 bytes, and a total capacity of 64MB. The storage device 104 may also be divided into a plurality of storage areas. Specifically, the schematic diagram of the structure of each storage area may be as follows: Figure 4 As shown, Figure 4 : is a structural diagram of a storage area in an embodiment. The above-mentioned storage areas may include a file system, such as littlefs (embedded file system), which is an embedded file system developed by ARM; and rawflash (raw flash memory). The above-mentioned MX25L51245G flash memory chip can be divided into multiple storage areas according to a preset size. For example, the first 8196 sectors of MX25L51245G, totaling 32MB, are allocated to the littlefs file management, and the latter 8196 sectors are managed by the rawflash device driver. APP (Application), that is, the basic application in the smart meter 106, can access different storage areas according to the different data generated, and at the lowest driver level, the control unit 102 can access the MX25L51245G chip through the public spi nor (serial peripheral interface standard) driver. The control unit 102 can determine the target storage area of the data to be stored in the storage device 104 based on the data size and storage method of the data to be stored.
[0053] Step S206, storing the data to be stored in the target storage area.
[0054] The data to be stored may be data that needs to be stored generated by various components and basic applications in the smart meter 106, and the target storage area may be a target storage area in the storage device 104 where the data to be stored needs to be stored, determined based on the storage type of the data to be stored, including the data size and storage method of the data to be stored, such as storage in a file system or in an original flash memory. The control unit 102 may store the data to be stored in the determined target storage area after determining the target storage area in the storage device 104 where the data to be stored is located. The storage methods of each target storage area may be different, that is, both the file system and the original flash memory may have corresponding data storage methods.
[0055] In the above-mentioned data classification and storage method based on the dual-core smart meter, the storage type of the data to be stored is obtained, wherein the storage type includes the data size and storage method of the data to be stored, and according to the storage type of the data to be stored, the target storage area of the data to be stored in the storage device is determined, wherein the storage device includes multiple storage areas, each storage area corresponds to the above-mentioned storage type, and the data to be stored is stored in the above-mentioned target storage area. Compared with the data storage method for traditional meters, this scheme divides the storage device into multiple storage areas, and determines which storage area to store the data according to the storage type of the data to be stored, thereby realizing data storage that is adapted to the software and hardware structure of the new generation of dual-core smart meters and improving the storage efficiency of data storage.
[0056] In one embodiment, obtaining the storage type of data to be stored includes: obtaining the historical data size of the data type corresponding to the data to be stored as the data size of the data to be stored; obtaining the storage method of the data to be stored; the storage method includes continuous backward storage and insertion overwrite storage; and using the data size and the storage method as the storage type of the data to be stored.
[0057] In this embodiment, the data to be stored may be data that needs to be stored generated by various components and basic applications in the smart meter 102. The data to be stored may have multiple storage types, and the storage type may include the data size of the data to be stored and the storage method of the data to be stored. The data size may be the size change rule of the data to be stored each time it is stored, and the storage method may be the method of the data to be stored when it is stored. The control unit 102 may determine the data size of the data to be stored based on multiple data of the data type corresponding to the data to be stored. Specifically, the control unit 102 may obtain the historical data size of the data type corresponding to the data to be stored, for example, the historical data of the data type corresponding to the data to be stored may be obtained from the storage device 104, thereby obtaining the data size of each data, and the control unit 102 may use the obtained historical data size as the data size of the data to be stored; the control unit 102 may also obtain the storage method of the data to be stored, and specifically, the control unit 102 may query the storage method of the above-mentioned data to be stored when it is stored, for example, it may include continuous backward storage, insertion and overwriting storage, etc. Among them, continuous backward storage may refer to that the data is stored continuously and is stored in the storage device 104 in order, and no interleaved storage occurs in the storage device 104; insertion and overwriting storage may refer to that the data is inserted or overwritten at the file header when the value data is stored. The control unit 102 may obtain the data size of the data to be stored according to the above historical data size, and obtain the storage mode of the data to be stored according to the above storage modes, so as to obtain the storage type of the data to be stored based on the above data size and storage mode.
[0058] Through this embodiment, the control unit 102 can obtain the storage type of the data to be stored based on the historical data size and storage method of the data to be stored, so that it can determine the target storage area of the data to be stored by itself and the storage type, thereby realizing data storage that adapts to the software and hardware structure of the new generation of dual-core smart meters, and improving the storage efficiency of data storage.
[0059] In one embodiment, according to the storage type of the data to be stored, determining the target storage area of the data to be stored in the storage device 104 includes: judging whether the change in the size of each historical data of the data type corresponding to the data to be stored is greater than a preset threshold; if so, and the storage method of the data to be stored is continuous backward storage, determining that the target storage area of the data to be stored is a file system; if not, and the storage method of the data to be stored is insert overwrite storage, determining that the target storage area of the data to be stored is original flash memory.
[0060] In this embodiment, the storage device 104 may include multiple storage areas, and the multiple storage areas include a file system and a raw flash memory. Specifically, the file system may be a littlefs file system, and the raw flash memory may be a rawflash device. The control unit 102 may determine the target storage area of the data to be stored in the storage device 104 according to the storage type of the data to be stored. Specifically, the storage type of the data to be stored may include the data size and storage mode of the data to be stored, and the data size may be determined based on the historical data size of the data to be stored. The control unit 102 may obtain the historical data size of the data to be stored, and may determine whether the change of each historical data size of the data type corresponding to the data to be stored is greater than a preset threshold. If so, it is determined that the data to be stored is data of non-fixed size. At this time, the control unit 102 may determine whether the storage mode of the data to be stored is continuous backward storage. If so, it may be determined that the target storage area of the data to be stored is a file system, that is, the data size is not fixed, and the data to be stored whose storage mode is continuous backward storage can be stored in the file system of the storage device 104. For example, it may include upgrade files of electric meter applications, event records and other data.
[0061] If the control unit 102 determines that the degree of change in the historical data size of the above-mentioned data to be stored does not exceed the preset threshold, it can be determined that the data size of the data to be stored is a fixed size. At this time, the control unit 102 can determine whether the storage method of the data to be stored is insertion and overwriting storage. If so, it can be determined that the target storage area of the data to be stored is the original flash memory, that is, the data size is fixed, but data inserted or overwritten will occur in the file header, such as frozen data in an electric meter at regular intervals. The size of the data stored each time is fixed, and the data element can be quickly determined according to the number of times, and the farthest data may be overwritten. This type of data can be stored in the original flash memory, for example, by reading and writing through a rawflash device.
[0062] Through this embodiment, the control unit 102 can store data elements with irregular size and continuously backward to the file system based on the data size and storage method of the data to be stored, and store data with fixed size of data elements that will be inserted or overwritten in the file header in the original flash memory, thereby adapting to the software and hardware structure of the new generation of dual-core smart meters and improving the efficiency of data storage in the smart meter 106.
[0063] In one embodiment, storing the data to be stored in the target storage area includes: if the target storage area is a file system, obtaining the data name of the data to be stored; and storing the data to be stored in a location corresponding to the data name in the file system.
[0064] In this embodiment, the data to be stored may be data that needs to be stored in the smart meter 106. The storage device 104 may include multiple storage areas. The target storage area may be a storage area in the storage device 104 determined by the control unit 102 based on the storage type of the data to be stored. Specifically, the storage area includes areas such as a file system and raw flash memory, wherein the file system may be a power-off safe and wear-balanced file system. The control unit 102 may store the data to be stored in different ways depending on the target storage area. For example, if the target storage area is a file system, the control unit 102 may obtain the data name of the data to be stored, and store the data to be stored in the location corresponding to the data name in the file system. Specifically, Figure 5 As shown, Figure 5 The flowchart of accessing the file system in one embodiment is shown in FIG. 1 . The control unit 102 can search for a file in the littlefs file system according to the file name of the data to be stored. If the file exists, the file is directly written to the location corresponding to the file. If the file does not exist, a new file can be created and written based on the file name, and the SPI NOR driver is called to access the flash memory chip, so as to store the data to be stored in the storage device 104. In addition, the control unit 102 can also read the data stored in the file system in the storage device 104 based on the name of the data. The reading process can be as follows: Figure 5 shown.
[0065] Through this embodiment, the control unit 102 can store the data to be stored that needs to be stored in the file system according to the name of the data to be stored, thereby realizing data storage that adapts to the software and hardware structure of the new generation of dual-core smart meters and improving the efficiency of data storage in the smart meter 106.
[0066] In one embodiment, storing the data to be stored in the target storage area includes: if the target storage area is an original flash memory, obtaining a storage sector corresponding to the data to be stored; and storing the data to be stored in a location corresponding to the storage sector in the original flash memory.
[0067] In this embodiment, the above-mentioned storage area may also include an original flash memory area, and the control unit 102 may determine the manner in which the data to be stored is stored in the storage device 104, that is, in the flash memory chip, according to the storage type of the data to be stored. For example, if the target storage area is an original flash memory, the control unit 102 may obtain the storage sector corresponding to the data to be stored, and may store the data to be stored in the original flash memory at a location corresponding to the storage sector obtained above. Specifically, Figure 6 As shown, Figure 6The figure is a flowchart of accessing the original flash memory in one embodiment. The control unit 102 can check the data of the sector according to the storage sector corresponding to the data to be stored in the original flash memory, and can determine whether the data of the sector needs to be erased. Specifically, if the sector is an empty sector, it does not need to be erased. If it is a sector with data, the data of the sector can be erased. The control unit 102 can write the data to be stored into the RawFlash original flash memory. Specifically, the flash flash memory chip can be accessed through the SPI NOR driver, and the data to be stored can be written into the chip, thereby realizing the storage of the data to be stored. In addition, the control unit 102 can also read the data stored in the flash memory chip based on the sector number of the data, and the reading step can be as follows. Figure 5 shown.
[0068] Through this embodiment, the control unit 102 can store the data to be stored that needs to be stored in the original flash memory according to the storage sector of the data to be stored, thereby realizing data storage that adapts to the software and hardware structure of the new generation of dual-core smart meters and improving the efficiency of data storage in the smart meter 106.
[0069] In one embodiment, storing the data to be stored in the target storage area includes: obtaining a target sector corresponding to the target storage area in the storage device 104; and storing the data to be stored in the target sector through a serial peripheral interface standard driver.
[0070] In this embodiment, the storage device 104 may include a plurality of sectors, the file system may be set in a first area formed by a first number of sectors, and the raw flash memory may be set in a second area formed by a second number of sectors. The control unit 102 may determine the sector to which the data to be stored needs to be stored based on the number of sectors occupied by the target storage area in the storage device 104. The control unit 102 may obtain the target sector corresponding to the target storage area in the storage device 104, and store the data to be stored in the target sector based on the SPI NOR serial peripheral interface standard driver. Specifically, the file system and the raw flash memory may be stored in the same flash memory chip. The control unit 102 may use two methods to access the same flash memory chip. The sector access boundary needs to be checked in the driver programs of the two methods. The sectors accessible to the littlefs file system are 0 to 8191, and the sectors accessible to the rawflash device are 8192 to 16383. The boundary check is completed in the common SPI NOR driver. After the control unit 102 determines the boundary, the data to be stored may be stored according to the sector corresponding to the target storage area.
[0071] Through this embodiment, the control unit 102 can determine the boundaries of each storage area based on the sector numbers corresponding to each storage area in the storage device 104, and perform boundary checks when storing data to be stored to prevent storage errors, thereby adapting to the software and hardware structure of the new generation of dual-core smart meters and improving the efficiency of data storage.
[0072] In one embodiment, it also includes: if the data to be stored includes multiple data, and the target storage areas for the multiple data include a file system and an original flash memory, after storing the data to be stored in the target storage area as the file system, storing the data to be stored in the target storage area as the original flash memory, and / or, after storing the data to be stored in the target storage area as the original flash memory, storing the data to be stored in the target storage area as the file system.
[0073] In this embodiment, the data to be stored may include multiple types of data, wherein the multiple types of data may include data whose target storage area is a file system, and may also include data whose target storage area is an original flash memory, that is, the control unit 102 needs to access the file system and the original flash memory, so as to store the data to be stored. When storing multiple types of data to be stored, the control unit 102 may access the storage device 104 in a mutually exclusive access manner. Specifically, the control unit 102 may first store the data whose target storage area is a file system among the data to be stored, that is, first access the file system, and then store the data whose target storage area is an original flash memory among the data to be stored, that is, then access the original flash memory; the control unit 102 may also first store the data whose target storage area is an original flash memory among the data to be stored, that is, first access the original flash memory, and then store the data whose target storage area is a file system among the data to be stored, that is, then access the file system. Finally, all the data to be stored are stored.
[0074] Through this embodiment, the control unit 102 can achieve mutually exclusive access to different storage areas in a multi-tasking system, so that only one access method can be used at the same time, thereby realizing data storage that adapts to the software and hardware structure of the new generation of dual-core smart meters and improving the data storage efficiency in the smart meter 106.
[0075] It should be understood that although Figure 2 and Figure 5-Figure 6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2 and Figure 5-Figure 6At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.
[0076] In one embodiment, Figure 7 As shown, a data classification storage device based on a dual-core smart meter is provided, comprising: an acquisition module 500, a determination module 502 and a storage module 504, wherein:
[0077] The acquisition module 500 is used to acquire the storage type of the data to be stored; the storage type includes the data size and storage method of the data to be stored.
[0078] The determination module 502 is used to determine the target storage area of the data to be stored in the storage device according to the storage type of the data to be stored; the storage device includes multiple storage areas, each storage area corresponds to a storage type.
[0079] The storage module 504 is used to store the data to be stored in the target storage area.
[0080] In one embodiment, the above-mentioned acquisition module 500 is specifically used to obtain the historical data size of the data type corresponding to the data to be stored as the data size of the data to be stored; obtain the storage method of the data to be stored; the storage method includes continuous backward storage and insertion overwrite storage; the data size and the storage method are used as the storage type of the data to be stored.
[0081] In one embodiment, the above-mentioned determination module 502 is specifically used to determine whether the change in the size of each historical data of the data type corresponding to the data to be stored is greater than a preset threshold; if so, and the storage method of the data to be stored is continuous backward storage, determine that the target storage area of the data to be stored is the file system; if not, and the storage method of the data to be stored is insert overlay storage, determine that the target storage area of the data to be stored is the original flash memory.
[0082] In one embodiment, the storage module 504 is specifically used to obtain the data name of the data to be stored if the target storage area is a file system; and store the data to be stored in a location corresponding to the data name in the file system.
[0083] In one embodiment, the storage module 504 is specifically used to obtain the storage sector corresponding to the data to be stored when the target storage area is the original flash memory; and store the data to be stored in the location corresponding to the storage sector in the original flash memory.
[0084] In one embodiment, the storage module 504 is specifically used to obtain the target sector corresponding to the target storage area in the storage device 104; and store the data to be stored in the target sector through a serial peripheral interface standard driver.
[0085] In one embodiment, the above-mentioned device also includes: a mutually exclusive module, which is used to store the data to be stored in the original flash memory after the target storage area is the data to be stored in the file system, and / or, if the data to be stored includes multiple data, and the target storage area of the multiple data includes a file system and an original flash memory, the target storage area is the data to be stored in the original flash memory after the target storage area is the data to be stored in the file system.
[0086] For the specific definition of the data classification storage device based on the dual-core smart meter, please refer to the definition of the data classification storage method based on the dual-core smart meter mentioned above, which will not be repeated here. Each module in the above-mentioned data classification storage device based on the dual-core smart meter can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0087] In one embodiment, a computer device is provided. The computer device may be a smart meter, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as files, records and metering information of the smart meter. The network interface of the computer device is used to communicate with an external control unit through a network connection. When the computer program is executed by the processor, a data classification storage method based on a dual-core smart meter is implemented.
[0088] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0089] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the data classification and storage method based on the dual-core smart meter is implemented.
[0090] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the data classification and storage method based on the dual-core smart meter is implemented.
[0091] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).
[0092] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0093] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A data classification and storage method based on a dual-core smart meter, characterized in that: The method comprises: Acquire the storage type of the data to be stored; the storage type includes the data size and storage mode of the data to be stored; the acquiring the storage type of the data to be stored includes: acquiring the historical data size of the data type corresponding to the data to be stored as the data size of the data to be stored; acquiring the storage mode of the data to be stored; the storage mode includes continuous backward storage and insertion overwriting storage; using the data size and the storage mode as the storage type of the data to be stored; Determine the target storage area of the data to be stored in the storage device according to the storage type of the data to be stored; the storage device includes multiple storage areas, each storage area corresponds to the storage type; the multiple storage areas include: a file system and an original flash memory; Determine the target storage area of the data to be stored in the storage device according to the storage type of the data to be stored, including: judging whether the change in the size of each historical data of the data type corresponding to the data to be stored is greater than a preset threshold; if so, and the storage method of the data to be stored is continuous backward storage, determine that the target storage area of the data to be stored is the file system; if not, and the storage method of the data to be stored is insert overwrite storage, determine that the target storage area of the data to be stored is the original flash memory; The data to be stored is stored in the target storage area.
2. The method according to claim 1, characterized in that The storing the data to be stored in the target storage area includes: If the target storage area is a file system, obtaining the data name of the data to be stored; The data to be stored is stored in the file system at a location corresponding to the data name.
3. The method according to claim 1, characterized in that The storing the data to be stored in the target storage area includes: If the target storage area is an original flash memory, obtaining a storage sector corresponding to the data to be stored; The data to be stored is stored in the location corresponding to the storage sector in the original flash memory.
4. The method according to claim 1, characterized in that: The storage device includes a plurality of sectors, the file system is set in a first area formed by a first number of sectors, and the original flash memory is set in a second area formed by a second number of sectors; The storing the data to be stored in the target storage area includes: Acquire a target sector corresponding to the target storage area in the storage device; The data to be stored is stored in the target sector through a serial peripheral interface standard drive.
5. The method according to claim 1, characterized in that The method further comprises: If the data to be stored includes multiple types of data, and the target storage areas for the multiple types of data include a file system and an original flash memory, after storing the data to be stored in the target storage area as the file system, the data to be stored in the target storage area as the original flash memory is stored, and / or, after storing the data to be stored in the target storage area as the original flash memory, the data to be stored in the target storage area as the file system is stored.
6. A data classification storage device based on a dual-core smart meter, characterized in that: The device comprises: an acquisition module, used to acquire a storage type of the data to be stored; the storage type includes the data size and storage mode of the data to be stored; specifically used to: acquire the historical data size of the data type corresponding to the data to be stored as the data size of the data to be stored; acquire the storage mode of the data to be stored; the storage mode includes continuous backward storage and insertion overwriting storage; use the data size and the storage mode as the storage type of the data to be stored; A determination module, configured to determine a target storage area of the data to be stored in a storage device according to a storage type of the data to be stored; the storage device includes a plurality of storage areas, each storage area corresponding to the storage type; the plurality of storage areas include: a file system and an original flash memory; the determination module is specifically configured to: determine whether a change in the size of each historical data of a data type corresponding to the data to be stored is greater than a preset threshold; if so, and the storage method of the data to be stored is continuous backward storage, determine that the target storage area of the data to be stored is a file system; if not, and the storage method of the data to be stored is insert overwrite storage, determine that the target storage area of the data to be stored is an original flash memory; The storage module is used to store the data to be stored in the target storage area.
7. The device according to claim 6, characterized in that The storage module is specifically used for: If the target storage area is a file system, obtaining the data name of the data to be stored; The data to be stored is stored in the file system at a location corresponding to the data name.
8. The device according to claim 6, characterized in that The storage module is specifically used for: If the target storage area is an original flash memory, obtaining a storage sector corresponding to the data to be stored; The data to be stored is stored in the location corresponding to the storage sector in the original flash memory.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Data write-in method, system and embedded electronic equipment
CN102855914A
Flash memory storage method and device with file system
CN108804344A
Data storage method and electronic equipment
CN111026674A
Data processor
JP2005258602A
Flash memory file apparatus and mounting method of the same
KR1020080096211A
