CN105224471A - Power information acquisition terminal based on built-in Linux stores the method for data - Google Patents
Power information acquisition terminal based on built-in Linux stores the method for data Download PDFInfo
- Publication number
- CN105224471A CN105224471A CN201510683330.XA CN201510683330A CN105224471A CN 105224471 A CN105224471 A CN 105224471A CN 201510683330 A CN201510683330 A CN 201510683330A CN 105224471 A CN105224471 A CN 105224471A
- Authority
- CN
- China
- Prior art keywords
- data
- file
- memory mapping
- acquisition terminal
- linux
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Techniques For Improving Reliability Of Storages (AREA)
Abstract
The present invention discloses a kind of power information acquisition terminal based on built-in Linux and uses Memory Mapping File and its to store the method for data, by memory-mapped function mmap (linux system calls) by the data-mapping of required read-write to consumer process space, with the access of the form of read/write memory store data have data write can be stored, power down is not lost, read and write convenience, superior performance, the advantage such as cost-saving.
Description
Technical field
The present invention relates to power utilization information collection system field used for intelligent electric network, be specifically related to the method storing data based on built-in Linux power information acquisition terminal.
Background technology
Power user power consumption information acquisition system (poweruserelectricenergydataacquiresystem) is the system gathering the power information of power consumer, process and monitor in real time, realizes the functions such as the automatic collection of power information, metering exception monitoring, electric energy quality monitoring, electrical energy consumption analysis and management, relevant information are issued, distributed energy is monitored, the information interaction of intelligent power equipment.
Power information acquisition terminal (electricenergydataacquireterminal) is the equipment gathered each information gathering point power information, is called for short acquisition terminal.The collection of electric energy meter data, data management, data double-way transmission can be realized and forward or perform the equipment of control command.Power information acquisition terminal is divided into by application places types such as specially becoming acquisition terminal, centralized automatic meter-reading terminal (comprising concentrator, collector), distributed energy monitor terminal.
Acquisition terminal can carry out frequent read-write to partial data because of functional requirement and be embodied in the following aspects in operational process: acquisition terminal can be added up collection result, calculates and store after every round checks meter end, acquisition terminal per minutely can carry out data statistics, calculating storing to each collection point, acquisition terminal can calculate, add up and store by kind reading self-metering chip data per second, and also cumulative, the storage of pulse meter state is read in acquisition terminal meeting in real time.
The following scheme of main use stores, reads and writes this type of data at present:
1. deposit file, used data are first buffered in after then having read and write in internal memory stored in file.The data loss problem that data can avoid system blackout to bring stored in file, but reading and writing of files operation is comparatively loaded down with trivial details, it is inconvenient to use with form visit data operate byte, and reading and writing of files limited capacity is embodied on the repetition of mass file, random read-write especially frequently.
2. increase hardware SRAM (power down does not lose internal memory), can to operate the form visit data of byte, but need extra power supply, it is 5 years that the plate of acquisition terminal carries lithium battery general designed life, even the life-span do not arrive also there is self-discharge of battery, quality of lot problem cause SRAM supplying cell lost efficacy cause loss of data, and increase hardware meaning increase cost.
3. be programmed into Flash, can realize solidification storage and not need extra power supply, after power down, data are not lost, but Flash programming needs special driving and need first wipe to write again, can not, to operate the form read-write of byte, also need to consider that the wear leveling of Flash is to ensure its reading-writing life-span.
Summary of the invention
For the problems referred to above, the invention provides a kind ofly data write can be stored, power down is not lost, read and write convenient, the power information acquisition terminal based on built-in Linux of superior performance stores data method.
For solving the problem, the technical scheme that the present invention takes is: the power information acquisition terminal based on built-in Linux stores the method for data, comprises the steps:
Step one, the data determining required storage and data length, define the base address of memory mapping area, and define the relativity shift for the address and base address storing each data in the process address space;
These data of data storing 1M are such as needed to be respectively data 1, data 2, data 3..... data 256, eachly take 4 bytes, if base address, memory mapping area is 0xffff0000, the address then storing these data is respectively data 1->0xffff0000, data 2->0xffff0004, data 3->0xffff0008......, then can as given a definition:
Data 1:(base address+0);
Data 2:(base address+4);
Data 3:(base address+8); ... ..
Defining these skews is conveniently read and write each data;
Step 2, treat according to the length detection storing data required in step one legitimacy of Memory Mapping File and its if file is legal, to enter step 3; If do not conform to rule to create file according to required storage data length and file content is filled to null value and enter step 3 again;
Step 3, invoke memory mapping function mmap, set up and the mapping treating Memory Mapping File and its in step 2, memory-mapped function mmap return address given the base address of definition in step one;
The base address of the memory mapping area of definition and the relativity shift address read-write required storage data of other data in step 4, use step one.
Memory Mapping File and its utilizes virtual memory File Mapping in the address space of process, process operation file after this, just as the address in the operation process space, such as uses the function of the internal memory operations such as memcpy.This method can be good at being applied in the occasion needing a frequent process file or a large files, and this mode process IO efficiency is higher than common IO efficiency.Linux provides memory-mapped function mmap, and indicating file to be mapped and file size when calling can return mapping internal memory first address, and it is mapped to file content on one section of internal memory.By to the reading of this section of internal memory and amendment, realize the reading to file and amendment.
Determine the length of required mapped inner-storage according to required storage data length, also determine the size treating Memory Mapping File and its simultaneously.
Detect in described step 2 and treat that the condition of Memory Mapping File and its legitimacy also comprises the start byte of file and the end byte of file.
The present invention discloses a kind of power information acquisition terminal based on built-in Linux and uses Memory Mapping File and its to store the method for data, by memory-mapped function mmap (linux system calls) by the data-mapping of required read-write to consumer process space, with the access of the form of read/write memory store data have data write can be stored, power down is not lost, read and write convenience, superior performance, the advantage such as cost-saving.
The present invention possesses following beneficial effect:
1. cost-saving without the need to increasing hardware, and increase reliability;
2. reading and writing data can carry out with the form operating internal memory;
3. realize solidification store, after system power failure without the need to powered battery to preserve data;
4. without the need to considering the abrasion equilibrium of memory device;
5. without the need to considering the read-write number of times of memory device;
6. without the need to the read-write driver, portable high of specific store device;
7. Memory Mapping File and its performance advantage: it is between file and kernel high-speed buffer that normal system IO reads and writes needs twice transmission primaries, and another time is between high-speed buffer and user's space buffer zone.Use memory-mapped function mmap just to transmit without the need to second time, for inputting, once kernel corresponding blocks of files being mapped and just can use these data into consumer process after internal memory.For output, consumer process only needs to revise the content in internal memory, and inner core managing device then can be relied on automatically to upgrade the file of bottom.After saving the once transmission between kernel spacing and user's space, memory-mapped function mmap can also carry out improving performance by reducing the required internal memory used.
Accompanying drawing explanation
Fig. 1 is process flow diagram of the present invention;
Fig. 2 is principle schematic of the present invention;
Embodiment
Power information acquisition terminal based on built-in Linux stores the method for data, comprises the steps:
Step one, the data determining required storage and data length, define the base address of memory mapping area, and define the relativity shift for the address and base address storing each data in the process address space; Determine the length of required mapped inner-storage according to required storage data length, also determine the size treating Memory Mapping File and its simultaneously;
Step 2, the length according to storage data required in step one, the start byte treating Memory Mapping File and its and end byte detect the legitimacy treating Memory Mapping File and its, if file is legal, enter step 3; If do not conform to rule to create file according to required storage data length and file content is filled to null value and enter step 3 again;
Step 3, invoke memory mapping function mmap, set up and the mapping treating Memory Mapping File and its in step 2, memory-mapped function mmap return address given the base address of definition in step one;
The base address of the memory mapping area of definition and the relativity shift address read-write required storage data of other data in step 4, use step one.
Claims (3)
1., based on the method for the power information acquisition terminal storage data of built-in Linux, it is characterized in that comprising the steps:
Step one, the data determining required storage and data length, define the base address of memory mapping area, and define the relativity shift for the address and base address storing each data in the process address space;
Step 2, treat according to the length detection storing data required in step one legitimacy of Memory Mapping File and its if file is legal, to enter step 3; If do not conform to rule to create file according to required storage data length and file content is filled to null value and enter step 3 again;
Step 3, invoke memory mapping function mmap, set up and the mapping treating Memory Mapping File and its in step 2, memory-mapped function mmap return address given the base address of definition in step one;
The base address of the memory mapping area of definition and the relativity shift address read-write required storage data of other data in step 4, use step one.
2. the method for data is stored according to the power information acquisition terminal based on built-in Linux described in claim 1, it is characterized in that: the length determining required mapped inner-storage according to required storage data length, also determine the size treating Memory Mapping File and its simultaneously.
3. store the method for data according to the power information acquisition terminal based on built-in Linux described in claim 1, it is characterized in that: detect in described step 2 and treat that the condition of Memory Mapping File and its legitimacy also comprises the start byte of file and the end byte of file.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510683330.XA CN105224471B (en) | 2015-10-20 | 2015-10-20 | The method of power information acquisition terminal storage data based on built-in Linux |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510683330.XA CN105224471B (en) | 2015-10-20 | 2015-10-20 | The method of power information acquisition terminal storage data based on built-in Linux |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105224471A true CN105224471A (en) | 2016-01-06 |
CN105224471B CN105224471B (en) | 2018-04-13 |
Family
ID=54993455
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510683330.XA Active CN105224471B (en) | 2015-10-20 | 2015-10-20 | The method of power information acquisition terminal storage data based on built-in Linux |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105224471B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107329697A (en) * | 2017-06-27 | 2017-11-07 | 湖南威胜信息技术有限公司 | Power information data access method and its electric energy meter for embedded system |
CN108333398A (en) * | 2018-01-18 | 2018-07-27 | 研耀(上海)信息科技有限公司 | A kind of high energy saving electric meter |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090249019A1 (en) * | 2008-03-28 | 2009-10-01 | Inventec Corporation | Method of allocating physical memory in specified address range under linux system platform |
US20110283071A1 (en) * | 2010-05-17 | 2011-11-17 | Satoshi Yokoya | Dynamically Configurable Memory System |
CN103634353A (en) * | 2012-08-27 | 2014-03-12 | 国网电力科学研究院 | Electricity utilization information acquisition terminal and realizing method thereof |
-
2015
- 2015-10-20 CN CN201510683330.XA patent/CN105224471B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090249019A1 (en) * | 2008-03-28 | 2009-10-01 | Inventec Corporation | Method of allocating physical memory in specified address range under linux system platform |
US20110283071A1 (en) * | 2010-05-17 | 2011-11-17 | Satoshi Yokoya | Dynamically Configurable Memory System |
CN103634353A (en) * | 2012-08-27 | 2014-03-12 | 国网电力科学研究院 | Electricity utilization information acquisition terminal and realizing method thereof |
Non-Patent Citations (2)
Title |
---|
李湘波: "嵌入式智能电能抄表集中器的设计", 《万方数据(学位)》 * |
杨茹: "基于ARM的远程抄表系统研究与设计", 《中国优秀硕士学位论文全文数据库(工程科技Ⅱ辑)》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107329697A (en) * | 2017-06-27 | 2017-11-07 | 湖南威胜信息技术有限公司 | Power information data access method and its electric energy meter for embedded system |
CN108333398A (en) * | 2018-01-18 | 2018-07-27 | 研耀(上海)信息科技有限公司 | A kind of high energy saving electric meter |
Also Published As
Publication number | Publication date |
---|---|
CN105224471B (en) | 2018-04-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105556416B (en) | The power-failure protecting of low power state and recovery are utilized in data storage device/system | |
CN102375788B (en) | Method and device for dynamic allocation of power budget for a system having non-volatile memory | |
CN102799396B (en) | Memory device, interrupt control method and power-on time measuring method | |
CN103942160B (en) | Storage system, storage device and date storage method | |
CN105702300A (en) | NAND Flash fault tolerant system based on FPGA (Field Programmable Gate Array) | |
CN103229136B (en) | Disk array brush method and disk array brush device | |
CN108710583A (en) | Management method, device, computer equipment and the medium in SSD write buffers area | |
CN103064792A (en) | Method and device for writing data | |
CN104272390A (en) | Composed memory array comprising a flash array and a RAM array with data write to the RAM array and data read from the flash array | |
CN107430554A (en) | Storage cache performance is improved as the standard that cache is inserted by using the compressibility of data | |
CN105354152A (en) | Nonvolatile memory and wear leveling method | |
CN105808455A (en) | Memory access method, storage-class memory and computer system | |
CN103309626A (en) | Method for realizing multi-read-write port memorizer of network chip and corresponding memorizer | |
CN202472635U (en) | Flash memory wear leveling device | |
CN105474182A (en) | Storage device supporting periodic writes while in a low power mode for an electronic device | |
CN105224471A (en) | Power information acquisition terminal based on built-in Linux stores the method for data | |
CN109697017A (en) | Data memory device and non-volatile formula memory operating method | |
CN108829345A (en) | The data processing method and terminal device of journal file | |
CN103246584B (en) | Chip structure of system-on-chip and method for storing debug information | |
CN104252423A (en) | Consistency processing method and device based on multi-core processor | |
CN110275678A (en) | A kind of solid-state memory random access performance method for improving based on STT-MRAM | |
CN110442299A (en) | Method for writing data, memorizer control circuit unit and memorizer memory devices | |
CN209182809U (en) | A kind of movable storage device | |
CN103226524B (en) | The FIFO system that bad block and empty block to Nandflash are managed collectively | |
CN202929443U (en) | Hand-held CAN bus data analytical equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |