CN117708138B - Data storage method, component, equipment and medium based on energy storage system database - Google Patents
Data storage method, component, equipment and medium based on energy storage system database Download PDFInfo
- Publication number
- CN117708138B CN117708138B CN202410160430.3A CN202410160430A CN117708138B CN 117708138 B CN117708138 B CN 117708138B CN 202410160430 A CN202410160430 A CN 202410160430A CN 117708138 B CN117708138 B CN 117708138B
- Authority
- CN
- China
- Prior art keywords
- data
- storage
- index
- database
- cycle
- 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
Links
- 238000013500 data storage Methods 0.000 title claims abstract description 66
- 238000000034 method Methods 0.000 title claims abstract description 35
- 238000004146 energy storage Methods 0.000 title claims abstract description 22
- 125000004122 cyclic group Chemical group 0.000 claims description 29
- 238000003780 insertion Methods 0.000 claims description 18
- 230000037431 insertion Effects 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 9
- 238000012360 testing method Methods 0.000 claims description 8
- 238000012545 processing Methods 0.000 claims description 7
- 230000001960 triggered effect Effects 0.000 claims description 4
- 238000010276 construction Methods 0.000 claims description 3
- 238000001514 detection method Methods 0.000 claims description 3
- 238000004891 communication Methods 0.000 description 15
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 7
- 238000013461 design Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 230000002441 reversible effect Effects 0.000 description 2
- 241001522296 Erithacus rubecula Species 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013479 data entry Methods 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 230000002427 irreversible effect Effects 0.000 description 1
- 238000007726 management method Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000004321 preservation Methods 0.000 description 1
- 229920006395 saturated elastomer Polymers 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000009897 systematic effect Effects 0.000 description 1
Classifications
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention provides a data storage method, a data storage component, a data storage device and a data storage medium based on an energy storage system database, which comprise the steps of detecting the data storage state of a recorded data area in the database in real time; and when the data storage state meets the triggering condition, sending a data circulation request message to a circulation storage area in the database so as to acquire the circulation storage strategy of the circulation storage area. According to the invention, the data is circularly stored according to the circular storage strategy, and the database can be circularly stored by synchronously creating and binding a table for marking whether the database is full or not and the storage position in the database file, so that the space safety of the data storage and the content in the database are ensured to be the latest content.
Description
Technical Field
The invention relates to the technical field of data storage, in particular to a data storage method, a data storage component, a data storage device and a data storage medium based on an energy storage system database.
Background
With the development of the energy storage field and the perfection of industry standards, the storage requirements of the energy storage management system become increasingly complex, and common storage requirements such as electricity, running parameters, fault alarm records of batteries or fire protection, charge and discharge or on-off event records and the like can be divided into two types: fixed cycle storage and event triggered storage. In either way, when we extend the time indefinitely, the size of the stored file will continue to grow and this growth is irreversible, ultimately resulting in systematic errors due to insufficient space.
According to the traditional database design mode: 1. the storage period of the fixed period storage class is reduced, so that the time of space saturation is delayed, and the safety requirement that the space is never saturated cannot be guaranteed; 2. when the stored database file reaches a certain size, deleting the table to reconstruct, wherein the method guarantees the safety requirement of space, but simultaneously causes data loss and can not meet the requirement of the data preservation time length of an energy storage system.
Under the condition, the invention provides a cyclic storage design method based on sqlit database design, so that the fixed number of data entries in the database is ensured, and the stored data content is always the latest content.
Disclosure of Invention
In order to solve the technical problems, the invention provides a data storage method, a data storage component, a data storage device and a data storage medium based on an energy storage system database, wherein the traditional database is improved, the sqlit database is designed, the data circulation storage of the energy storage system database is realized by establishing a circulation storage area and a set circulation storage strategy, and the integrity of the data and the rationality of time sequence are ensured while the space safety requirement is ensured.
In a first aspect, the present invention provides a data storage method based on an energy storage system database, the method comprising:
detecting the data storage state of a recorded data area in a database in real time;
when the data storage state meets a trigger condition, sending a data circulation request message to a circulation storage area in a database to acquire a circulation storage strategy of the circulation storage area;
performing data cyclic storage according to the cyclic storage strategy;
The step of performing data cycle storage according to the cycle storage strategy comprises the steps of calling an insertion interface to perform data cycle storage when the execution condition of the cycle storage strategy is 0, and calling an update interface to perform data cycle storage when the execution condition of the cycle storage strategy is 1.
In some embodiments, the step of detecting in real time the data storage status of the recorded data area in the database includes: a database file is established in the database in advance, and a record data area and a circulation storage area are set in the database file, wherein the database file is represented by test.db, the record data area is represented by Table1, and the circulation storage area is represented by Table 2.
In some embodiments, an Index field Index and a full flag field IsFull are created in the circular memory area, and the data structures data-Index and data-IsFull are formed in the database, respectively.
In some embodiments, the step of sending a data loop request message to a loop storage area in a database to obtain a loop storage policy of the loop storage area includes sending a data loop request message to a loop storage area in the database, the loop storage area generating an execution condition based on the loop storage policy of the data-IsFull, the loop storage policy being to invoke an insert data store when the execution condition is 0, and the loop storage policy being to invoke an update data store when the execution condition is 1.
In some embodiments, when the execution condition of the loop storage policy is 0, the step of calling the insertion interface to perform data loop storage includes writing a row of data into Table1 by using sqlite statement insert in the insertion interface, wherein the storage location is data-Index, and adding one to the data-Index for pointing to the next storage location; while checking the amount of data already stored in Table1, if the amount of data stored is greater than or equal to the set maximum entry, then data-Index is assigned 1 to point to the first row, data-IsFull is assigned 1, and the latest data-Index and data-IsFull are updated to the Index and IsFull fields in Table 2.
In some embodiments, when the execution condition is 1, the round robin storage policy is to call for updating data to be stored in the update interface, update a piece of data into Table1 using the sqlite statement update, the updated location being at the location pointed to by the data-Index, add one to the data-Index for pointing to the next storage location, assign 1 to the data-Index for pointing to the first row if the value of the data-Index is greater than or equal to the maximum entry of 1 ten thousand pieces set, and synchronously update the field index=data-Index in Table 2.
In a second aspect, the present invention also provides a data storage component based on an energy storage system database, the data storage component comprising:
The pre-construction module is used for pre-establishing a database file in the database, setting a record data area and a circulation storage area in the database file, establishing an Index field Index and a full mark field IsFull in the circulation storage area, and respectively forming a data structure form data-Index and a data-IsFull in the database;
the detection module is used for detecting the data storage state of the recorded data area in the database in real time;
the processing module is used for sending a data circulation request message to a circulation storage area in the database when the data storage state meets the triggering condition so as to acquire a circulation storage strategy of the circulation storage area;
the execution module is used for carrying out data cyclic storage according to the cyclic storage strategy, when the execution condition of the cyclic storage strategy is 0, the insertion interface is called to carry out data cyclic storage, and when the execution condition of the cyclic storage strategy is 1, the update interface is called to carry out data cyclic storage;
The database file is represented by test.db, the record data area is represented by Table1, the circulating storage area is represented by Table2, and the triggering condition is that the storage time reaches a preset storage period or a storage request is triggered.
In some embodiments, the execution module comprises:
The first execution module is used for calling the insertion interface to carry out data cyclic storage when the execution condition of the cyclic storage strategy is 0, wherein in the insertion interface, a row of data is written into the Table1 by using a sqlite statement insert, the storage position is data-Index, and the data-Index is added with one for pointing to the next storage position; checking the amount of data already stored in Table1 at the same time, if the amount of data stored is greater than or equal to the set maximum entry, then using the data-Index value of 1 to point to the first row, the data-IsFull value of 1, and updating the latest data-Index and data-IsFull to the Index and IsFull fields in Table 2;
And the second execution module is used for updating one piece of data in the Table1 by using the sqlite statement update, wherein the updated position is positioned at the position pointed by the data-Index, adding one data-Index for pointing to the next storage position, and if the value of the data-Index is greater than or equal to the set maximum entry of 1 ten thousand pieces, assigning 1 data-Index for pointing to the first row, and synchronously updating the field index=data-Index in the Table 2.
In a third aspect, the present specification provides an electronic device comprising: one or more processors; and a memory associated with the one or more processors, the memory for storing program instructions that, when read for execution by the one or more processors, perform the steps of the method of the first aspect.
In a fourth aspect, the present description provides a computer-readable storage medium, on which a computer program is stored, characterized in that the program when executed by a processor implements the steps of the method according to the first aspect.
The invention provides a data storage method, a data storage component, a data storage device and a data storage medium based on an energy storage system database, which comprise the steps of detecting the data storage state of a recorded data area in the database in real time; and when the data storage state meets the triggering condition, sending a data circulation request message to a circulation storage area in the database so as to acquire the circulation storage strategy of the circulation storage area. According to the method, the data is circularly stored according to the circular storage strategy, and the data can be circularly stored by synchronously creating and binding a table for marking whether the data is full or not and the storage position in the database file, so that the space safety of the data storage and the content in the database are ensured to be the latest content, and meanwhile, a user can directly store the data by using the method under the condition of not paying attention to the space and the data integrity.
Drawings
Fig. 1 is a flowchart of a data storage method based on an energy storage system database according to the present invention.
Fig. 2 is a diagram of a data storage component framework based on an energy storage system database according to the present invention.
Fig. 3 is a schematic diagram of a data storage electronic device based on an energy storage system database according to the present invention.
Detailed Description
The following description is presented to enable one of ordinary skill in the art to make and use the invention, and is provided in the context of a particular application and its requirements. Various modifications to the disclosed embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments and applications without departing from the spirit and scope of the disclosure. Thus, the present description is not limited to the embodiments shown, but is to be accorded the widest scope consistent with the claims.
The terminology used herein is for the purpose of describing particular example embodiments only and is not intended to be limiting. For example, as used herein, the singular forms "a", "an" and "the" include plural referents unless the context clearly dictates otherwise. The terms "comprises," "comprising," "includes," and/or "including," when used in this specification, are taken to specify the presence of stated integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
These and other features of the present specification, as well as the operation and function of the related elements of structure, as well as the combination of parts and economies of manufacture, may be significantly improved upon in view of the following description. All of which form a part of this specification, reference is made to the accompanying drawings. It is to be expressly understood, however, that the drawings are for the purpose of illustration and description only and are not intended as a definition of the limits of the description. It should also be understood that the drawings are not drawn to scale.
The flowcharts used in this specification illustrate operations implemented by systems according to some embodiments in this specification. It should be clearly understood that the operations of the flow diagrams may be implemented out of order. Rather, operations may be performed in reverse order or concurrently. Further, one or more other operations may be added to the flowchart. One or more operations may be removed from the flowchart.
Fig. 1 is a flowchart of a data storage method based on an energy storage system database according to the present invention, and as shown in fig. 1, the present invention provides a data storage method based on an energy storage system database, including the following steps:
detecting the data storage state of a recorded data area in a database in real time;
when the data storage state meets a trigger condition, sending a data circulation request message to a circulation storage area in a database to acquire a circulation storage strategy of the circulation storage area;
performing data cyclic storage according to the cyclic storage strategy;
The step of performing data cycle storage according to the cycle storage strategy comprises the steps of calling an insertion interface to perform data cycle storage when the execution condition of the cycle storage strategy is 0, and calling an update interface to perform data cycle storage when the execution condition of the cycle storage strategy is 1.
In this embodiment, the scheme of the present invention proposes a data cycle storage method, and in order to achieve the purpose of the scheme of the present invention, data cycle storage is performed by a cycle storage policy, and a table for marking whether full and storage locations exist is created and bound in synchronization in a database file, so that the database can be stored in a cycle. When a sqlit database is established, a database file is established in the database in advance, and a record data area and a circulation storage area are set in the database file, wherein the database file is represented by test.db, the record data area is represented by Table1, and the circulation storage area is represented by Table 2. An Index field Index and a full flag field IsFull are created in the circular memory area, and the data structures data-Index and data-IsFull are formed in the database, respectively.
In this embodiment, a data loop request message is sent to a loop storage area in the database, the loop storage area generates an execution condition based on the loop storage policy of the data-IsFull, when the execution condition is 0, the loop storage policy is to call an insert data store, and when the execution condition is 1, the loop storage policy is to call an update data store.
In this embodiment, the manner of loop storage is performed based on a loop policy, including calling an insert data storage and calling an update data storage, when the execution condition of the loop storage policy is 0, calling an insert interface, writing a row of data into Table1 by using a sqlite statement insert in the insert interface, wherein a storage location is data-Index, and adding one data-Index for pointing to a next storage location; while checking the amount of data already stored in Table1, if the amount of data stored is greater than or equal to the set maximum entry, then data-Index is assigned 1 for pointing to the first row, data-IsFull is assigned 1, and the latest data-Index and data-IsFull are updated to the Index and IsFull fields in Table 2. Within the update interface, one piece of data is updated into Table1 using the sqlite statement update, the updated location is at the location pointed to by the data-Index, data-Index is added by one for pointing to the next storage location, if the value of data-Index is greater than or equal to the set maximum entry of 1 ten thousand, then data-Index is assigned 1 for pointing to the first row, and the fields Index=data-Index in Table2 are updated synchronously.
The data circulation storage process of the database is realized through the process.
For more clear description of the technical scheme of the invention, the content of the invention is elaborated, and the specific operation process is as follows:
S1, opening a database test.db, and setting a maximum item to be stored, for example, 1 ten thousand items;
S2, creating Table2 in test.db, wherein the Table comprises two fields: index and full flag IsFull, read the values of Index and IsFull to be stored as 'data-Index' and 'data-IsFull' if Table2 already exists, insert index=1 IsFull =0 in Table2 if Table does not exist, and initialize 'data-Index' =1 and 'data-IsFull' =0;
S3, judging a 'data-IsFull' mark when a storage condition is met (a fixed period arrives or event triggers), calling an update interface when 'data-IsFull' = 1, and calling an insert interface when 'data-IsFull' = 0;
S4, writing a row of data into the Table1 by using the sqlite statement insert in the insertion interface, wherein the storage position is 'data-Index', and adding one to the 'data-Index' for pointing to the next storage position. Checking the number already stored in Table1 at the same time, if the number is equal to the set maximum entry (assuming 1 ten thousand entries), then 'data-Index' is assigned 1 for pointing to the first row, 'data-IsFull' is assigned 1, and the latest data-Inde and 'data-IsFull' are updated to the Index and IsFull fields in Table 2;
S5, in the update interface, updating a piece of data in the Table1 by using the sqlite statement update, wherein the updated position is positioned at a position pointed by 'data-Index', adding one to the 'data-Index' for pointing to the next storage position, and if the value of the 'data-Index' is greater than the set maximum entry of 1 ten thousand pieces, assigning 1 to the 'data-Index' for pointing to the first row, and synchronously updating the field index= 'data-Index' in the Table 2;
s6, returning to S3.
Based on the same inventive concept, the present disclosure further provides a data storage assembly 200 based on an energy storage system database, as shown in fig. 2, the data storage assembly 200 includes:
A pre-construction module 201, configured to pre-establish a database file in the database, set a recording data area and a cyclic storage area in the database file, create an Index field Index and a full mark field IsFull in the cyclic storage area, and form a data structure form data-Index and data-IsFull in the database, respectively;
The detection module 202 is configured to detect a data storage state of a recorded data area in the database in real time;
The processing module 203 is configured to send a data cycle request message to a cycle storage area in a database when the data storage state meets a trigger condition, so as to obtain a cycle storage policy of the cycle storage area;
The execution module 204 is configured to perform data cycle storage according to the cycle storage policy, call an insertion interface to perform data cycle storage when an execution condition of the cycle storage policy is 0, and call an update interface to perform data cycle storage when the execution condition of the cycle storage policy is 1;
The database file is represented by test.db, the record data area is represented by Table1, the circulating storage area is represented by Table2, and the triggering condition is that the storage time reaches a preset storage period or a storage request is triggered.
The first execution module 2041 is configured to, when the execution condition of the circular storage policy is 0, call the insertion interface to perform data circular storage, where in the insertion interface, write a row of data into the Table1 by using a sqlite statement insert, where the storage location is data-Index, and add one to the data-Index for pointing to a next storage location; checking the amount of data already stored in Table1 at the same time, if the amount of data stored is greater than or equal to the set maximum entry, then using the data-Index value of 1 to point to the first row, the data-IsFull value of 1, and updating the latest data-Index and data-IsFull to the Index and IsFull fields in Table 2;
A second execution module 2042, configured to update a piece of data in the Table1 using the sqlite statement update in the update interface, where the updated location is located at the location pointed to by the data-Index, add one to the data-Index for pointing to the next storage location, and assign 1 to the data-Index for pointing to the first row if the value of the data-Index is greater than or equal to the set maximum entry of 1 ten thousand, and synchronize the update of the field index=data-Index in the Table 2.
Another aspect of the present disclosure also provides an electronic device, as shown in fig. 3, which illustrates a schematic structural diagram of an electronic device 300 suitable for implementing the embodiments of the present disclosure. The terminal devices in the embodiments of the present specification may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 3 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 3, an electronic device 300 may include at least one processor 301 and at least one memory 302. In some embodiments, electronic device 300 may also include a communication module 303, a communication bus 304, and related I/O components for input/output between the electronic device and other components. The communication bus 304 may connect the different system components including the processor 301, the memory 302, and the communication module 303. The communication module 303 is used for data communication between the electronic device 300 and the outside, for example, the communication module 303 may be used for data communication between the electronic device 300 and a mobile communication network or a wireless communication network. The communication module 303 may be provided with a wired communication port or may be provided with a wireless communication port.
Memory 302 may include a data storage device. The data storage device may be a non-transitory storage medium or a transitory storage medium. For example, the data storage device may include one or more of a magnetic disk, a Read Only Memory (ROM), or a Random Access Memory (RAM). Memory 402 also includes at least one set of instructions stored in the data storage device. The instructions are computer program code that may include programs, routines, objects, components, data structures, procedures, modules, etc. that perform the methods of data storage based on energy storage system databases provided herein.
The at least one processor 301 may be communicatively coupled to the at least one memory 302 and the communication module 303 via a communication bus 304. The at least one processor 301 is configured to execute the at least one instruction set described above. When the electronic device 300 is running, the at least one processor 301 reads the at least one instruction set and, according to the indication of the at least one instruction set, performs the energy storage system database-based data storage method provided herein. The processor 301 may perform all the steps involved in the energy storage system database based data storage method. Processor 301 may be in the form of one or more processors, in some embodiments, processor 301 may include one or more hardware processors, such as microcontrollers, microprocessors, reduced Instruction Set Computers (RISC), application Specific Integrated Circuits (ASICs), application specific instruction set processors (ASIPs), central Processing Units (CPUs), graphics Processing Units (GPUs), physical Processing Units (PPUs), microcontroller units, digital Signal Processors (DSPs), field Programmable Gate Arrays (FPGAs), advanced RISC Machines (ARM), programmable Logic Devices (PLDs), any circuit or processor capable of executing one or more functions, or the like, or any combination thereof. For illustrative purposes only, only one processor 301 is depicted in the electronic device 300 in this specification. However, it should be noted that the electronic device 300 may also include multiple processors in this specification, and thus, the operations and/or method steps disclosed in this specification may be performed by one processor as described in this specification, or may be performed jointly by multiple processors. For example, if the processor 301 of the electronic device 300 performs steps a and B in this specification, it should be understood that steps a and B may also be performed by two different processors 301 in combination or separately (e.g., a first processor performs step a, a second processor performs step B, or the first and second processors together perform steps a and B).
According to an embodiment of the present disclosure, the present disclosure also includes a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication module 303, or installed from the memory 302, or installed from the ROM. When executed, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to: detecting the data storage state of a recorded data area in a database in real time; when the data storage state meets a trigger condition, sending a data circulation request message to a circulation storage area in a database to acquire a circulation storage strategy of the circulation storage area; and carrying out data cyclic storage according to the cyclic storage strategy. The step of performing data cycle storage according to the cycle storage strategy comprises the steps of calling an insertion interface to perform data cycle storage when the execution condition of the cycle storage strategy is 0, and calling an update interface to perform data cycle storage when the execution condition of the cycle storage strategy is 1.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
The foregoing examples illustrate only a few embodiments of the invention and are described in detail herein without thereby limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention.
Claims (4)
1. A method of data storage based on an energy storage system database, the method comprising:
A database file is established in the database in advance, a record data area and a circulation storage area are set in the database file, wherein the database file is represented by test.db, the record data area is represented by Table1, the circulation storage area is represented by Table2, an Index field Index and a full mark field IsFull are created in the circulation storage area, and data structures data-Index and data-IsFull are respectively formed in the database;
detecting the data storage state of a recorded data area in a database in real time;
When the data storage state meets a trigger condition, sending a data cycle request message to a cycle storage area in a database to acquire a cycle storage strategy of the cycle storage area, wherein the method comprises the following steps: sending a data cycle request message to a cycle storage area in the database, wherein the cycle storage area generates an execution condition based on the cycle storage strategy of the data-IsFull, when the execution condition is 0, the cycle storage strategy is to call an inserted data storage, and when the execution condition is 1, the cycle storage strategy is to call an updated data storage;
When the execution condition of the cyclic storage strategy is 0, calling an insertion interface to carry out cyclic storage of data, wherein in the insertion interface, a row of data is written into Table1 by using a sqlite statement insert, the storage position is data-Index, and the data-Index is added with one for pointing to the next storage position; checking the amount of data already stored in Table1 at the same time, if the amount of data stored is greater than or equal to the set maximum entry, then using the data-Index value of 1 to point to the first row, the data-IsFull value of 1, and updating the latest data-Index and data-IsFull to the Index and IsFull fields in Table 2;
When the execution condition is 1, the step of calling the update data storage by the loop storage policy comprises the steps of using the sqlite statement update to update one piece of data in the Table1 in the update interface, wherein the updated position is positioned at the position pointed by the data-Index, adding one data-Index for pointing to the next storage position, and if the value of the data-Index is greater than or equal to the set maximum entry of 1 ten thousands, assigning 1 data-Index for pointing to the first row, and synchronously updating the field index=data-Index in the Table 2;
performing data cyclic storage according to the cyclic storage strategy;
The step of performing data cycle storage according to the cycle storage strategy comprises the steps of calling an insertion interface to perform data cycle storage when the execution condition of the cycle storage strategy is 0, and calling an update interface to perform data cycle storage when the execution condition of the cycle storage strategy is 1.
2. A data storage component of a data storage method according to claim 1, wherein the data storage component comprises:
The pre-construction module is used for pre-establishing a database file in the database, setting a record data area and a circulation storage area in the database file, establishing an Index field Index and a full mark field IsFull in the circulation storage area, and respectively forming a data structure form data-Index and a data-IsFull in the database;
the detection module is used for detecting the data storage state of the recorded data area in the database in real time;
the processing module is used for sending a data circulation request message to a circulation storage area in the database when the data storage state meets the triggering condition so as to acquire a circulation storage strategy of the circulation storage area;
the execution module is used for carrying out data cyclic storage according to the cyclic storage strategy, when the execution condition of the cyclic storage strategy is 0, the insertion interface is called to carry out data cyclic storage, and when the execution condition of the cyclic storage strategy is 1, the update interface is called to carry out data cyclic storage;
The database file is represented by test.db, the recorded data area is represented by Table1, the circulating storage area is represented by Table2, and the triggering condition is that the storage time reaches a preset storage period or a storage request is triggered;
the execution module comprises:
The first execution module is used for calling the insertion interface to carry out data cyclic storage when the execution condition of the cyclic storage strategy is 0, wherein in the insertion interface, a row of data is written into the Table1 by using a sqlite statement insert, the storage position is data-Index, and the data-Index is added with one for pointing to the next storage position; checking the amount of data already stored in Table1 at the same time, if the amount of data stored is greater than or equal to the set maximum entry, then using the data-Index value of 1 to point to the first row, the data-IsFull value of 1, and updating the latest data-Index and data-IsFull to the Index and IsFull fields in Table 2;
And the second execution module is used for updating one piece of data in the Table1 by using the sqlite statement update, wherein the updated position is positioned at the position pointed by the data-Index, adding one data-Index for pointing to the next storage position, and if the value of the data-Index is greater than or equal to the set maximum entry of 1 ten thousand pieces, assigning 1 data-Index for pointing to the first row, and synchronously updating the field index=data-Index in the Table 2.
3. An electronic device, comprising: one or more processors; and a memory associated with the one or more processors, the memory for storing program instructions that, when read for execution by the one or more processors, perform the steps of the method of claim 1.
4. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the steps of the method of claim 1.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410160430.3A CN117708138B (en) | 2024-02-05 | 2024-02-05 | Data storage method, component, equipment and medium based on energy storage system database |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410160430.3A CN117708138B (en) | 2024-02-05 | 2024-02-05 | Data storage method, component, equipment and medium based on energy storage system database |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117708138A CN117708138A (en) | 2024-03-15 |
CN117708138B true CN117708138B (en) | 2024-06-11 |
Family
ID=90153795
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410160430.3A Active CN117708138B (en) | 2024-02-05 | 2024-02-05 | Data storage method, component, equipment and medium based on energy storage system database |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117708138B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1361489A (en) * | 2000-12-28 | 2002-07-31 | 深圳市中兴通讯股份有限公司 | Automatic circular daily record information storing method and system |
CN104361029A (en) * | 2014-10-24 | 2015-02-18 | 成都亿盟恒信科技有限公司 | Double-index video circulating memory and quick retrieval method |
CN107247561A (en) * | 2017-05-31 | 2017-10-13 | 成都华立达电力信息系统有限公司 | Buffer pool circulation storage reading/writing method |
CN108959354A (en) * | 2018-05-04 | 2018-12-07 | 北京小米移动软件有限公司 | Data processing method, device and server |
CN109274545A (en) * | 2017-07-17 | 2019-01-25 | 北京航空航天大学 | A kind of cycle storage method based on mixed cloud |
CN110474851A (en) * | 2019-08-01 | 2019-11-19 | 北京世纪东方通讯设备有限公司 | A kind of access method and device recycling storage organization |
CN115248658A (en) * | 2021-04-28 | 2022-10-28 | 无锡飞翎电子有限公司 | Data storage method, device, clothes processing equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8965175B2 (en) * | 2001-04-09 | 2015-02-24 | Monitoring Technology Corporation | Data recording and playback system and method |
-
2024
- 2024-02-05 CN CN202410160430.3A patent/CN117708138B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1361489A (en) * | 2000-12-28 | 2002-07-31 | 深圳市中兴通讯股份有限公司 | Automatic circular daily record information storing method and system |
CN104361029A (en) * | 2014-10-24 | 2015-02-18 | 成都亿盟恒信科技有限公司 | Double-index video circulating memory and quick retrieval method |
CN107247561A (en) * | 2017-05-31 | 2017-10-13 | 成都华立达电力信息系统有限公司 | Buffer pool circulation storage reading/writing method |
CN109274545A (en) * | 2017-07-17 | 2019-01-25 | 北京航空航天大学 | A kind of cycle storage method based on mixed cloud |
CN108959354A (en) * | 2018-05-04 | 2018-12-07 | 北京小米移动软件有限公司 | Data processing method, device and server |
CN110474851A (en) * | 2019-08-01 | 2019-11-19 | 北京世纪东方通讯设备有限公司 | A kind of access method and device recycling storage organization |
CN115248658A (en) * | 2021-04-28 | 2022-10-28 | 无锡飞翎电子有限公司 | Data storage method, device, clothes processing equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
基于高清视频处理芯片DM8168的车载数据记录仪设计;曾鹏程;中国优秀硕士学位论文全文数据库;20201115;C035-20 * |
Also Published As
Publication number | Publication date |
---|---|
CN117708138A (en) | 2024-03-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021180025A1 (en) | Message processing method and apparatus, electronic device and medium | |
CN110851139B (en) | Method and device for checking codes and electronic equipment | |
CN107402821B (en) | Access control method, device and equipment for shared resources | |
CN110865852B (en) | Webpage component loading method and device, electronic equipment and storage medium | |
CN112035344A (en) | Multi-scenario test method, device, equipment and computer readable storage medium | |
CN112631590A (en) | Component library generation method and device, electronic equipment and computer readable medium | |
CN117708138B (en) | Data storage method, component, equipment and medium based on energy storage system database | |
CN112860412B (en) | Service data processing method and device, electronic equipment and storage medium | |
CN110795331A (en) | Software testing method and device | |
CN111414152B (en) | Method, system, readable medium and electronic device for realizing business logic | |
CN111159298A (en) | Service request processing method and device, electronic equipment and storage medium | |
CN106341449A (en) | Data synchronization method and device | |
CN112000482B (en) | Memory management method and device, electronic equipment and storage medium | |
CN115203158A (en) | Data comparison method, device, equipment and storage medium | |
CN114428815A (en) | Data storage method and device, electronic equipment and computer readable medium | |
CN115016836A (en) | Component version management method and device, electronic equipment and system | |
CN109446462B (en) | Page-based data monitoring processing method, device, equipment and storage medium | |
CN113988313A (en) | User data deleting method and device and electronic equipment | |
CN112783903A (en) | Method and device for generating update log | |
CN112907198B (en) | Service state circulation maintenance method and device and electronic equipment | |
CN111290755B (en) | Method, device, electronic equipment and storage medium for presenting data | |
CN112667447B (en) | Data restoration method and device | |
CN111209042B (en) | Method, device, medium and electronic equipment for establishing function stack | |
CN109933413A (en) | Service implementation method and device, electronic equipment, storage medium | |
CN111427868B (en) | Processing method and device for operation request in database migration and electronic equipment |
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 |