CN103792489B - Improved method for measuring and calculating system battery capacity - Google Patents

Improved method for measuring and calculating system battery capacity Download PDF

Info

Publication number
CN103792489B
CN103792489B CN201310594558.2A CN201310594558A CN103792489B CN 103792489 B CN103792489 B CN 103792489B CN 201310594558 A CN201310594558 A CN 201310594558A CN 103792489 B CN103792489 B CN 103792489B
Authority
CN
China
Prior art keywords
electricity
battery
voltage
electric quantity
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.)
Active
Application number
CN201310594558.2A
Other languages
Chinese (zh)
Other versions
CN103792489A (en
Inventor
刘荣
宋夏
张享隆
郭崇鑫
王业飞
朱长春
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Original Assignee
Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Shiyuan Electronics Thecnology Co Ltd filed Critical Guangzhou Shiyuan Electronics Thecnology Co Ltd
Priority to CN201310594558.2A priority Critical patent/CN103792489B/en
Publication of CN103792489A publication Critical patent/CN103792489A/en
Application granted granted Critical
Publication of CN103792489B publication Critical patent/CN103792489B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Measurement and the improved method of computing system battery electric quantity
Technical field
The present invention relates to a kind of computer automation measuring method, more particularly to a kind of measurement and calculate changing for battery electric quantity Enter method.
Background technology
In the equipment using battery such as panel computer, mobile phone, the electricity for showing present battery is typically necessary.For survey The exigent occasion of accuracy of measurement, will typically use the special chips such as coulometer.Coulometer by measure battery voltage, fill/ Discharge current, can accurately calculate battery storage and the energy for consuming, so as to draw current battery charge.
In order to cost-effective, for the consumption electronic product that required precision is not very high, will not generally use this kind of Special coulant meter chip, but measure and calculate battery electric quantity using only by the method for ADC measurement cell voltages.The party The principle of method is that under different electricity, its output voltage is different to battery.Electricity is more, and voltage is higher, conversely, Electricity is fewer, and voltage is lower.But practical situation is, cell voltage is not single related with electricity, also related with charge/discharge current. And it is that relatively difficult therefore general consumption electronic product does not possess battery current measurement function to measure battery current.Institute Not increase any algorithm, only it is that effect is excessively poor, has time error even calculating battery electric quantity simply by voltage As many as 50% can be reached.
For the problems referred to above, some designs are with regard to increased the voltage compensating function under different scenes on here basis.It is logical Cross to the voltage measurement under different scenes, record voltage compensation value, then according to different patterns after virtual voltage is measured Compensate.As voltage pulsation is larger, voltage compensation also is difficult to be made accurately, therefore typically can also carry out letter to result of calculation Single computing such as average, makes result seem more steady.
To sum up, the major defect of prior art includes:
It is if the 1, using special coulometer chip, relatively costly, take around 0.5~1 U.S. dollar of increase;
2nd, coulometer chip is not used, battery curve is unsmooth, electricity display error big, fluctuation is big, for example, open again Before and after dynamic system, battery electric quantity deviation is very big, electricity rapid increase when charging, pull out charger electricity rapid decrease etc..
The content of the invention
Present invention mainly solves under the restriction that no current measures function, only using voltage system on-line measurement battery electric quantity The problem that deviation is big and the fluctuation of battery charging and discharging curve is big.
For achieving the above object, the invention discloses it is a kind of measurement and computing system battery electric quantity improved method, specifically Comprise the following steps:
Step one, according to the state of the main current consuming apparatus of system to measuring the benchmark electricity that cell voltage method is obtained using ADC Pressure U carries out voltage compensation, and obtains corresponding electricity as battery according to the voltage after compensation by voltage-capacity relation table Measuring electric quantity;
Step 2, the measuring electric quantity to the battery carry out anti-bounce-back process, slope restriction and process, simulate at discharge and recharge One or more in reason, electricity Filtering Processing and preservation electricity process, and show the electricity renewal battery after process current Show electricity.
It is preferred that the step one specifically includes step:
Step 1, measures the reference voltage U that cell voltage method obtains battery using ADC;
Step 2, according to the state of the main current consuming apparatus of system, to main current consuming apparatus each described according to below equation meter Calculate the offset voltage of each main current consuming apparatus;
When battery is in discharge condition:UOffset voltage=UCompensation side-play amount+F(U)*VCurrency/VMaximum,
When battery is in charged state:UOffset voltage=UCompensation side-play amount-F(U)*VCurrency/VMaximum
Wherein, VCurrencyIt is that currently mainly current consuming apparatus correspond to the value of attribute, VMaximumIt is that the correspondence attribute is accessible most Big to be worth, F (U) is the function with the reference voltage as parameter, and expression calculates main power consumption according to presently described reference voltage Equipment operates in the maximum offset voltage during correspondence attribute maximum;UCompensation side-play amountFor compensating side-play amount, its size and system The current state of main current consuming apparatus is related;
Step 3, calculates the summation of the reference voltage and the offset voltage of all main current consuming apparatus, as compensation Voltage afterwards;
Step 4, obtains corresponding electricity as battery according to the voltage after the compensation by voltage-capacity relation table Measuring electric quantity
Wherein, the main current consuming apparatus at least include LCD backlight, CPU and GPU;For LCD backlight, the correspondence belongs to Property be LCD backlight brightness, for CPU, it is described correspondence attribute be CPU running frequency values, for GPU, it is described correspondence attribute be GPU Running frequency value.
The present invention is different from the scheme of some same unused current measurements and sets only in accordance with several specific application scenarios Determine offset, but the main current consuming apparatus for selecting are calculated, it is possible to obtain accurate voltage compensation value.
In order to the display electricity error for further solving the battery is big, battery curve is unsmooth, the problems such as fluctuate big, After the step one, can also include that carrying out anti-bounce-back process, slope restriction to the measuring electric quantity of the battery processes, simulates One or more in charge and discharge electric treatment, electricity Filtering Processing, and/or process including the preservation electricity independently of step one.Its Described in anti-bounce-back process, slope restriction process, simulation charge and discharge electric treatment, each item in electricity Filtering Processing when processing, All using the output electricity of the next item up process as currently processed input electricity, and using currently processed output electricity as next The input electricity that item is processed, the input electricity of the process being connected with the step one are the measurement electricity after step one process described in Amount, the output electricity that last is processed is used as the current display electricity of the battery of step 2.
Wherein, the anti-bounce-back is processed and is specifically included:Input electricity current with battery display electricity is contrasted, when When battery is in discharge condition, if the input electricity display electricity current more than the battery, is worked as using the battery Front display electricity is used as output electricity;When battery is in charged state, if the input electricity is current less than the battery Display electricity, then using the current display electricity of the battery as the output electricity;Other situations adopt the input Electricity is used as output electricity.
The slope restriction is processed and is specifically included:Input electricity current with battery display electricity is contrasted, if The input electricity ninThe display electricity n current more than the batterym, then it is n to export electricityout=(int)((nin-nm)/N+1) +nm;If the input electricity ninLess than the display electricity nm, then it is n to export electricityout=(int)((nin-nm)/N-1)+ nm;If the input electricity ninEqual to the display electricity nm, exporting electricity is:nout=nin;Wherein nin noutAnd nmBe with Numerical value when hundred-mark system shows before percentage sign, N is a coefficient according to current working current size real-time adjustment.
It is the mode of fixed slope that existing technology is used, i.e., no matter charging and discharging currents are how many, all use fixation Slope.And the present invention then can be according to current charging and discharging currents dynamic the tuned slope, so as to closer to truth.
The simulation charge and discharge electric treatment is specifically included:When system detectio to the current display electricity of battery is within a period of time Do not change, if system is in charged state, calculate duration t needed for analog charge in the charge statec, in tcDuration model In enclosing, by the input electricity ninBecome according to the speed that time per unit plus 1 and be turned to export electricity;If system is in electric discharge shape State, then calculate duration t needed for simulation electric discharge in the discharged conditiond, in tdIn the range of duration, by the input electricity ninAccording to every The speed change that unit interval subtracts 1 is turned to export electricity, wherein described ninIt is numerical value when being represented with hundred-mark system before percentage sign.
The electricity Filtering Processing is specifically included:The value of input electricity is added to into filtering queue end, by queue most An early data deletion, then averages as output electricity to filtering all values in queue.
Present invention uses queue-type Filtering Processing, rather than common average value filtering mode, make in this way not Filter effect only can be numerically produced, filter effect can be also produced in time.
The preservation electricity is processed and includes step:Change the current display electricity of battery is detected, or exceed Preset Time, or during user's modification time, the display electricity and temporal information will be preserved to file system, to participate in next time The survey calculation of electricity during system boot.During next system boot, first load from file system last information about power and when Between information, then and current calculated electricity and time contrast, if electricity is more or less the same, and time change is not less than finger Fixed value, then it is assumed that effectively, follow-up calculating is all carried out the information about power being loaded into from file system on this basis, if Electricity deviation is larger, then directly ignore the information about power for storing before using current calculated charge value.
Embodiment of the present invention technical problem to be solved is on the premise of it can not obtain current information, for only using ADC voltage measurement battery electric quantity methods, and by the improvement in the method and algorithm so that accuracy of measurement significantly rises, Battery charging and discharging curve closer to truth, so as to greatly promote user experience.
Implement the embodiment of the present invention, have the advantages that:
1st, contrast is using special coulometer chip or increases the scheme of current measurement, the present invention hardly increase it is extra into This, completes battery electric quantity measurement function by the ADC for directly carrying using chip;
2nd, the scheme of similar no current measurement is contrasted, because present invention uses more accurate voltage compensating method and calculation Method, so the result that the present invention is measured is more accurate;
3rd, the scheme of similar no current measurement is contrasted, due to present invention uses preferably algorithm and intelligent parameter adjustment Function, such as dynamic slope limitation function, simulation discharge and recharge processing procedure, queue-type Filtering Processing etc. so that of the invention The battery charging and discharging curve for arriving is closer to truth;
4th, similar measurement scheme is contrasted, has benefited from electricity of the present invention and preserve the pre-loaded function that processes and start shooting, the present invention exists Started shooting after shutdown at once or restarted, electricity will not be mutated.
Description of the drawings
Fig. 1 is the flow chart of one embodiment of the present of invention.
Fig. 2 is the particular flow sheet of step S01 shown in Fig. 1.
Fig. 3 is the flow chart that the embodiment of the present invention calculates offset voltage.
Fig. 4 be the embodiment of the present invention table look-up acquisition measuring electric quantity flow chart.
Fig. 5 is the flow chart of an alternative embodiment of the invention.
Fig. 6 is the anti-bounce-back process chart of the embodiment of the present invention.
Fig. 7 is that embodiment of the present invention slope limits process chart.
Fig. 8 is embodiment of the present invention simulation discharge and recharge process chart.
Fig. 9 is embodiment of the present invention electricity Filtering Processing flow chart.
Figure 10 is that the embodiment of the present invention preserves electricity process chart.
Figure 11 is embodiment of the present invention start preload process flow chart.
Specific embodiment
For making the object, technical solutions and advantages of the present invention clearer, the present invention is made into one below in conjunction with accompanying drawing Step ground is described in detail.
As shown in figure 1, for the flow chart of one embodiment of the invention, specifically including step:
S01, according to the state of the main current consuming apparatus of system to measuring the reference voltage U that cell voltage method is obtained using ADC Voltage compensation is carried out, and corresponding electricity is obtained as the survey of battery by voltage-capacity relation table according to the voltage after compensation Volume and electricity;
S02, the measuring electric quantity to the battery carry out anti-bounce-back process, slope restriction and process, simulate charge and discharge electric treatment, electricity One or more in amount Filtering Processing and preservation electricity process, and the electricity after process is updated into the current display electricity of battery Amount.
With reference to Fig. 2, describe the implementation procedure of step S01 in the embodiment first in detail, specifically include step:
S11, measures the reference voltage that cell voltage method obtains battery using ADC, it is preferred that by continuous 10 AD conversion And average and obtain reference voltage;
S12, according to the state of the main current consuming apparatus of system, calculates the offset voltage of each main current consuming apparatus;
S13, calculates the summation of the reference voltage and the offset voltage of all main current consuming apparatus, after compensation Voltage;
S14, obtains corresponding electricity as the survey of battery according to the voltage after the compensation by voltage-capacity relation table Volume and electricity;
S15, updates the current display electricity of battery with the measuring electric quantity of the battery.
Wherein, in step S12, main current consuming apparatus are according to the different equipment of different Systematic selections.For example flat In plate computer, LCD backlight and CPU, GPU are main current consuming apparatus, and power consumption is not fixed.Therefore by measuring different LCD backlights The voltage deviation value of brightness, cpu frequency, GPU frequencies under different cell voltages, then by curve matching, obtains some passes The data of key point, then can calculate voltage compensation value further according to actual LCD backlight brightness, cpu frequency, GPU frequencies, from And can accurately calculate battery electric quantity.
Assume that the cell voltage for currently measuring by ADC is U, then the voltage after compensation is represented by Uc=U+ Ublc+Ucpuc+Ugpuc.Wherein UcFor the voltage after compensation, UblcFor LCD backlight offset voltage, UcpucFor CPU offset voltages, Ugpuc For GPU offset voltages.
LCD backlight offset voltage Ublc=Ubl_offset+Fbl(U)*Vbl/Vblmax, wherein Ubl_offsetFor compensating side-play amount, with The system of reality, the battery for being used etc. are all related, need actual measurement to determine;FblFor a function, it can be according to current voltage value The offset of high-high brightness is calculated, the function is all related to the LCD backlight of reality, the battery for being used etc., needs actual measurement to determine It is fixed;VblIt is current LCD backlight brightness values, VblmaxIt is backlight maximum.
CPU offset voltages Ucpuc=Ucpu_offset+Fcpu(U)*Vcpu/Vcpumax, wherein Ucpu_offsetFor compensating side-play amount, with The system of reality, the battery for being used etc. are all related, need actual measurement to determine;FcpuFor a function, it can be according to current voltage value Offset during maximum cpu frequency is calculated, the function is all related to the CPU of reality, the battery for being used etc., needs actual measurement to determine It is fixed;VcpuIt is the running frequency value of current CPU, VcpumaxIt is the frequency maxima of CPU operations.
GPU offset voltages Ugpuc=Ugpu_offset+Fgpu(U)*Vgpu/Vgpumax, wherein Ugpu_offsetFor compensating side-play amount, with The system of reality, the battery for being used etc. are all related, need actual measurement to determine;FgpuFor a function, it can be according to current voltage value Offset during maximum GPU frequencies is calculated, the function is all related to the GPU of reality, the battery for being used etc., needs actual measurement to determine It is fixed;VgpuIt is the running frequency value of current GPU, VgpumaxIt is the frequency maxima of GPU operations.
When charging, it is also desirable to calculate the offset of charging voltage according to LCD backlight, cpu frequency, GPU frequencies etc..Cause For in systems, the total current that charger is provided is fixed, when the electric current for needing when the system is operated is big, can reduce automatically filling Electric current.And different charging currents, even if in the case of battery capacity identical, cell voltage is also different, it is therefore desirable to Voltage compensation is done for charging.Charging voltage compensation calculation formula is essentially the same in form with computing formula during electric discharge, different Where be that, when backlight/CPU/GPU electric currents increases, offset voltage reduces, therefore the parameter for using is different.During charging The computing formula for being used is in form:Ublc=Ubl_offset-Fbl(U)*Vbl/Vblmax;Ucpuc=Ucpu_offset-Fcpu(U)*Vcpu/ Vcpumax;Ugpuc=Ugpu_offset-Fgpu(U)*Vgpu/Vgpumax
Furthermore, it is contemplated that USB port is connecting computer and during charger, the maximum current that can be got be it is different, The measurement of battery electric quantity when this directly influences whether to charge.Therefore the function of feeder ear detection is increased in the design, works as inspection When measuring different feeder ears, different compensating parameters can be used.Preferably detection foundation is, during connection computer, computer Row data communication can be entered with equipment, and data communication is not had when connecting charger.
For convenience of understanding, voltage compensation handling process will be described by Fig. 3 below.
Assume that the voltage measured by ADC measurement voltage methods is U;
S131, determines whether that external power source is input into, if it has, step S132 is then entered, otherwise, into step S134;
S132, judges whether the external power source for connecting is computer, if it is, step S133 is entered, otherwise, into step 135;
S133, calculates LCD backlight offset voltage U under computer modelblc, CPU offset voltages Ucpuc, GPU offset voltages Ugpuc
S134, calculates LCD backlight offset voltage U under discharge modeblc, CPU offset voltages Ucpuc, GPU offset voltages Ugpuc
S135, calculates LCD backlight offset voltage U under charge modeblc, CPU offset voltages Ucpuc, GPU offset voltages Ugpuc
S136, according to formula Uc=U+Ublc+Ucpuc+UgpucCalculate the voltage after compensation.
Fig. 4 tables look-up in showing step S14 and obtains the idiographic flow of battery electric quantity, specifically includes step:
S141, judges battery whether in charged state, if being in charged state, into step S142, otherwise Into step S143;
S142, obtains the measuring electric quantity of present battery, and enters step S144 by looking into charging voltage table;
S143, obtains the measuring electric quantity of present battery, and enters step S144 by looking into discharge voltage table;
S144, returns the measuring electric quantity of present battery.
Although the display electricity that embodiment is obtained as shown in Figure 2, by being fitted voltage compensation to main current consuming apparatus Curve, obtains more accurately battery electric quantity, but if adds anti-bounce-back process, slope limit on the basis of the embodiment It is fixed to process, simulate charge and discharge electric treatment, electricity Filtering Processing and preserve one or more during electricity is processed, it will to obtain more It is close to truth and meets the result of people's psychology.
And it should be understood that the anti-bounce-back process, slope restriction process, simulation charge and discharge electric treatment, at electricity filtering It is separate and regardless of order that reason and preservation electricity are processed, and can select one item or many according to measurement precision demand Item is processed.Preferably, carry out above-mentioned whole on the basis of the display electricity that embodiment illustrated in fig. 2 is obtained to process.
As shown in figure 5, for the flow chart of a preferred embodiment of the invention, including step:
S1, obtains battery measurement electricity:It is identical with S11 to S14 the step of first embodiment, set according to the main power consumption of system Standby state carries out voltage compensation to the reference voltage obtained using ADC measurements cell voltage method, and according to the voltage after compensation Determine the measuring electric quantity of battery.
S2, anti-bounce-back are processed:Assume that currently displaying electricity is nmIf having been acknowledged that battery is in discharge condition, such as Not connected charger bright screen operation, then for being calculated more than nmResult should abandon, otherwise battery not charge But battery electric quantity is rising and now can directly use value n of currently displaying electricity to the experience of the no good cake of usermAs the step The result of process;Equally, if it is confirmed that battery is in charged state, and calculated electricity is less than nm, then to also abandon, prevent The situation that battery electric quantity declines on the contrary when only battery charges occurs, correspondingly also using value n of currently displaying electricitymAs the step The result of process;For other situations, the result processed as the step using the measuring electric quantity that Jing S1 steps are obtained.
S3, slope restriction are processed:It is not directly using the result of Jing steps S2, but according to currently displaying electricity, right Electricity after the process of step S2 is further adjusted.According to the current charging and discharging state of system and main current consuming apparatus State, calculates electric quantity change rate N, limits the amplitude of electric quantity change using this rate of change, pins down battery in time The rapid fluctuations of electricity.It is assumed that the result of step S2 process is denoted as nin, currently displaying electricity is denoted as into nm.Work as ninThan nmWhen big, according to formula ((int) (nin-nm)/N+1)+nmThe step S2 result is further adjusted;Work as ninCompare nmIt is little When, according to formula ((int) (nin-nm)/N-1)+nmThe step S2 result is further adjusted;Work as ninEqual to nmWhen, Then do not adjust;Wherein ninAnd nmIt is numerical value when being shown with hundred-mark system before percentage sign.
S4, simulates charge and discharge electric treatment:To described, if system detectio shows that the electricity long period does not change, and In the case of specifying the charging and discharging state of battery, make the electricity Jing after the process of step S3 at one according to system current state It is determined that time in, to change less than the amplitude that changes during normal discharge and recharge.As the charge/discharge rates simulated are filled than actual The velocity of discharge is slow, therefore after a period of time, calculated electricity can be gradually close to the electricity for showing, finally the two is equal. When such process makes user feel to charge, battery electric quantity rises than relatively evenly, and during electric discharge, battery electric quantity more declines.
S5, electricity Filtering Processing:The electricity obtained after above step is adjusted is added to into a smothing filtering queue, And by a data deletion earliest in queue, then average and be calculated final battery electric quantity.And by result For updating the display electricity.
S6, preserves electricity and processes:Change the current display electricity of battery is detected, or preserved super apart from last time Preset Time is crossed, or during user's modification time, the presently described value and temporal information for showing electricity will be preserved to file system, To participate in the survey calculation of electricity during next system boot.
The concrete steps that wherein described counnter attack bullet processes S2 are as shown in Figure 6:
Perform it is described it is anti-bounce-back process S2 before, first loading obtain battery measurement process result as anti-bounce-back at The input electricity of reason;The anti-bounce-back is processed and specifically includes step:
Whether S21, judge battery in charged state.It is if battery is in charged state, into step S22, no Step S23 is entered then;
Whether S22, judge to be input into electricity less than display electricity, if it does, step S24 is entered, otherwise, into step S25;
Whether S23, judge to be input into electricity more than display electricity, if it does, step S24 is entered, otherwise, into step S25;
S24, the value of currently displaying electricity is assigned to export electricity;
S25, the value of input electricity is assigned to export electricity.
After more than use processing, although the accuracy of battery electric quantity measurement can be effectively improved, but effect is still not enough It is preferable.Main cause is that system complexity is too high, it is impossible to all module ruuning situations are converted into voltage benefit accurately completely Value is repaid, and its characteristic of different batteries is also different, along with ADC measurement error etc., the result fluctuation width for finally obtaining Spend or larger.Can not possibly undergo mutation in view of battery electric quantity, therefore the embodiment of the present invention is to after said method is processed Result enter again line slope limit process and electricity Filtering Processing, pin down the rapid fluctuations of battery electric quantity in time.It is described It is as shown in Figure 7 that slope limits the concrete steps for processing:
Before performing the slope and limiting process step, the output electricity of load step S2 is processed as slope restriction first Input electricity nin;The slope limits to process includes step:
S31, judges input electricity ninWhether more than display electricity nm, if it is, step S32 is entered, otherwise, into step S34;
S32, according to LCD backlight brightness Vbl, CPU running frequencies Vcpu, GPU running frequency VgpuAnd whether connect computer Slope calculations coefficient N;
S33, exports electricity noutFor nout=((int)(nin-nm)/N+1)+nm
S34, judges input electricity ninWhether less than display electricity nm, if it is, step S35 is entered, otherwise, into step S37;
S35, according to LCD backlight brightness Vbl, CPU running frequencies Vcpu, GPU running frequency VgpuAnd whether connect computer Slope calculations coefficient N;
S36, exports electricity noutFor nout=((int)(nin-nm)/N-1)+nm
S37, the value of input electricity is assigned to export electricity.
Preferably, in step s 32, the calculation of N is as follows:
Charged state:N=10+(30*Vbl/Vblmax)+(10*Vcpu/Vcpumax)+(10*Vgpu/Vgpumax),
Discharge condition:N=60-(30*(Vbl)/Vblmax)-(10*Vcpu/Vcpumax)-(10*Vgpu/Vgpumax),
Wherein digital value, will be adjusted according to actual battery, backlight, CPU, GPU.
After such algorithm, the maximum rate of change of battery electric quantity is limited, so as to reach good smooth effect.
Charger is inserted into or charge a period of time and battery underfill in electric discharge a period of time and after battery is not discharged When just disconnect charger or long-time heavy-duty service after then be transferred to suddenly underrun etc., these when electricity Amount only is most difficult to calculate by voltage, the larger situation of deviation typically can all occurs.Due to adding anti-bounce-back measure, generally The situation of appearance is exactly that the battery electric quantity shown in a very long time is held at same level, and actually battery be Charge or discharge.For such case, the present embodiment adopts simulation charge and discharge electric treatment, according to the speed slower than normal discharge and recharge Carry out simulated battery charge and discharge process.As the charge/discharge rates simulated are bound to than actual charge/discharge rates slowly, therefore one section After time, calculated charge value can be gradually close to the charge value for showing, final to show electricity by the charge value with calculating It is equal.The concrete steps of the simulation charge and discharge electric treatment are as shown in Figure 8:
Before the simulation discharge and recharge process step is performed, the result of anti-bounce-back process is loaded first as simulation discharge and recharge Input electricity nin;The simulation charge and discharge electric treatment includes step:
S41, judges to show whether electricity changes, if it is, step S42 is entered, otherwise, into step S43;
S42, resets timer Ts, and enter step S411;
Whether S43, judge battery in charged state, if it is, step S44 is entered, otherwise, into step S45;
S44, calculates under conditions present, and charging should produce the time t of changec, and enter step S46;
Whether S45, judge battery in discharge condition, if it is, step S47 is entered, otherwise, into step S411;
S46, judges TsWhether t is more thanc, if it is, step S48 is entered, otherwise into step S411;
S47, calculates under conditions present, and electric discharge should produce the time t of changed, and enter step S49;
S48, calculates output electricity nout=nin+ 1, reset timer Ts, and enter S412;
S49, judges TsWhether t is more thand, if it is, step S410 is entered, otherwise into step S411;
S410, calculates output electricity nout=nin- 1, reset timer Ts, and enter step S412;
S411, the value of input electricity is assigned to export electricity;
S412, returns output electricity.
After such process, when user can feel to charge, battery electric quantity rises than relatively evenly, battery electricity during electric discharge Amount declines than relatively evenly, without there is situation of the long-time in same level, so as to improve Consumer's Experience well.
The concrete steps of the electricity Filtering Processing as shown in figure 9, before the electricity Filtering Processing step is performed, first Using the result of the simulation charge and discharge electric treatment as the electricity Filtering Processing input electricity, the electricity Filtering Processing is concrete Including step:
S51, earliest value in filtering queue is removed;
The value of input electricity is added to queue end by S52;
All values in filtering queue are averaged and are assigned to export electricity by S53.
By such process so that the fluctuation in positive and negative scope is canceled each other out, so as to reach smooth effect well Really.
After shut down, the software for calculating electricity just normally cannot run system, therefore common practice is exactly start every time When recalculate battery electric quantity.Due to some above-mentioned reasons, the electricity for finally calculating may be with the electricity before shutdown Deviation 10% is even more more, and this can give client very bad experience.In order to solve this problem, the system is designed with slotting charging Device automatic turn-on function, and add the preservation electricity to process.As shown in Figure 10, it is described to preserve the concrete steps that electricity is processed For:
S61, judges to show whether electricity changes, if it is, step S64 is entered, otherwise into step S63;
S62, judges whether user changes system time, if it is, entering step S64;
Whether S63, judging distance last saved have reached tsaveDuration, if it has been reached, then enter step Rapid S64, otherwise, into step S66, wherein tsaveIt is a value set in advance;
S64, preserves current electric quantity information and temporal information to file system;
S65, empties the timer T for recording distance last savednc
S66, preservation are completed.
The meaning for preserving electricity process is as the reference for calculating electricity during start next time.During start next time, example When start or the charging of slotting charger are started shooting manually such as user, last electricity and temporal information is loaded from file system first, so Calculated battery electric quantity and time contrast afterwards and currently.If battery electric quantity is more or less the same, and time change is not less than finger Fixed value, then it is assumed that the battery level information that is loaded into from file system effectively, follow-up calculating all here bases it is enterprising OK.So ensure that user in the case where restarting or the unused time not being to grow very much, it is ensured that what battery electric quantity showed Concordance.If battery electric quantity deviation is larger, such as user changes battery, or time deviation is for a long time or temporal regression, for example After changing battery or long-time shutdown, battery miss out a lot, and at this moment user generally also less remembers that last time is closed During machine, how many battery electric quantities is, then just directly using current calculated charge value, and neglect the electricity for storing before Amount information.If the information about power of last storage can not be got in start, then can only directly use calculated electricity Pond electricity.When such case generally only occurs in plant produced, therefore do not interfere with user and normally use.
The concrete steps of the start prestrain are as shown in figure 11, including step:
S71, according to the measuring electric quantity for obtaining battery the step of S1;
S72, the measuring electric quantity that S71 steps are obtained is according to carrying out electricity Filtering Processing the step of S5;
Whether completely S73, judge to filter queue, if it is, entering step S74, otherwise, return to step S71;
S74, loads information about power and temporal information from file system;
Whether effectively S75, judge the information about power that loads from file system, if effectively, into step S76, otherwise Do not deal with;
S76, sets currently displaying electricity as the charge value of preservation, and using the charge value filling filtering queue for preserving;
S77, opening initialization are completed.
Except above-mentioned process, average voltage is also used in the design, the larger value of variance, look-up table conversion electricity is filtered The conventional design such as pond electricity, are not described in detail in the document.It is appreciated that the present invention is to apply the system in no current measurement On, but processing method of the present invention to battery electric quantity, it is clear that can be used on system or the coulomb chip of powered flow measurement.
It should be noted that, although above-described embodiment has used the anti-bounce-back process, slope limit in one embodiment Electricity process is processed calmly, simulates charge and discharge electric treatment, electricity Filtering Processing and preserved, but this six process not necessarily must be at one All use in embodiment, one or more therein can be only selected as needed with optimum results.The anti-bounce-back simultaneously Process, slope restriction are processed, simulate the processing sequence of charge and discharge electric treatment, electricity Filtering Processing nor inevitable such as above-mentioned embodiment It is shown, corresponding appropriate adjustment can be made according to the needs of user.
The above is the preferred embodiment of the present invention, it is noted that for those skilled in the art For, under the premise without departing from the principles of the invention, some improvements and modifications can also be made, these improvements and modifications are also considered as Protection scope of the present invention.

Claims (9)

1. it is a kind of measurement and computing system battery electric quantity improved method, it is characterised in that comprise the following steps:
Step one, entered to measuring the reference voltage U that cell voltage method obtains using ADC according to the state of the main current consuming apparatus of system Row voltage compensation, and corresponding electricity is obtained as the measurement of battery by voltage-capacity relation table according to the voltage after compensation Electricity;
Step 2, the measuring electric quantity to the battery enter line slope restriction process and the measuring electric quantity to the battery is prevented Bounce-back processes, simulates charge and discharge electric treatment, electricity Filtering Processing and preserve one or more during electricity is processed, and by after process Electricity updates the current display electricity of battery;
The slope restriction is processed and is specifically included:Input electricity current with battery display electricity is contrasted, if described Input electricity ninThe display electricity n current more than the batterym, then export electricity noutFor:nout=(int) ((nin-nm)/N+ 1)+nm;If the input electricity ninLess than the display electricity nm, then export electricity noutFor:nout=(int) ((nin- nm)/N-1)+nm;If the input electricity ninEqual to the display electricity nm, export electricity noutFor:nout=nin;Wherein nin、noutAnd nmIt is numerical value when being shown with hundred-mark system before percentage sign, N is according to current working current size real-time adjustment Coefficient.
2. method according to claim 1, it is characterised in that the step one specifically includes following steps:
Step 1, measures the reference voltage U that cell voltage method obtains battery using ADC;
Main current consuming apparatus each described, according to the state of the main current consuming apparatus of system, are calculated every according to below equation by step 2 The offset voltage of the individual main current consuming apparatus;
When battery is in discharge condition:UOffset voltage=UCompensation side-play amount+F(U)*VCurrency/VMaximum,
When battery is in charged state:UOffset voltage=UCompensation side-play amount-F(U)*VCurrency/VMaximum
Wherein, VCurrencyIt is that currently mainly current consuming apparatus correspond to the value of attribute, VMaximumIt is the accessible maximum of the correspondence attribute, F (U) is the function with the reference voltage as parameter, to represent and calculate main current consuming apparatus fortune according to presently described reference voltage Maximum offset voltage of the row in the correspondence attribute maximum;UCompensation side-play amountFor compensating side-play amount, its size is mainly consumed with system The current state of electric equipment is related;
Step 3, calculates the summation of the reference voltage and the offset voltage of all main current consuming apparatus, after compensation Voltage;
Step 4, obtains corresponding electricity as the measurement of battery according to the voltage after the compensation by voltage-capacity relation table Electricity.
3. method according to claim 2, it is characterised in that the main current consuming apparatus at least include LCD backlight, CPU and GPU;For LCD backlight, the correspondence attribute is LCD backlight brightness, and for CPU, the correspondence attribute is CPU running frequencies Value, for GPU, the correspondence attribute is GPU running frequency values.
4. method according to claim 1, it is characterised in that the anti-bounce-back process, slope restriction are processed, simulation discharge and recharge Process, each item in electricity Filtering Processing when processing, all using the output electricity of the next item up process as currently processed defeated Enter electricity, and the input electricity that currently processed output electricity is processed as the next item down, the process being connected with the step one Input electricity be described in step one process after measuring electric quantity, last process output electricity as step 2 institute State the current display electricity of battery.
5. method according to claim 4, it is characterised in that the anti-bounce-back is processed and specifically included:Will input electricity and electricity The current display electricity in pond is contrasted, when battery is in discharge condition, if the input electricity is current more than the battery Display electricity, then using the current display electricity of the battery as output electricity;When battery is in charged state, if institute The input electricity display electricity current less than the battery is stated, then using the current display electricity of the battery as the output Electricity;Other situations are using the input electricity as output electricity.
6. method according to claim 4, it is characterised in that the simulation charge and discharge electric treatment is specifically included:Work as system detectio To the current display electricity of battery a period of time in do not change when, if system be in charged state, calculate charging Duration t needed for the charging of state Imitatingc, in tcIn the range of duration, by the input electricity ninThe speed for plus 1 according to time per unit Rate change is turned to export electricity;If system is in discharge condition, duration t needed for simulation electric discharge in the discharged condition is calculatedd, tdIn the range of duration, by the input electricity ninBecome according to the speed that time per unit subtracts 1 and be turned to export electricity, it is wherein described ninIt is numerical value when being represented with hundred-mark system before percentage sign.
7. method according to claim 4, it is characterised in that the electricity Filtering Processing is specifically included:By input electricity Value is added to filtering queue end, and then a data deletion earliest in queue is averaged to filtering all values in queue Value is used as output electricity.
8. method according to claim 1, it is characterised in that the preservation electricity is processed includes step:Detecting battery Current display electricity changes, or exceedes Preset Time apart from last saved, or during user's modification time, will The display electricity and temporal information are preserved to file system, to participate in the survey calculation of electricity during next system boot.
9. method according to claim 8, it is characterised in that the preservation electricity is processed:In lower subsystem During start, the first information about power of last preservation and temporal information before loading shutdown from file system, and survey when calculating start Volume and electricity, the then measuring electric quantity of the electricity that is loaded into described in contrast and the calculating, if the two electricity is more or less the same, and when Between change not less than specified value, then it is assumed that the information about power being loaded into from file system is effectively, initial after start Show that electricity will be calculated according to the information about power of the loading, if electricity deviation is larger, directly use the calculating The measuring electric quantity for obtaining, ignores the information about power for storing before.
CN201310594558.2A 2013-11-22 2013-11-22 Improved method for measuring and calculating system battery capacity Active CN103792489B (en)

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 CN103792489A (en) 2014-05-14
CN103792489B true 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)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105491208A (en) * 2014-09-16 2016-04-13 中兴通讯股份有限公司 Method for storing electric quantity information of mobile terminal, and mobile terminal
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
CN107479001B (en) * 2017-08-25 2023-04-04 深圳金仕盾照明科技有限公司 Battery electric quantity detection device and lamp
CN107703461B (en) * 2017-11-20 2019-12-10 普联技术有限公司 battery power display control method and display control device of electronic equipment
CN108344952B (en) * 2018-02-26 2021-07-09 深圳市道通智能航空技术股份有限公司 Battery electric quantity calculation method and device
CN112130082B (en) * 2019-06-05 2024-07-16 海能达通信股份有限公司 Method and equipment for calculating battery power and device with storage function
CN110850313A (en) * 2019-11-14 2020-02-28 宁波德晶元科技有限公司 Lithium battery charging and discharging electric quantity display method and system

