CN115964002B - Electric energy meter terminal archive management method, device, equipment and medium - Google Patents

Electric energy meter terminal archive management method, device, equipment and medium Download PDF

Info

Publication number
CN115964002B
CN115964002B CN202310233223.1A CN202310233223A CN115964002B CN 115964002 B CN115964002 B CN 115964002B CN 202310233223 A CN202310233223 A CN 202310233223A CN 115964002 B CN115964002 B CN 115964002B
Authority
CN
China
Prior art keywords
ram
ram block
block
file
new
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.)
Active
Application number
CN202310233223.1A
Other languages
Chinese (zh)
Other versions
CN115964002A (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.)
Hangzhou Sunrise Technology Co ltd
Original Assignee
Hangzhou Sunrise Technology 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 Hangzhou Sunrise Technology Co ltd filed Critical Hangzhou Sunrise Technology Co ltd
Priority to CN202310233223.1A priority Critical patent/CN115964002B/en
Publication of CN115964002A publication Critical patent/CN115964002A/en
Application granted granted Critical
Publication of CN115964002B publication Critical patent/CN115964002B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a method, a device, equipment and a medium for managing files of an electric energy meter terminal. Relates to the technical field of electric energy meter archive data storage and computers. The method comprises the following steps: dividing a memory of the embedded meter equipment into a plurality of RAM blocks, receiving file addition application information, determining at least one target RAM block in an idle state for storing a new file according to the storage space requirement of the new file, adjusting the identification bit of the at least one target RAM block into an occupied state, and assigning the at least one target RAM to the new file; the method and the device realize dynamic occupation and deletion according to the issued file parameters, realize dynamic management of files under the condition of not occupying the overhead of the embedded MCU, have the advantages of high RAM utilization rate, flexible and configurable file quantity and convenient access, and can greatly improve the upper performance limit of the device on the embedded device with limited RAM resources.

Description

