Summary of the invention
In view of above-mentioned the deficiencies in the prior art part, the object of the present invention is to provide a kind of application class method based on power consumption and mobile terminal, to solve the inaccurate and incomplete problem of new opplication power managed of prior art correspondence power consumption classification.
In order to achieve the above object, this invention takes following technical scheme:
Based on an application class method for power consumption, power consumption during for opening according to tested application is classified, and it comprises:
A, mobile terminal start offline mode, keep screen Chang Liang;
B, start application class pattern, obtain and record initial voltage and the initial time of battery, open every Preset Time acquisition primary cell voltage and time after tested application, and judge that whether the current time be power consumption point stabilization time of tested application; If so, current cell voltage and time is then recorded;
C, according to current cell voltage and time, initial voltage and initial time calculate the power consumption number of tested application, carry out power consumption level classification according to this power consumption number to tested application.
Described based in the application class method of power consumption, described steps A also comprises:
A1, judge the charged state of battery, automatically stop when charging charging and point out and suspend charging; Keep current state when not charging and point out detecting;
A2, a voltage quantities is set and assignment is 0.
Described based in the application class method of power consumption, specifically comprise at described step B:
B1, acquisition record initial voltage and the initial time of battery;
B2, open tested application simultaneously start timer;
B3, judge whether the Preset Time of timer arrives, and if so, then obtains current cell voltage and time;
B4, judge whether the difference of current cell voltage and voltage quantities is less than predetermined threshold value: if be less than, then the current time is power consumption point stabilization time of tested application, records current cell voltage and time, performs step C; Otherwise, by current cell voltage assignment to voltage quantities, return step B3.
Described based in the application class method of power consumption, before described step C, also comprise: power consumption correspondence table is set: when 0mV<| difference |≤50mV is the application of first order power consumption; When 50mV<| difference |≤100mV is the application of second level power consumption; When 100mV<| difference |≤150mV is the application of third level power consumption; When 150mV<| difference |≤200mV is the application of fourth stage power consumption; When 200mV<| difference |≤250mV is the application of level V power consumption; When 250mV<| difference |≤300mV is the 6th grade of power consumption application; When 300mV<| difference |≤350mV is the 7th grade of power consumption application; When 350mV<| difference |≤400mV is the 8th grade of power consumption application; When 400mV<| difference |≤450mV is the 9th grade of power consumption application; When 450mV<| difference |≤500mV is the tenth grade of power consumption application.
Described based in the application class method of power consumption, described step C specifically comprises:
C1, calculate current cell voltage and the difference of initial voltage, corresponding power consumption application level found out by inquiry power consumption correspondence table;
C2, calculate current time and the difference of initial time, sort according to the size of the absolute value of time difference in this power consumption application level, draw the sub-rank of application in this power consumption application level.
Described based in the application class method of power consumption, first order power consumption is applied as minimum rank, represents the least in power-consuming of tested application; Tenth grade of power consumption is applied as highest level, represents that the power consumption of tested application is the highest; In every grade of power consumption application level, the absolute value of time difference is less, represents that the sub-rank of the application of this tested application is lower.
Described based in the application class method of power consumption, after described step C, also comprise:
D, the power consumption level storing tested application, current cell voltage and the difference of initial voltage and the difference of current time and initial time, the cell voltage obtain all the other and time reset.
Based on a mobile terminal for the application class method of power consumption, it comprises:
Timer, for arranging Preset Time;
Mode control module, for starting offline mode, keeps screen Chang Liang; Start application class pattern;
Voltage acquisition module, for obtaining and recording the initial voltage of battery, obtains primary cell voltage every Preset Time after opening tested application;
Time-obtaining module, for obtaining and recording current initial time, and obtains a time every Preset Time after opening tested application;
Judge module, for judging that whether the current time be power consumption point stabilization time of tested application; If then record current cell voltage and time;
Power consumption classified calculating module, for according to current cell voltage and time, initial voltage and initial time calculate the power consumption number of tested application, carry out power consumption level classification according to this power consumption number to tested application.
In described mobile terminal, described mode control module, also for judging the charged state of battery, automatically stopping when charging charging and pointing out and suspending charging; Keep current state when not charging and point out starting classification.
In described mobile terminal, also comprise storage control module, for the difference of the difference and current time and initial time that store the power consumption level of tested application, current cell voltage and initial voltage; The cell voltage obtain all the other and time reset.
Compared to prior art, application class method based on power consumption provided by the invention and mobile terminal, at offline mode and carry out under the state keeping screen Chang Liang application power consumption classification, mobile terminal receiving and transmitting signal can be avoided affect classification results, improve power consumption classify accuracy; Record initial voltage and initial time, obtains primary cell voltage and time every Preset Time after opening tested application, when judge the current time be the power consumption of tested application to put stabilization time time, record current cell voltage and time; Again according to current cell voltage and time, initial voltage and Time Calculation go out the power consumption number of tested application, power consumption level classification can be carried out to tested application according to this power consumption number, any application can calculate the power consumption number of its reality, by the size of power consumption number, application is classified, improve accuracy and the compatibility of application class, and its mode classification is simple, be easy to realize, be applicable to wideling popularize.
Embodiment
The invention provides a kind of application class method based on power consumption and mobile terminal, for making object of the present invention, technical scheme and effect clearly, clearly, developing simultaneously referring to accompanying drawing, the present invention is described in more detail for embodiment.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
Be existing battery schematic equivalent circuit please refer to Fig. 1 and Fig. 2, Fig. 1.Suppose that the voltage at the battery two ends of mobile terminal is V, the virtual voltage of battery is E, and the internal resistance of cell is R, and the electric current that battery flows out is I, then have V=E-R × I.As can be seen from this formula, if electric current I is less, the voltage V of battery is approximately equal to the virtual voltage E of battery, shows that the power consumption of mobile terminal is lower; If electric current I is comparatively large, the voltage V of battery will significantly reduce, and shows that the power consumption of mobile terminal is higher.In use, when user opens the application of a high power consumption, find that the voltage V of battery can significantly decline at short notice after testing.Waveform as shown in Figure 2, supposes that user starts dialing, the value of battery now as shown in A point; After having crossed 50s, the value shown in cell voltage continuous decrease to B point, as calculated in 50s, the difference that cell voltage declines is about 200mV.Can draw, electric current is less, and the difference of cell voltage decline is less within a certain period of time, then the power consumption of mobile terminal is lower, otherwise power consumption is higher.
Based on above-mentioned principle, the power consumption size that the present invention judges to apply by calculating cell voltage difference within a certain period of time, and according to power consumption size, application is classified, judge that it is the application of high power consumption or low-power consumption application, can application management be facilitated.Refer to Fig. 3, the application class method based on power consumption provided by the invention comprises:
S100, mobile terminal start offline mode, keep screen Chang Liang;
S200, start application class pattern, obtain and record current initial voltage and initial time, open every Preset Time acquisition primary cell voltage and time after tested application, and judge that whether the current time be power consumption point stabilization time of tested application; If so, current cell voltage and time is then recorded;
S300, according to current cell voltage and time, initial voltage and initial time calculate the power consumption number of tested application, carry out power consumption level classification according to this power consumption number to tested application.
Operationally can transmitting/receiving wireless signal based on mobile terminal, some modules are in running order in real time, as the SIM card in mobile phone, GSM/GPRS module.In order to avoid being bothered by wireless signal when detecting the power consumption applied, and avoid these module consuming cells electricity to cause power consumption calculation inaccurate, in the step s 100, need to enter offline mode, the GSM/GPRS module of mobile terminal is made to be stopped use, and turn off the function of SIM card, stop transmitting and the acceptance of wireless signal.Meanwhile, in order to the operating state of simulation application, need to keep screen Chang Liang, improve the accuracy of power consumption calculation further.
Because the present invention calculates power consumption number according to cell voltage, guarantee that battery can only be in power supply state, then described step S100 also comprises:
Step 101, judge the charged state of battery, automatically stop when charging charging and point out and suspend charging; Keep current state when not charging and point out detecting;
Step 102, a voltage quantities is set and assignment is 0.
Arrange voltage quantities Vx and can be used for follow-up calculating, its numerical value can be changed.After determining that battery does not charge, can start to detect cell voltage.Emphasis of the present invention is that power consumption when opening application detects and according to this as the class condition of this application.Based on be applied in just open time state labile, the cell voltage now obtained accurately can not reflect the virtual condition of power consumption, therefore, in the present embodiment, the cell voltage situation of change in application rear a period of time is opened in main detection, calculates power consumption level when this application is opened.Then described step S200 specifically comprises:
Step 201, start application class pattern, obtain and record initial voltage and the initial time of battery;
In order to avoid the normal use of application, this enforcement arranges an application class pattern, on a display screen by an icon representation, can eject a choice box after starting this application class pattern, shows the application also do not tested, and user selects the application needing test.If do not start this application class pattern, directly click and be applied as normal use.When tested application is not opened, the initial voltage recording battery current is V0, and initial time is t0.
Step 202, open tested application simultaneously start timer;
Step 203, judge whether the Preset Time of timer arrives, and if so, then obtains current cell voltage and time;
Step 204, judge whether the difference of current cell voltage and voltage quantities is less than predetermined threshold value: if be less than, then the current time is power consumption point stabilization time of tested application, records current cell voltage and time, performs step S300; Otherwise, by current cell voltage assignment to voltage quantities, return step 203.
Described Preset Time is 5s, and described predetermined threshold value is 10mV.Primary cell voltage and current time is obtained every 5s.When first 5s reaches, recording current cell voltage is V1, and the time is t1; Deducting voltage quantities Vx(with cell voltage V1 is now 0) obtain difference 1, if the absolute value of difference 1 is greater than 10mV, illustrate that the difference of now cell voltage is larger, thus current fluctuation is larger, power consumption is not also stablized, and needs to continue to calculate, and the value of cell voltage V1 is assigned to voltage quantities Vx.The cell voltage recorded when second 5s reaches is V2, and the time is t2; Deducting voltage quantities Vx(with cell voltage V2 is now the value of cell voltage V1) obtain difference 2, if the absolute value of difference 2 is still greater than 10mV, illustrate that now power consumption is not also stablized, need to continue to calculate, the value of cell voltage V2 is assigned to voltage quantities Vx.The cell voltage recorded when the 3rd 5s reaches is V3, and the time is t3; Deducting voltage quantities Vx(with cell voltage V3 is now the value of cell voltage V2) obtain difference 3, suppose that the absolute value of this difference 3 is less than 10mV, illustrate that now power consumption is stablized, time t3 is power consumption point stabilization time of tested application, can by current cell voltage V3, time t3 is as the key element of follow-up power consumption calculation.
Before calculating power consumption, need first to arrange power consumption correspondence table, so that power consumption calculation out inquires about the rank that power consumption determined by this power consumption correspondence table afterwards.Then also comprising before step S300: power consumption correspondence table is set: when 0mV<| difference |≤50mV is the application of first order power consumption; When 50mV<| difference |≤100mV is the application of second level power consumption; When 100mV<| difference |≤150mV is the application of third level power consumption; When 150mV<| difference |≤200mV is the application of fourth stage power consumption; When 200mV<| difference |≤250mV is the application of level V power consumption; When 250mV<| difference |≤300mV is the 6th grade of power consumption application; When 300mV<| difference |≤350mV is the 7th grade of power consumption application; When 350mV<| difference |≤400mV is the 8th grade of power consumption application; When 400mV<| difference |≤450mV is the 9th grade of power consumption application; When 450mV<| difference |≤500mV is the tenth grade of power consumption application.
In the present embodiment, every grade of power consumption application is using the voltage difference of 50mV as cut off value, and namely every adjacent two-stage power consumption application difference 50mV, in the specific implementation, can differ 100mV, 120mV, 200mV etc. as cut off value.Power consumption divides also can totally eight grades or totally ten secondarys.Such as: 0mV<| difference |≤100mV is the application of first order power consumption; When 100mV<| difference |≤200mV is the application of second level power consumption; The like 12 grades are set altogether.Or, 0mV<| difference |≤350mV is the application of first order power consumption; When 350mV<| difference |≤700mV is the application of second level power consumption; The like six grades are set altogether.Numerical values recited in power consumption correspondence table and grade classification can be arranged according to actual requirement, and the present invention is not construed as limiting this.
After setting power consumption correspondence table, the power consumption calculation in step S300 and classification can be carried out.Described step S300 specifically comprises:
Step 301, calculate current cell voltage and the difference of initial voltage, corresponding power consumption application level found out by inquiry power consumption correspondence table;
Step 302, calculate current time and the difference of initial time, sort according to the size of the absolute value of time difference in this power consumption application level, draw the sub-rank of application in this power consumption application level.
Suppose in the present embodiment that current time t3 is power consumption point stabilization time of tested application.Then calculate the difference that cell voltage V3 deducts initial voltage V0, this tested which grade power consumption that is applied as found out by inquiry power consumption correspondence table is applied.Then computing time, t3 deducted the difference that initial time is t0 again.In this grade of power consumption application, compare sequence with the time difference of other application stored, final power consumption level can be obtained.What take when it should be noted that inquiry power consumption correspondence table is the absolute value of difference.
Suppose V3=3920mV, V0=3808mV, t3=22:39:17, t0=22:39:41 of tested application, V3-V0=112mV, t3-t0=24s.Then this tested third level power consumption that is applied as is applied, in the application of third level power consumption, judge its final power consumption level according to 24s.In the present embodiment, first order power consumption is applied as minimum rank, represents the least in power-consuming of tested application; Tenth grade of power consumption is applied as highest level, represents that the power consumption of tested application is the highest.In every grade of power consumption application level, the absolute value of time difference is less, represents that the sub-rank of the application of this tested application is lower.Suppose that, in the application of third level power consumption, the time difference having application A is 15s, the time difference of application B is 30s, and the time difference of tested application is 24s, and the power dissipation ratio application A of known tested application is high and lower than application B.Then the third level power consumption application in make further classification and ordination, apply sub-rank minimum be application A, sequence the first, sequence second be tested application, application son highest-ranking is application B, sequence the 3rd.
In order to distinguish with other application of also not surveying, the classification of later application power consumption is provided and compares foundation, after the power consumption level of clearly this tested application, namely after completing steps S300, also need to store the difference of the power consumption level of tested application, current cell voltage and initial voltage and the difference of current time and initial time, the cell voltage obtain all the other and time reset, to save memory space.
The present invention is also corresponding provides a kind of mobile terminal, refers to Fig. 4, and described mobile terminal comprises timer 10, mode control module 20, voltage acquisition module 30, time-obtaining module 40, judge module 50 and power consumption classified calculating module 60.Described mode control module 20, for starting offline mode, keeps screen Chang Liang; After starting application class pattern, eject the application that choice box display mobile terminal is not also tested select for user; It is connected with voltage acquisition module 30, time-obtaining module 40, obtains and record the initial voltage of battery for starting resistor acquisition module 30, and acquisition module 40 obtained and recorded current initial time start-up time.Described timer 10 is for arranging Preset Time, and it connects voltage acquisition module 30 and time-obtaining module 40, starts timer 10 start timing when tested application is opened; And control voltage acquisition module 30 obtains primary cell voltage every Preset Time, and control time acquisition module 40 obtains a time every Preset Time.Judge module 50 connects voltage acquisition module 30 and time-obtaining module 40, judges that whether the current time be power consumption point stabilization time of tested application; If then record current cell voltage and time.Power consumption classified calculating module 60 connects voltage acquisition module 30 and time-obtaining module 40, it is according to current cell voltage and time, initial voltage and initial time calculate the power consumption number of tested application, carry out power consumption level classification according to this power consumption number to tested application.
Wherein, the system time of mobile terminal when what time-obtaining module 40 obtained is test.Described mode control module 20, also for judging the charged state of battery, automatically stopping when charging charging and pointing out and suspending charging; Keep current state when not charging and point out starting classification.
Described mobile terminal also comprises storage control module 70, it connects voltage acquisition module 30, time-obtaining module 40 and power consumption classified calculating module 60, for the difference of the difference and current time and initial time that store the power consumption level of tested application, current cell voltage and initial voltage; Remaining cell voltage obtain voltage acquisition module 30, time-obtaining module 40 and time reset.
In sum, the present invention at offline mode and carry out under the state keeping screen Chang Liang application power consumption classification, mobile terminal receiving and transmitting signal can be avoided affect the result of consumption detection, improve power consumption classify accuracy; Timer is started when opening tested application, primary cell voltage and time is obtained every Preset Time, find out cell voltage and the time of power consumption point stabilization time of tested application, the reference value that the difference that obtains classifies as power consumption level is subtracted each other with initial voltage and initial time, inquiry power consumption correspondence table can find out corresponding power consumption application level, any application can calculate the power consumption number of its reality, is classified to application by the size of power consumption number, improves accuracy and the compatibility of application class., sort in the power consumption application level drawn according to the size of the absolute value of time difference meanwhile, draw the sub-rank of application in this power consumption application level, the further refinement rank of tested application, improves the accuracy of classification; Its mode classification is simple, is easy to realize, and is applicable to wideling popularize.
Be understandable that, for those of ordinary skills, can be equal to according to technical scheme of the present invention and inventive concept thereof and replace or change, and all these change or replace the protection range that all should belong to the claim appended by the present invention.