CN103792489A - Improved method for measuring and calculating system battery capacity - Google Patents
Improved method for measuring and calculating system battery capacity Download PDFInfo
- Publication number
- CN103792489A CN103792489A CN201310594558.2A CN201310594558A CN103792489A CN 103792489 A CN103792489 A CN 103792489A CN 201310594558 A CN201310594558 A CN 201310594558A CN 103792489 A CN103792489 A CN 103792489A
- Authority
- CN
- China
- Prior art keywords
- electric weight
- battery
- voltage
- processing
- current
- 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
- 238000000034 method Methods 0.000 title claims abstract description 56
- 238000012545 processing Methods 0.000 claims abstract description 94
- 238000001914 filtration Methods 0.000 claims abstract description 34
- 238000005259 measurement Methods 0.000 claims abstract description 31
- 238000004088 simulation Methods 0.000 claims description 23
- 230000008569 process Effects 0.000 claims description 22
- 230000008859 change Effects 0.000 claims description 13
- 230000002123 temporal effect Effects 0.000 claims description 9
- 238000004364 calculation method Methods 0.000 claims description 8
- 238000004321 preservation Methods 0.000 claims description 8
- 238000005286 illumination Methods 0.000 claims description 6
- 238000012986 modification Methods 0.000 claims description 5
- 230000004048 modification Effects 0.000 claims description 5
- 238000002203 pretreatment Methods 0.000 claims description 4
- 238000007599 discharging Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 6
- 238000004422 calculation algorithm Methods 0.000 description 5
- 238000013459 approach Methods 0.000 description 4
- 238000013461 design Methods 0.000 description 4
- 230000006872 improvement Effects 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000005094 computer simulation Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 210000005069 ears Anatomy 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000035772 mutation Effects 0.000 description 1
- 230000036316 preload Effects 0.000 description 1
Images
Landscapes
- Charge And Discharge Circuits For Batteries Or The Like (AREA)
- Secondary Cells (AREA)
Abstract
The invention discloses an improved method for measuring and calculating the battery power of a system, which comprises the following steps: the method comprises the following steps that firstly, voltage compensation is carried out on a reference voltage U obtained by a method of measuring the voltage of a battery by using an ADC (analog to digital converter) according to the state of main power consumption equipment of a system, and corresponding electric quantity is obtained through a voltage-electric quantity relation table according to the compensated voltage and is used as the measured electric quantity of the battery; and step two, performing one or more of anti-rebound processing, slope limit processing, analog charge and discharge processing, electric quantity filtering processing and electric quantity storage processing on the measured electric quantity of the battery, and updating the current display electric quantity of the battery with the processed electric quantity. The invention can only use the ADC voltage to measure the battery electric quantity method on the premise of not obtaining the current information, and can carry out one or more of anti-rebound processing, slope limit processing, analog charge and discharge processing, electric quantity filtering processing and electric quantity storage processing on the measured electric quantity obtained by the method, thereby greatly improving the measurement accuracy.
Description
Technical field
The present invention relates to a kind of computer automation measuring method, relate in particular to improving one's methods of a kind of measurements and calculations battery electric quantity.
Background technology
Use in the equipment of battery at panel computer, mobile phone etc., generally all need to show the electric weight of current battery.For the exigent occasion of measuring accuracy, generally to use the special chips such as coulombmeter.Coulombmeter, by measuring voltage, the charge/discharge current of battery, can accurately calculate the energy of battery storage and consumption, thereby draw current battery electric quantity.
For cost-saving, not very high consumption electronic product for accuracy requirement, conventionally can not use the special voltameter chip of this class, but carry out measurements and calculations battery electric quantity by the method for only measuring cell voltage by ADC.The party's ratio juris is, battery is under different electric weight, and its output voltage is different.Electric weight is more, and voltage is just higher, and on the contrary, electric weight is fewer, and voltage is just lower.But actual conditions are that cell voltage is singly not relevant with electric weight, also relevant with charge/discharge current.Be more difficult and measure battery current, therefore general consumption electronic product does not possess battery current measurement function.So do not increase any algorithm, be only to calculate battery electric quantity by voltage simply, effect is non-constant, has time error even can reach 50% more than.
For the problems referred to above, some design has just increased the voltage compensating function under different scenes on this basis.By the voltage measurement under different scenes, record voltage compensation value, then compensate according to different patterns recording after virtual voltage.Because voltage fluctuation is larger, voltage compensation is also difficult to do accurately, therefore generally also can, to the result of calculation computing such as simply average, make result seem more steady.
To sum up, the major defect of prior art comprises:
If 1 uses special coulombmeter chip, cost is higher, approximately need to increase by 0.5~1 U.S. dollar;
2, do not use coulombmeter chip, battery curve is unsmooth, electric weight display error large, fluctuation is large, for example electric weight fast rise when very large, the charging of battery electric quantity deviation before and after restarting systems, pull out charger electric weight fast-descending etc.
Summary of the invention
The present invention mainly solves under the restriction of no current measurement function, only uses the large and battery charging and discharging curve of the voltage system on-line measurement battery electric quantity deviation large problem that fluctuates.
For achieving the above object, the invention discloses improving one's methods of a kind of measurements and calculations system battery electric weight, specifically comprise the following steps:
Step 1, carry out voltage compensation according to the state of the main current consuming apparatus of system to utilizing ADC to measure the reference voltage U that cell voltage method obtains, and obtain the measuring electric quantity of corresponding electric weight as battery according to the voltage after compensation by voltage-electric weight relation table;
Step 2, to the measuring electric quantity of described battery carry out anti-bounce-back processing, slope limit process, simulation discharges and recharges processings, electric weight filtering is processed and preserve one or more in processing of electric weight, and by the current demonstration electric weight of electric weight renewal battery after treatment.
Preferably, described step 1 specifically comprises step:
Step 1, utilizes ADC to measure the reference voltage U of cell voltage method acquisition battery;
Step 2, according to the state of the main current consuming apparatus of system, calculates the bucking voltage of each described main current consuming apparatus according to following formula to each described main current consuming apparatus;
When battery is during in discharge condition: U
bucking voltage=U
compensating offset amount+ F (U) * V
currency/ V
maximal value,
When battery is during in charged state: U
bucking voltage=U
compensating offset amount-F (U) * V
currency/ V
maximal value;
Wherein, V
currencythe value of the corresponding attribute of current main current consuming apparatus, V
maximal valuebe the accessible maximal value of described corresponding attribute, F (U) is the function take described reference voltage as parameter, the maximum bucking voltage while representing to calculate main current consuming apparatus and operate in described corresponding attribute maximal value according to current described reference voltage; U
compensating offset amountfor compensating offset amount, its big or small state current to the main current consuming apparatus of system is relevant;
Step 3, calculates the summation of the bucking voltage of described reference voltage and all described main current consuming apparatus, the voltage after by way of compensation;
Step 4, obtains the measuring electric quantity of corresponding electric weight as battery according to the voltage after described compensation by voltage-electric weight relation table
Wherein, described main current consuming apparatus at least comprise that LCD is backlight, CPU and GPU; Backlight for LCD, described corresponding attribute is LCD backlight illumination, and for CPU, described corresponding attribute is CPU running frequency value, and for GPU, described corresponding attribute is GPU running frequency value.
The present invention is different from some and does not only carry out setting compensation value according to several specific application scenarioss by the scheme of current measurement equally, but calculates for selected main current consuming apparatus, can obtain voltage compensation value comparatively accurately.
In order further to solve, the demonstration electric weight error of described battery is large, battery curve is unsmooth, the problem such as large fluctuates, after described step 1, can also comprise to the measuring electric quantity of described battery carry out anti-bounce-back processing, slope limit process, simulation discharges and recharges processings, one or more in electric weight filtering processing, and/or comprises the preservation electric weight processing that is independent of step 1.Wherein said anti-bounce-back processing, slope limit and process, simulation discharges and recharges processings, each in processing of electric weight filtering is in the time of processing, all using the output electric weight of the next item up processing as the input electric weight when pre-treatment, and will work as the output electric weight of pre-treatment as the input electric weight of the next item down processing, the input electric weight of the processing being connected with described step 1 is through described step 1 measuring electric quantity after treatment, and the output electric weight of last processing is as the current demonstration electric weight of the described battery of step 2.
Wherein, described anti-bounce-back is processed and is specifically comprised: contrast inputting the current demonstration electric weight of electric weight and battery, when battery is during in discharge condition, if described input electric weight is greater than the current demonstration electric weight of described battery, adopt the current demonstration electric weight of described battery as output electric weight; When battery is during in charged state, if described input electric weight is less than the current demonstration electric weight of described battery, adopt the current demonstration electric weight of described battery as described output electric weight; Other situations adopt described input electric weight as output electric weight.
Described slope limits to process and specifically comprises: contrast inputting the current demonstration electric weight of electric weight and battery, if described input electric weight n
inbe greater than the current demonstration electric weight n of described battery
m, exporting electric weight is n
out=(int) ((n
in-n
m)/N+1)+n
m; If described input electric weight n
inbe less than described demonstration electric weight n
m, exporting electric weight is n
out=(int) ((n
in-n
m)/N-1)+n
m; If described input electric weight n
inequal described demonstration electric weight n
m, output electric weight is: n
out=n
in; Wherein n
inn
outand n
mnumerical value when showing with centesimal system before percentage sign, N is a coefficient of adjusting in real time according to current working current size.
What existing utilization was crossed is the mode of fixed slope,, no matter charging and discharging currents is how many, all uses fixing slope.The present invention can be according to the dynamic the tuned slope of current charging and discharging currents, thereby more approaches truth.
Described simulation discharges and recharges processing and specifically comprises: when system detects the not change within a period of time of the current demonstration electric weight of battery, if system in charged state, is calculated at the charged state Imitating required duration t that charges
c, at t
cwithin the scope of duration, by described input electric weight n
inadd 1 rate variation according to time per unit as output electric weight; If system in discharge condition, is calculated at the discharge condition Imitating required duration t that discharges
d, at t
dwithin the scope of duration, by described input electric weight n
insubtract 1 rate variation according to time per unit as output electric weight, wherein said n
innumerical value when representing with centesimal system before percentage sign.
Described electric weight filtering is processed and is specifically comprised: the value of input electric weight is joined to filtering queue end, data the earliest in queue are deleted, then all values in filtering queue is averaged as output electric weight.
The present invention has used queue-type filtering processing, rather than common average value filtering mode, makes not only can numerically produce in this way filter effect, also can produce in time filter effect.
The processing of described preservation electric weight comprises step: detecting that the current demonstration electric weight of battery changes, or exceed Preset Time, or when user's modification time, will preserve described demonstration electric weight and temporal information to file system, the measurement of electric weight is calculated when participating in next system boot.When next system boot, first from file system, load last information about power and temporal information, then with the current electric weight calculating and time contrast, if electric weight is more or less the same, and the time change and do not exceed the value of appointment, think that the information about power being loaded into is effective from file system, follow-up calculating is all carried out on this basis, if electric weight deviation is larger, directly use the current charge value calculating, the information about power of storage before ignoring.
Embodiment of the present invention technical matters to be solved is can not obtain under the prerequisite of current information, for only using ADC voltage measurement battery electric quantity method, and by the improvement on the method and algorithm, make accuracy of measurement significantly increase, battery charging and discharging curve more approaches truth, thereby greatly promotes user's experience.
Implement the embodiment of the present invention, there is following beneficial effect:
1, contrast is used the scheme of special coulombmeter chip or increase current measurement, and the present invention increases extra cost hardly, directly uses the ADC that chip carries can complete battery electric quantity measurement function;
2, contrast the scheme that similar no current is measured, because the present invention has used more accurate voltage compensating method and algorithm, the result that the present invention records is more accurate;
3, contrast the scheme that similar no current is measured, because having used good algorithm and intelligent parameter, the present invention adjusts function, for example dynamic Slope restrictions function, simulation discharge and recharge processing procedure, queue-type filtering processing etc., make the battery charging and discharging curve that the present invention obtains more approach truth;
4, contrast similar measurement scheme, have benefited from electric weight of the present invention and preserve the pre-loaded function of processing and start shooting, the present invention starts shooting or restarts afterwards in shutdown at once, and electric weight can not suddenly change.
Accompanying drawing explanation
Fig. 1 is the process flow diagram of one embodiment of the present of invention.
Fig. 2 is the particular flow sheet of the step S01 shown in Fig. 1.
Fig. 3 is the process flow diagram that the embodiment of the present invention is calculated bucking voltage.
Fig. 4 is that the embodiment of the present invention is tabled look-up and obtained measuring electric quantity process flow diagram.
Fig. 5 is the process flow diagram of an alternative embodiment of the invention.
Fig. 6 is the anti-bounce-back processing flow chart of the embodiment of the present invention.
Fig. 7 is that embodiment of the present invention slope limits processing flow chart.
Fig. 8 is that embodiment of the present invention simulation discharges and recharges processing flow chart.
Fig. 9 is embodiment of the present invention electric weight filtering processing flow chart.
Figure 10 is that the embodiment of the present invention is preserved electric weight processing flow chart.
Figure 11 is embodiment of the present invention start preload process process flow diagram.
Embodiment
For making the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, the present invention is described in further detail.
As shown in Figure 1, be the process flow diagram of one embodiment of the invention, specifically comprise step:
S01, carry out voltage compensation according to the state of the main current consuming apparatus of system to utilizing ADC to measure the reference voltage U that cell voltage method obtains, and obtain the measuring electric quantity of corresponding electric weight as battery according to the voltage after compensation by voltage-electric weight relation table;
S02, to the measuring electric quantity of described battery carry out anti-bounce-back processing, slope limit process, simulation discharges and recharges processings, electric weight filtering is processed and preserve one or more in processing of electric weight, and by the current demonstration electric weight of electric weight renewal battery after treatment.
Below in conjunction with Fig. 2, first describe the implementation of the step S01 in this embodiment in detail, specifically comprise step:
S11, utilizes ADC to measure the reference voltage of cell voltage method acquisition battery, preferably, is changed and averaged obtaining reference voltage by continuous 10 AD;
S12, according to the state of the main current consuming apparatus of system, calculates the bucking voltage of each described main current consuming apparatus;
S13, calculates the summation of the bucking voltage of described reference voltage and all described main current consuming apparatus, the voltage after by way of compensation;
S14, obtains the measuring electric quantity of corresponding electric weight as battery according to the voltage after described compensation by voltage-electric weight relation table;
S15, with the current demonstration electric weight of measuring electric quantity renewal battery of described battery.
Wherein, in described step S12, main current consuming apparatus is selected different equipment according to different systems.For example, in panel computer, LCD backlight and CPU, GPU are main current consuming apparatus, and power consumption is fixing.Therefore by measuring Different L CD backlight illumination, cpu frequency, the voltage deviation value of GPU frequency under different cell voltages, then pass through curve, obtain the data of some key points, and then can calculate voltage compensation value according to actual LCD backlight illumination, cpu frequency, GPU frequency, thereby can calculate more exactly battery electric quantity.
Suppose that the current cell voltage measuring by ADC is U, can be expressed as U by the voltage after compensation so
c=U+U
blc+ U
cpuc+ U
gpuc.Wherein U
cfor the voltage after compensation, U
blcfor LCD backlight compensation voltage, U
cpucfor CPU bucking voltage, U
gpucfor GPU bucking voltage.
LCD backlight compensation voltage U
blc=U
bl_offset+ F
bl(U) * V
bl/ V
blmax, wherein U
bl_offsetfor compensating offset amount, all relevant to actual system, the battery using etc., need actual measurement to determine; F
blbe a function, its can calculate the offset of high-high brightness according to current voltage value, and the battery that this function is backlight to actual LCD, use etc. are all relevant, need actual measurement decision; V
blcurrent LCD backlight brightness values, V
blmaxit is maximal value backlight.
CPU bucking voltage U
cpuc=U
cpu_offset+ F
cpu(U) * V
cpu/ V
cpumax, wherein U
cpu_offsetfor compensating offset amount, all relevant to actual system, the battery using etc., need actual measurement to determine; F
cpube a function, offset when it can calculate maximum cpu frequency according to current voltage value, this function is all relevant to actual CPU, the battery using etc., needs actual measurement to determine; V
cputhe running frequency value of current C PU, V
cpumaxit is the frequency maximal value of CPU operation.
GPU bucking voltage U
gpuc=U
gpu_offset+ F
gpu(U) * V
gpu/ V
gpumax, wherein U
gpu_offsetfor compensating offset amount, all relevant to actual system, the battery using etc., need actual measurement to determine; F
gpube a function, offset when it can calculate maximum GPU frequency according to current voltage value, this function is all relevant to actual GPU, the battery using etc., needs actual measurement to determine; V
gputhe running frequency value of current GPU, V
gpumaxit is the frequency maximal value of GPU operation.
In when charging, also need, cpu frequency backlight according to LCD, GPU frequency etc. to calculate the offset of charging voltage.Because in system, the total current that charger provides is fixed, and when the electric current of needs is large in the time that system is moved, can automatically reduce charging current.And different charging currents, even in the situation that battery capacity is identical, cell voltage is also different, therefore need to do voltage compensation for charging.The computing formula of charging voltage compensation computing formula during with electric discharge is in form substantially the same, and different places are, when backlight/when the increase of CPU/GPU electric current, bucking voltage reduces, therefore the parameter of use is different.The computing formula using when charging is in form: U
blc=U
bl_offset-F
bl(U) * V
bl/ V
blmax; U
cpuc=U
cpu_offset-F
cpu(U) * V
cpu/ V
cpumax; U
gpuc=U
gpu_offset-F
gpu(U) * V
gpu/ V
gpumax.
In addition, consider that USB mouth is in the time connecting computer and charger, the maximum current that can get is different, the measurement of battery electric quantity when this directly can have influence on charging.Therefore in the design, increase the function that feeder ear detects, in the time different feeder ears being detected, can use different compensating parameters.As preferably detecting according to being, while connecting computer, computer can and equipment carry out data communication, and do not have data communication when connecting charger.
For convenience of understanding, will be described voltage compensation treatment scheme by Fig. 3 below.
Suppose that the voltage recording by ADC measuring voltage method is U;
S131, has judged whether external power source input, if had, enters step S132, otherwise, enter step S134;
S132, judges whether the external power source connecting is computer, if so, enters step S133, otherwise, enter step 135;
S133, calculates LCD backlight compensation voltage U under computer model
blc, CPU bucking voltage U
cpuc, GPU bucking voltage U
gpuc;
S134, calculates LCD backlight compensation voltage U under discharge mode
blc, CPU bucking voltage U
cpuc, GPU bucking voltage U
gpuc;
S135, calculates LCD backlight compensation voltage U under charge mode
blc, CPU bucking voltage U
cpuc, GPU bucking voltage U
gpuc;
S136, according to formula U
c=U+U
blc+ U
cpuc+ U
gpuccalculate the voltage after compensation.
Figure 4 shows that in step S14 and table look-up and obtain the idiographic flow of battery electric quantity, specifically comprise step:
S141, judges that whether battery is in charged state, if be in charged state, enters step S142, otherwise enters step S143;
S142, obtains the measuring electric quantity of current battery by looking into charging voltage table, and enters step S144;
S143, obtains the measuring electric quantity of current battery by looking into sparking voltage table, and enters step S144;
S144, returns to the measuring electric quantity of current battery.
Although the demonstration electric weight that embodiment obtains as shown in Figure 2, pass through main current consuming apparatus matching voltage compensation curve, obtain battery electric quantity more accurately, if but adding anti-bounce-back processing, slope to limit on the basis of this embodiment processes again, simulation discharges and recharges processings, electric weight filtering is processed and preserve one or more in electric weight processing, will obtain the result that more approaches truth and meet people's psychology.
And understandable, described anti-bounce-back processing, slope limit and process, simulation discharges and recharges processings, electric weight filtering is processed and preserve electric weight processing is separate and regardless of order, can select its one or more processing according to the accurate demand of measurement.Preferably, on the basis of the demonstration electric weight of acquisition embodiment illustrated in fig. 2, carry out above-mentioned whole processing.
As shown in Figure 5, be the process flow diagram of a preferred embodiment of the invention, comprise step:
S1, obtain battery measurement electric weight: identical with the step S11 to S14 of the first embodiment, according to the state of the main current consuming apparatus of system, the reference voltage that utilizes ADC measurement cell voltage method to obtain is carried out to voltage compensation, and determine the measuring electric quantity of battery according to the voltage after compensation.
S2, anti-bounce-back processing: suppose that current demonstration electric weight is n
mif, confirm that battery is in discharge condition, for example not connecting charger bright screen operation, is greater than n for calculating so
mresult should abandon, otherwise battery not in charging but battery electric quantity rise can be to the experience of the no good cake of user, the now direct value n of the current demonstration electric weight of use
mas the result of this step processing; Equally, if confirm that battery is in charged state, and the electric weight calculating is less than n
m, also to abandon, the situation that while preventing battery charging, battery electric quantity declines on the contrary occurs, and correspondingly also uses the value n of current demonstration electric weight
mas the result of this step processing; For other situations, the measuring electric quantity that use obtains through S1 step is as the result of this step processing.
S3, slope limits to be processed: directly do not use the result through step S2, but according to current demonstration electric weight, to doing further adjustment through step S2 electric weight after treatment.According to the state of the current charging and discharging state of system and main current consuming apparatus, calculate an electric quantity change rate N, utilize the amplitude of this rate of change limit electric quantity change, pin down in time the rapid fluctuations of battery electric quantity.Suppose, the result note that described step S2 is processed is n
in, current demonstration electric weight is denoted as to n
m.Work as n
incompare n
mwhen large, according to formula ((int) (n
in-n
m)/N+1)+n
mdescribed step S2 result is further adjusted; Work as n
incompare n
mhour, according to formula ((int) (n
in-n
m)/N-1)+n
mdescribed step S2 result is further adjusted; Work as n
inequal n
mtime, do not adjust; Wherein n
inand n
mnumerical value when showing with centesimal system before percentage sign.
S4, simulation discharges and recharges processing: if system detects described not change of demonstration electric weight long period, and in the situation of the charging and discharging state of clear and definite battery, make described through step S3 electric weight after treatment one according to definite time of system current state in, change with the amplitude changing when normally discharging and recharging.Due to the speed that discharges and recharges of simulation than reality to discharge and recharge speed slow, therefore, after a period of time, the electric weight calculating can be close to the electric weight showing gradually, finally the two equates.When such processing makes user feel to charge, battery electric quantity rises more equably, and when electric discharge, battery electric quantity more all declines.
S5, electric weight filtering processing: the electric weight obtaining after above step adjustment is joined to a smothing filtering queue, and data the earliest in queue are deleted, then average and calculate final battery electric quantity.And result is used for upgrading described demonstration electric weight.
S6, preserve electric weight processing: detecting that the current demonstration electric weight of battery changes, or exceed Preset Time apart from preserving last time, or when user's modification time, to preserve the value of current described demonstration electric weight and temporal information to file system, the measurement calculating of electric weight when participating in next system boot.
The concrete steps of wherein said anti-bounce-back treatment S 2 are as shown in Figure 6:
Before carrying out described anti-bounce-back treatment S 2, first load and obtain the result of battery measurement processing as the input electric weight of anti-bounce-back processing; Described anti-bounce-back is processed and is specifically comprised step:
S21, judges that whether battery is in charged state.If battery is in charged state, enters step S22, otherwise enter step S23;
S22, judges whether input electric weight is less than demonstration electric weight, if, enter step S24, otherwise, step S25 entered;
S23, judges whether input electric weight is greater than demonstration electric weight, if, enter step S24, otherwise, step S25 entered;
S24, is assigned to output electric weight by the value of current demonstration electric weight;
S25, is assigned to output electric weight by the value of input electric weight.
Use after above processing, although can effectively improve the accuracy that battery electric quantity is measured, effect or not ideal enough.Main cause is that system complexity is too high, can not completely accurately all module ruuning situation be converted into voltage compensation value, and its characteristic of different batteries is also different, adds ADC measuring error etc., and the result fluctuating range finally obtaining is still larger.Consider that battery electric quantity can not undergo mutation, therefore the embodiment of the present invention limits and processes and electric weight filtering processing carry out slope through said method result after treatment again, pins down in time the rapid fluctuations of battery electric quantity.Described slope limits the concrete steps processed as shown in Figure 7:
Limit before treatment step at the described slope of execution, first the output electric weight of load step S2 limits the input electric weight n processing as slope
in; Described slope limits to process and comprises step:
S31, judgement input electric weight n
inwhether be greater than and show electric weight n
m, if so, enter step S32, otherwise, step S34 entered;
S32, according to LCD backlight illumination V
bl, CPU running frequency V
cpu, GPU running frequency V
gpuand whether connect computer slope calculations coefficient N;
S33, output electric weight n
outfor n
out=((int) (n
in-n
m)/N+1)+n
m;
S34, judgement input electric weight n
inwhether be less than and show electric weight n
m, if so, enter step S35, otherwise, step S37 entered;
S35, according to LCD backlight illumination V
bl, CPU running frequency V
cpu, GPU running frequency V
gpuand whether connect computer slope calculations coefficient N;
S36, output electric weight n
outfor n
out=((int) (n
in-n
m)/N-1)+n
m;
S37, is assigned to output electric weight by the value of input electric weight.
Preferably, in step S32, the account form of N is as follows:
Charged state: N=10+ (30*V
bl/ V
blmax)+(10*V
cpu/ V
cpumax)+(10*V
gpu/ V
gpumax),
Discharge condition: N=60-(30* (V
bl)/V
blmax)-(10*V
cpu/ V
cpumax)-(10*V
gpu/ V
gpumax),
The wherein value of numeral, adjust according to actual battery, backlight, CPU, GPU.
Use after such algorithm, the maximum rate of change of battery electric quantity is limited, thereby reaches good smooth effect.
After just disconnecting charger or long-time heavy-duty service just insert charger or charging a period of time and battery underfill after discharge a period of time and battery do not discharge time, be then transferred to suddenly underrun etc., these time electric weight be only the most difficult calculating by voltage, generally all can there is the situation that deviation is larger.Owing to having added anti-bounce-back measure, situation about conventionally occurring is exactly that the battery electric quantity showing in a very long time all remains on same level, and in fact battery in charge or discharge.For this situation, the present embodiment adopts simulation to discharge and recharge processing, according to carrying out simulated battery charge and discharge process than normally discharging and recharging slow speed.Due to the speed that discharges and recharges of simulation be bound to than reality to discharge and recharge speed slow, therefore, after a period of time, the charge value calculating can be close to the charge value showing gradually, finally shows that electric weight will equate with the charge value calculating.The concrete steps that described simulation discharges and recharges processing are as shown in Figure 8:
Discharge and recharge before treatment step carrying out described simulation, first load the input electric weight n that the result of anti-bounce-back processing discharges and recharges as simulation
in; Described simulation discharges and recharges to process and comprises step:
S41, judges and shows whether electric weight changes, and if so, enters step S42, otherwise, enter step S43;
S42, zero clearing timer T
s, and enter step S411;
S43, judges that whether battery is in charged state, if so, enters step S44, otherwise, enter step S45;
S44, calculates when under precondition the time t that charging should change
c, and enter step S46;
S45, judges that whether battery is in discharge condition, if so, enters step S47, otherwise, enter step S411;
S46, judges T
swhether be greater than t
c,, if so, enter step S48, otherwise enter step S411;
S47, calculates when under precondition the time t that electric discharge should change
d, and enter step S49;
S48, calculates output electric weight n
out=n
in+ 1, zero clearing timer T
s, and enter S412;
S49, judges T
swhether be greater than t
d, if so, enter step S410, otherwise enter step S411;
S410, calculates output electric weight n
out=n
in-1, zero clearing timer T
s, and enter step S412;
S411, is assigned to output electric weight by the value of input electric weight;
S412, returns to output electric weight.
After such processing, when user can feel to charge, battery electric quantity rises more equably, and when electric discharge, battery electric quantity declines more equably, and there will not be the long-time situation in same level, thereby has promoted well user's experience.
The concrete steps of described electric weight filtering processing as shown in Figure 9, carrying out before described electric weight filtering treatment step, first discharge and recharge described simulation the result of processing as the input electric weight of described electric weight filtering processing, and described electric weight filtering is processed and specifically comprised step:
S51, removes value the earliest in filtering queue;
S52, joins queue end by the value of input electric weight;
S53, averages and is assigned to output electric weight all values in filtering queue.
By such processing, the fluctuation in positive and negative scope is cancelled out each other, thereby reach good smooth effect.
System is after shutdown, and the software that calculates electric weight just cannot normally move, and recalculates battery electric quantity when therefore common way is exactly each start.Due to some above-mentioned reasons, the electric weight finally calculating may with shutdown before electric weight deviation 10% even more, this can be to the very bad experience of client.In order to address this problem, native system is designed with inserts charger automatic turn-on function, and adds the processing of described preservation electric weight.As shown in figure 10, the concrete steps of described preservation electric weight processing are:
S61, judges and shows whether electric weight changes, and if so, enters step S64, otherwise enters step S63;
S62, judges whether user revises system time, if so, enters step S64;
S63, whether judging distance last saved has reached t
saveduration, if reached, enter step S64, otherwise, enter step S66, wherein t
saveit is a predefined value;
S64, preserves current electric quantity information and temporal information to file system;
S65, empties the timer T for recording distance last saved
nc;
S66, preservation completes.
The meaning of described preservation electric weight processing is to calculate while start as next time the reference of electric weight.Next time, while start,, when for example user manually starts shooting or slotting charger charges start, first last electric weight and the temporal information of loading from file system, then with the current battery electric quantity calculating and time contrast.If battery electric quantity is more or less the same, and the time change and do not exceed the value of appointment, think that the battery electric quantity information being loaded into is effective from file system, follow-up calculating is all carried out on this basis.So just can guarantee that user is restarting or the unused time is not grow very much in the situation that, guarantees the consistance that battery electric quantity shows.If battery electric quantity deviation is larger, for example user changes battery, or time deviation for a long time or temporal regression, for example, after changing battery or long-time shutdown, battery has been missed a lot, at this moment when user also not too remembers to shut down for the last time conventionally, how many battery electric quantities has been, so just directly use the current charge value calculating, and the information about power of storage before neglecting.If can not get the information about power of last storage in the time of start, can only directly use so the battery electric quantity calculating.When this situation only can occur in plant produced conventionally, therefore can not affect user and normally use.
The concrete steps of described start prestrain as shown in figure 11, comprise step:
S71, obtains the measuring electric quantity of battery according to the step of S1;
S72, the measuring electric quantity that S71 step is obtained carries out electric weight filtering processing according to the step of S5;
S73, judges that whether filtering queue is full, if so, enters step S74, otherwise, return to step S71;
S74 loads information about power and temporal information from file system;
S75, judges that whether the information about power loading from file system is effective, if effectively, enter step S76, otherwise do not deal with;
S76, setting current demonstration electric weight is the charge value of preserving, and uses the charge value of preserving to fill filtering queue;
S77, opening initialization completes.
Except above-mentioned processing, in the design, also use average voltage, filtered the conventional design such as value, look-up table conversion battery electric quantity that variance is larger, in this document, do not describe in detail.Be appreciated that the present invention is applied in the system of no current measurement, but the disposal route of the present invention to battery electric quantity, in the system or coulomb chip that obviously also can measure for belt current.
It should be noted that, although above-described embodiment has used in one embodiment described anti-bounce-back processing, slope to limit and has processed, simulation discharges and recharges processing, electric weight filtering is processed and preserve electric weight processing, but these six processing must all not used in one embodiment, can be as required only select wherein one or more with optimum results.Described anti-bounce-back processing simultaneously, the processing sequence that slope restriction is processed, simulation discharges and recharges processing, electric weight filtering processing neither, as shown in above-described embodiment, can be made corresponding suitable adjustment according to user's needs.
The above is the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications are also considered as protection scope of the present invention.
Claims (10)
1. improving one's methods of a measurements and calculations system battery electric weight, is characterized in that, comprises the following steps:
Step 1, carry out voltage compensation according to the state of the main current consuming apparatus of system to utilizing ADC to measure the reference voltage U that cell voltage method obtains, and obtain the measuring electric quantity of corresponding electric weight as battery according to the voltage after compensation by voltage-electric weight relation table;
Step 2, to the measuring electric quantity of described battery carry out anti-bounce-back processing, slope limit process, simulation discharges and recharges processings, electric weight filtering is processed and preserve one or more in processing of electric weight, and by the current demonstration electric weight of electric weight renewal battery after treatment.
2. method according to claim 1, is characterized in that, described step 1 specifically comprises the following steps:
Step 1, utilizes ADC to measure the reference voltage U of cell voltage method acquisition battery;
Step 2, according to the state of the main current consuming apparatus of system, calculates the bucking voltage of each described main current consuming apparatus according to following formula to each described main current consuming apparatus;
When battery is during in discharge condition: U
bucking voltage=U
compensating offset amount+ F (U) * V
currency/ V
maximal value,
When battery is during in charged state: U
bucking voltage=U
compensating offset amount-F (U) * V
currency/ V
maximal value;
Wherein, V
currencythe value of the corresponding attribute of current main current consuming apparatus, V
maximal valuebe the accessible maximal value of described corresponding attribute, F (U) is the function take described reference voltage as parameter, the maximum bucking voltage while representing to calculate main current consuming apparatus and operate in described corresponding attribute maximal value according to current described reference voltage; U
compensating offset amountfor compensating offset amount, its big or small state current to the main current consuming apparatus of system is relevant;
Step 3, calculates the summation of the bucking voltage of described reference voltage and all described main current consuming apparatus, the voltage after by way of compensation;
Step 4, obtains the measuring electric quantity of corresponding electric weight as battery according to the voltage after described compensation by voltage-electric weight relation table.
3. method according to claim 2, is characterized in that, described main current consuming apparatus at least comprises that LCD is backlight, CPU and GPU; Backlight for LCD, described corresponding attribute is LCD backlight illumination, and for CPU, described corresponding attribute is CPU running frequency value, and for GPU, described corresponding attribute is GPU running frequency value.
4. method according to claim 1, it is characterized in that, described anti-bounce-back processing, slope limit and process, simulation discharges and recharges processings, each in processing of electric weight filtering is in the time of processing, all using the output electric weight of the next item up processing as the input electric weight when pre-treatment, and will work as the output electric weight of pre-treatment as the input electric weight of the next item down processing, the input electric weight of the processing being connected with described step 1 is through described step 1 measuring electric quantity after treatment, and the output electric weight of last processing is as the current demonstration electric weight of the described battery of step 2.
5. method according to claim 4, it is characterized in that, described anti-bounce-back is processed and is specifically comprised: contrast inputting the current demonstration electric weight of electric weight and battery, when battery is during in discharge condition, if described input electric weight is greater than the current demonstration electric weight of described battery, adopt the current demonstration electric weight of described battery as output electric weight; When battery is during in charged state, if described input electric weight is less than the current demonstration electric weight of described battery, adopt the current demonstration electric weight of described battery as described output electric weight; Other situations adopt described input electric weight as output electric weight.
6. method according to claim 4, is characterized in that, described slope limits to process and specifically comprises: input electric weight and the current demonstration electric weight of battery are contrasted, if described input electric weight n
inbe greater than the current demonstration electric weight n of described battery
m, export electric weight n
outfor: n
out=(int) ((n
in-n
m)/N+1)+n
m; If described input electric weight n
inbe less than described demonstration electric weight n
m, export electric weight n
outfor: n
out=(int) ((n
in-n
m)/N-1)+n
m; If described input electric weight n
inequal described demonstration electric weight n
m, output electric weight n
outfor: n
out=n
in; Wherein n
inn
outand n
mnumerical value when showing with centesimal system before percentage sign, N is the coefficient of adjusting in real time according to current working current size.
7. method according to claim 4, it is characterized in that, described simulation discharges and recharges processing and specifically comprises: when system detects that the current demonstration electric weight of battery is within a period of time not when change, if system in charged state, is calculated at the charged state Imitating required duration t that charges
c, at t
cwithin the scope of duration, by described input electric weight n
inadd 1 rate variation according to time per unit as output electric weight; If system in discharge condition, is calculated at the discharge condition Imitating required duration t that discharges
d, at t
dwithin the scope of duration, by described input electric weight n
insubtract 1 rate variation according to time per unit as output electric weight, wherein said n
innumerical value when representing with centesimal system before percentage sign.
8. method according to claim 4, it is characterized in that, described electric weight filtering is processed and is specifically comprised: the value of input electric weight is joined to filtering queue end, data the earliest in queue are deleted, then all values in filtering queue is averaged as output electric weight.
9. method according to claim 1, it is characterized in that, the processing of described preservation electric weight comprises step: detecting that the current demonstration electric weight of battery changes, or exceed Preset Time apart from last saved, or when user's modification time, to preserve described demonstration electric weight and temporal information to file system, the measurement of electric weight is calculated when participating in next system boot.
10. method according to claim 9, it is characterized in that, described preservation electric weight is processed and is also comprised step: in the time of next system boot, first from file system, load information about power and the temporal information of before shutdown, finally preserving, and calculate the measuring electric quantity in when start, then the electric weight being loaded into described in contrast and the measuring electric quantity of described calculating, if the two electric weight is more or less the same, and the time changes the value that does not exceed appointment, think that the described information about power being loaded into is effective from file system, demonstration electric weight initial after start calculates the information about power according to described loading, if electric weight deviation is larger, the measuring electric quantity calculating described in directly using, the information about power of storage before ignoring.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310594558.2A CN103792489B (en) | 2013-11-22 | 2013-11-22 | Improved method for measuring and calculating system battery capacity |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310594558.2A CN103792489B (en) | 2013-11-22 | 2013-11-22 | Improved method for measuring and calculating system battery capacity |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103792489A true CN103792489A (en) | 2014-05-14 |
CN103792489B CN103792489B (en) | 2017-03-22 |
Family
ID=50668351
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310594558.2A Active CN103792489B (en) | 2013-11-22 | 2013-11-22 | Improved method for measuring and calculating system battery capacity |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103792489B (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105068016A (en) * | 2015-09-18 | 2015-11-18 | 杰华特微电子(张家港)有限公司 | Battery power display control method and battery power display control circuit |
WO2016041398A1 (en) * | 2014-09-16 | 2016-03-24 | 中兴通讯股份有限公司 | Method for storing battery level information of mobile terminal and mobile terminal |
CN105975879A (en) * | 2016-04-29 | 2016-09-28 | 宇龙计算机通信科技(深圳)有限公司 | Control method and device for displayed electric quantity of terminal |
CN106093780A (en) * | 2016-05-31 | 2016-11-09 | 青岛海信移动通信技术股份有限公司 | A kind of terminal residual electricity determines method and terminal |
CN106680728A (en) * | 2016-12-30 | 2017-05-17 | 深圳天珑无线科技有限公司 | Electricity quantity detecting method and device |
CN107479001A (en) * | 2017-08-25 | 2017-12-15 | 深圳金仕盾照明科技有限公司 | A kind of battery electric quantity checking device and light fixture |
CN107703461A (en) * | 2017-11-20 | 2018-02-16 | 普联技术有限公司 | The battery electric quantity display control method and display control unit of a kind of electronic equipment |
CN108344952A (en) * | 2018-02-26 | 2018-07-31 | 深圳市道通智能航空技术有限公司 | Battery power amount calculation method and its device |
CN110850313A (en) * | 2019-11-14 | 2020-02-28 | 宁波德晶元科技有限公司 | Lithium battery charging and discharging electric quantity display method and system |
CN112130082A (en) * | 2019-06-05 | 2020-12-25 | 海能达通信股份有限公司 | Method and equipment for calculating battery electric quantity and device with storage function |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5631540A (en) * | 1994-11-23 | 1997-05-20 | Lucent Technologies Inc. | Method and apparatus for predicting the remaining capacity and reserve time of a battery on discharge |
CN101126796A (en) * | 2007-10-12 | 2008-02-20 | 深圳华为通信技术有限公司 | Battery electric quantity detecting method and device |
CN102739845A (en) * | 2011-04-11 | 2012-10-17 | 国基电子(上海)有限公司 | Electronic device capable of detecting battery power and battery power detection method |
CN103176132A (en) * | 2011-12-22 | 2013-06-26 | 联芯科技有限公司 | Estimation method and terminal device of electricity quantity of battery |
CN103217649A (en) * | 2013-03-28 | 2013-07-24 | 广东欧珀移动通信有限公司 | Method and device for displaying electric quantity, and mobile device |
-
2013
- 2013-11-22 CN CN201310594558.2A patent/CN103792489B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5631540A (en) * | 1994-11-23 | 1997-05-20 | Lucent Technologies Inc. | Method and apparatus for predicting the remaining capacity and reserve time of a battery on discharge |
CN101126796A (en) * | 2007-10-12 | 2008-02-20 | 深圳华为通信技术有限公司 | Battery electric quantity detecting method and device |
CN102739845A (en) * | 2011-04-11 | 2012-10-17 | 国基电子(上海)有限公司 | Electronic device capable of detecting battery power and battery power detection method |
CN103176132A (en) * | 2011-12-22 | 2013-06-26 | 联芯科技有限公司 | Estimation method and terminal device of electricity quantity of battery |
CN103217649A (en) * | 2013-03-28 | 2013-07-24 | 广东欧珀移动通信有限公司 | Method and device for displaying electric quantity, and mobile device |
Non-Patent Citations (1)
Title |
---|
翟天嵩 主编: "《计算机控制技术与系统仿真》", 30 September 2012, 北京:清华大学出版社 * |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016041398A1 (en) * | 2014-09-16 | 2016-03-24 | 中兴通讯股份有限公司 | Method for storing battery level information of mobile terminal and mobile terminal |
CN105491208A (en) * | 2014-09-16 | 2016-04-13 | 中兴通讯股份有限公司 | Method for storing electric quantity information of mobile terminal, and mobile terminal |
CN105068016A (en) * | 2015-09-18 | 2015-11-18 | 杰华特微电子(张家港)有限公司 | Battery power display control method and battery power display control circuit |
CN105068016B (en) * | 2015-09-18 | 2018-11-13 | 杰华特微电子(张家港)有限公司 | Battery capacity display control method and control circuit |
CN105975879A (en) * | 2016-04-29 | 2016-09-28 | 宇龙计算机通信科技(深圳)有限公司 | Control method and device for displayed electric quantity of terminal |
CN106093780A (en) * | 2016-05-31 | 2016-11-09 | 青岛海信移动通信技术股份有限公司 | A kind of terminal residual electricity determines method and terminal |
CN106680728A (en) * | 2016-12-30 | 2017-05-17 | 深圳天珑无线科技有限公司 | Electricity quantity detecting method and device |
CN107479001A (en) * | 2017-08-25 | 2017-12-15 | 深圳金仕盾照明科技有限公司 | A kind of battery electric quantity checking device and light fixture |
CN107703461A (en) * | 2017-11-20 | 2018-02-16 | 普联技术有限公司 | The battery electric quantity display control method and display control unit of a kind of electronic equipment |
CN108344952A (en) * | 2018-02-26 | 2018-07-31 | 深圳市道通智能航空技术有限公司 | Battery power amount calculation method and its device |
CN112130082A (en) * | 2019-06-05 | 2020-12-25 | 海能达通信股份有限公司 | Method and equipment for calculating battery electric quantity and device with storage function |
CN110850313A (en) * | 2019-11-14 | 2020-02-28 | 宁波德晶元科技有限公司 | Lithium battery charging and discharging electric quantity display method and system |
Also Published As
Publication number | Publication date |
---|---|
CN103792489B (en) | 2017-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103792489A (en) | Improved method for measuring and calculating system battery capacity | |
CN103792490A (en) | Method for measuring and calculating battery capacity of system | |
CN102520364B (en) | Method utilizing battery voltage to display electric quantity | |
CN102231551B (en) | Battery charger combining charging time and service life of battery | |
CN108233464B (en) | Active equalization method and system for battery pack | |
CN112737032B (en) | Battery charging control method, control device and terminal | |
CN103872398A (en) | Charging method of rechargeable battery and related charging structure | |
CN105006871B (en) | A kind of method and device for being used to simulate actual battery charging process | |
CN109713660A (en) | Direct-current grid parallel connection energy-storage battery state-of-charge balance control method and device | |
US11360148B2 (en) | Method for updating capacity of battery, device for updating capacity of battery, electronic device, and storage unit | |
CN104749525A (en) | Battery aging state detection device, system and method | |
CN115459313A (en) | Energy storage participation demand response method, device and medium | |
CN104765396A (en) | Mobile terminal based shutdown voltage dynamic adjusting method and system | |
CN112310990A (en) | Charge state-based balancing control method for multiple energy storage systems of direct-current micro-grid | |
CN105580235A (en) | Storage battery control device, control method, control program, and electricity storage system | |
CN115902628A (en) | Method, device and equipment for calculating internal resistance of battery and storage medium | |
CN114156912B (en) | Energy management method and system for primary frequency modulation by using hybrid energy storage | |
CN112332493B (en) | Lithium battery charging current determination method, device, equipment and storage medium | |
CN113612272A (en) | Charging control method and device for uninterruptible power supply of new energy power generation system | |
CN112789779B (en) | Charging current adjusting method, device, terminal and computer readable storage medium | |
CN115327391B (en) | Detection method and device based on echelon battery utilization | |
CN111082424A (en) | Method and device for predicting reliability of comprehensive energy and micro-grid system | |
CN112398194B (en) | Battery control method and device for elevator control cabinet | |
CN113507154A (en) | Charging method and device, charger and electronic equipment | |
CN108879742B (en) | Energy storage optimal configuration method and system |
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 |