Electric energy meter terminal archive management method, device, equipment and medium
Technical Field
The application relates to the technical field of electric energy meter archive data storage and computers, in particular to an electric energy meter terminal archive management method, an electric energy meter terminal archive management device, electric energy meter terminal archive management equipment and an electric energy meter terminal archive management medium.
Background
The files are used as important parameters of the intelligent terminal, and have important roles in data acquisition and data retrieval, so that in order to accelerate access, the files are stored in the RAM, the files are stored according to the designed maximum file number application structure member array in the traditional method, the method occupies the RAM space very much, and in the embedded equipment, RAM resources are quite small. And when the actual number of files is far smaller than the design number, the RAM utilization rate is very low, and when the actual number exceeds the design number, configuration cannot be carried out, so that an efficient method for effectively distributing and managing the files stored in the RAM space is lacked, and the RAM utilization rate is improved.
In view of the above problems, an effective technical solution is currently needed.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method, an apparatus, a device, and a medium for managing a terminal file of an electric energy meter, which are used for solving the technical problem of low resource utilization in the prior art.
In a first aspect, the present invention provides a method for managing a terminal profile of an electric energy meter, where the method is applied to an embedded meter device, and includes:
dividing the memory of the embedded meter equipment into a plurality of RAM blocks, wherein each RAM block comprises a state identification bit, and the identification bit is used for indicating an idle state or an occupied state;
Receiving file adding application information, wherein the file adding application information is used for requesting to add a new file into a memory of the embedded meter equipment;
according to the storage space requirement of the new archive, determining at least one target RAM block in an idle state for storing the new archive, and adjusting the identification bit of the at least one target RAM block to be in an occupied state;
and assigning the at least one target RAM to the new archive.
Optionally, in the method for managing a terminal archive of an electric energy meter according to the present invention, the determining, according to a storage space requirement of a new archive, at least one target RAM block in an idle state for storing the new archive includes:
determining a first RAM block in an idle state from a plurality of RAM blocks of a memory of the embedded meter device;
if at least one second RAM block is determined to be used for storing the new file before the first RAM block, modifying a next block indication field in a last RAM block in the at least one second RAM block to be a block number of the first RAM block, wherein after dividing the memory into a plurality of RAM blocks, each RAM block is assigned a block number;
And if the total space of the first RAM block and the at least one second RAM block is larger than the space required by the new file, modifying a next block indication field in the first RAM block into a block tail indication mark, wherein the first RAM block and the at least one second RAM block form the at least one target RAM block.
Optionally, in the method for managing terminal files of electric energy meter according to the present invention, the method further includes:
the multiple RAM blocks of the memory are prioritized according to a preset storage sequence;
searching a plurality of alternative RAM blocks in an idle state from a plurality of RAM blocks corresponding to the priority according to the preset storage level of the new file;
comparing the storage space requirement of the new file with the prestored spaces of the plurality of alternative RAM blocks, searching the least number of alternative RAM blocks which can meet the storage space requirement, and obtaining at least one alternative RAM block;
marking the found at least one alternative RAM block as a target RAM block group;
performing difference making according to the total space of the target RAM block group and the storage space requirement of the new file to obtain a first difference value;
comparing the first difference value with a preset first space idle value, and if the first difference value is smaller than the first space idle value, enabling the target RAM block group to be effective;
And if the first difference value is not smaller than the first space free value, the target RAM block group is invalid, and the alternative RAM block is reselected.
Optionally, in the method for managing terminal files of electric energy meter according to the present invention, the method further includes:
if the total space of the plurality of third RAM blocks in the idle state with the priority corresponding to the preset storage level of the new file does not meet the storage space requirement;
obtaining a first space requirement difference by making a difference between the storage space requirement of the new file and the total space of the plurality of third RAM blocks;
acquiring a plurality of fourth RAM blocks in an idle state of one level lower than the priority;
searching for a minimum number of at least one second alternative RAM block among the plurality of fourth RAM blocks;
and if the difference value between the total space of the at least one second alternative RAM block and the first space requirement difference is smaller than the first space free value, determining the at least one second alternative RAM block as the patch RAM block of the storage space requirement.
Optionally, in the method for managing a terminal archive of an electric energy meter according to the present invention, each RAM block includes a status identification bit and a next block indication field.
Optionally, in the method for managing terminal files of electric energy meter according to the present invention, the method further includes:
A first pointer in a linked list pointer of the new file memory points to a table head in a file linked list before adding, and a second pointer points to a table tail in the file linked list before adding; simultaneously, a first pointer of the tail of the file linked list before adding is pointed to a file memory of a new electric meter; and pointing the tail pointer of the header in the file linked list before adding to the file memory of the new electric meter.
In a second aspect, there is provided an electric energy meter terminal archive management device applied to an embedded meter device, dividing a memory of the embedded meter device into a plurality of RAM blocks, wherein each RAM block includes a status identification bit, and the identification bit is used to indicate an idle state or an occupied state, the device includes:
the receiving module is used for receiving file adding application information, wherein the file adding application information is used for requesting to add a new file into the memory of the embedded meter equipment;
the determining module is used for determining at least one target RAM block in an idle state for storing the new archive according to the storage space requirement of the new archive, and adjusting the identification bit of the at least one target RAM block to be in an occupied state;
And the assignment module is used for assigning the at least one target RAM to the new file.
Optionally, in the terminal archive management device for electric energy meter according to the present invention, the determining module is specifically configured to:
determining a first RAM block in an idle state from a plurality of RAM blocks of a memory of the embedded meter device;
if at least one second RAM block is determined to be used for storing the new file before the first RAM block, modifying a next block indication field in a last RAM block in the at least one second RAM block to be a block number of the first RAM block, wherein after dividing the memory into a plurality of RAM blocks, each RAM block is assigned a block number;
and if the total space of the first RAM block and the at least one second RAM block is larger than the space required by the new file, modifying a next block indication field in the first RAM block into a block tail indication mark, wherein the first RAM block and the at least one second RAM block form the at least one target RAM block.
Optionally, in the terminal archive management device for electric energy meter according to the present invention, the terminal archive management device further includes: the adding module is used for pointing a first pointer in a linked list pointer of the file memory of the new electric meter to a head in a file linked list before adding, and pointing a second pointer to a tail in the file linked list before adding; simultaneously, a first pointer of a table tail in the file linked list before adding is pointed to the file memory of the new electric meter; and pointing the tail pointer of the header in the file linked list before adding to the file memory of the new electric meter.
In a third aspect, the present invention provides an electronic device comprising: processing means and storage means;
the storage means has stored thereon a computer program which, when run by a processor, performs the method of any of the previous embodiments for terminal profile management.
In a fourth aspect, the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of any of the preceding embodiments.
The invention provides a method, a device, equipment and a medium for managing files of an electric energy meter terminal, which are characterized in that the memory of the embedded meter equipment is divided into a plurality of RAM blocks, file addition application information is received, at least one target RAM block which is used for storing a new file and is in an idle state is determined according to the storage space requirement of the new file, the identification bit of the at least one target RAM block is adjusted to be in an occupied state, and at least one target RAM is assigned to the new file; the method and the device realize dynamic occupation and deletion according to the issued file parameters, realize dynamic management of files under the condition of not occupying the overhead of the embedded MCU, have the advantages of high RAM utilization rate, flexible and configurable file quantity and convenient access, and can greatly improve the upper performance limit of the device on the embedded device with limited RAM resources.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the invention of the present application, the following brief description will be given of the drawings required for the invention of the present application, it being understood that the following drawings illustrate only some embodiments of the present application and are therefore not to be considered limiting of scope, and that other relevant drawings may be obtained from these drawings without the benefit of the inventive effort to a person of ordinary skill in the art.
Fig. 1 is a flow chart of a method for managing files of a terminal of an electric energy meter according to an embodiment of the present application;
fig. 2 is a schematic flow chart of another method for managing files of an electric energy meter terminal according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for managing files of a terminal of an electric energy meter according to an embodiment of the present application;
fig. 4 is another flow chart of a method for managing files of a terminal of an electric energy meter according to an embodiment of the present application;
Fig. 5 is another flow chart of a method for managing files of a terminal of an electric energy meter according to an embodiment of the present application;
FIG. 6 is a data structure of a method for managing files of a terminal of an electric energy meter according to an embodiment of the present application;
fig. 7 is another flow chart of a method for managing files of a terminal of an electric energy meter according to an embodiment of the present application;
fig. 8 is another flow chart of a method for managing files of a terminal of an electric energy meter according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electric energy meter terminal archive management device according to an embodiment of the present invention;
fig. 10 is an example electronic device of a method for managing a terminal profile of an electric energy meter according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the 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 invention, as 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 made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
Some embodiments of the present invention are described in detail below with reference to the accompanying drawings. The following embodiments and features of the embodiments may be combined with each other without conflict.
According to an embodiment of the present invention, there is provided an embodiment of a terminal profile management method, it being noted that the steps shown in the flowcharts of the drawings may be performed in a computer system such as a set of computer executable instructions, and that although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that herein.
Fig. 1 is a flow chart of a method for managing a terminal file of an electric energy meter according to an embodiment of the present invention. The method is applied to the embedded meter equipment, and the memory of the embedded meter equipment is divided into a plurality of RAM blocks, wherein each RAM block comprises a state identification bit, the identification bit is used for indicating an idle state or an occupied state, and each RAM block comprises a state identification bit and a next block indication field. After the memory is divided into a plurality of RAM blocks, a block number is allocated to each RAM block, and the block number may be a number. The block number may be determined based on a preset RAM address, or a byte may be used in a RAM block to indicate the block number.
As an example, as shown in the following tables 1 and 2, table 1 is to divide an embedded meter device into N RAM blocks, where N is a positive integer, and the size of N may be determined according to actual needs. Table 2 shows a state identification bit and a next block indication field included in a RAM block, where the state identification bit is one bit, the next block indication field is 15 bits, and the state identification bit and the next block indication field are two bytes together, and the two bytes may be the first two bytes of the RAM block.
TABLE 1
Figure SMS_1
TABLE 2
Figure SMS_2
Random access memory (English: random Access Memory, abbreviated: RAM), also called main memory, is an internal memory that exchanges data directly with the CPU. It can be read and written at any time and is fast, usually as a temporary data storage medium for an operating system or other program in operation. RAM can write or read information from any designated address at any time during operation. The biggest difference from ROM is the volatility of the data, i.e. the stored data will be lost upon power down. RAM is used in computer and digital systems to temporarily store programs, data, and intermediate results.
As shown in fig. 1, the method comprises the steps of:
S101, receiving file adding application information, wherein the file adding application information is used for adding a new file into a memory of an embedded meter device;
for new files, RAM space may be applied to the memory, in this embodiment RAM blocks.
S102, determining at least one target RAM block in an idle state for storing the new file according to the storage space requirement of the new file, and adjusting the identification bit of the at least one target RAM block to be in an occupied state;
the size of the new archive may be determined based on archive parameters that may be carried in the archive addition application.
Wherein the first RAM block in the idle state may be determined from a plurality of RAM blocks of a memory of the embedded meter device; if at least one second RAM block is determined to be used for storing a new file before the first RAM block, modifying a next block indication field in a last RAM block in the at least one second RAM block to be a block number of the first RAM block, wherein after dividing the memory into a plurality of RAM blocks, each RAM block is assigned a block number; and if the total space of the first RAM block and the at least one second RAM block is larger than the space required by the new file, modifying the next block indication field in the first RAM block into a block tail indication mark, wherein the first RAM block and the at least one second RAM block form at least one target RAM block.
In addition, if the space required by the new archive is insufficient after the first RAM block is added, the new first RAM block in the idle state can be continuously determined, the old first RAM block is used as the second RAM block, and the process is repeatedly executed by modifying the next block indication field in the last RAM block (usually the old first RAM block) in the at least one second RAM block into the block number of the first RAM block until the total space of the first RAM block and the at least one second RAM block is larger than the space required by the new archive.
The first RAM block and the second RAM block herein are only for distinguishing RAM blocks applied at different application stages in the process of applying for the RAM blocks, and the "first" and the "second" herein are only for distinguishing, and do not constitute a limitation of the RAM blocks.
S103, assigning at least one target RAM to the new file.
The at least one target RAM is a memory space of the new file, and when the new file is accessed, the contents in the memory space can be directly accessed.
Fig. 2 is a schematic flow chart of another method for managing files of a terminal of an electric energy meter according to an embodiment of the present invention. According to an embodiment of the present invention, further comprising:
s201, dividing priorities of a plurality of RAM blocks of the memory according to a preset storage sequence;
S202, searching a plurality of alternative RAM blocks in an idle state from a plurality of RAM blocks corresponding to the priority according to the preset storage level of the new file;
s203, comparing the storage space requirement of the new file with the prestored spaces of a plurality of alternative RAM blocks, searching the least number of alternative RAM blocks capable of meeting the storage space requirement, and obtaining at least one alternative RAM block;
s204, marking the found at least one alternative RAM block as a target RAM block group;
s205, performing difference making according to the total space of the target RAM block group and the storage space requirement of the new file to obtain a first difference value;
s206, comparing the first difference value with a preset first space free value, and if the first difference value is smaller than the first space free value, enabling the target RAM block group to be effective;
s207, if the first difference value is not smaller than the first space free value, the target RAM block group is invalid, and the alternative RAM block is reselected.
When the RAM blocks are matched according to the new files, the RAM blocks have different priorities due to the preset storage sequence requirements, the new files also have preset storage levels according to the different electric energy meter attributes and file characteristics, therefore, the preset storage levels of the new files are matched with the RAM blocks with corresponding priorities, the idle state of the candidate RAM blocks is searched in the matched plurality of RAM blocks, in order to save the space utilization rate of the RAM blocks, the storage space requirements of the new files are compared with the pre-stored space of the candidate RAM blocks, the candidate RAM blocks which can meet the storage space requirements are searched in the plurality of RAM blocks, the searched at least one candidate RAM block with the minimum requirement is marked as a target RAM block group, the first difference value is obtained by making a difference between the total space of the target RAM block group and the storage space requirements of the new files, if the first difference value is smaller than the first space idle value, otherwise, the target RAM block group is effective, the candidate RAM blocks are reselected, the candidate RAM blocks can be searched in the plurality of RAM blocks according to the storage space requirements of the preset free space requirements of the preset RAM blocks, and the idle state of the idle state is reduced, and the idle state of the RAM blocks is achieved.
Further comprises: if the total space of the plurality of third RAM blocks in the idle state corresponding to the preset storage level of the new file does not meet the storage space requirement, the storage space requirement of the new file and the total space of the plurality of third RAM blocks are subjected to difference to obtain a first space requirement difference, a plurality of fourth RAM blocks in the idle state lower than the priority level by one level are obtained, at least one second alternative RAM block with the minimum number is searched in the plurality of fourth RAM blocks, and if the difference value between the total space of the at least one second alternative RAM block and the first space requirement difference is smaller than the first space idle value, the at least one second alternative RAM block is determined to be a patch RAM block with the storage space requirement.
When the third RAM block in the idle state corresponding to the priority level of the new file does not meet the storage space requirement, firstly, determining the storage space requirement difference of the new file by solving the difference, namely, the shortage of the storage space of the idle third RAM block corresponding to the priority level, then searching for an adaptive second alternative RAM block through a fourth RAM block in the idle state of the priority level of the first level, wherein the difference between the total space of the selected second alternative RAM block and the first space requirement difference is smaller than the first space idle value, determining at least one second alternative RAM block as a patch RAM block with the storage space requirement as a supplement to the shortage of the storage space of the third RAM block, and taking the third RAM block and the second alternative RAM block as target storage blocks for storing the new file.
In some embodiments, files in the memory may also be managed by a circular linked list, and a specific management manner may be a method in the embodiment shown in fig. 3. Specifically, a first pointer in a linked list pointer of a file memory of the new electric meter can point to a head in a file linked list before adding, and a second pointer points to a tail in the file linked list before adding; simultaneously, a first pointer of the tail of the file in the file list before addition points to the file memory of the new electric meter; and pointing the tail pointer of the header in the file linked list before adding to the file memory of the new electric meter. The first pointer may be a forward pointer, and the second pointer may be a backward pointer.
As an example, as shown in fig. 4, the idle RAM may be equally divided into RAM blocks with the same size according to design requirements, and the RAM block size is designed to be smaller to default to 128 bytes for improving the utilization. And simultaneously using the first two bytes of the RAM block as management marks and defaulting to an idle state.
The whole flow is shown in fig. 4, and the specific steps are as follows: after the addition flow is started, firstly traversing N RAM blocks to find an idle block (the RAM block in an idle state), and marking the idle block into an occupied state at the moment;
After determining the free block, it may be determined whether the free block is the first block, where the first block refers to the first RAM block used to store the new archive;
if not, writing the found block sequence number (the sequence number of the first RAM block) into the "next block" field of the previous block (one of the at least one second RAM block);
if so, setting the field of 'next block' of the block to be found to be empty;
judging whether the size of the RAM block is larger than the applied file size (the new file size), if not, continuously searching for the next free block, and marking the next free block as an occupied state; writing the block number into the next block field of the first block at the same time; if so, the "next block" field of the most recent free block is marked as "none".
Setting the block states of all the applications as occupied states until the number of the blocks of the applications meets the size of the file parameters;
and assigning the address of the first block of the RAM block to the applied file parameter pointer to complete the new function of the file. The address pointer of the first block may be returned to the applicant and a success indication (indicating that the memory space application was successful) returned.
If no sufficient RAM block is found, the applied pointer is emptied and a failure indication (indicating that the memory space application failed) is returned.
And deleting the applied memory space, for deleting the file, finding a RAM block corresponding to the file according to the file parameter pointer, setting the state of the RAM block into a free state, checking a next field, and setting the state of the corresponding sequence number into an idle state if the sequence number exists until all the RAM blocks occupied by the file are changed into the idle state. After the deletion process is started, as shown in fig. 5, the block corresponding to the input pointer may be marked as an idle state, and it may be determined whether the "next block" field is smaller than N (used to determine whether the "next block" field has a sequence number), if so, the block corresponding to the input pointer may be continuously marked as an idle state, and if not, the deletion operation may be ended, and success may be returned.
The inquiry file can copy the memory pointed by the pointer into a temporary file variable by using the first address pointer of the application, if the file parameter consists of a plurality of blocks, the file parameter can be spliced according to the field of the next block, and the parameter is copied into the file variable in sequence to finish the inquiry of the file.
The modification files can be processed by two ways, if the structures of the files before and after change, the modification files can be realized by deleting files before and adding files before, if the structures of the files before and after do not change, but only certain parameter fields change, the modification files can be realized by searching the file flow, and modifying the corresponding fields and then writing the fields into the RAM.
Fig. 3 is a flowchart of a method for managing a terminal profile of an electric energy meter according to an embodiment of the present invention. As shown in fig. 3, the method includes:
s301, receiving a file adding application, wherein the file adding application is used for adding a new file;
in the electricity consumption information acquisition system of the power consumer, each acquisition terminal needs to acquire information of a few, a plurality of hundreds of electric energy meters. Usually, these electric energy meters are stored in the acquisition terminal in the form of index numbers, forming an electric energy meter file. The accuracy and the integrality of the electric energy meter file directly influence the meter reading success rate of the acquisition terminal, and further influence the operation quality of the whole electric power system.
S302, applying for a new ammeter file memory for storing a new file, wherein the ammeter file memory comprises a linked list pointer;
s303, a first pointer in a linked list pointer of a file memory of the new electric meter points to a head in a file linked list before adding, and a second pointer points to a tail in the file linked list before adding; simultaneously, a first pointer of the tail of the file in the file list before addition points to the file memory of the new electric meter; and pointing the tail pointer of the header in the file linked list before adding to the file memory of the new electric meter.
The method can dynamically apply for the memory according to the quantity of files, wherein the first pointer can be a forward pointer, the second pointer can be a backward pointer, files are serially connected in a linked list mode through the prev pointer and the next pointer, the method has the advantages of high RAM utilization rate, flexible and configurable quantity of files and convenience in access, and the performance upper limit of the device can be greatly improved on embedded devices with limited RAM resources.
In some embodiments, files may be deleted, which may be implemented by the following steps: determining a file deleting application, wherein the file deleting application comprises parameters to be deleted; inquiring in a file linked list based on the parameters to be deleted, and determining files to be deleted; determining that a first pointer in a linked list pointer of a file to be deleted points to the first file; determining that a second pointer in the linked list pointer of the file to be deleted points to the second file; directing a second pointer of the first file to the second file; directing a first pointer of the second file to the first file; and releasing the memory space of the file to be deleted.
The first file and the second file in the file list may be a previous file and a next file of the file to be deleted, where "first" and "second" are merely for distinguishing, and are not limited.
In some embodiments, the meter file memory further includes verification parameters; the method further comprises the steps of: generating verification parameters based on the new archive;
in some embodiments, updating the archive may be implemented by: determining a file updating application, wherein the file updating application comprises parameters to be updated; updating the parameters to be updated into the files to be updated; and determining new verification parameters based on the updated parameters in the file to be updated.
In some embodiments, the content of the archive may also be queried, which may be specifically implemented by the following steps: determining a file inquiry application, wherein the file inquiry application comprises parameters to be inquired; and determining the head of the file linked list, and sequentially inquiring from the head until a third file matched with the parameter to be inquired is determined or the tail of the file is inquired.
The third file is the file where the query content is located, wherein the first file, the second file and the third file are all files in the memory.
The embodiment of the invention can be composed of a file data structure and a series of API functions, and can realize the functions of initializing, adding, deleting, modifying, inquiring and the like of files.
As an example, the archive data structure includes a linked list, a checksum archive parameter, and three parts, as shown in FIG. 6.
The whole management flow is as follows:
initializing: the header points both the next and prev pointers to itself, representing that the current archive linked list is empty, without any archive.
Adding files: applying for the memory of the ammeter structure, pointing the next pointer of the header to the new meter_list structure, and pointing the prev pointer in the new meter_list structure back to the header. As shown in fig. 7, the CRC check is generated by the new file parameter calculation and written into the CRC structure. The method is used for self-checking of file parameters.
Deleting the file: traversing file parameters, finding a file structure to be deleted, modifying a next pointer in a meter_list structure pointed by a prev pointer in the structure to the next pointer of the user, pointing the prev pointer of the meter_list structure pointed by the next pointer of the user to the prev original position of the user, and performing free operation on an applied memory to release RAM resources.
Querying a file: as shown in fig. 8, all file structures are traversed from the next pointer of the header, and compared with the parameters to be queried, if the comparison is successful, the file parameter pointer is returned to the querier, if the next pointer points to the header, the traversal is ended, and failure is returned.
Modifying the archive: firstly, inquiring the file, modifying parameters to be modified, and simultaneously, recalculating CRC and updating the check.
Fig. 9 is a schematic structural diagram of an electric energy meter terminal archive management device according to an embodiment of the present invention. The device is applied to an embedded meter device,
the memory of the embedded meter device is divided into a plurality of RAM blocks, wherein each RAM includes a status identification bit, and the identification bit is used for indicating an idle status or an occupied status, as shown in fig. 9, and the apparatus includes:
The receiving module 901 is configured to receive file adding application information, where the file adding application information is used to add a new file into a memory of the embedded meter device;
a determining module 902, configured to determine, according to a storage space requirement of the new archive, at least one target RAM block in an idle state for storing the new archive, and adjust an identification bit of the at least one target RAM block to an occupied state;
a valuation module 903, configured to assign at least one target RAM to the new archive.
In some embodiments, the determining module 902 is specifically configured to:
determining a first RAM block in an idle state from a plurality of RAM blocks of a memory;
modifying a next block indication field in a last RAM block of the at least one second RAM block to a block number of the first RAM block if the at least one second RAM block has been determined to store the new archive prior to the first RAM block, wherein after dividing the memory into a plurality of RAM blocks, each RAM block is assigned a block number;
and if the total space of the first RAM block and the at least one second RAM block is larger than the space required by the new file, modifying the next block indication field in the first RAM block into a block tail indication mark, wherein the first RAM block and the at least one second RAM block form at least one target RAM block.
In some embodiments, each RAM block includes a status identification bit and a next block indication field.
In some embodiments, further comprising:
the adding module is used for pointing a first pointer in a linked list pointer of the file memory of the new electric meter to a head in a file linked list before adding, and pointing a second pointer to a tail in the file linked list before adding; simultaneously, a first pointer of the tail of the file in the file list before addition points to the file memory of the new electric meter; and pointing the tail pointer of the header in the file linked list before adding to the file memory of the new electric meter.
The device provided by the embodiment of the present invention has the same implementation principle and technical effects as those of the foregoing method embodiment, and for the sake of brevity, reference may be made to the corresponding content in the foregoing method embodiment where the device embodiment is not mentioned.
Fig. 10 is an exemplary electronic device 100 for implementing a method for managing a terminal profile of an electric energy meter according to an embodiment of the present invention, where the electronic device 100 may be an embedded meter device.
As shown in fig. 10, the electronic device 100 includes one or more processing devices 102, one or more storage devices 104, an input device 106, and an output device 108, which are interconnected by a bus system 112 and/or other forms of connection mechanisms (not shown). It should be noted that the components and structures of the electronic device 100 shown in fig. 10 are exemplary only and not limiting, as the electronic device may have other components and structures as desired.
The processing device 102 may be a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 100 to perform desired functions.
The storage 104 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. Volatile memory can include, for example, random Access Memory (RAM) and/or cache memory (cache) and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like. One or more computer program instructions may be stored on a computer readable storage medium and the processing device 102 may execute the program instructions to implement client functions (implemented by a processor) and/or other desired functions in embodiments of the present invention described below. Various applications and various data, such as various data used and/or generated by the applications, may also be stored in the computer readable storage medium.
The input device 106 may be a device used by a user to input instructions and may include one or more of a keyboard, mouse, microphone, touch screen, and the like.
The output device 108 may output various information (e.g., images or sounds) to the outside (e.g., a user), and may include one or more of a display, a speaker, and the like.
For example, an example electronic device for implementing a terminal profile management method according to an embodiment of the present invention may be implemented on a mobile terminal such as a smart phone, a tablet computer, or the like.
Further, the present embodiment also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor performs the steps of the method provided by the foregoing method embodiment.
The invention provides a method, a device, equipment and a medium for managing files of an electric energy meter terminal, which are characterized in that the memory of the embedded meter equipment is divided into a plurality of RAM blocks, file addition application information is received, at least one target RAM block which is used for storing a new file and is in an idle state is determined according to the storage space requirement of the new file, the identification bit of the at least one target RAM block is adjusted to be in an occupied state, and at least one target RAM is assigned to the new file; the method and the device realize dynamic occupation and deletion according to the issued file parameters, realize dynamic management of files under the condition of not occupying the overhead of the embedded MCU, have the advantages of high RAM utilization rate, flexible and configurable file quantity and convenient access, and can greatly improve the upper performance limit of the device on the embedded device with limited RAM resources.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above described device embodiments are only illustrative, e.g. the division of the units is only one logical function division, and there may be other divisions in practice, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units; can be located in one place or distributed to a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present invention may be integrated in one processing unit, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the above method embodiments may be implemented by hardware related to program instructions, and the foregoing program may be stored in a readable storage medium, where the program, when executed, performs steps including the above method embodiments; and the aforementioned storage medium includes: a mobile storage device, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk or an optical disk, or the like, which can store program codes.
Alternatively, the above-described integrated units of the present invention may be stored in a readable storage medium if implemented in the form of software functional modules and sold or used as separate products. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in essence or a part contributing to the prior art in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, ROM, RAM, magnetic or optical disk, or other medium capable of storing program code.

