CN110647443A - Method for detecting power consumption abnormality, terminal and computer-readable storage medium - Google Patents
Method for detecting power consumption abnormality, terminal and computer-readable storage medium Download PDFInfo
- Publication number
- CN110647443A CN110647443A CN201910914556.4A CN201910914556A CN110647443A CN 110647443 A CN110647443 A CN 110647443A CN 201910914556 A CN201910914556 A CN 201910914556A CN 110647443 A CN110647443 A CN 110647443A
- Authority
- CN
- China
- Prior art keywords
- power consumption
- terminal
- time
- acquiring
- charging
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/3058—Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computing Systems (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Charge And Discharge Circuits For Batteries Or The Like (AREA)
Abstract
The invention discloses a method for detecting power consumption abnormity, which comprises the following steps: the method comprises the steps of obtaining a first endurance time of a terminal according to a first preset strategy, obtaining a second endurance time of the terminal according to a second preset strategy, and judging whether a difference value between the first endurance time and the second endurance time meets a power consumption abnormal condition or not. The invention also discloses a terminal and a computer readable storage medium. According to the invention, the theoretical endurance time and the actual endurance time of the terminal are calculated, and whether the power consumption of the terminal is abnormal is judged according to the difference between the actual endurance time and the theoretical endurance time, so that whether the power consumption of the terminal is abnormal is accurately and effectively judged through a specific algorithm on the premise of not increasing the hardware cost.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a terminal, and a computer-readable storage medium for detecting power consumption anomalies.
Background
Android intelligent terminals in the current market have more power consumption detection schemes, and generally measure based on application power consumption statistics or hardware equipment (such as current measuring instruments, current sensors and the like). The calculation scheme based on the application power consumption situation can only detect the power consumption of the terminal, but cannot effectively judge whether the power consumption of the terminal is abnormal.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a method for detecting abnormal power consumption, a terminal and a computer readable storage medium, and aims to solve the technical problem that whether the power consumption of the terminal is abnormal or not cannot be effectively judged in the prior art.
In order to achieve the above object, the present invention provides a method of detecting a power consumption abnormality, including the steps of:
acquiring a first endurance time of the terminal according to a first preset strategy;
acquiring a second endurance time of the terminal according to a second preset strategy;
judging whether the difference value of the first endurance time and the second endurance time meets the power consumption abnormal condition or not;
if yes, corresponding processing is carried out according to a preset rule.
Optionally, the step of obtaining the first endurance time of the terminal according to the first preset policy includes:
the method comprises the steps of obtaining power consumption of an application program of the terminal in a preset period, and obtaining a first endurance time of the terminal according to the power consumption and the battery capacity of the terminal.
Optionally, the step of obtaining power consumption of the application program of the terminal in a preset period includes:
acquiring the running time of the application program in the preset period;
acquiring the average current of the application program during running;
and obtaining the power consumption of the application program in the preset period according to the running time and the average current.
Optionally, the step of obtaining the average current of the application program during running includes:
acquiring an application scene type of the application program;
and determining the average current of the application program during running according to the application scene type.
Optionally, the preset period includes a plurality of measurement periods, and the step of obtaining the power consumption of the application program of the terminal in the preset period includes:
acquiring the power consumption of the application program in each measurement period;
and respectively carrying out average calculation on the power consumption in the plurality of measurement periods through a weighted average algorithm to obtain the total power consumption of the application program in the preset period.
Optionally, the step of obtaining the second endurance time of the terminal according to the second preset policy includes:
and acquiring the information of the charging event of the terminal in the preset period and determining a second endurance time of the terminal according to the information of the charging event.
Optionally, the step of obtaining the information of the charging event of the terminal in the preset period and determining the second duration of the terminal according to the information of the charging event includes:
acquiring information of at least two charging events of the terminal in the preset period, wherein the information of the charging events comprises the moment of starting charging, the electric quantity at the beginning of charging, the moment of finishing charging and the electric quantity at the end of charging;
obtaining electricity consumption statistical time according to the time when one-time charging starts and the time when the previous charging finishes, and obtaining the electricity consumption of the terminal within the electricity consumption statistical time according to the electricity quantity when the previous charging finishes and the electricity quantity when the one-time charging starts;
calculating the ratio of the power consumption in the power consumption statistical time length to be used as power consumption average current;
and determining a second endurance time of the terminal according to the power consumption average current.
Optionally, the step of obtaining the electricity consumption statistical time according to the time when one charging starts and the time when the previous charging ends includes:
acquiring a time difference value between the moment when one-time charging starts and the moment when the previous charging ends;
judging whether the time difference is greater than or equal to a preset time difference threshold value or not;
and when the time difference is greater than or equal to the preset time difference threshold, taking the time difference as the electricity utilization statistical time length.
Optionally, the step of determining a second endurance of the terminal according to the power consumption average current includes:
acquiring a plurality of power consumption average currents;
and respectively carrying out average calculation on the plurality of power consumption average currents through a weighted average algorithm to obtain a second endurance time of the terminal.
Optionally, the preset period comprises a plurality of working days or a plurality of resting days.
Optionally, the step of determining whether the difference between the first duration and the second duration meets the power consumption abnormal condition includes:
comparing the difference value with a preset threshold range, and if the difference value is not within the preset threshold range, judging that the terminal meets the power consumption abnormal condition;
or
Acquiring the ratio of the difference value to the first endurance time;
and when the ratio of the difference value to the first endurance time is not within a preset ratio threshold range, judging that the terminal meets the power consumption abnormal condition.
Optionally, the preset rule is: and outputting prompt information for reducing resource occupation of application operation.
In addition, to achieve the above object, the present invention also provides a terminal, including: the method for detecting the power consumption abnormity comprises the following steps of:
receiving a power consumption abnormity detection instruction according to a system preset instruction;
determining a terminal power consumption abnormity detection strategy according to the instruction;
acquiring the power consumption information of the terminal, wherein the power consumption information comprises a first endurance time and a second endurance time;
judging whether the terminal consumes abnormal power or not based on the terminal power consumption abnormal detection strategy and the terminal power consumption information;
if yes, corresponding processing is carried out according to a preset rule.
Optionally, the power consumption abnormality detection policy is:
acquiring the power consumption of an application program of the terminal in a preset period, and acquiring a first endurance time of the terminal according to the power consumption and the battery capacity of the terminal;
acquiring the information of a charging event of the terminal in the preset period and determining a second endurance time of the terminal according to the information of the charging event;
and acquiring a difference value between the first endurance time and the second endurance time, and judging whether the power consumption of the terminal is abnormal according to the difference value.
In order to achieve the above object, the present invention further provides a computer-readable storage medium, in which a processing program for detecting a power consumption abnormality is stored, and the processing program for detecting a power consumption abnormality implements the steps of the method for detecting a power consumption abnormality as described above when executed by a processor.
According to the method, the terminal and the readable computer storage medium for detecting the power consumption abnormity, the first endurance time of the terminal is obtained according to the first preset strategy, the second endurance time of the terminal is obtained according to the second preset strategy, and whether the difference value of the first endurance time and the second endurance time meets the power consumption abnormity condition or not is judged. The invention also discloses a terminal and a computer readable storage medium. According to the invention, the theoretical endurance time and the actual endurance time of the terminal are calculated, and whether the power consumption of the terminal is abnormal is judged according to the difference between the actual endurance time and the theoretical endurance time, so that whether the power consumption of the terminal is abnormal is accurately and effectively judged through a specific algorithm on the premise of not increasing the hardware cost.
Drawings
Fig. 1 is a schematic diagram of a terminal structure according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a first embodiment of a method for detecting power consumption anomalies according to the present invention;
FIG. 3 is a flowchart illustrating a second embodiment of a method for detecting power consumption anomalies according to the present invention;
fig. 4 is a flowchart illustrating a method for detecting power consumption abnormality according to a third embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main solution of the embodiment of the invention is as follows: acquiring a first endurance time of a terminal according to a first preset strategy, acquiring a second endurance time of the terminal according to a second preset strategy, and judging whether a difference value between the first endurance time and the second endurance time meets a power consumption abnormal condition
According to the invention, the theoretical endurance time and the actual endurance time of the terminal are calculated, and whether the power consumption of the terminal is abnormal is judged according to the difference between the actual endurance time and the theoretical endurance time, so that whether the power consumption of the terminal is abnormal is accurately and effectively judged through a specific algorithm on the premise of not increasing the hardware cost.
As shown in fig. 1, fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a communication bus 1002, and a memory 1003. Wherein a communication bus 1002 is used to enable connective communication between these components. The memory 1003 may be a high-speed RAM memory or a non-volatile memory (e.g., a disk memory). The memory 1003 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, the memory 1003, which is a kind of computer storage medium, may include therein an operating system and a handler program that detects a power consumption abnormality.
In the apparatus shown in fig. 1, the processor 1001 may be configured to call a handler stored in the memory 1003 that detects a power consumption abnormality, and perform the following operations:
acquiring a first endurance time of the terminal according to a first preset strategy;
acquiring a second endurance time of the terminal according to a second preset strategy;
judging whether the difference value of the first endurance time and the second endurance time meets the power consumption abnormal condition or not;
if yes, corresponding processing is carried out according to a preset rule.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
the method comprises the steps of obtaining power consumption of an application program of the terminal in a preset period, and obtaining a first endurance time of the terminal according to the power consumption and the battery capacity of the terminal.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
acquiring the running time of the application program in the preset period;
acquiring the average current of the application program during running;
and obtaining the power consumption of the application program in the preset period according to the running time and the average current.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
acquiring an application scene type of the application program;
and determining the average current of the application program during running according to the application scene type.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
acquiring the power consumption of the application program in each measurement period;
and respectively carrying out average calculation on the power consumption in the plurality of measurement periods through a weighted average algorithm to obtain the total power consumption of the application program in the preset period.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
and acquiring the information of the charging event of the terminal in the preset period and determining a second endurance time of the terminal according to the information of the charging event.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
acquiring information of at least two charging events of the terminal in the preset period, wherein the information of the charging events comprises the moment of starting charging, the electric quantity at the beginning of charging, the moment of finishing charging and the electric quantity at the end of charging;
obtaining electricity consumption statistical time according to the time when one-time charging starts and the time when the previous charging finishes, and obtaining the electricity consumption of the terminal within the electricity consumption statistical time according to the electricity quantity when the previous charging finishes and the electricity quantity when the one-time charging starts;
calculating the ratio of the power consumption in the power consumption statistical time length to be used as power consumption average current;
and determining a second endurance time of the terminal according to the power consumption average current.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
acquiring a time difference value between the moment when one-time charging starts and the moment when the previous charging ends;
judging whether the time difference is greater than or equal to a preset time difference threshold value or not;
and when the time difference is greater than or equal to the preset time difference threshold, taking the time difference as the electricity utilization statistical time length.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
acquiring a plurality of power consumption average currents;
and respectively carrying out average calculation on the plurality of power consumption average currents through a weighted average algorithm to obtain a second endurance time of the terminal.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
the step of judging whether the difference value between the first endurance time and the second endurance time meets the power consumption abnormal condition or not comprises the following steps:
comparing the difference value with a preset threshold range, and if the difference value is not within the preset threshold range, judging that the terminal meets the power consumption abnormal condition;
or
Acquiring the ratio of the difference value to the first endurance time;
and when the ratio of the difference value to the first endurance time is not within a preset ratio threshold range, judging that the terminal meets the power consumption abnormal condition.
Further, the processor 1001 may call a handler stored in the memory 1003 that detects a power consumption abnormality, and also perform the following operations:
and outputting prompt information for reducing resource occupation of application operation.
Referring to fig. 2, a first embodiment of the present invention provides a method for detecting a power consumption abnormality, including:
step S10, acquiring a first endurance time of the terminal according to a first preset strategy;
in this step, a first duration of the terminal is obtained according to a first preset strategy and is a theoretical duration of the terminal. The obtaining may be performed by adopting a plurality of first preset strategies, for example, obtaining according to a preset database, or obtaining according to a preset algorithm estimation model.
In this embodiment, preferably, the first preset policy is: the method comprises the steps of obtaining power consumption of an application program of the terminal in a preset period, and obtaining a first endurance time of the terminal according to the power consumption and the battery capacity of the terminal.
The preset period is a period for counting power consumption of the application program of the terminal, and specifically, the power consumption of the application program of the terminal in the preset period may be obtained according to the following steps S101 to 103:
step S101, acquiring the running time of the application program in the preset period;
the power consumption of the application program needs to be calculated according to the running time of the application program in the preset period, and then the first endurance time of the terminal needs to be calculated according to the power consumption of the application program in the preset period, where the unit of the first endurance time is day, so that the length of the preset period needs to be an integral multiple of day, for example, the preset period may be 24 hours a day, multiple consecutive days, or a week, and the running time of each application program in the preset period may be obtained by monitoring events and occurrence times of the application program on the terminal for switching between the foreground and the background.
And when the preset period is one day, acquiring the running time of each application program on the terminal in one day. When the preset period is a plurality of consecutive days or a week, one day is taken as one measurement period, that is, the preset period includes a plurality of measurement periods. For each application program, the power consumption of the application program in each measurement period is obtained, the power consumption in a plurality of measurement periods can be respectively calculated in an average manner through a weighted average algorithm, weighting coefficients corresponding to the power consumption can also be obtained, and the power consumption of the application program in the preset period can be obtained according to the power consumption and the corresponding weighting coefficients.
For the weighting coefficients of the power consumption in each measurement period, the same weighting coefficient may be set, or the largest weighting coefficient may be set for the power consumption corresponding to the latest date according to the sequence of the dates of the measurement periods, and the weighting coefficients are sequentially decreased. For example, the preset period is five days, five power consumption amounts X1, X2, X3, X4 and X5 of a certain application program are obtained in five consecutive days, wherein X1 corresponds to the oldest date, X5 corresponds to the newest date, and the power consumption amount X of the application program in the preset period is X1 + 5% + X2 + 10% + X3 + 15% + X4 + 20 + X5 + 50%.
Step S102, obtaining the average current of the application program during operation;
there may be a plurality of methods to obtain the average current of the application program during running, for example, the average current of various application programs is tested in an experimental environment in advance to obtain a data table of the average current of the application program, and in this step, the corresponding average current is obtained from the data table according to the identifier of the application program.
Further, when the number of the application programs is large, in order to reduce the cost of testing in the experimental environment, the application scenes of each application program can be classified, wherein the application scenes comprise calls, photographs, videos, browsing pictures, watching videos and the like, an application scene model is constructed in advance, a corresponding experimental environment is constructed, the average current of each application scene during operation is tested, and the average current table of the following application scenes is obtained:
application scenarios | Average current (unit: mA) |
Communication system | C1 |
Photographing device | C2 |
Video recording | C3 |
Browsing pictures | C4 |
…… | …… |
Watching video | Cn |
When the average current of the application program is determined, the application scene type of the application program is obtained, and then the corresponding average current is inquired from the average current table of the application scene according to the application scene type.
Further, the preset period includes a plurality of working days or a plurality of rest days, that is, since behaviors of the user using the terminal application program are greatly different between the working days and the rest days and have respective behavior laws, statistics of power consumption needs to be separately performed, and the average current values of the application program are obtained by respectively modeling and testing.
And step S103, obtaining the power consumption of the application program in the preset period according to the running time and the average current.
In this step, the running time T of each application program is obtainediAnd average current IiAnd then, acquiring the power consumption A of all the application programs in a preset period according to the following formula, namely, accumulating the products of the running length and the average current of each application program to obtain the power consumption A:
A=iTi*Ii
after the total power consumption of the plurality of application programs of the terminal in a preset period is obtained, the ratio of the battery capacity of the terminal to the total power consumption is used as a first endurance time of the terminal, wherein the battery capacity of the terminal is a calibration capacity of a battery, namely the electric quantity of the battery when the battery is fully charged.
Note that the unit of the first duration is one day.
Step S20, acquiring a second endurance time of the terminal according to a second preset strategy;
in this step, the second endurance time of the terminal is obtained according to a second preset strategy, which may be obtained by multiple preset strategies, for example, estimating the actual endurance time according to charging information submitted by a user, or obtaining information of a charging event of the terminal in the preset period and determining the second endurance time of the terminal according to the information of the charging event.
In the last step S10, a first duration is obtained according to the average current of the application program or the average current of the application scenario tested in the laboratory, and this average current is regarded as the current of the application program in normal operation, so that the first duration reflects the normal power consumption of the application program in normal operation, and can be used as a reference for detecting whether the power consumption of the terminal is abnormal. Then, the actual power consumption of the terminal needs to be obtained, which is obtained by monitoring the charging event of the terminal in a preset period in this step, specifically, the obtaining may be performed according to the following steps S210 to S240:
step S210, acquiring information of at least two charging events of the terminal in the preset period, wherein the information of the charging events comprises the moment of starting charging, the electric quantity at the beginning of charging, the moment of finishing charging and the electric quantity at the end of charging;
in this embodiment, if the information of the charging time is obtained twice or more in the preset period, the information of the charging time of the latest two times is selected to perform the processing of the subsequent steps.
Step S220, obtaining electricity consumption statistical time according to the starting time of one-time charging and the ending time of the previous charging, and obtaining the electricity consumption of the terminal within the electricity consumption statistical time according to the electric quantity at the ending time of the previous charging and the electric quantity at the starting time of the one-time charging;
for example, when the latest charging start time is t1, the electric quantity at the charging start time is e1, the time when the previous charging is finished is t2, and the electric quantity at the charging end time is e2, the difference between t1 and t2 is calculated as the electricity consumption statistical time period, and the difference between e2 and e1 is calculated as the electricity consumption quantity in the electricity consumption statistical time period.
Step S230, calculating the ratio of the power consumption in the power consumption statistical time length to the power consumption statistical time length as power consumption average current;
and step S240, determining a second endurance time of the terminal according to the power consumption average current.
The average current of power consumption is calculated according to the charging time information actually generated by the user, so that the obtained second endurance time reflects the real power consumption condition of the terminal.
Step S30, judging whether the difference value of the first endurance time and the second endurance time accords with the power consumption abnormal condition;
in this step, a difference between the first duration Tum and the second duration Tr may be obtained first, where the first duration Tum is regarded as a theoretical duration, and the second duration Tr is a real duration.
After obtaining the difference value, the difference value may be compared with a preset threshold range, and if the difference value is not within the preset threshold range, it is determined that the terminal meets the power consumption abnormal condition, or a ratio of the difference value to the first duration Tum may be obtained, the ratio is compared with the preset ratio threshold range, and if the difference value is not within the preset ratio threshold range, it is determined that the terminal meets the power consumption abnormal condition.
For example, the preset ratio threshold range is [ S1, S2], for example, [ -10.5%, 50% ], and when (Tr-Tum)/Tum is not within the preset range, that is, Tr is shorter than Tum and is different from Tum by more than a certain range, or Tr is larger than Tum but exceeds a certain range (at this time, it is considered that there is an error in measurement), it indicates that the terminal has abnormal power consumption.
It should be noted that when S1 is equal to S2, the preset ratio threshold range is a value, for example, S1 is equal to S2 which is equal to-10%, when the following inequality is satisfied, it indicates that the power consumption of the terminal is abnormal, that is, if the real duration is longer than the theoretical duration, or the real duration is shorter than the theoretical duration, but the difference is within the preset range, the power consumption of the terminal is normal, otherwise, it is determined that the power consumption of the terminal is abnormal.
(Tr-Tum)/Tum<S
And step S40, if yes, performing corresponding processing according to preset rules.
In this step, the preset rule is: and outputting prompt information for reducing resource occupation of application operation. For example, the power consumption of each application is counted, the user is prompted to clean the application with high power consumption according to the counted power consumption, or the appropriate use frequency or use time of the application is estimated according to the counted power consumption, and the user is prompted to limit the use of some applications with high power consumption according to the estimation, for example, the frequency of use of the application is reduced or the time of single use is reduced.
In the embodiment, the theoretical endurance time of the terminal is obtained by calculating the ratio of the power consumption of the application program of the terminal in the preset period to the battery capacity of the terminal, the actual endurance time of the terminal is calculated according to the information of the charging event of the terminal in the preset period, and whether the power consumption of the terminal is abnormal or not is further judged according to the difference between the actual endurance time and the theoretical endurance time, so that whether the power consumption of the terminal is abnormal or not is accurately and effectively judged through a specific algorithm on the premise of not increasing the hardware cost, and the obtained power consumption information can be widely applied to power consumption optimization, such as abnormal power consumption reminding, corresponding measures are taken when abnormal power consumption is consumed, power consumption fast customer complaint analysis and the like.
Further, referring to fig. 3, a second embodiment of the present invention provides a method for detecting power consumption abnormality based on the first embodiment, where the present embodiment includes in step S240:
step S241 of acquiring a plurality of power consumption average currents;
in this embodiment, if the information of the charging time is obtained twice or more in the preset period, for each two adjacent charging events, the information of the corresponding charging event is processed according to the step S220 to obtain one power consumption average current value, and a plurality of sets of two adjacent charging times can be obtained correspondingly.
Step S242, respectively performing average calculation on the plurality of power consumption average currents through a weighted average algorithm, to obtain a second endurance time of the terminal.
In addition to obtaining the second endurance time of the terminal according to the method in step S242, a weighting coefficient corresponding to each power consumption average current may also be obtained, and the second endurance time of the terminal is obtained according to the power consumption average current and the corresponding weighting coefficient.
In this embodiment, the information of the charging events of two or more times is obtained in the preset period, and the plurality of power consumption average currents can be correspondingly calculated according to the information of the plurality of charging events of two adjacent times. For example, five charging event information in succession is shown in the following table:
for two adjacent charging times, obtaining the electricity consumption statistical time length according to the time when one charging starts and the time when the previous charging ends, and obtaining the electricity consumption of the terminal in the electricity consumption statistical time length according to the electricity quantity when the previous charging ends and the electricity quantity when the one charging starts, namely obtaining four groups of electricity consumption average current values S1, S2, S3 and S4 according to the following formulas:
S1=(ce1-cs2)/(ts2-te1)
S2=(ce2-cs3)/(ts3-te2)
S3=(ce3-cs4)/(ts4-te3)
S4=(ce4-cs5)/(ts5-te4)
after the plurality of sets of power consumption average currents are obtained, a weighting coefficient of each power consumption average current needs to be obtained. The weighting coefficients of the power consumption average currents may be set to be the same, or the largest weighting coefficient may be set to the latest charging time according to the order of the corresponding charging times. For example, S1 + S2 + S15% + S3 + S4 + 55%.
Further, when the number of the power consumption average currents is large, several power consumption average currents with the latest time can be selected according to the preset number and the time sequence.
In this embodiment, when the power consumption average current is multiple, the second endurance time of the terminal is obtained by averaging the multiple power consumption average currents through a weighted average algorithm, so that a more accurate second endurance time can be obtained, and the accuracy of judging whether the power consumption of the terminal is abnormal is improved.
Further, referring to fig. 4, a third embodiment of the present invention provides a method for detecting power consumption abnormality based on the first embodiment, where the step of obtaining the electricity consumption statistical time length according to the time when one charging starts and the time when the previous charging ends in step S220 includes:
the user may frequently charge for a short time in the process of using the terminal, and if the charging time information of the short time is counted and processed, the accuracy of the finally calculated average current of power consumption is affected, so the charging time information of the short time needs to be screened out according to a preset condition.
Step S221, acquiring a time difference value between the moment when one-time charging starts and the moment when the previous charging ends;
step S222, judging whether the time difference value is greater than or equal to a preset time difference value threshold value;
and step S223, when the time difference is greater than or equal to the preset time difference threshold, taking the time difference as the electricity utilization statistical time length.
It should be noted that the preset time difference threshold is preferably four hours.
In this embodiment, the calculated power consumption statistical time is compared with the preset time difference threshold value, so that the shorter power consumption statistical time is screened out, the accuracy of statistical data is improved, and the correctness of the calculated power consumption average current is ensured.
The present invention also provides a terminal, including: the method comprises the steps of storing a memory, a processor and a processing program for detecting the power consumption abnormity, wherein the processing program for detecting the power consumption abnormity is stored in the memory and can run on the processor, and the steps of the method for detecting the power consumption abnormity are realized when the processing program for detecting the power consumption abnormity is executed by the processor.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, where a processing program for detecting a power consumption abnormality is stored in the computer-readable storage medium, and when the processing program for detecting a power consumption abnormality is executed by a processor, the steps of the method for detecting a power consumption abnormality are implemented.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (15)
1. A method for detecting abnormal power consumption is applied to a terminal, and is characterized by comprising the following steps:
acquiring a first endurance time of the terminal according to a first preset strategy;
acquiring a second endurance time of the terminal according to a second preset strategy;
judging whether the difference value of the first endurance time and the second endurance time meets the power consumption abnormal condition or not;
if yes, corresponding processing is carried out according to a preset rule.
2. The method according to claim 1, wherein the step of obtaining the first endurance time of the terminal according to the first predetermined policy comprises:
the method comprises the steps of obtaining power consumption of an application program of the terminal in a preset period, and obtaining a first endurance time of the terminal according to the power consumption and the battery capacity of the terminal.
3. The method for detecting power consumption abnormality according to claim 2, wherein the step of acquiring the power consumption of the application program of the terminal for a preset period comprises:
acquiring the running time of the application program in the preset period;
acquiring the average current of the application program during running;
and obtaining the power consumption of the application program in the preset period according to the running time and the average current.
4. The method of detecting a power consumption abnormality according to claim 3, wherein the step of obtaining the average current at which the application program runs includes:
acquiring an application scene type of the application program;
and determining the average current of the application program during running according to the application scene type.
5. The method for detecting power consumption abnormality according to claim 2, wherein the preset period includes a plurality of measurement periods, and the step of acquiring the power consumption of the application program of the terminal in the preset period includes:
acquiring the power consumption of the application program in each measurement period;
and respectively carrying out average calculation on the power consumption in the plurality of measurement periods through a weighted average algorithm to obtain the total power consumption of the application program in the preset period.
6. The method according to claim 1, wherein the step of obtaining the second endurance time of the terminal according to the second predetermined policy comprises:
and acquiring the information of the charging event of the terminal in the preset period and determining a second endurance time of the terminal according to the information of the charging event.
7. The method of claim 6, wherein the step of obtaining the information of the charging event of the terminal in the preset period and determining the second endurance of the terminal according to the information of the charging event comprises:
acquiring information of at least two charging events of the terminal in the preset period, wherein the information of the charging events comprises the moment of starting charging, the electric quantity at the beginning of charging, the moment of finishing charging and the electric quantity at the end of charging;
obtaining electricity consumption statistical time according to the time when one-time charging starts and the time when the previous charging finishes, and obtaining the electricity consumption of the terminal within the electricity consumption statistical time according to the electricity quantity when the previous charging finishes and the electricity quantity when the one-time charging starts;
calculating the ratio of the power consumption in the power consumption statistical time length to be used as power consumption average current;
and determining a second endurance time of the terminal according to the power consumption average current.
8. The method of detecting power consumption abnormality according to claim 7, wherein the step of obtaining the electricity usage statistic time period based on the time when one charge is started and the time when the previous charge is ended includes:
acquiring a time difference value between the moment when one-time charging starts and the moment when the previous charging ends;
judging whether the time difference is greater than or equal to a preset time difference threshold value or not;
and when the time difference is greater than or equal to the preset time difference threshold, taking the time difference as the electricity utilization statistical time length.
9. The method of detecting power consumption anomalies according to claim 7, characterized in that said step of determining a second endurance of the terminal as a function of the power consumption average current comprises:
acquiring a plurality of power consumption average currents;
and respectively carrying out average calculation on the plurality of power consumption average currents through a weighted average algorithm to obtain a second endurance time of the terminal.
10. Method for detecting electricity consumption anomalies according to any one of claims 2 to 7, characterized in that said preset period comprises a plurality of working days or a plurality of resting days.
11. The method according to any one of claims 1 to 9, wherein the step of determining whether the difference between the first duration and the second duration meets the power consumption abnormality condition comprises:
comparing the difference value with a preset threshold range, and if the difference value is not within the preset threshold range, judging that the terminal meets the power consumption abnormal condition;
or
Acquiring the ratio of the difference value to the first endurance time;
and when the ratio of the difference value to the first endurance time is not within a preset ratio threshold range, judging that the terminal meets the power consumption abnormal condition.
12. The method for detecting a power consumption abnormality according to any one of claims 1 to 9, characterized in that the preset rule is: and outputting prompt information for reducing resource occupation of application operation.
13. A terminal, characterized in that the terminal comprises: the method for detecting the power consumption abnormity comprises the following steps of:
receiving a power consumption abnormity detection instruction according to a system preset instruction;
determining a terminal power consumption abnormity detection strategy according to the instruction;
acquiring the power consumption information of the terminal, wherein the power consumption information comprises a first endurance time and a second endurance time;
judging whether the terminal consumes abnormal power or not based on the terminal power consumption abnormal detection strategy and the terminal power consumption information;
if yes, corresponding processing is carried out according to a preset rule.
14. The terminal of claim 13, wherein the power consumption abnormality detection policy is:
acquiring the power consumption of an application program of the terminal in a preset period, and acquiring a first endurance time of the terminal according to the power consumption and the battery capacity of the terminal;
acquiring the information of a charging event of the terminal in the preset period and determining a second endurance time of the terminal according to the information of the charging event;
and acquiring a difference value between the first endurance time and the second endurance time, and judging whether the power consumption of the terminal is abnormal according to the difference value.
15. A computer-readable storage medium, characterized in that a handler detecting a power consumption abnormality is stored on the computer-readable storage medium, which when executed by a processor implements the steps of the method of detecting a power consumption abnormality according to any one of claims 1 to 12.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910914556.4A CN110647443A (en) | 2019-09-25 | 2019-09-25 | Method for detecting power consumption abnormality, terminal and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910914556.4A CN110647443A (en) | 2019-09-25 | 2019-09-25 | Method for detecting power consumption abnormality, terminal and computer-readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110647443A true CN110647443A (en) | 2020-01-03 |
Family
ID=69011277
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910914556.4A Pending CN110647443A (en) | 2019-09-25 | 2019-09-25 | Method for detecting power consumption abnormality, terminal and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110647443A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112688389A (en) * | 2020-12-21 | 2021-04-20 | 珠海格力电器股份有限公司 | Charging control method and device for equipment, storage medium and electronic device |
CN115391152A (en) * | 2022-10-27 | 2022-11-25 | 浙江数思信息技术有限公司 | Server state monitoring method and device based on Internet of things |
-
2019
- 2019-09-25 CN CN201910914556.4A patent/CN110647443A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112688389A (en) * | 2020-12-21 | 2021-04-20 | 珠海格力电器股份有限公司 | Charging control method and device for equipment, storage medium and electronic device |
CN115391152A (en) * | 2022-10-27 | 2022-11-25 | 浙江数思信息技术有限公司 | Server state monitoring method and device based on Internet of things |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110647443A (en) | Method for detecting power consumption abnormality, terminal and computer-readable storage medium | |
CN113815464B (en) | Charging pile recommendation method and device, vehicle and storage medium | |
CN110133526B (en) | Method, device and equipment for determining SOC of battery and storage medium | |
CN114064445B (en) | Test method, test device, test equipment and computer-readable storage medium | |
CN110737587A (en) | testing method, device, storage medium and server based on testing cases | |
CN115756812A (en) | Resource adjusting method and device and storage medium | |
CN111143209B (en) | Layering pressure testing method and device, electronic equipment and storage medium | |
CN113484762A (en) | Battery state of health estimation method, device, equipment and storage medium | |
CN114801868A (en) | Method, device, equipment and medium for dynamically correcting available power of battery | |
CN111259338B (en) | Component failure rate correction method and device, computer equipment and storage medium | |
CN117009221A (en) | Processing method, device, equipment, storage medium and program product for product test | |
CN115097320A (en) | Battery use estimation method and device, electronic equipment and readable storage medium | |
CN115545241A (en) | Charging pile state identification method and device, electronic equipment and storage medium | |
CN114083987A (en) | Battery monitoring parameter correction method and device and computer equipment | |
CN113934458A (en) | Time sequence index out-of-order detection method, device and medium | |
CN111781450A (en) | Electric parameter sampling method, sampling device, earphone and readable storage medium | |
CN111711957A (en) | Traffic-based site capacity expansion prediction method, device and system | |
CN111367640B (en) | Data statistics period determining method and device, electronic equipment and storage medium | |
CN113439252A (en) | Terminal control method, terminal control device, storage medium and electronic equipment | |
CN113934616B (en) | Method for judging abnormal user based on user operation time sequence | |
CN117124856B (en) | Circulation overvoltage identification method and device, readable storage medium and electric automobile | |
CN117471328B (en) | Method, system and terminal equipment for determining capacity of lead-acid battery | |
CN111016730B (en) | Battery charging detection method and device and terminal equipment | |
CN117314683B (en) | Power operation and maintenance method, device, equipment and medium | |
CN113656275B (en) | User activity prediction method, device, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |