CN102495808B - Method for saving memory space - Google Patents
Method for saving memory space Download PDFInfo
- Publication number
- CN102495808B CN102495808B CN201110378046.3A CN201110378046A CN102495808B CN 102495808 B CN102495808 B CN 102495808B CN 201110378046 A CN201110378046 A CN 201110378046A CN 102495808 B CN102495808 B CN 102495808B
- Authority
- CN
- China
- Prior art keywords
- data
- buffer
- memory
- type
- value
- 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.)
- Expired - Fee Related
Links
Landscapes
- Memory System Of A Hierarchy Structure (AREA)
- Techniques For Improving Reliability Of Storages (AREA)
- Memory System (AREA)
Abstract
The invention provides a method for saving memory space. The method comprises the following steps of: calculating the total quantity of data according to the length of analyzing time and the type of data to be acquired; presetting a buffer memory area of a certain size in a memory according to the total quantity of the data; determining the type of cache data according to the type of analytical data; establishing a control block for saving control block information; inserting the acquired data into the buffer memory area according to the type of the data according to a ranking algorithm specific to different cache data types, and correspondingly updating information in the control block; and acquiring, and calculating a result according to contents in the control block. Due to the adoption of a technical scheme provided by the invention, memory is required to be allocated in an amount which is only 5 percent of all data, memory required to be allocated can be greatly reduced, and the memory space is saved. The method has incomparable advantages for an embedded system with a small memory capacity.
Description
Technical field
The present invention relates to power quality analysis field, particularly relate to a kind of method of saving memory headroom, the method can be applicable in the Analysis System for Power Quality based on EN50160 agreement.
Background technology
When carrying out the analysis based on EN50160 standard in embedded system application, often run into the electrical measurement data in Water demand a period of time, now require that distributing corresponding memory headroom stores these data.But the time interval of analysis is longer, need the memory headroom of distribution larger, the internal memory limited relative to embedded system, the memory headroom taken is comparatively considerable, and for the analysis based on EN50160 standard of long-time data, usually adopts the method for piecewise analysis.
But, when applying above-mentioned piecewise analysis mechanism, inventor finds that in prior art, at least there are the following problems: the computing power being limited to embedded system, can not carry out aggregate analysis to long-time data, committed memory space is relatively large, easy consume system resources.
Summary of the invention
Embodiments of the invention provide a kind of save memory headroom method, it can be used in the analytic system based on EN50160 standard, to realize carrying out aggregate analysis to long-time data under the prerequisite of saving memory headroom.
For achieving the above object, an aspect of of the present present invention provides a kind of method of saving memory headroom, and it comprises: the total amount calculating data according to the length of analysis time and the type of data to be collected; According to total amount preset buffer storage (buffer) with a certain size in internal memory of these data; Data cached type is determined according to analysis data type; Set up controll block and preserve controll block information; Be inserted into gathering the data come in buffer storage according to the sort algorithm for the data cached type of difference according to the type of data, and the corresponding information upgraded in controll block; And, after collection, calculate result according to the content in controll block.
Further, predistribution size to be a certain proportion of internal memory of data total amount can be 5% internal memory.
Further, described controll block information at least comprises data buffer pointer, the data buffer pointer of buffer memory minimum value data, the data cached type of the data total amount of Water demand, the data amount check adding analysis, the data amount check meeting the limit value of EN50160 agreement, buffer memory maximum value data.Wherein EN50160 agreement be used to judge supplier the standard whether quality of electric energy qualified is provided.
Further, data cached type comprises: a buffer memory maximum 5%, a buffer memory minimum 5%, buffer memory maximum 2.5% and minimum 2.5% etc.;
Further, according to sort algorithm, Data Update is comprised to the step in buffer memory, according to descending algorithm by Data Update in maximum value data buffer zone, if data buffer overflow, then discard minimum value; Or, according to ascending order algorithm by Data Update in minimum value data buffer, if data buffer overflow, then discard maximum value;
Further, the step calculating result according to the content in controll block comprises:
For the only data type of buffer memory maximum 5% and the data type of a buffer memory minimum 5%, analysis module is according to the data cached buffer pointer in controll block information, from data cached buffer zone, take out first value, this value is EN50160 and analyzes 100% probable value needed; Round after data inserting number is multiplied by 0.05 in controll block, show that EN50160 analyzes 95% position of probable value data in data buffer needed, in data buffer, take out this value; The data amount check meeting EN50160 limit value in controll block can draw the qualification rate of data in EN50160 analysis divided by data inserting number.
For the data type of buffer memory maximum 2.5% and minimum 2.5%, analysis module is according to the data cached buffer pointer in controll block information, first value is taken out respectively from maximum value data buffer zone and minimum value data buffer, according to the deviation algorithm that EN50160 analyzes, calculate 100% probable value being EN50160 analysis and requiring that two value large deviations are large; Round after in controll block, data inserting number is multiplied by 0.025, from maximal value, minimum value data buffer, the data of relevant position are taken out respectively as positional information, according to the deviation algorithm that EN50160 analyzes, calculate 95% probable value being EN50160 analysis and requiring that two value large deviations are large; The data amount check meeting EN50160 limit value in controll block can draw the qualification rate of data in EN50160 analysis divided by data inserting number.
Beneficial effect of the present invention is, by only separating certain space of internal memory as buffer storage, make to greatly reduce taking of internal memory, and owing to only calculating the little part in the tree numerical value that collects, therefore, without the need to taking the very large resource of processor when carrying out computational analysis to index and numerical value.
Accompanying drawing explanation
Fig. 1 is the distribution schematic diagram of data buffer in an embodiment of the present invention;
Fig. 2 is the distribution schematic diagram of data buffer in the another kind of embodiment of the present invention;
Fig. 3 is a kind of schematic flow sheet saving the method for memory headroom of the embodiment of the present invention.
Embodiment
With reference to the accompanying drawings the specific embodiment of the present invention is further described.
The method of the saving memory headroom in the present invention can be applicable in the Analysis System for Power Quality based on EN50160 agreement.EN50160 standard gives under normal operating conditions, the mains voltage parameter at user's points of common connection place of common low pressure and Medium voltage power supply system and their deviation ranges of allowing.Electric energy is a kind of product, as other products, should meet suitable quality requirements.True(-)running wanted by electric equipment, and needing provides electric energy for it with certain voltage grade, and voltage indices should within the specialized range of ratings.As user, supplier is to provide a side of electric power, and user buys power from suppliers, and the requirement supplier that has the right provides the electric energy meeting quality criteria requirements, and EN50160, exactly one be used for judge supplier the standard whether quality of electric energy qualified is provided.The many voltage parameters of EN50160 main definitions, topmost have: voltage effective value, voltage peak, and the slow liter of voltage is slow to fall, and quick voltage changes, instantaneous overvoltage, flickering, power failure, relative harmonic content, tri-phase unbalance factor etc.For these voltage parameters, EN50160 provides certain methods simultaneously, be used for calculating and according to result judge correlation parameter reach which kind of degree immediately with statistics time defective as this power index, namely create corresponding quality of power supply event at last, user is satisfying judges that the quality of power supply of supplier is defective accordingly.
System based on EN50160 agreement is generally embedded system, and adopt RAM or FLASH etc. to use as internal memory, by an embedded controller, such as, controller based on ARM framework realizes calling and data analysis, calculating of instruction.
This control program can be stored in a storer of this system, run following steps with reference to this control program of Fig. 3:
First, the total amount S101 of data is calculated according to the length of analysis time and the type of data to be collected; According to total amount preset buffer storage (buffer) S102 with a certain size in internal memory of these data; Data cached type S103 is determined according to analysis data type; Set up controll block and preserve controll block information S104; Be inserted into gathering the data come in buffer storage according to the sort algorithm for the data cached type of difference according to the type of data, and the corresponding information S105 upgraded in controll block; And, after collection, calculate result S106 according to the content in controll block.
Wherein, predistribution size to be a certain proportion of internal memory of data total amount can be 5% internal memory.
Further, described controll block information at least comprises data buffer pointer, the data buffer pointer of buffer memory minimum value data, the data cached type of the data total amount of Water demand, the data amount check adding analysis, the data amount check meeting the limit value of EN50160 agreement, buffer memory maximum value data.
With reference to Fig. 1,2 further, data cached type comprises: a buffer memory maximum 5%, a buffer memory minimum 5%, buffer memory maximum 2.5% and minimum 2.5% etc.
Further, according to sort algorithm, Data Update is comprised to the step in buffer memory, according to descending algorithm by Data Update in maximum value data buffer zone, if data buffer overflow, then discard minimum value; Or, according to ascending order algorithm by Data Update in minimum value data buffer, if data buffer overflow, then discard maximum value.
Further, the step calculating result according to the content in controll block comprises:
For the only data type of buffer memory maximum 5% and the data type of a buffer memory minimum 5%, analysis module is according to the data cached buffer pointer in controll block information, from data cached buffer zone, take out first value, this value is EN50160 and analyzes 100% probable value needed; Round after data inserting number is multiplied by 0.05 in controll block, show that EN50160 analyzes 95% position of probable value data in data buffer needed, in data buffer, take out this value; The data amount check meeting EN50160 limit value in controll block can draw the qualification rate of data in EN50160 analysis divided by data inserting number.
For the data type of buffer memory maximum 2.5% and minimum 2.5%, analysis module is according to the data cached buffer pointer in controll block information, first value is taken out respectively from maximum value data buffer zone and minimum value data buffer, according to the deviation algorithm that EN50160 analyzes, calculate 100% probable value being EN50160 analysis and requiring that two value large deviations are large; Round after in controll block, data inserting number is multiplied by 0.025, from maximal value, minimum value data buffer, the data of relevant position are taken out respectively as positional information, according to the deviation algorithm that EN50160 analyzes, calculate 95% probable value being EN50160 analysis and requiring that two value large deviations are large; The data amount check meeting EN50160 limit value in controll block can draw the qualification rate of data in EN50160 analysis divided by data inserting number.
Example 1 carries out the analysis based on EN50160 standard to the data in a week.
With the degree of unbalancedness data instance in electrical measurement data, EN50160 standard specifies that the sample interval of degree of unbalancedness data is 10 minutes.The total degree of unbalancedness data amount check calculating a week is 7 days * 24 hours * 60 minutes/10 minutes=1008 (individual).Therefore EN50160 is only concerned about for degree of unbalancedness data only needs the whether super upper limit to retain 5% of maximum data, so save as 1008*5%=51 (individual) in predistribution 5%.After starting analysis, within every 10 minutes, can obtain degree of unbalancedness data, be inserted in internal memory by these data through descending sort, after the total amount of data inserted is greater than 51, data in EMS memory can be overflowed, and all abandons minimum degree of unbalancedness data at every turn.After a week, altogether in internal memory, insert 1008 data, all can abandon minimum one when overflowing because each, so 5% maximum data can be retained in internal memory, the value being in 5% position is exactly that EN50160 analyzes 95% probable value needed.
Example 2 carries out EN50160 analysis to the data in a week
With the voltage effective value data instance in electrical measurement data, EN50160 standard specifies that the sample interval of voltage effective value data is 10 minutes.Total voltage effective value data amount check that therefore can calculate a week is 7 days * 24 hours * 60 minutes/10 minutes=1008 (individual), for voltage effective value data, EN50160 had both been concerned about that whether the super upper limit was also concerned about and whether super lower limit had therefore distributed the memory headroom of two piece 2.5% respectively.First piece of memory headroom size is 1008*2.5%=26 (individual), for depositing 2.5% data maximum in 1008 data; Second piece of memory headroom size is 1008*2.5%=26 (individual), for depositing 2.5% number minimum in 1008 data.After starting analysis, within every 10 minutes, voltage effective value data can be obtained, these data are inserted in first piece of memory headroom through descending sort, after the total amount of data inserted is greater than 26, data in EMS memory can be overflowed, and all abandons minimum voltage effective value data at every turn; Be inserted in second piece of memory headroom by these data through ascending order arrangement, after the data volume inserted is greater than 26, data in EMS memory can be overflowed, and all abandons maximum voltage effective value data at every turn.After a week, altogether insert 1008 data respectively in first piece of internal memory, second piece of internal memory, for first piece of internal memory, because each spilling all can abandon minimum data, so 2.5% maximum data can be retained in internal memory, the value being in 2.5% position is exactly that EN50160 analyzes the large value of 95% probability needed; For second piece of internal memory, because each spilling all can abandon maximum data, so 2.5% minimum data can be retained in internal memory, the value being in 2.5% position is exactly that EN50160 analyzes the little value of 95% probability needed.
Claims (3)
1. save a method for memory headroom, it is characterized in that, comprising:
The total amount of data is calculated according to the length of analysis time and the type of data to be collected;
According to total amount preset buffer storage with a certain size in internal memory of these data;
Data cached type is determined according to analysis data type;
Set up controll block and preserve controll block information;
Be inserted into gathering the data come in buffer storage according to the sort algorithm for the data cached type of difference according to the type of data, and the corresponding information upgraded in controll block; And
After collection, calculate result according to the content in controll block;
Wherein data cached type comprises: cache size image data maximum 5%, cache size image data minimum 5%, or maximum 2.5% and the image data of cache size image data minimum 2.5%;
According to sort algorithm, Data Update is comprised to the step in buffer memory, according to descending algorithm by Data Update in maximum value data buffer zone, if data buffer overflow, then discard minimum value; Or, according to ascending order algorithm by Data Update in minimum value data buffer, if data buffer overflow, then discard maximum value.
2. the method for saving memory headroom according to claim 1, is characterized in that: predistribution size to be a certain proportion of internal memory of data total amount be 5% internal memory.
3. the method for saving memory headroom according to claim 1, it is characterized in that: described controll block information at least comprises data buffer pointer, the data buffer pointer of buffer memory minimum value data, the data cached type of the data total amount of Water demand, the data amount check adding analysis, the data amount check meeting the limit value of EN50160 agreement, buffer memory maximum value data, wherein EN50160 agreement be used to judge supplier the standard whether quality of electric energy qualified is provided.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110378046.3A CN102495808B (en) | 2011-11-24 | 2011-11-24 | Method for saving memory space |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110378046.3A CN102495808B (en) | 2011-11-24 | 2011-11-24 | Method for saving memory space |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102495808A CN102495808A (en) | 2012-06-13 |
CN102495808B true CN102495808B (en) | 2014-12-17 |
Family
ID=46187633
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110378046.3A Expired - Fee Related CN102495808B (en) | 2011-11-24 | 2011-11-24 | Method for saving memory space |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102495808B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002319964A (en) * | 2001-04-24 | 2002-10-31 | Ando Electric Co Ltd | Circuit for detecting character string and protocol analyzer |
JP2004127140A (en) * | 2002-10-07 | 2004-04-22 | Hitachi Ltd | Risk prediction supporting method, and information processor |
CN1677934A (en) * | 2004-03-31 | 2005-10-05 | 华为技术有限公司 | Method and system for monitoring network service performance |
CN101995823A (en) * | 2010-09-28 | 2011-03-30 | 吴伪亮 | Energy-saving control method based on statistical forecasting technology |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8665892B2 (en) * | 2006-05-30 | 2014-03-04 | Broadcom Corporation | Method and system for adaptive queue and buffer control based on monitoring in a packet network switch |
-
2011
- 2011-11-24 CN CN201110378046.3A patent/CN102495808B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2002319964A (en) * | 2001-04-24 | 2002-10-31 | Ando Electric Co Ltd | Circuit for detecting character string and protocol analyzer |
JP2004127140A (en) * | 2002-10-07 | 2004-04-22 | Hitachi Ltd | Risk prediction supporting method, and information processor |
CN1677934A (en) * | 2004-03-31 | 2005-10-05 | 华为技术有限公司 | Method and system for monitoring network service performance |
CN101995823A (en) * | 2010-09-28 | 2011-03-30 | 吴伪亮 | Energy-saving control method based on statistical forecasting technology |
Also Published As
Publication number | Publication date |
---|---|
CN102495808A (en) | 2012-06-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105094272A (en) | Regulating method and regulating device for hardware refresh rate of terminal | |
CN109962856B (en) | Resource allocation method, device and computer readable storage medium | |
CN109981744B (en) | Data distribution method and device, storage medium and electronic equipment | |
CN1967620A (en) | Online visible energy consumption audit management system | |
CN113407426A (en) | Server cluster capacity evaluation method and device, electronic equipment and storage medium | |
CN106410781A (en) | Power consumer demand response potential determination method | |
CN104679590A (en) | Map optimization method and device in distributive calculating system | |
CN114519450A (en) | Power distribution network situation sensing method and system suitable for novel power system | |
JP2014180134A (en) | Power management system, and power management method | |
CN115081721A (en) | Power system optimization system of carbon emission factor | |
CN117590792B (en) | Intelligent control method, system, terminal and medium based on large-scale direct drinking water equipment | |
CN117575369B (en) | Rural building group energy consumption prediction method and system | |
CN102495808B (en) | Method for saving memory space | |
CN114418794A (en) | Building data analysis method and device, electronic equipment and storage medium | |
CN118093175A (en) | Computer resource distribution system and method based on big data analysis | |
CN103246539B (en) | Based on the generalized information system module loading method of user's use habit | |
CN117332005A (en) | Intelligent energy service information interaction method, system and storage medium | |
CN112182916A (en) | Power distribution network reliability marginal benefit and marginal cost analysis method and system | |
CN103413192A (en) | Unit dispatching method based on power grid dispatching automatic system power load curve | |
CN116307886A (en) | Method and device for monitoring production state of enterprise in real time | |
CN112423032B (en) | Data monitoring method and device based on smart television, electronic equipment and medium | |
CN114970928A (en) | Electric power data energy consumption analysis and prediction method | |
CN106247546B (en) | A kind of central air-conditioning implementation method and regulating device that can refine quota | |
CN104124681B (en) | A kind of micro-capacitance sensor is powered the computational methods of potential regulating power parameter | |
CN113098019B (en) | Power scheduling method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20141217 Termination date: 20151124 |