Claims (8)

1. An electric energy meter terminal archive management method, characterized in that the method is applied to an embedded meter device, and comprises the following steps:
dividing the memory of the embedded meter equipment into a plurality of RAM blocks, wherein each RAM block comprises a state identification bit, and the identification bit is used for indicating an idle state or an occupied state;
receiving file adding application information, wherein the file adding application information is used for requesting to add a new file into a memory of the embedded meter equipment;
according to the storage space requirement of the new archive, determining at least one target RAM block in an idle state for storing the new archive, and adjusting the identification bit of the at least one target RAM block to be in an occupied state;
assigning the at least one target RAM block to the new archive;
further comprises:
the multiple RAM blocks of the memory are prioritized according to a preset storage sequence;
searching a plurality of alternative RAM blocks in an idle state from a plurality of RAM blocks corresponding to the priority according to the preset storage level of the new file;
comparing the storage space requirement of the new file with the prestored spaces of the plurality of alternative RAM blocks, searching the least number of alternative RAM blocks which can meet the storage space requirement, and obtaining at least one alternative RAM block;
Marking the found at least one alternative RAM block as a target RAM block group;
performing difference making according to the total space of the target RAM block group and the storage space requirement of the new file to obtain a first difference value;
comparing the first difference value with a preset first space idle value, and if the first difference value is smaller than the first space idle value, enabling the target RAM block group to be effective;
if the first difference value is not smaller than the first space idle value, the target RAM block group is invalid, and the alternative RAM block is reselected;
further comprises:
if the total space of the plurality of third RAM blocks in the idle state with the priority corresponding to the preset storage level of the new file does not meet the storage space requirement;
obtaining a first space requirement difference by making a difference between the storage space requirement of the new file and the total space of the plurality of third RAM blocks;
acquiring a plurality of fourth RAM blocks in an idle state of one level lower than the priority;
searching for a minimum number of at least one second alternative RAM block among the plurality of fourth RAM blocks;
and if the difference value between the total space of the at least one second alternative RAM block and the first space requirement difference is smaller than the first space free value, determining the at least one second alternative RAM block as the patch RAM block of the storage space requirement.
2. The method for managing a terminal profile of an electric energy meter according to claim 1, wherein said determining at least one target RAM block in an idle state for storing a new profile according to a storage space requirement of said new profile comprises:
determining a first RAM block in an idle state from a plurality of RAM blocks of a memory of the embedded meter device;
if at least one second RAM block is determined to be used for storing the new file before the first RAM block, modifying a next block indication field in a last RAM block in the at least one second RAM block to be a block number of the first RAM block, wherein after dividing the memory into a plurality of RAM blocks, each RAM block is assigned a block number;
and if the total space of the first RAM block and the at least one second RAM block is larger than the space required by the new file, modifying a next block indication field in the first RAM block into a block tail indication mark, wherein the first RAM block and the at least one second RAM block form the at least one target RAM block.
3. The power meter terminal profile management method as in claim 1, wherein each of said RAM blocks comprises a status identification bit and a next block indication field.
4. The electric energy meter terminal archive management method of claim 3, further comprising:
a first pointer in a linked list pointer of the new file memory points to a table head in a file linked list before adding, and a second pointer points to a table tail in the file linked list before adding; simultaneously, a first pointer of the tail of the file linked list before adding is pointed to a file memory of a new electric meter; and pointing the tail pointer of the header in the file linked list before adding to the file memory of the new electric meter.
5. An electric energy meter terminal archive management device, characterized in that the device is applied to embedded meter equipment, divides the memory of the embedded meter equipment into a plurality of RAM blocks, wherein each RAM block comprises a state identification bit, and the identification bit is used for indicating an idle state or an occupied state, and the device comprises:
the receiving module is used for receiving file adding application information, wherein the file adding application information is used for requesting to add a new file into the memory of the embedded meter equipment;
the determining module is used for determining at least one target RAM block in an idle state for storing the new archive according to the storage space requirement of the new archive, and adjusting the identification bit of the at least one target RAM block to be in an occupied state;
The assignment module is used for assigning the at least one target RAM block to the new file;
further comprises:
the multiple RAM blocks of the memory are prioritized according to a preset storage sequence;
searching a plurality of alternative RAM blocks in an idle state from a plurality of RAM blocks corresponding to the priority according to the preset storage level of the new file;
comparing the storage space requirement of the new file with the prestored spaces of the plurality of alternative RAM blocks, searching the least number of alternative RAM blocks which can meet the storage space requirement, and obtaining at least one alternative RAM block;
marking the found at least one alternative RAM block as a target RAM block group;
performing difference making according to the total space of the target RAM block group and the storage space requirement of the new file to obtain a first difference value;
comparing the first difference value with a preset first space idle value, and if the first difference value is smaller than the first space idle value, enabling the target RAM block group to be effective;
if the first difference value is not smaller than the first space idle value, the target RAM block group is invalid, and the alternative RAM block is reselected;
further comprises:
if the total space of the plurality of third RAM blocks in the idle state with the priority corresponding to the preset storage level of the new file does not meet the storage space requirement;
Obtaining a first space requirement difference by making a difference between the storage space requirement of the new file and the total space of the plurality of third RAM blocks;
acquiring a plurality of fourth RAM blocks in an idle state of one level lower than the priority;
searching for a minimum number of at least one second alternative RAM block among the plurality of fourth RAM blocks;
and if the difference value between the total space of the at least one second alternative RAM block and the first space requirement difference is smaller than the first space free value, determining the at least one second alternative RAM block as the patch RAM block of the storage space requirement.
6. The device for managing a terminal profile of an electric energy meter according to claim 5, wherein the determining module is specifically configured to:
determining a first RAM block in an idle state from a plurality of RAM blocks of a memory of the embedded meter device;
if at least one second RAM block is determined to be used for storing the new file before the first RAM block, modifying a next block indication field in a last RAM block in the at least one second RAM block to be a block number of the first RAM block, wherein after dividing the memory into a plurality of RAM blocks, each RAM block is assigned a block number;
And if the total space of the first RAM block and the at least one second RAM block is larger than the space required by the new file, modifying a next block indication field in the first RAM block into a block tail indication mark, wherein the first RAM block and the at least one second RAM block form the at least one target RAM block.
7. An electronic device, comprising: processing means and storage means; the storage means has stored thereon a computer program which, when run by a processor, performs the method of terminal profile management of a power meter according to any one of claims 1 to 4 for terminal profile management.
8. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor performs the steps of the electric energy meter terminal profile management method of any one of the preceding claims 1 to 4.
CN202310233223.1A 2023-03-13 2023-03-13 Electric energy meter terminal archive management method, device, equipment and medium Active CN115964002B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310233223.1A CN115964002B (en) 2023-03-13 2023-03-13 Electric energy meter terminal archive management method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310233223.1A CN115964002B (en) 2023-03-13 2023-03-13 Electric energy meter terminal archive management method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN115964002A CN115964002A (en) 2023-04-14
CN115964002B true CN115964002B (en) 2023-07-07

Family

ID=85894691

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310233223.1A Active CN115964002B (en) 2023-03-13 2023-03-13 Electric energy meter terminal archive management method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115964002B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117558118A (en) * 2023-10-12 2024-02-13 北京思凌科半导体技术有限公司 Ammeter data acquisition method and device, storage medium and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032817A (en) * 2018-07-25 2018-12-18 天津凯发电气股份有限公司 A kind of Power quality management system Sharing Memory Realization method
CN114490076A (en) * 2022-02-07 2022-05-13 北京高途云集教育科技有限公司 Memory allocation method and device, computer equipment and storage medium

Family Cites Families (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW526415B (en) * 2000-02-15 2003-04-01 Ibm System and method for persistent and robust storage allocation
US7076629B2 (en) * 2001-12-26 2006-07-11 Bonola Thomas J Method for providing concurrent non-blocking heap memory management for fixed sized blocks
CN100382048C (en) * 2005-11-08 2008-04-16 中兴通讯股份有限公司 A managing method for EMS memory
CN102339254A (en) * 2011-06-17 2012-02-01 杭州炬华科技股份有限公司 Flash data storage method for intelligent electric energy meter
CN105027091B (en) * 2013-03-13 2017-12-19 英派尔科技开发有限公司 memory allocation accelerator
CN104978627B (en) * 2015-06-13 2018-05-29 烟台东方威思顿电气有限公司 A kind of method of electric power acquisition terminal update internal electric energy table archives
CN107765991B (en) * 2016-08-19 2019-03-01 北京百度网讯科技有限公司 The method and apparatus for being used for transmission message
CN106383666B (en) * 2016-09-07 2020-05-01 东信和平科技股份有限公司 Data storage method and device
US11016665B2 (en) * 2018-01-23 2021-05-25 Seagate Technology Llc Event-based dynamic memory allocation in a data storage device
CN111177017B (en) * 2018-11-09 2022-05-27 炬芯科技股份有限公司 Memory allocation method and device
US11954328B2 (en) * 2019-07-25 2024-04-09 Sony Interactive Entertainment Inc. Storage management device, storage management method, and program
CN112395087B (en) * 2020-11-10 2022-11-15 上海商米科技集团股份有限公司 Dynamic memory area of embedded equipment without memory management unit and management method
CN112381583A (en) * 2020-11-19 2021-02-19 深圳供电局有限公司 Power consumption calculation method and device based on distributed memory calculation technology
CN112506813B (en) * 2020-12-29 2022-04-08 郑州信大捷安信息技术股份有限公司 Memory management method and system
CN114217738A (en) * 2021-11-25 2022-03-22 深圳益邦阳光有限公司 Dynamic queue type cyclic storage method, device, equipment and medium
CN115756868A (en) * 2022-12-01 2023-03-07 北京奕斯伟计算技术股份有限公司 Memory allocation method, device, equipment, storage medium and computer program product

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109032817A (en) * 2018-07-25 2018-12-18 天津凯发电气股份有限公司 A kind of Power quality management system Sharing Memory Realization method
CN114490076A (en) * 2022-02-07 2022-05-13 北京高途云集教育科技有限公司 Memory allocation method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN115964002A (en) 2023-04-14

Similar Documents

Publication Publication Date Title
US11003625B2 (en) Method and apparatus for operating on file
CN106294190B (en) Storage space management method and device
CN109690498B (en) Memory management method and equipment
WO2020093501A1 (en) File storage method and deletion method, server, and storage medium
WO2018121430A1 (en) File storage and indexing method, apparatus, media, device and method for reading files
CN110209348B (en) Data storage method and device, electronic equipment and storage medium
CN109240607B (en) File reading method and device
CN103077197A (en) Data storing method and device
CN111722918A (en) Service identification code generation method and device, storage medium and electronic equipment
CN115964002B (en) Electric energy meter terminal archive management method, device, equipment and medium
CN112817538B (en) Data processing method, device, equipment and storage medium
CN112148693A (en) Data processing method, device and storage medium
CN112579595A (en) Data processing method and device, electronic equipment and readable storage medium
CN113806300A (en) Data storage method, system, device, equipment and storage medium
CN115712500A (en) Memory release method, memory recovery method, memory release device, memory recovery device, computer equipment and storage medium
CN110222046B (en) List data processing method, device, server and storage medium
US11287997B2 (en) Method, electronic device and computer program product for managing disk array
CN111752941A (en) Data storage method, data access method, data storage device, data access device, server and storage medium
US20230168830A1 (en) Method and apparatus for data access of nand flash file, and storage medium
CN115934354A (en) Online storage method and device
CN112380004B (en) Memory management method, memory management device, computer readable storage medium and electronic equipment
EP3995972A1 (en) Metadata processing method and apparatus, and computer-readable storage medium
CN115221360A (en) Tree structure configuration method and system
CN114281248B (en) Method for improving read-write performance of RAM, electronic equipment and medium
CN113741787B (en) Data storage method, device, equipment and 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