CN110716934A - Data storage method and device and electronic equipment - Google Patents

Data storage method and device and electronic equipment Download PDF

Info

Publication number
CN110716934A
CN110716934A CN201910953600.2A CN201910953600A CN110716934A CN 110716934 A CN110716934 A CN 110716934A CN 201910953600 A CN201910953600 A CN 201910953600A CN 110716934 A CN110716934 A CN 110716934A
Authority
CN
China
Prior art keywords
storage
data
storage units
addresses
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910953600.2A
Other languages
Chinese (zh)
Other versions
CN110716934B (en
Inventor
王锦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ningbo Sanxing Medical and Electric Co Ltd
Original Assignee
Ningbo Sanxing Medical and Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ningbo Sanxing Medical and Electric Co Ltd filed Critical Ningbo Sanxing Medical and Electric Co Ltd
Priority to CN201910953600.2A priority Critical patent/CN110716934B/en
Publication of CN110716934A publication Critical patent/CN110716934A/en
Application granted granted Critical
Publication of CN110716934B publication Critical patent/CN110716934B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Economics (AREA)
  • Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Human Resources & Organizations (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Public Health (AREA)
  • Water Supply & Treatment (AREA)
  • General Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Marketing (AREA)
  • Primary Health Care (AREA)
  • Strategic Management (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The embodiment of the invention provides a data storage method and device and electronic equipment, and relates to the field of data storage. The data storage method comprises the following steps: when the acquired electric meter data belong to a first type of data, selecting a first preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from low to high, and storing the electric meter data in the first preset number of idle storage units; when the acquired electric meter data belong to second type data, selecting a second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low, and storing the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type data and the second type data is different. The data storage method, the data storage device and the electronic equipment provided by the embodiment of the invention can be used for dynamically storing the electric meter data, so that the utilization rate of the storage space is improved.

Description

Data storage method and device and electronic equipment
Technical Field
The invention relates to the technical field of data storage, in particular to a data storage method and device and electronic equipment.
Background
Electronic equipment used by the current power grid platform generally adopts a storage space pre-allocation mechanism, namely after the electronic equipment fixes the number of different types of measuring points, the storage space can be solidified according to the number of the different types of measuring points. If the storage contents are adjusted or the storage types are increased, the storage space for storing one type of contents is insufficient; or cause storage space for storing another type of content to remain, making the utilization of the storage space inefficient.
Disclosure of Invention
The invention aims to provide a data storage method, a data storage device and electronic equipment, which can be used for dynamically storing electric meter data and improving the utilization rate of a storage space.
Embodiments of the invention may be implemented as follows:
in a first aspect, an embodiment of the present invention provides a data storage method applied to an electronic device, where the electronic device includes a memory, the memory includes a plurality of memory units, and each memory unit is configured with a memory address, where the method includes: when the acquired electric meter data belong to a first type of data, selecting a first preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from low to high, and storing the electric meter data in the first preset number of idle storage units; when the acquired electric meter data belong to second-class data, selecting a second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low, and storing the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type of data and the second type of data is different.
Therefore, the ammeter data belonging to the first type of data and the ammeter data belonging to the second type of data are dynamically stored according to the sequence of the storage addresses, more storage units can be occupied by more ammeter data of which type, and compared with a storage space pre-allocation mechanism, the utilization rate of a storage is higher, and the storage of the ammeter data is more flexible.
In an optional implementation manner, when the number of the storage units occupied by the first type of data is less than the number of the storage units occupied by the second type of data, the storage addresses of the second preset number of idle storage units are consecutive, and the step of selecting the second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low includes: when the number of free storage units with continuous storage addresses selected from the plurality of storage units in the sequence of the storage addresses from high to low is smaller than the second preset number, if the storage units which are free and have the storage addresses lower than the free storage units with continuous storage addresses exist, the electric meter data of the first type data stored in the storage units adjacent to the free storage units with continuous storage addresses are shifted into the storage units with the free and the lowest storage addresses until the number of the free storage units with continuous storage addresses is equal to the second preset number.
Therefore, when the number of the idle storage units with continuous storage addresses is not enough to store the ammeter data belonging to the second type of data, storage adjustment is carried out, the ammeter data belonging to the first type of data and stored in the storage unit adjacent to the idle storage unit connected with the storage addresses are shifted to the idle storage unit with the lowest storage address, so that the idle storage units with continuous storage addresses enough to store the ammeter data belonging to the second type of data are adjusted, the utilization rate of the storage is higher, and the storage of the ammeter data is more flexible.
In an alternative embodiment, the method further comprises: and outputting first prompt information when the total number of the idle storage units is less than the second preset number. Therefore, the storage condition of the storage can be known by the staff in time by outputting the first prompt message.
In an optional implementation manner, when the number of the storage units occupied by the first type of data is greater than the number of the storage units occupied by the second type of data, the storage addresses of the first preset number of idle storage units are consecutive, and the step of selecting the first preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from low to high includes: when the number of idle storage units with continuous storage addresses selected from the plurality of storage units according to the sequence of the storage addresses from low to high is smaller than the first preset number, if the storage units which are idle and have the storage addresses higher than the idle storage units with continuous storage addresses exist, the ammeter data of the second type of data stored in the storage units adjacent to the idle storage units with continuous storage addresses are shifted to the storage units with the idle and the highest storage addresses until the number of the idle storage units with continuous storage addresses is equal to the first preset number.
In an alternative embodiment, the method further comprises: and outputting first prompt information when the total number of the idle storage units is smaller than the first preset number.
In an alternative embodiment, the method further comprises: and when no free storage unit exists, outputting second prompt information.
In a second aspect, an embodiment of the present invention provides a data storage apparatus, which is applied to an electronic device, where the electronic device includes a memory, the memory includes a plurality of memory cells, and each memory cell is configured with a memory address, where the data storage apparatus includes: the first storage processing module is used for selecting a first preset number of idle storage units from the plurality of storage units according to the sequence of storage addresses from low to high when the acquired electric meter data belongs to a first class of data, and storing the electric meter data in the first preset number of idle storage units; the second storage processing module is used for selecting a second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low when the acquired electric meter data belongs to a second type of data, and storing the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type of data and the second type of data is different.
In an alternative embodiment, when the number of the storage units occupied by the first type data is less than the number of the storage units occupied by the second type data, the second preset number of idle memory units has continuous memory addresses, and the second memory processing module, when the number of free memory units with continuous memory addresses selected from the plurality of memory units in the sequence of the memory addresses from high to low is less than the second preset number, if there are memory cells that are free and have memory addresses lower than the free memory cells whose memory addresses are consecutive, the meter data belonging to the first kind of data stored in the memory cells adjacent to the free memory cell consecutive to the memory address is shifted to the free memory cell having the lowest memory address, until the number of the idle memory units with continuous memory addresses is equal to the second preset number.
In an alternative embodiment, the data storage device further comprises: and the output module is used for outputting first prompt information when the total number of the idle storage units is less than the second preset number.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, where the memory stores a computer program capable of being executed by the processor, and the computer program, when executed by the processor, implements the method according to any one of the foregoing embodiments.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic application environment diagram of an electronic device according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
fig. 3 is a flowchart illustrating a data storage method according to an embodiment of the present invention;
FIG. 4 is a flow chart illustrating another data storage method according to an embodiment of the present invention;
FIG. 5 is a flow chart illustrating a further data storage method according to an embodiment of the present invention;
fig. 6 is a structural diagram of a data storage device according to an embodiment of the present invention.
Icon: 100-an electronic device; 110-a memory; 120-a processor; 130-a communication module; 140-data storage means; 141-a first storage processing module; 142-a second storage handling module; 143-an output module; 200-single-phase electric meter; 300-three-phase electric meter.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. indicate an orientation or a positional relationship based on that shown in the drawings or that the product of the present invention is used as it is, this is only for convenience of description and simplification of the description, and it does not indicate or imply that the device or the element referred to must have a specific orientation, be constructed in a specific orientation, and be operated, and thus should not be construed as limiting the present invention.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
Referring to fig. 1, a schematic diagram of an applicable environment of the electronic device 100 according to the embodiment is provided, in which the electronic device 100 is communicatively connected to at least one single-phase electric meter 200 and at least one three-phase electric meter 300, and the electronic device 100 is configured to receive and store meter data of the single-phase electric meter 200 and meter data of the three-phase electric meter 300.
The electronic device 100 may be a power collection terminal. The size of the meter data of the three-phase electric meter 300 may be 15748 bytes, and the size of the meter data of the single-phase electric meter 200 may be 3348 bytes, and it is understood that the size of the meter data of the three-phase electric meter 300 is 4.7 times the size of the meter data of the single-phase electric meter 200. The meter data of the single-phase electric meter 200 and the meter data of the three-phase electric meter 300 may include voltage information, current information, power information, and the like.
Referring to fig. 2, which is a schematic structural diagram of an implementation of the electronic device 100 shown in fig. 1, the electronic device 100 includes a memory 110, a processor 120 and a communication module 130, and the elements of the memory 110, the processor 120 and the communication module 130 are directly or indirectly electrically connected to each other to implement data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 110 includes a plurality of memory cells, each memory cell is configured with a corresponding memory address, and the size of each memory cell is set according to the size of the meter data of the single-phase meter 200, so that the meter data of one single-phase meter 200 occupies one memory cell, and the meter data of one three-phase meter 300 occupies five memory cells. The memory 110 is used to store a program or data, which may be only the meter data of the plurality of single-phase meters 200, only the meter data of the plurality of three-phase meters 300, or a mixture of the meter data of the single-phase meters 200 and the meter data of the three-phase meters 300. The Memory 110 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM) 110, a Programmable Read Only Memory (PROM), an Erasable Read Only Memory (EPROM), an electrically Erasable Read Only Memory (EEPROM), and the like.
The processor 120 is used to read/write data or programs stored in the memory 110 and perform corresponding functions. For example, the computer program stored in the memory 110 can implement the data storage method disclosed by the embodiment of the present invention when being executed by the processor 120.
The communication module 130 is used for establishing a communication connection between the electronic device 100 and the single-phase electric meter 200 and the three-phase electric meter 300 through a network or a communication bus, and transceiving data through the network or the communication bus.
It should be understood that the configuration shown in fig. 2 is merely a schematic diagram of the configuration of the electronic device 100, and that the electronic device 100 may include more or fewer components than shown in fig. 2, or have a different configuration than shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
Fig. 3 is a schematic flow chart of a data storage method according to an embodiment of the present invention. It should be noted that, the data storage method provided in the embodiment of the present invention is not limited by fig. 3 and the following specific sequence, and it should be understood that, in other embodiments, the sequence of some steps in the data storage method provided in the embodiment of the present invention may be interchanged according to actual needs, or some steps in the data storage method may also be omitted or deleted. The data storage method can be applied to the electronic device 100 shown in fig. 1, and the specific flow shown in fig. 3 will be described in detail below.
Step S101, when the obtained electric meter data belongs to a first type of data, selecting a first preset number of idle storage units from a plurality of storage units according to the sequence of the storage addresses from low to high, and storing the electric meter data in the first preset number of idle storage units.
Step S102, when the obtained electric meter data belongs to second type data, selecting a second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low, and storing the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type data and the second type data is different.
In this embodiment, the first type data may be meter data of the single-phase meter 200, and may be meter data of the three-phase meter 300. The second type data may be the meter data of the single-phase meter 200, and may be the meter data of the three-phase meter 300.
When the number of the storage units occupied by the first type of data is less than the number of the storage units occupied by the second type of data, the first type of data is the electric meter data of the single-phase electric meter 200, and the second type of data is the electric meter data of the three-phase electric meter 300. When the number of the storage units occupied by the first type of data is greater than the number of the storage units occupied by the second type of data, the first type of data is the electric meter data of the three-phase electric meter 300, and the second type of data is the electric meter data of the single-phase electric meter 200.
The first type of data is the meter data of the single-phase meter 200, and the second type of data is the meter data of the three-phase meter 300. When the number of the storage units occupied by the first type of data is less than the number of the storage units occupied by the second type of data, the number of the idle storage units in the first preset number may be one, the number of the idle storage units in the second preset number may be five, and the storage addresses of the idle storage units in the second preset number are continuous. When receiving the electric meter data, the electronic device 100 determines whether the electric meter data is the electric meter data of the single-phase electric meter 200 or the three-phase electric meter 300 according to the size of the electric meter data. If the received electric meter data is judged to be the electric meter data of the single-phase electric meter 200, one storage unit with the lowest storage address is selected from the idle storage units to store the electric meter data of the single-phase electric meter 200. If the received electric meter data is judged to be the electric meter data of the three-phase electric meter 300, and the number of the idle storage units with continuous storage addresses in the plurality of storage units is more than or equal to five, the five storage units with continuous storage addresses from high to low are selected from the idle storage units to store the electric meter data of the three-phase electric meter 300.
When the number of free storage units with continuous storage addresses, which are selected from the plurality of storage units in the sequence from high storage addresses to low storage addresses, is smaller than a second preset number, if the storage units are free and have storage addresses lower than the free storage units with continuous storage addresses, the electric meter data which are stored in the storage units adjacent to the free storage units with continuous storage addresses and belong to the first type of data are shifted to the storage units with the free storage addresses and the lowest storage addresses until the number of the free storage units with continuous storage addresses is equal to the second preset number.
It can be understood that if the memory 110 includes 1450 memory cells, each memory cell is correspondingly configured to have a memory address of 1-1450, the meter data of one single-phase meter 200 occupies one memory cell, and the meter data of one three-phase meter 300 occupies five memory cells with consecutive memory addresses. If only the memory cells corresponding to the memory addresses 2, 4, 7, 8, and 9 in the memory 110 are free, the meter data of the two single-phase meters 200 are stored in the memory cells corresponding to the memory addresses 5 and 6, and the meter data of one three-phase meter 300 is stored in the memory cells corresponding to the memory addresses 10-14, if the electronic device 100 receives the meter data of the three-phase meter 300 at this time, because the memory addresses of the free five memory cells are not continuous, the electronic device 100 cannot directly store the meter data of the three-phase meter 300 in the memory cells corresponding to the memory addresses 2, 4, 7, 8, and 9, the electronic device 100 will first shift the meter data of the single-phase meter 200 in the memory cell with the memory address 6 to the memory cell with the memory address 2, and then shift the meter data of the single-phase meter 200 in the memory cell with the memory address 5 to the memory cell with the memory address 4, after obtaining five free memory cells with the memory addresses of 5-9, the electronic device 100 stores the meter data of the three-phase electric meter 300 in the memory cells with the memory addresses of 5-9. In other words, the memory cells with the memory addresses of 7, 8, and 9 can be understood as the aforementioned idle memory cells with the number less than the second preset number and with consecutive memory addresses; the memory cells having the memory addresses 2 and 4 can be understood as the aforementioned memory cells which are free and have memory addresses lower than the free memory cells having consecutive memory addresses; the memory cell having the memory address of 6 may be understood as a memory cell adjacent to the aforementioned free memory cell having the memory address consecutive thereto and storing the meter data of the single-phase meter 200.
The idle storage units with storage addresses lower than the storage addresses continuously may be always in an idle state, or the electronic device 100 may delete the idle single-phase electric meter 200 in the storage units with storage addresses lower than the storage addresses continuously in response to a deletion operation of a user, so as to obtain the idle storage units with storage addresses lower than the storage addresses continuously.
The first type of data is the meter data of the three-phase meter 300, and the second type of data is the meter data of the single-phase meter 200. When the number of the storage units occupied by the first type of data is greater than the number of the storage units occupied by the second type of data, the first preset number of idle storage units may be five, the second preset number of idle storage units may be one, and the storage addresses of the first preset number of idle storage units are continuous. When receiving the electric meter data, the electronic device 100 determines whether the electric meter data is the electric meter data of the single-phase electric meter 200 or the three-phase electric meter 300 according to the size of the electric meter data. If the received electric meter data is judged to be the electric meter data of the single-phase electric meter 200, the electric meter data of the single-phase electric meter 200 can be stored in the storage unit with the highest storage address selected from the idle storage units. If the received electric meter data is judged to be the electric meter data of the three-phase electric meter 300, and the number of the idle storage units with continuous storage addresses in the plurality of storage units is greater than or equal to five, the five storage units with continuous storage addresses from low to high are selected from the idle storage units to store the electric meter data of the three-phase electric meter 300.
When the number of idle storage units with continuous storage addresses, which are selected from the plurality of storage units according to the sequence of the storage addresses from low to high, is smaller than a second preset number, if the storage units which are idle and have the storage addresses higher than the idle storage units with continuous storage addresses exist, the ammeter data which are stored in the storage units adjacent to the idle storage units with continuous storage addresses and belong to the second type of data are shifted to the storage units with the idle and the highest storage addresses until the number of the idle storage units with continuous storage addresses is equal to the first preset number.
It can be understood that if the memory 110 includes 1450 memory cells, each memory cell is correspondingly configured to have a memory address of 1-1450, the meter data of one single-phase meter 200 occupies one memory cell, and the meter data of one three-phase meter 300 occupies five memory cells with consecutive memory addresses. If only the storage units corresponding to the storage addresses 6, 7, 8, 9, 12, and 14 in the memory 110 are free, the storage units corresponding to the storage addresses 10 and 11 store the meter data of the two single-phase meters 200, and the storage units corresponding to the storage addresses 1 to 5 store the meter data of one three-phase meter 300, at this time, if the electronic device 100 receives the meter data of the three-phase meter 300, because the storage addresses of the free six storage units are not continuous, the electronic device 100 cannot directly store the meter data of the three-phase meter 300 in the storage units corresponding to the storage addresses 6, 7, 8, 9, 12, and 14, the electronic device 100 will first shift the meter data of the single-phase meter 200 in the storage unit with the storage address 10 to the storage unit with the storage address 14, and obtain five free storage units with the storage addresses 6 to 10, the electronic apparatus 100 stores the meter data of the three-phase electric meter 300 in the memory location having the memory address of 6-10. In other words, the memory cells with the memory addresses of 6, 7, 8, and 9 can be understood as the aforementioned idle memory cells with consecutive memory addresses whose number is less than the first preset number; the memory cells with the memory addresses 12 and 14 can be understood as the memory cells with the free memory cells and the memory addresses higher than the free memory cells with continuous memory addresses; the memory cell having the memory address of 10 may be understood as a memory cell adjacent to the aforementioned free memory cell having the memory address consecutive thereto and storing the meter data of the single-phase meter 200.
The storage units of the idle storage units with the idle addresses higher than the continuous storage addresses may be always in an idle state, or the electronic device 100 may delete the idle single-phase electric meter 200 in the storage units of the idle storage units with the storage addresses higher than the continuous storage addresses in response to a deletion operation of a user, so as to obtain the storage units of the idle storage units with the idle addresses higher than the continuous storage addresses.
Further, as shown in fig. 4, which is another implementable flow diagram of the data storage method provided in the embodiment of the present invention, the data storage method shown in fig. 4 further includes the following steps on the basis of the data storage method shown in fig. 3:
and step S103, outputting first prompt information when the total number of the idle storage units is less than a second preset number.
In this embodiment, when the number of the storage units occupied by the first type of data is less than the number of the storage units occupied by the second type of data, the second preset number is greater than the first preset number. When the total number of the free storage units is less than the second preset number, which indicates that the storage space of the memory 110 is insufficient to store the meter data of one three-phase meter 300, the electronic device 100 may output a first prompt message indicating that the storage space is insufficient.
And step S104, outputting first prompt information when the total number of the idle storage units is less than a first preset number.
In this embodiment, when the number of the storage units occupied by the first type of data is greater than the number of the storage units occupied by the second type of data, the first preset number is greater than the second preset number. When the total number of the free storage units is less than the second preset number, which indicates that the storage space of the memory 110 is insufficient to store the meter data of one three-phase meter 300, the electronic device 100 may output a first prompt message indicating that the storage space is insufficient.
Further, as shown in fig. 5, which is a schematic flow chart of another implementable data storage method provided in the embodiment of the present invention, the data storage method shown in fig. 5 further includes the following steps based on the data storage method shown in fig. 3:
and step S105, outputting second prompt information when no idle storage unit exists.
In this embodiment, when there is no free storage unit, indicating that the storage space of the memory 110 is completely occupied, the electronic device 100 outputs the second prompt message that the storage space is full.
In order to perform the corresponding steps in the above embodiments and various possible manners, an implementation manner of the data storage device 140 is given below. Referring to fig. 6, fig. 6 is a schematic diagram illustrating functional modules of a data storage device 140 according to an embodiment of the present invention. It should be noted that the basic principle and the generated technical effect of the data storage device 140 provided in the present embodiment are the same as those of the above embodiments, and for the sake of brief description, no part of the present embodiment is mentioned, and corresponding contents in the above embodiments may be referred to. The data storage device 140 includes a first storage processing module 141, a second storage processing module 142, and an output module 143.
The first storage processing module 141 is configured to, when the obtained electric meter data belongs to a first class of data, select a first preset number of idle storage units from the plurality of storage units according to a sequence from low to high of storage addresses, and store the electric meter data in the first preset number of idle storage units.
It is understood that the first storage processing module 141 is configured to execute the content of step S101.
The second storage processing module 142 is configured to, when the obtained electric meter data belongs to a second type of data, select a second preset number of idle storage units from the plurality of storage units according to a sequence from high to low of the storage addresses, and store the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type data and the second type data is different.
It is understood that the second storage processing module 142 is used for executing the content of the above step S102.
The output module 143 is configured to output the first prompt message when the total number of the idle storage units is smaller than the second preset number when the number of the storage units occupied by the first type of data is smaller than the number of the storage units occupied by the second type of data. The output module 143 is further configured to output a first prompt message when the total number of the idle storage units is smaller than a first preset number when the number of the storage units occupied by the first type of data is larger than the number of the storage units occupied by the second type of data. The output module 143 is further configured to output a second prompt message when there is no free storage unit.
It is understood that the output module 143 is used for executing the contents of step S103, step S104 and step S105.
Alternatively, the first storage processing module 141, the second storage processing module 142, and the output module 143 may be stored in the memory 110 in the form of software or Firmware (Firmware) and may be executed by the processor 120.
In summary, embodiments of the present invention provide a data storage method, an apparatus, and an electronic device, where when electric meter data acquired by the electronic device belongs to a first class of data, a first preset number of idle storage units are selected from a plurality of storage units according to a sequence from a low storage address to a high storage address, and the electric meter data is stored in the first preset number of idle storage units; when the electric meter data acquired by the electronic equipment belong to second type data, selecting a second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low, and storing the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type of data and the second type of data is different. Therefore, the ammeter data belonging to the first type of data and the ammeter data belonging to the second type of data are dynamically stored according to the sequence of the storage addresses, more storage units can be occupied by more ammeter data of which type, and compared with a storage space pre-allocation mechanism, the utilization rate of a storage is higher, and the storage of the ammeter data is more flexible.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. A data storage method is applied to an electronic device, the electronic device comprises a memory, the memory comprises a plurality of memory units, and each memory unit is correspondingly configured with a memory address, the method comprises the following steps:
when the acquired electric meter data belong to a first type of data, selecting a first preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from low to high, and storing the electric meter data in the first preset number of idle storage units;
when the acquired electric meter data belong to second-class data, selecting a second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low, and storing the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type of data and the second type of data is different.
2. The data storage method according to claim 1, wherein when the number of the storage units occupied by the first type of data is less than the number of the storage units occupied by the second type of data, the storage addresses of the second preset number of free storage units are consecutive, and the step of selecting the second preset number of free storage units from the plurality of storage units according to the sequence from high storage addresses to low storage addresses comprises:
when the number of free storage units with continuous storage addresses selected from the plurality of storage units in the sequence of the storage addresses from high to low is smaller than the second preset number, if the storage units which are free and have the storage addresses lower than the free storage units with continuous storage addresses exist, the electric meter data of the first type data stored in the storage units adjacent to the free storage units with continuous storage addresses are shifted into the storage units with the free and the lowest storage addresses until the number of the free storage units with continuous storage addresses is equal to the second preset number.
3. The data storage method of claim 2, further comprising:
and outputting first prompt information when the total number of the idle storage units is less than the second preset number.
4. The data storage method according to claim 1, wherein when the number of the storage units occupied by the first type of data is greater than the number of the storage units occupied by the second type of data, the storage addresses of the first preset number of idle storage units are consecutive, and the step of selecting the first preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from low to high comprises:
when the number of idle storage units with continuous storage addresses selected from the plurality of storage units according to the sequence of the storage addresses from low to high is smaller than the first preset number, if the storage units which are idle and have the storage addresses higher than the idle storage units with continuous storage addresses exist, the ammeter data of the second type of data stored in the storage units adjacent to the idle storage units with continuous storage addresses are shifted to the storage units with the idle and the highest storage addresses until the number of the idle storage units with continuous storage addresses is equal to the first preset number.
5. The data storage method of claim 4, wherein the method further comprises:
and outputting first prompt information when the total number of the idle storage units is smaller than the first preset number.
6. The data storage method of claim 1, wherein the method further comprises:
and when no free storage unit exists, outputting second prompt information.
7. A data storage device, applied to an electronic device, wherein the electronic device includes a memory, the memory includes a plurality of memory cells, and each memory cell is configured with a memory address, the data storage device includes:
the first storage processing module is used for selecting a first preset number of idle storage units from the plurality of storage units according to the sequence of storage addresses from low to high when the acquired electric meter data belongs to a first class of data, and storing the electric meter data in the first preset number of idle storage units;
the second storage processing module is used for selecting a second preset number of idle storage units from the plurality of storage units according to the sequence of the storage addresses from high to low when the acquired electric meter data belongs to a second type of data, and storing the electric meter data in the second preset number of idle storage units; the number of the storage units occupied by the first type of data and the second type of data is different.
8. The data storage device of claim 7, wherein when the number of storage units occupied by the first type of data is less than the number of storage units occupied by the second type of data, the second preset number of idle memory units has continuous memory addresses, and the second memory processing module, when the number of free memory units with continuous memory addresses selected from the plurality of memory units in the sequence of the memory addresses from high to low is less than the second preset number, if there are memory cells that are free and have memory addresses lower than the free memory cells whose memory addresses are consecutive, the meter data belonging to the first kind of data stored in the memory cells adjacent to the free memory cell consecutive to the memory address is shifted to the free memory cell having the lowest memory address, until the number of the idle memory units with continuous memory addresses is equal to the second preset number.
9. The data storage device of claim 8, further comprising:
and the output module is used for outputting first prompt information when the total number of the idle storage units is less than the second preset number.
10. An electronic device, comprising a processor and a memory, the memory storing a computer program executable by the processor, the computer program, when executed by the processor, implementing the method of any one of claims 1-6.
CN201910953600.2A 2019-10-09 2019-10-09 Data storage method and device and electronic equipment Active CN110716934B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910953600.2A CN110716934B (en) 2019-10-09 2019-10-09 Data storage method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910953600.2A CN110716934B (en) 2019-10-09 2019-10-09 Data storage method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110716934A true CN110716934A (en) 2020-01-21
CN110716934B CN110716934B (en) 2022-07-26

Family

ID=69212312

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910953600.2A Active CN110716934B (en) 2019-10-09 2019-10-09 Data storage method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110716934B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113703689A (en) * 2021-10-26 2021-11-26 深圳金正方科技股份有限公司 Data storage method and device for intelligent electric meter, intelligent electric meter and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007281823A (en) * 2006-04-05 2007-10-25 Sharp Corp Image processing apparatus and image forming apparatus
CN103309812A (en) * 2012-03-15 2013-09-18 ***通信集团公司 Allocation method and device for memory space of smart card
WO2013170731A1 (en) * 2012-05-12 2013-11-21 北京忆恒创源科技有限公司 Method for writing data into storage device and storage device
CN104283572A (en) * 2013-07-03 2015-01-14 展讯通信(上海)有限公司 Method and device for controlling input information of convolutional code decoder
EP3367206A1 (en) * 2016-12-30 2018-08-29 Huawei Technologies Co., Ltd. Server management method and server

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2007281823A (en) * 2006-04-05 2007-10-25 Sharp Corp Image processing apparatus and image forming apparatus
CN103309812A (en) * 2012-03-15 2013-09-18 ***通信集团公司 Allocation method and device for memory space of smart card
WO2013170731A1 (en) * 2012-05-12 2013-11-21 北京忆恒创源科技有限公司 Method for writing data into storage device and storage device
CN104283572A (en) * 2013-07-03 2015-01-14 展讯通信(上海)有限公司 Method and device for controlling input information of convolutional code decoder
EP3367206A1 (en) * 2016-12-30 2018-08-29 Huawei Technologies Co., Ltd. Server management method and server

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113703689A (en) * 2021-10-26 2021-11-26 深圳金正方科技股份有限公司 Data storage method and device for intelligent electric meter, intelligent electric meter and storage medium
CN113703689B (en) * 2021-10-26 2022-02-18 深圳金正方科技股份有限公司 Data storage method and device for intelligent electric meter, intelligent electric meter and storage medium

Also Published As

Publication number Publication date
CN110716934B (en) 2022-07-26

Similar Documents

Publication Publication Date Title
CN110716934B (en) Data storage method and device and electronic equipment
CN110648525B (en) Data complementary reading method and device and power acquisition terminal
CN110333956A (en) Message storage method, device, medium and electronic equipment in message queue
CN109521292A (en) A kind of the capacitor group lifetime estimation method and device of modularization multi-level converter
CN110209605A (en) The register reading/writing method and calculating equipment of PCIE Cardbus NIC Cardbus
CN107193753A (en) Internal memory reforming method, device, electronic equipment and readable storage medium storing program for executing
CN115934076B (en) Cross-platform client micro-service providing device and method and electronic equipment
CN113900562A (en) Excel-based testing method and device and storage medium
CN113901852A (en) Detection method and device for electronic equipment
CN109959842A (en) A kind of method, apparatus and distribution terminal of fault detection
CN111740881B (en) Network card link detection method, system, equipment and computer storage medium
CN113242302A (en) Data access request processing method and device, computer equipment and medium
CN113672176A (en) Data reading method, system, equipment and computer readable storage medium
CN111970675A (en) Early warning method and device and storage medium
CN116991545B (en) Virtual machine deployment position determining method and device
CN109510855B (en) Event distribution system, method and device
US20230045153A1 (en) Method and apparatus for displaying measurement parameters
CN116028508B (en) Reporting storage method and device, electric energy meter equipment and storage medium
CN112181738B (en) Device cluster serial number identification device and electronic equipment
CN109905912A (en) The determination method and apparatus of access terminal
CN106528577B (en) Method and device for setting file to be cleaned
CN108009094A (en) A kind of computer software testing system
CN109460422B (en) Push method and device, terminal equipment and readable storage medium
CN111239523B (en) Frequency converter testing system, method and device and storage medium
CN117527621A (en) Visual distributed energy data acquisition method, system and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant