Disclosure of Invention
The invention aims to provide an electric quantity calibration method and an electric quantity calibration device, which are used for solving the problem that the electric quantity display of a button battery is inaccurate due to voltage data fluctuation of the battery in a working state.
In order to achieve the above object, a technical solution of the present invention provides an electric quantity calibration method, including:
acquiring preset group number battery electric quantity data of an ith group, wherein the preset group number battery electric quantity data are periodically acquired;
when the difference value between the maximum value and the minimum value in the battery electric quantity data of the preset group number of the ith group and the battery electric quantity data of the preset group number of the (i-1) th group is smaller than a first preset threshold value, determining the battery electric quantity data of the preset group number of the ith group as a quasi-effective data group;
preprocessing the battery electric quantity data of the preset group number of the ith group to obtain first data;
when the absolute value of the difference value between the first data and the second data is smaller than a second preset threshold value, determining the first data as valid data;
acquiring the percentage of the battery electric quantity corresponding to the first data in a preset battery electric quantity percentage comparison table, and taking the percentage of the battery electric quantity as finally displayed electric quantity data, wherein the second data is as follows: the method comprises the steps of preprocessing battery electric quantity data of a preset number of groups of a kth group to obtain data, wherein the battery electric quantity data of the preset number of groups of the kth group are the battery electric quantity data of the preset number of groups obtained in a period before the battery electric quantity data of the preset number of groups of the ith group are obtained, the battery electric quantity data of the preset number of groups of the kth group are quasi-effective data groups of the battery electric quantity data of the preset number of groups of the ith group, the period is adjacent to the period, i is a positive integer larger than or equal to 2, k is a positive integer larger than or equal to 1, and k is smaller than i.
The invention has the following advantages: and periodically acquiring a plurality of groups of battery electric quantity data, determining a difference value between the maximum value and the minimum value from each group of battery electric quantity data, and if the difference value is smaller than a first preset threshold value, indicating that the group of battery electric quantity data is a quasi-effective data group. And preprocessing the data in the effective data group to obtain first data, and determining the first data as effective data when the difference value between the first data and the second data is smaller than second preset data. This second data is also acquired by acquiring the first data, and the second data is acquired in a period prior to the first data. And comparing the absolute difference value between the two data, and determining that the first data is valid data when the absolute difference value is smaller than a second preset threshold value. And then acquiring the battery power percentage corresponding to the first data in a preset battery power percentage comparison table as a final display result. Different battery electric quantity data are acquired through different periods, then the battery electric quantity data are screened, a quasi-effective data set is selected, effective data are selected, and the absolute difference value between the effective data and the previous effective data can be within a certain range. The condition that the displayed battery power data are wrong due to the fact that the battery is in a working state and the voltage data fluctuate up and down can be filtered through the screening process. The finally screened battery electric quantity data can accurately reflect the actual battery electric quantity data. The unnecessary resource waste caused by directly throwing away the button battery damaged by mistake due to wrong battery electric quantity display of the user is avoided.
In order to achieve the above object, an embodiment of the present invention provides an electric quantity calibration apparatus, including:
the device comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring the battery electric quantity data of the preset group number of the ith group, and the battery electric quantity data of the preset group number is periodically acquired;
the processing unit is used for determining the battery electric quantity data of the preset group number of the ith group as a quasi-effective data group when the difference value between the maximum value and the minimum value in the battery electric quantity data of the preset group number of the ith group and the battery electric quantity data of the preset group number of the (i-1) th group is smaller than a first preset threshold value;
preprocessing the battery electric quantity data of the preset group number of the ith group to obtain first data;
when the absolute value of the difference value between the first data and the second data is smaller than a second preset threshold value, determining the first data as valid data;
the obtaining unit is further configured to obtain, in a preset battery power percentage comparison table, a battery power percentage corresponding to the first data as finally displayed power data, where the second data is: the method comprises the steps of preprocessing battery electric quantity data of a preset number of groups of a kth group to obtain data, wherein the battery electric quantity data of the preset number of groups of the kth group are the battery electric quantity data of the preset number of groups obtained in a period before the battery electric quantity data of the preset number of groups of the ith group are obtained, the battery electric quantity data of the preset number of groups of the kth group are quasi-effective data groups of the battery electric quantity data of the preset number of groups of the ith group, the period is adjacent to the period, i is a positive integer larger than or equal to 2, k is a positive integer larger than or equal to 1, and k is smaller than i.
The invention has the following advantages: and periodically acquiring a plurality of groups of battery electric quantity data, determining a difference value between the maximum value and the minimum value from each group of battery electric quantity data, and if the difference value is smaller than a first preset threshold value, indicating that the group of battery electric quantity data is a quasi-effective data group. And preprocessing the data in the effective data group to obtain first data, and determining the first data as effective data when the difference value between the first data and the second data is smaller than second preset data. This second data is also acquired by acquiring the first data, and the second data is acquired in a period prior to the first data. And comparing the absolute difference value between the two data, and determining that the first data is valid data when the absolute difference value is smaller than a second preset threshold value. And then acquiring the battery power percentage corresponding to the first data in a preset battery power percentage comparison table as a final display result. Different battery electric quantity data are acquired through different periods, then the battery electric quantity data are screened, a quasi-effective data set is selected, effective data are selected, and the absolute difference value between the effective data and the previous effective data can be within a certain range. The condition that the displayed battery power data are wrong due to the fact that the battery is in a working state and the voltage data fluctuate up and down can be filtered through the screening process. The finally screened battery electric quantity data can accurately reflect the actual battery electric quantity data. The unnecessary resource waste caused by directly throwing away the button battery damaged by mistake due to wrong battery electric quantity display of the user is avoided.
Detailed Description
The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Example 1
The embodiment 1 of the invention provides a flow schematic diagram of an electric quantity calibration method. As shown in fig. 1 in detail, the method may include:
and step 110, acquiring the battery capacity data of the preset group number of the ith group.
Specifically, the electric quantity acquisition device can periodically acquire each group of data. For example, 5 minutes as a large period, a set of 5 minutes of data is collected, which includes a total of 5 data, i.e., battery charge data is collected once per minute. A set of 5 battery charge data was collected for 5 minutes. Then the electricity quantity acquisition device uploads the 5 data of the group to the client. And the client obtains the set of data.
And 120, when the difference value between the maximum value and the minimum value in the battery electric quantity data of the preset number of groups of the ith group and the battery electric quantity data of the preset number of groups of the (i-1) th group is smaller than a first preset threshold value, determining the battery electric quantity data of the preset number of groups of the ith group as a quasi-effective data group.
Specifically, the electric quantity acquisition device uploads data every 5 minutes. The preset number of sets is 5 data. And the power collecting device may be in an operating state or a sleeping state within the 5 minutes. Once in operation, the set of data may fluctuate widely, i.e., there may be invalid data. For example, the first minute charge is 80%, the second minute charge is 20%, the third minute charge is 50%, the fourth minute charge is 60%, and the fifth minute charge is 10% within 5 minutes. In effect, this set of data is invalid data. And specifically, whether a group of data is a quasi-effective data group or not is judged, namely, the up-down fluctuation among five data is in a preset range. A corresponding discrimination strategy needs to be adopted. The judgment strategy adopted in the document of the application is as follows:
and when the difference value between the maximum value and the minimum value in the battery capacity data in the ith group of data and the battery capacity data in the preset group number of the (i-1) th group is smaller than a first preset threshold value (for example, 15%), determining the battery capacity data in the preset group number of the ith group as a quasi-effective data group. That is, the client counts the quasi-valid data set every 10 minutes.
The determination of a certain set of data as a quasi-valid data set is only the first step, and subsequent steps are also required to be performed, and finally, the battery capacity data to be displayed is determined. Specifically, the method comprises steps 130-150.
Step 130, preprocessing the battery electric quantity data of the preset group number of the ith group to obtain first data.
Optionally, the preprocessing the battery power data of the preset group number of the ith group may include:
and removing a maximum value and a minimum value in the battery capacity data of the preset group number of the ith group, and then acquiring a peak value in the battery capacity data of the residual group number as first data.
Of course, the first data may be obtained in other manners, such as obtaining an average value of the battery level data of the preset number of sets.
And step 140, when the absolute value of the difference value between the first data and the second data is determined to be smaller than a second preset threshold value, determining that the first data is valid data.
Specifically, the second data is: the method comprises the steps of preprocessing battery electric quantity data of a preset number of groups of a kth group to obtain data, wherein the battery electric quantity data of the preset number of groups of the kth group are the battery electric quantity data of the preset number of groups obtained in a period before the battery electric quantity data of the preset number of groups of the ith group are obtained, the battery electric quantity data of the preset number of groups of the kth group are quasi-effective data groups of the battery electric quantity data of the preset number of groups of the ith group, the period is adjacent to the period, i is a positive integer larger than or equal to 2, k is a positive integer larger than or equal to 1, and k is smaller than i.
Namely, after receiving each group of data uploaded by the electric quantity acquisition device, the client performs one-time screening to screen out the quasi-effective data group. In a specific example, for example, the data uploaded in the second period may be screened to be a quasi-valid data set, the data uploaded in the third period may be screened to be determined to be an invalid data set, and the data uploaded in the fourth period may be screened to be determined to be a quasi-valid data set. Then, the data uploaded in the second period may be interpreted as the battery level data of the preset number of groups of the kth group, and the data uploaded in the fourth period may be interpreted as the battery level data of the preset number of groups of the ith group. And the battery electric quantity data of the k-th group with the preset group number and the battery electric quantity data of the i-th group with the preset group number are quasi-effective data groups with adjacent periods. That is, the period close proximity here is not the period close proximity of the second period and the third period in the usual sense, but it is said that only the adjacent two quasi-valid data groups among the plurality of quasi-valid data groups correspond to the periods. Wherein i may be a positive integer starting from 2, k may be a positive integer starting from 1, and k is smaller than i. Of course, the process of obtaining the second data from the battery power data of the preset number of groups of the kth group is similar to the process of obtaining the first data, and is not described herein again.
After the first data and the second data are acquired from the valid data group, it is further required to determine that an absolute difference between the first data and the second data is first smaller than a second preset threshold (for example, 10%), and this process may be understood as a second screening process. It is further determined that the display of the battery level is in a steady state, where steady means that the battery level is being consumed normally, rather than the battery level fluctuating significantly due to a certain condition.
If the difference between the two is actually smaller than the second preset threshold, it indicates that the first data is actually valid data. Step 150 may be performed.
And 150, acquiring a percentage of the battery electric quantity corresponding to the first data in a preset battery electric quantity percentage comparison table, and taking the percentage as finally displayed electric quantity data.
The preset percentage of battery charge look-up table is shown below, which is merely a reference table based on experimental data. The skilled person can adapt the table according to the actual situation, and the table is only for the convenience of the reader to understand and may not be used as a standard for the actual implementation.
Serial number
|
Actual electric quantity value
|
Display scale
|
1
|
100%
|
100%
|
2
|
99%~90%
|
90%
|
3
|
89%~81%
|
80%
|
4
|
80%~72%
|
70%
|
5
|
71%~64%
|
60%
|
6
|
63%~56%
|
50%
|
7
|
55%-48%
|
40%
|
8
|
47%-39%
|
30%
|
9
|
38%-30%
|
20%
|
10
|
29%-20%
|
10%
|
11
|
19%-0%
|
5% |
TABLE 1
In the above implementation, default i is taken from 2. In fact, there is also a special case. When the first period collects the battery electric quantity data of the preset group number, no reference is provided, so that whether the battery electric quantity data of the preset group number collected in the first period is quasi-effective data cannot be determined, and only the battery electric quantity data of the preset group number collected in the first period can be acquiescent as the quasi-effective data group. And (3) preprocessing the battery electric quantity data of the preset group number of the 1 st group, and taking the third data as effective data acquired for the first time after acquiring the third data.
Here, the process of acquiring the third data is similar to the process of acquiring the first data and the second data, and is not described again.
Further optionally, after step 150, the method may further include:
and counting the data of the final display electric quantity for a preset number of times, wherein the preset number of times is 5 times for example. That is, if 5 minutes is taken as data collected in one cycle, it is actually 10 minutes in one cycle when the quasi-valid data set is subsequently judged. Therefore, the subsequent process is at least 10 minutes as a cycle, and if the preset number is 5 times, 50 minutes is actually a cycle.
And when the number of times that the electric quantity value is 0 in the data of the final display electric quantity of the preset number of times is more than or equal to two times and the number of times that the electric quantity value is less than or equal to 80% is less than or equal to 2 times, displaying that the electric quantity is low and sending out warning information.
Or, when the number of times that the electric quantity value is 0 in the data of the final display electric quantity of the preset number of times is 0, and the number of times that the electric quantity value is greater than or equal to 30% is greater than or equal to 2, switching the electric quantity display state from the low electric quantity state to the normal power supply state.
According to the electric quantity calibration method provided by the embodiment of the invention, a plurality of groups of battery electric quantity data are periodically acquired, the difference value between the maximum value and the minimum value is determined from each group of battery electric quantity data, and if the difference value is smaller than a first preset threshold value, the group of battery electric quantity data is regarded as a quasi-effective data group. And preprocessing the data in the effective data group to obtain first data, and determining the first data as effective data when the difference value between the first data and the second data is smaller than second preset data. This second data is also acquired by acquiring the first data, and the second data is acquired in a period prior to the first data. And comparing the absolute difference value between the two data, and determining that the first data is valid data when the absolute difference value is smaller than a second preset threshold value. And then acquiring the battery power percentage corresponding to the first data in a preset battery power percentage comparison table as a final display result. Different battery electric quantity data are acquired through different periods, then the battery electric quantity data are screened, a quasi-effective data set is selected, effective data are selected, and the absolute difference value between the effective data and the previous effective data can be within a certain range. The condition that the displayed battery power data are wrong due to the fact that the battery is in a working state and the voltage data fluctuate up and down can be filtered through the screening process. The finally screened battery electric quantity data can accurately reflect the actual battery electric quantity data. The unnecessary resource waste caused by directly throwing away the button battery damaged by mistake due to wrong battery electric quantity display of the user is avoided.
Example 2
Corresponding to embodiment 1, an embodiment of the present invention further provides an electric quantity calibration apparatus, specifically as shown in fig. 2, the apparatus includes: an acquisition unit 201 and a processing unit 202.
An obtaining unit 201, configured to obtain preset group number battery capacity data of an ith group, where the preset group number battery capacity data is periodically collected;
the processing unit 202 is configured to determine that the battery electric quantity data of the preset number of groups of the ith group is a quasi-valid data group when a difference value between a maximum value and a minimum value of the battery electric quantity data of the preset number of groups of the ith group and the battery electric quantity data of the preset number of groups of the (i-1) th group is smaller than a first preset threshold;
preprocessing the battery electric quantity data of the preset group number of the ith group to obtain first data;
when the absolute value of the difference value between the first data and the second data is smaller than a second preset threshold value, determining the first data as valid data;
the obtaining unit 201 is further configured to obtain, in a preset battery power percentage comparison table, a battery power percentage corresponding to the first data as finally displayed power data, where the second data is: the method comprises the steps of preprocessing battery electric quantity data of a preset number of groups of a kth group to obtain data, wherein the battery electric quantity data of the preset number of groups of the kth group are the battery electric quantity data of the preset number of groups obtained in a period before the battery electric quantity data of the preset number of groups of the ith group are obtained, the battery electric quantity data of the preset number of groups of the kth group are quasi-effective data groups of the battery electric quantity data of the preset number of groups of the ith group, the period is adjacent to the period, i is a positive integer larger than or equal to 2, k is a positive integer larger than or equal to 1, and k is smaller than i.
Optionally, the processing unit 202 is further configured to define that the battery power data of the preset number of groups of the group 1 is acquired as a quasi-valid data group acquired for the first time, pre-process the battery power data of the preset number of groups of the group 1, and after acquiring third data, take the third data as valid data acquired for the first time.
Optionally, the processing unit 202 is specifically configured to:
removing a maximum value and a minimum value in the battery electric quantity data of the preset group number;
selecting a peak value in the battery electric quantity data of the residual groups as first data;
the quasi-effective data group is the ith group of data or the kth group of data.
Optionally, the apparatus further comprises: a counting unit 203, configured to count data of the final display electric quantity for a preset number of times;
the display unit 204 is configured to display that the electric quantity is low and send out warning information when the number of times that the electric quantity value is 0 in the data of the final display electric quantity of the preset number of times is greater than or equal to two times and the number of times that the electric quantity value is less than or equal to 80% is less than or equal to 2 times.
Optionally, the display unit 204 is further configured to switch the power display state from the low power state to the normal power supply state when the number of times that the power value is 0 in the data of the final display power of the preset number of times is 0, and the number of times that the power value is greater than or equal to 30% is greater than or equal to 2.
The functions performed by the components in the power calibration device provided by the embodiment of the present invention are described in detail in the above embodiment 1, and therefore, are not described in detail here.
The electric quantity calibration device provided by the embodiment of the invention periodically acquires a plurality of groups of battery electric quantity data, determines the difference value between the maximum value and the minimum value from each group of battery electric quantity data, and if the difference value is smaller than a first preset threshold value, the group of battery electric quantity data is regarded as a quasi-effective data group. And preprocessing the data in the effective data group to obtain first data, and determining the first data as effective data when the difference value between the first data and the second data is smaller than second preset data. This second data is also acquired by acquiring the first data, and the second data is acquired in a period prior to the first data. And comparing the absolute difference value between the two data, and determining that the first data is valid data when the absolute difference value is smaller than a second preset threshold value. And then acquiring the battery power percentage corresponding to the first data in a preset battery power percentage comparison table as a final display result. Different battery electric quantity data are acquired through different periods, then the battery electric quantity data are screened, a quasi-effective data set is selected, effective data are selected, and the absolute difference value between the effective data and the previous effective data can be within a certain range. The condition that the displayed battery power data are wrong due to the fact that the battery is in a working state and the voltage data fluctuate up and down can be filtered through the screening process. The finally screened battery electric quantity data can accurately reflect the actual battery electric quantity data. The unnecessary resource waste caused by directly throwing away the button battery damaged by mistake due to wrong battery electric quantity display of the user is avoided.
Example 3
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, on which computer program instructions are stored, and the program instructions, when executed by a client, implement the method steps of embodiment 1 above.
Although the invention has been described in detail above with reference to a general description and specific examples, it will be apparent to one skilled in the art that modifications or improvements may be made thereto based on the invention. Accordingly, such modifications and improvements are intended to be within the scope of the invention as claimed.