Citations (5)

* Cited by examiner, † Cited by third party
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
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

Also Published As

Publication number Publication date
CN103792489A (en) 2014-05-14

Similar Documents

Publication Publication Date Title
CN103792489B (en) Improved method for measuring and calculating system battery capacity
CN103792490B (en) Method for measuring and calculating battery capacity of system
CN104360285B (en) A kind of battery capacity modification method based on improved ampere-hour integration method
CN108089133B (en) Battery pack consistency detection method and detection device for energy storage system
CN102520364B (en) Method utilizing battery voltage to display electric quantity
CN204666795U (en) A kind of power battery pack consistency detection device and equipment
CN106646256A (en) Battery capacity calculating method
CN108539300A (en) The electric quantity balancing method and system of battery pack
CN113406523B (en) Energy storage battery state evaluation method and device, electronic equipment and storage system
CN110401211B (en) Energy storage power station working scene identification method based on feature extraction
CN109617169A (en) A kind of lithium ion battery equalization methods based on fuzzy control
CN115932605A (en) Method and device for correcting residual electric quantity of energy storage battery and battery management system
CN106772091A (en) The update method of battery capacity value, device and terminal
CN111308374A (en) Estimation method for SOH value of battery pack state of health
CN106992325B (en) Battery module charge-discharge control method and charge-discharge control system
CN107768747A (en) Battery consistency screening technique and screening plant
CN109975708A (en) A kind of automatic on-line modification method of battery SOC
CN103901347A (en) Method for display of battery level and terminal
CN109669143B (en) Battery pack capacity evaluation method
CN115542186B (en) Method, device, equipment and medium for evaluating state and consistency of energy storage battery
CN104281513A (en) Application power consumption detection method and system
CN109273787A (en) A kind of method, apparatus for the state-of-charge SOC adjusting cascaded lithium ion batteries group
CN110018422A (en) A kind of battery management method and device
CN115459313A (en) Energy storage participation demand response method, device and medium
CN102306941A (en) Battery pack capacity coupling method and battery pack capacity coupling apparatus

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