Battery electric quantity determination method and terminal equipment
By using the charging and discharging data and the storage capacity of the battery in the terminal device, the current full charge capacity of the battery is quickly and accurately determined, and the problem of poor power learning effect in the prior art is solved, and the efficiency and accuracy of power learning are improved.
Patent Information
- Application Number
- CN202411577903.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-03-25
AI Technical Summary
When using the static electricity calibration algorithm in the prior art, it is difficult to quickly and accurately learn the power of batteries with high electrochemical stability such as lithium iron phosphate batteries, resulting in poor power learning effect.
During the charging and discharging process of the terminal device, it is determined that the data update conditions are currently met based on the charging and discharging data, and the current full charge capacity of the battery is quickly and accurately determined by at least one of the historical full charge capacity stored in the flash memory of the charge meter, the preset full charge capacity of the battery, and the total capacity during the charging and discharging process.
It significantly improves the efficiency and accuracy of battery meter power learning, is suitable for various pluggable battery terminal devices, and improves the effectiveness of user experience and battery health management.
Smart Images

Figure CN119689286A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of battery technology, and in particular, relates to a method for determining battery power and a terminal device. Background Art
[0002] Smart terminal devices are widely used in various industries such as medical, finance, retail, education and entertainment. For portable terminal devices or mobile terminal devices, it is usually necessary to connect a rechargeable battery. Such terminal devices are usually equipped with a fuel gauge to detect the battery power in real time, so as to better manage the battery and provide the user with necessary battery information. For example, some terminal devices with display screens can display the battery power in real time. Considering scenarios such as long-term use, the batteries of some terminal devices are set to be detachable. For terminal devices with pluggable batteries, after the terminal device is disconnected from the battery, the battery that is connected again may be different from the battery that was connected last time. Therefore, how the fuel gauge can quickly and accurately learn the power of the connected battery after each power-on is a priority issue.
[0003] In the prior art, the power meter of the terminal device usually adopts a static power calibration algorithm to learn the power. That is, when the terminal device is turned off or in sleep mode, the power meter detects whether the battery is in a static state at regular time windows. Each time the battery is determined to be in a static state, the power meter collects the open circuit voltage of the battery and estimates the power of the battery at this time based on the open circuit voltage. When the change in the power of the two estimates exceeds the change threshold, and the deviation between the full charge capacity further calculated based on the two estimated powers and the recorded full charge capacity is less than the deviation threshold, the full charge capacity is updated. Based on the updated full charge capacity, the battery power can be calibrated to achieve the purpose of learning the power.
[0004] However, for some batteries with high electrochemical stability, such as lithium iron phosphate batteries, the voltage change is small and the charge change is large. In the static charge calibration algorithm, the open circuit voltage of the battery collected by the fuel gauge has a large deviation, resulting in inaccurate charge determined for such batteries, resulting in poor effect of charge learning. Summary of the invention
[0005] The embodiments of the present application provide a method for determining the battery power, an apparatus for determining the battery power, a terminal device, a computer-readable storage medium, and a computer program product. During the battery charging and discharging process, when it is determined based on the charging and discharging data that a data update condition is currently satisfied, the current full charge capacity of the battery can be quickly and accurately determined based on at least one of the historical full charge capacity stored in the flash memory of the fuel meter, the preset full charge capacity of the battery, and the total capacity charged or discharged during the charging and discharging process, thereby significantly improving the efficiency and accuracy of the fuel meter power learning.
[0006] A first aspect of an embodiment of the present application provides a method for determining battery power, comprising:
[0007] During the charging and discharging process of the first battery currently connected to the terminal device, acquiring charging and discharging data, wherein the charging and discharging data includes charging data of the first battery during the charging process and / or discharging data of the first battery during the discharging process;
[0008] When it is determined based on the charge and discharge data that the data update conditions are currently met, the current full charge capacity of the first battery is determined based on at least one of the first capacity, the second capacity, and the third capacity, wherein the first capacity is the historical full charge capacity stored in the flash memory of the power meter of the terminal device, the second capacity is the preset full charge capacity of the first battery, and the third capacity is equal to the total capacity charged during the charging process or the total capacity discharged during the discharging process.
[0009] In one embodiment, determining the current full charge capacity of the first battery according to at least one of the first capacity, the second capacity, and the third capacity includes:
[0010] When it is determined that the data update conditions are currently met, the current full charge capacity is determined based on the power learning information of the power meter and one of the first capacity, the second capacity or the third capacity, wherein the power learning information includes: first information indicating that the power meter has not yet completed the first learning process for the first battery or second information indicating that the power meter has completed the first learning process for the first battery.
[0011] In one implementation, determining the current full charge capacity according to the power learning information of the power meter and one of the first capacity, the second capacity, or the third capacity includes:
[0012] When the power learning information of the power meter is the first information, determining the current full charge capacity according to the first capacity or the second capacity;
[0013] When the power learning information of the power meter is the second information, the current full charge capacity is determined according to one of the first capacity, the second capacity, or the third capacity.
[0014] In one implementation, when the power learning information of the power meter is the first information, determining the current full charge capacity according to the first capacity or the second capacity includes:
[0015] Reading verification data stored in a flash memory of the power meter, wherein the verification data includes: a value of the first capacity and a first verification value determined according to the first capacity;
[0016] When the first verification value and the second verification value corresponding to the first capacity are equal, determining that the current full charge capacity is equal to the first capacity;
[0017] When the first verification value and the second verification value are not equal, or when no verification data is read, it is determined that the current full charge capacity is equal to the second capacity.
[0018] In one embodiment, the method further comprises:
[0019] When it is determined that the data update condition is currently met and the power learning information of the power meter is the second information, determining whether the first battery reaches the attenuation condition according to the first difference between the third capacity and the second capacity and the first difference threshold;
[0020] If so, updating the verification data stored in the flash memory of the fuel gauge according to the value of the third capacity and a third verification value corresponding to the third capacity when the second difference between the third capacity and the first capacity is greater than or equal to the second difference threshold;
[0021] If not, the calibration data stored in the flash memory of the fuel gauge is cleared.
[0022] In one embodiment, the method further comprises:
[0023] When it is determined that the data update condition is currently satisfied and the electric quantity learning information of the electric quantity meter is the first information, updating the electric quantity learning information of the electric quantity meter to the second information; and / or
[0024] When it is determined that the terminal device is disconnected from the first battery, the power learning information of the power meter is updated to the first information.
[0025] In one embodiment, before determining the current full charge capacity of the first battery, the method further includes:
[0026] During the charging process, if it is determined according to the charging data that the power of the first battery is full, it is determined that the data update condition is currently met; and / or
[0027] During the discharge process, if it is determined according to the discharge data that the power of the first battery has been discharged, it is determined that the data update condition is currently met.
[0028] In one embodiment, after determining the current full charge capacity of the first battery, the method further includes:
[0029] When it is determined according to the charging data that the first battery is fully charged, determining and updating the current remaining capacity and / or the current remaining power of the first battery, wherein the current remaining capacity is equal to the current full charge capacity, and the current remaining power is equal to the full charge capacity; and / or
[0030] When it is determined according to the discharge data that the power of the first battery has been discharged, the current remaining capacity and / or the current remaining power of the first battery is determined and updated, wherein the current remaining capacity is equal to the discharged capacity, and the current remaining power is equal to the discharged power.
[0031] In one embodiment, the method further comprises:
[0032] In response to a power-on instruction, determining a first battery curve parameter corresponding to the first battery;
[0033] If the first battery curve parameter is different from the second battery curve parameter stored in the fuel gauge, updating the first battery curve parameter into the fuel gauge so that the fuel gauge determines the initial charge of the first battery according to the first battery curve parameter;
[0034] Clears the first capacity stored in the flash memory of the fuel gauge.
[0035] A second aspect of an embodiment of the present application provides a device for determining battery power, including:
[0036] An acquisition module, used to acquire charge and discharge data during the charge and discharge process of the first battery currently connected to the terminal device, wherein the charge and discharge data includes charging data of the first battery during the charging process and / or discharging data of the first battery during the discharging process;
[0037] A first determination module is used to determine the current full charge capacity of the first battery according to at least one of the first capacity, the second capacity, and the third capacity when it is determined that the data update condition is currently met according to the charge and discharge data, wherein the first capacity is the historical full charge capacity stored in the flash memory of the power meter of the terminal device, the second capacity is the preset full charge capacity of the first battery, and the third capacity is equal to the total capacity charged during the charging process or the total capacity discharged during the discharging process.
[0038] A third aspect of an embodiment of the present application provides a terminal device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned method for determining battery power when executing the computer program.
[0039] A fourth aspect of an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned method for determining the battery power are implemented.
[0040] A fifth aspect of an embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device can implement the steps in the above-mentioned method for determining the battery power.
[0041] The first aspect of the embodiment of the present application provides a method for determining the battery power. During the charging and discharging process of the battery of the terminal device, when it is determined that the data update condition is currently met according to the charging and discharging data of the battery, the current full charge capacity of the battery is quickly and accurately determined according to at least one of the historical full charge capacity stored in the flash memory of the power meter, the preset full charge capacity of the battery, and the total capacity charged or discharged during the charging and discharging process. On the one hand, since the charging and discharging data collected by the power meter during the battery charging and discharging process are more reliable and can more accurately reflect the changes in the battery power, it can not only accurately determine whether the data update condition is currently met, but also improve the accuracy and efficiency of power learning; on the other hand, the scheme fully considers various possible scenarios of the battery connected to the terminal device during the power learning process, and when it is determined that the data update condition is currently met, according to the three different capacity values corresponding to these scenarios, the full charge capacity of the battery in the scenario can be quickly and accurately determined, thereby not only improving the accuracy and efficiency of the power meter power learning, but also improving the applicability and flexibility of the scheme, and providing a better user experience.
[0042] It can be understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0044] Figure 1 is a flowchart of a method for determining battery power provided by an embodiment of the present application;
[0045] Figure 2 It is a schematic diagram of a partial structure of a terminal device provided by an embodiment of the present application;
[0046] Figure 3 is a flowchart of a method for determining battery power provided by another embodiment of the present application;
[0047] Figure 4 is a flowchart of a method for determining battery power provided by another embodiment of the present application;
[0048] Figure 5 is a structural schematic diagram of a device for determining battery power provided by another embodiment of the present application;
[0049] Figure 6It is a structural diagram of a terminal device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0050] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0051] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0052] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0053] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0054] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0055] As mentioned above, in the prior art, the fuel meter of the terminal device usually uses a static power calibration algorithm to complete power learning. That is, when the terminal device is turned off or in sleep mode, the fuel meter detects whether the battery is in a static state at regular time windows. Each time it is determined that the battery is in a static state, the fuel meter collects the open circuit voltage of the battery and estimates the battery power at this time based on the open circuit voltage. When the change in the two estimated power exceeds the change threshold, and the deviation between the full charge capacity further calculated based on the two estimated power and the recorded full charge capacity is less than the deviation threshold, the full charge capacity is updated. Based on the updated full charge capacity, the battery power can be calibrated to achieve the purpose of learning the power.
[0056] However, for some batteries with high electrochemical stability, the effect of using traditional static charge calibration algorithms for charge learning is poor, which is specifically manifested in that it is difficult to quickly learn the accurate battery charge.
[0057] The following is an example of lithium iron phosphate battery. On the one hand, lithium iron phosphate battery has the characteristics of flat voltage platform. Specifically, the voltage change is small and the power change is large (the voltage change of 30% in the flat area corresponds to only about 1mV). This requires the analog-to-digital converter of the fuel gauge to have a high precision in order to accurately capture the tiny voltage change. If the accuracy of the analog-to-digital converter is insufficient, even a small measurement error will be amplified in the power calculation, resulting in inaccurate calculated power data. On the other hand, after the load pulls down the voltage, it takes a long time (usually more than 15 minutes) for the lithium iron phosphate battery to recover to a more accurate open circuit voltage. Due to its relatively slow electrochemical reaction rate, the voltage recovery process is slow. Therefore, when the terminal device is turned off or in sleep mode, due to the slow recovery of the lithium iron phosphate battery voltage, the open circuit voltage of the battery collected by the analog-to-digital converter of the fuel gauge has a large deviation, so it is difficult to quickly learn the accurate power. Therefore, the logic of the traditional static power calibration algorithm cannot meet the learning method for the power of lithium iron phosphate batteries.
[0058] In order to at least partially solve the above technical problems, the embodiments of the present application provide a method for determining battery power. The method is applicable to various terminal devices that require rechargeable batteries, especially terminal devices that use pluggable batteries, including but not limited to: portable terminal devices such as smart phones, laptops, tablet computers, portable point of sale terminals (POS terminals for short), walkie-talkies, electronic watches, sports bracelets, cameras, camcorders, voice recorders, and other portable terminal devices including mobile robots. Figure 1 As shown, the method for determining the battery power provided in the embodiment of the present application includes the following steps:
[0059] Step S110, acquiring charging and discharging data during the charging and discharging process of the first battery currently connected to the terminal device, wherein the charging and discharging data includes charging data of the first battery during the charging process and / or discharging data of the first battery during the discharging process.
[0060] In the embodiment of the present application, the first battery is any battery currently connected to the terminal device. In one example, the battery in the terminal device is detachable, and the terminal device can be connected to any matching battery model. Taking the POS terminal as an example, for ease of use, a POS terminal can be equipped with multiple batteries of the same model. When a battery runs out of power, it can be replaced with a spare battery with sufficient power, or when the service life of a battery reaches a certain limit, it can be replaced with a good battery. Of course, the battery of the terminal device can also be non-detachable, and the terminal device can always be connected to the same battery.
[0061] In an embodiment of the present application, the charging and discharging process of the first battery may include the charging process and / or the discharging process of the first battery. Accordingly, the charging and discharging data may include the charging data of the first battery during each charging process, and may also include the discharging data of the first battery during each discharging process. The charging and discharging data may specifically be relevant data that can reflect the charging and discharging conditions collected and calculated by the battery management module during the battery charging and discharging process. Specifically, the charging data may include: the current, voltage, cumulative charged capacity, battery health status (such as battery aging, internal resistance change, etc.) of the battery during the current charging process, charging temperature, charging time, energy conversion efficiency, etc. Similarly, the discharging data may include: the current, voltage, cumulative discharged capacity, battery health status (such as battery aging, internal resistance change, etc.) of the battery during the current discharging process, discharge temperature, discharge time, energy conversion efficiency, etc.
[0062] In a specific example, the terminal device includes a central processing unit (CPU) and a fuel gauge. Each time the terminal device receives a power-on command (such as a user pressing a power-on button), the CPU communicates with the fuel gauge through the I2C bus, sends the battery curve parameters of the first battery currently connected to the terminal device to the fuel gauge, and resets the fuel gauge chip. The battery curve parameters can be a data table of standard parameters related to the power of each battery, which can be established by the fuel gauge manufacturer based on the real data of batteries of different brands and models measured in advance. The data table can specifically include: a corresponding table of battery temperature and capacity in the battery model, a corresponding table of open circuit voltage and power in the battery model, an internal resistance table, etc. It can be understood that the battery curve parameters of batteries of different brands and models can be different. Afterwards, the fuel gauge collects the current battery voltage, the current battery current and the current battery temperature through an analog-to-digital converter. The preset full charge capacity of the battery can be obtained according to the current battery temperature combined with the corresponding table of battery temperature and capacity in the battery curve parameters. Afterwards, the current battery internal resistance is calculated by the current battery temperature, the current battery voltage, and the internal resistance table in the battery curve parameters. Furthermore, the open circuit voltage of the battery can be calculated based on the current battery internal resistance, the current battery voltage, and the current battery current (open circuit voltage = battery voltage + battery current × battery internal resistance). Finally, based on the open circuit voltage of the battery and the correspondence table between the open circuit voltage and the battery power in the battery curve parameters, the current battery power, that is, the initial power of the first battery, is obtained to complete the initialization of the fuel gauge. After the initialization is completed, if the battery is charged, the fuel gauge can collect relevant charging data during the charging process, such as the charging current and charging voltage, as well as the cumulative charging capacity, in real time. If the battery is not charged, the battery is usually in a discharging state during the use of the terminal device, and the fuel gauge can also collect the discharge data of the battery during the discharge process, such as the discharge voltage, discharge current, etc.
[0063] Step S120, when it is determined that the data update condition is currently met according to the charge and discharge data, the current full charge capacity of the first battery is determined according to at least one of the first capacity, the second capacity, and the third capacity. The first capacity is the historical full charge capacity stored in the flash memory of the power meter of the terminal device, the second capacity is the preset full charge capacity of the first battery, and the third capacity is equal to the total capacity charged in the charging process or the total capacity discharged in the discharging process.
[0064] In an embodiment of the present application, when it is determined that the charging completion degree or the discharging completion degree is a preset completion degree, it is determined that the data update condition is currently met. The preset completion degree can be set according to actual needs and can be represented by a suitable indicator. In one example, the preset completion degree can be 100%, which means that the battery is fully charged during the charging process, or that the battery is emptied during the discharging process. For example, the fuel gauge can determine whether the battery is fully charged according to the charging data during the charging process. If so, it can be determined that the data update condition is currently met. In another example, the preset completion degree can also be other suitable values. For example, a voltage reference value table for different types of batteries can be established in advance through testing, and the voltage value of the battery corresponds to the battery power percentage. For example, for lithium iron phosphate batteries, a corresponding relationship table between the charging voltage of the battery and the battery power percentage can be tested to determine. That is, each voltage value corresponds to a power percentage. According to the corresponding relationship table, a curve about the relationship between the charging voltage and the battery power can be fitted. And the preset completion degree can be determined according to the power percentage corresponding to the turning point of the curve. For example, the curve of the power of a lithium iron phosphate battery changing with the open circuit voltage changes relatively smoothly in the power range of about 10% to 94%, while the voltage changes steeply in the power range of 95% to 100%. Therefore, the preset completion degree can be set to 95%. And during the charging process, it can be determined whether the open circuit voltage of the battery is the open circuit voltage at 95% of the power in the corresponding relationship table. If so, it can be determined that the data update condition is currently met.
[0065] In an embodiment of the present application, the first capacity is the historical full charge capacity stored in the flash memory of the fuel meter of the terminal device. The historical full charge capacity may be the full charge capacity of the battery learned by the fuel meter most recently, or the full charge capacity of the battery learned by the fuel meter at a previous time (for example, the updated full charge capacity when the battery capacity decay is determined). For example, when the data update condition is determined to be met last time, the full charge capacity of the battery with the same model as the current battery determined and stored by the fuel meter. In an embodiment of the present application, the second capacity is the preset full charge capacity of the first battery. Specifically, it may be the full charge capacity calculated according to the battery curve parameters of the first battery. As mentioned above, during the initialization process, the fuel meter may collect the battery temperature of the first battery through an analog-to-digital converter. According to the battery temperature, the preset full charge capacity of the first battery may be obtained by looking up the corresponding table of battery temperature and capacity in the battery curve parameters. Exemplarily, the third capacity may be the sum of the cumulative charge capacity during the entire charging process (the unit may be ampere-hour or milliampere-hour), or the sum of the cumulative discharge capacity during the discharge process. Any suitable method may be used to determine the charging capacity and the discharging capacity, which is not limited in this application. For example, a coulomb meter calculates the charging or discharging capacity based on the current and voltage values collected by an analog-to-digital converter.
[0066] In an embodiment of the present application, when it is determined that the data update condition is currently met, the current full charge capacity of the first battery is determined according to at least one of the first capacity, the second capacity, and the third capacity. In one example, a variety of suitable screening methods can be used to select one from the first capacity, the second capacity, and the third capacity, and the current full charge capacity of the first battery is determined according to the selected one. For example, the selected one can be directly used as the current full charge capacity of the first battery. In another example, the three capacities can also be statistically analyzed to obtain a new capacity as the current full charge capacity of the first battery. For example, a weighted average method can also be used to obtain the current full charge capacity of the first battery.
[0067] It can be understood that the scenarios in which the terminal device is connected to the battery include the following: the first scenario is that the terminal device is connected to the same battery, and the battery capacity has not decayed relative to the previous power calibration; the second scenario is that the terminal device is connected to the same battery, but the battery capacity has decayed relative to the previous power calibration; the third scenario is that the terminal device has replaced a new battery. Corresponding to the first scenario, the first capacity (for example, the full charge capacity of the battery most recently learned by the fuel gauge) can more accurately represent the current full charge capacity of the battery; corresponding to the second scenario, the current full charge capacity of the battery can be more accurately determined based on the third capacity (the total capacity accumulated in or discharged during the current charging and discharging process); corresponding to the third scenario, the second capacity (the preset full charge capacity of the first battery) can more accurately represent the current full charge capacity of the battery. Therefore, no matter what the scenario is, based on these three, the current full charge capacity of the first battery can be quickly and accurately determined.
[0068] Exemplarily, after determining the current full charge capacity of the first battery, the current full charge capacity can be updated and stored in the corresponding storage location in the fuel gauge. For example, the flash memory of the fuel gauge has an erase and write function, and there are storage partitions A and B in the flash memory, wherein the value of the first capacity mentioned above can be stored in storage partition A, and the value of the second capacity mentioned above can be stored in storage partition B. In one example, each time a new current full charge capacity is determined, the value of the current full charge capacity can be written in storage partition A (erasing the old value of the first capacity). In another example, each time a new current full charge capacity is determined, the current full charge capacity can be compared with the preset full charge capacity of the first battery to determine whether the battery capacity has decayed. If so, the value of the current full charge capacity is written in storage partition A (erasing the old value of the first capacity). In this example, storage sub-area A may contain data or may not contain any data (for example, the battery capacity has not decayed). Exemplarily, to facilitate subsequent verification, when the value of the current full charge capacity is written into storage sub-area A, a verification value corresponding to the current full charge capacity can also be written into storage sub-area A (the verification value can be obtained by encoding the value of the current full charge capacity using various suitable data encoding methods), and the verification value and the value of the current full charge capacity can be used as verification data for subsequent verification.
[0069] For example, after determining the current full charge capacity, the current remaining capacity and the current remaining power (the percentage between the current remaining capacity and the current full charge capacity) can be updated according to the current full charge capacity, and the current remaining power can be displayed on the display screen of the terminal device as the current remaining power. In this way, the purpose of calibrating the power can be achieved. At least during the charging and discharging process before the next update, the current remaining power can be quickly and accurately determined based on the current full charge capacity and the charged power and discharged power.
[0070] As mentioned above, for some batteries with high electrochemical stability, the effect of using the traditional static charge calibration algorithm for charge learning is poor, which is specifically manifested in that it is difficult to quickly learn the accurate battery charge. The battery charge learning method provided in the first aspect of the embodiment of the present application, during the charging and discharging process of the battery of the terminal device, when it is determined that the data update condition is currently met based on the battery charging and discharging data, the current full charge capacity of the battery is quickly and accurately determined based on at least one of the historical full charge capacity stored in the flash memory of the power meter, the preset full charge capacity of the battery, and the total capacity charged or discharged during the charging and discharging process. On the one hand, during the battery charging and discharging process, the charging and discharging data collected by the fuel meter is more reliable and can more accurately reflect the changes in battery power. It can not only accurately determine whether the data update conditions are currently met, but also improve the accuracy and efficiency of power learning. On the other hand, the solution fully considers various possible scenarios of the battery connected to the terminal device during the power learning process, and when it is determined that the data update conditions are currently met, the full charge capacity of the battery in the scenario can be quickly and accurately determined based on the three different capacity values corresponding to these scenarios. This not only improves the accuracy and efficiency of the fuel meter power learning, but also improves the applicability and flexibility of the solution, and provides a better user experience.
[0071] In one implementation, before step S110, the method for determining the battery power of the embodiment of the present application further includes the following steps:
[0072] Step S101, in response to a power-on instruction, determining a first battery curve parameter corresponding to a first battery;
[0073] Step S102, if the first battery curve parameter is different from the second battery curve parameter stored in the fuel meter, updating the first battery curve parameter to the fuel meter so that the fuel meter determines the initial power of the first battery according to the first battery curve parameter;
[0074] Step S103, clearing the first capacity stored in the flash memory of the power meter.
[0075] like Figure 2As shown, the terminal device in the embodiment of the present application may include: a CPU, a battery and a fuel gauge chip. The fuel gauge chip and the CPU may communicate via an I2C bus. Steps S101 and S102 may be executed by the CPU of the terminal device. Specifically, each time the terminal device receives a power-on instruction, the CPU may search and determine the first battery curve parameter corresponding to the first battery according to the identification information such as the model of the first battery currently connected. As mentioned above, the battery curve parameter of each battery may be a data table of standard parameters related to the power of each battery, which may be established by the fuel gauge manufacturer based on the real data of batteries of different brands and models measured in advance. The second battery curve parameter may be a battery curve parameter of a battery (for example, called a second battery) stored in the flash memory of the fuel gauge and connected to the last time the terminal device was powered on. Then, it may be determined whether the first battery curve parameter and the second curve parameter are the same. Exemplarily, a cumulative checksum algorithm may be used to determine whether the first battery curve parameter and the second curve parameter are the same. The cumulative checksum algorithm is a simple error detection method that obtains a checksum value by adding each byte in the data. Specifically, the CPU can first calculate the checksum value of the battery curve parameter of the first battery, and then send a command to obtain the checksum value of the second battery curve parameter through the I2C bus to obtain the checksum value of the second battery curve parameter stored in the flash memory of the fuel meter chip. Compare the two checksum values. If the two checksum values are not equal, first communicate with the fuel meter chip through the I2C bus of the CPU to update the first battery curve parameter to the fuel meter. Then, send a reset command to the fuel meter to notify the fuel meter chip to reset. Then, the fuel meter chip completes the initialization of the fuel meter. Specifically, during the initialization process of the fuel meter, the fuel meter can accurately determine the initial power of the first battery based on the updated first battery curve parameter. In this way, during the charging and discharging process after the initialization is completed, at the moment when the data update condition is not met, the battery power can also be quickly estimated based on the initial power. That is to say, in this example, if the first battery curve parameter is different from the second battery curve parameter (the two checksum values are different), it can be explained that the first battery currently connected to the terminal device is different from the second battery connected last time. Updating the current battery curve parameter of the first battery to the fuel meter can make the initial battery power determined by the fuel meter during the initialization process more accurate. If the first battery curve parameter is the same as the second battery curve parameter, step S102 and step S103 may not be performed.
[0076] In the embodiment of the present application, if it is determined that the first battery curve parameter is different from the second battery curve parameter, the first capacity stored in the flash memory of the power meter is cleared. It can be understood that the first battery curve parameter is different from the second battery curve parameter, indicating that the terminal device has replaced another battery. Clearing the full charge capacity of other batteries stored in the flash memory can prevent data errors and improve the accuracy of power learning.
[0077] In the above scheme, before receiving the power-on command, the terminal device first determines the battery curve parameters corresponding to the current battery, and compares them with the battery curve parameters stored in the fuel meter. If the two are inconsistent, the battery curve parameters in the fuel meter are updated, and the first capacity stored in the flash memory of the fuel meter is cleared. This scheme enables the fuel meter to accurately determine the initial power of the current battery according to the updated battery curve parameters. This adaptability enables the fuel meter to better adapt to the replacement of the battery and improve the accuracy of power monitoring. And in the case of determining that the battery curve parameters are inconsistent, the data about the full charge capacity of the last connected battery stored in the flash memory of the fuel meter is also cleared. By clearing the old full charge capacity data, the use of unmatched battery parameters for power calculation can be reduced. Clearing the old data enables the fuel meter to re-learn and adapt to the replacement of the pluggable battery according to the new parameters of the current battery, which can prevent the confusion of the old and new battery parameters, and improve the data accuracy of the fuel meter and the effectiveness of battery health management. In general, the above scheme allows the fuel meter to use the correct battery parameters in each learning process, further improves the accuracy of power monitoring, optimizes the battery capacity, enhances the robustness of the system, and improves the user experience.
[0078] In one implementation, before determining the current full charge capacity of the first battery in step S120, the method for determining the battery power in the embodiment of the present application further includes the following steps S104 and / or S105.
[0079] Step S104: During the charging process, if it is determined according to the charging data that the power of the first battery is full, it is determined that the data update condition is currently met.
[0080] In an embodiment of the present application, a variety of suitable methods can be used to determine whether the power of the first battery is full based on the charging data. In one example, during the charging process, the analog-to-digital converter of the fuel gauge can collect the charging voltage and charging current of the first battery at a preset frequency (such as 1 millisecond / time), and judge in real time whether the charging voltage and charging current collected within the current first time window (for example, 10 seconds, 20 seconds) both meet the preset full charge condition. The preset full charge condition can be arbitrarily set according to actual needs. For example, the preset full charge condition includes: the charging voltage collected within the current first time window is always greater than the charging cut-off voltage; the charging current is always greater than the minimum charging current and less than the charging cut-off current. If it is determined that the charging voltage and charging current collected within the current first time window both meet the preset full charge condition, it can be determined that the power of the first battery is full, that is, it is determined that the data update condition is currently met.
[0081] Step S105: During the discharge process, if it is determined according to the discharge data that the power of the first battery has been discharged, it is determined that the data update condition is currently met.
[0082] In an embodiment of the present application, a variety of suitable methods can be used to determine whether the power of the first battery has been discharged based on the discharge data. Similar to the above step S104, during the discharge process, the analog-to-digital converter of the power meter can collect the discharge voltage of the first battery at a preset frequency, and determine in real time whether the discharge voltage collected within the current second time window (for example, 40 seconds, 60 seconds) meets the preset emptying condition. The preset emptying condition can be arbitrarily set according to actual needs. For example, the preset emptying condition includes: the discharge voltage collected within the current second time window is always less than the charging zero voltage (the voltage at which the battery power is 0%). If it is determined that the discharge voltage collected within the current second time window meets the preset emptying condition, it can be determined that the power of the first battery has been discharged, that is, it is determined that the data update condition is currently met.
[0083] It can be understood that the battery charge and discharge data can be used to more accurately monitor the full or empty state of the battery. Updating the battery power data every time the battery is full or empty can improve the accuracy of the power data, because the battery power in these states is relatively easier to measure and determine. And at the end of each charge and discharge cycle, the state of the battery is relatively stable. At this time, updating the power data helps to calibrate the state of the battery and reduce the error caused by battery aging or changes in usage conditions. If the power data is continuously updated during the use of the battery, a large error may accumulate due to small measurement errors. Updating at the end of the charge and discharge cycle can weaken this cumulative error. When the battery is fully charged and discharged, the chemical state of the battery is relatively consistent, which simplifies the power calculation model and makes the power prediction more reliable. In general, updating the power data when the battery is full or empty can improve the accuracy of power monitoring, optimize battery use, enhance user experience, and improve the effectiveness of battery health management and smart device scheduling.
[0084] In one implementation, after determining the current full charge capacity of the first battery in step S120, the method for determining the battery power in the embodiment of the present application further includes the following steps S131 and / or S132.
[0085] Step S131, when it is determined based on the charging data that the first battery is fully charged, determine and update the current remaining capacity and / or the current remaining power of the first battery, wherein the current remaining capacity is equal to the current full charge capacity, and the current remaining power is equal to the full charge capacity.
[0086] In an embodiment of the present application, the fuel gauge can determine the current remaining capacity and / or the current remaining power according to the current full charge capacity learned each time, and can update and store the current remaining capacity and / or the current remaining power in the memory. For example, during the charging process, at multiple moments when the full charge condition is not reached, the remaining capacity and the remaining power of the first battery can be estimated according to the preset full charge capacity of the first battery, the initial power determined by the initialization process, and the charge and discharge data, and updated in the memory of the fuel gauge. In this step, when it is determined that the power of the first battery is full, not only the current full charge capacity of the first battery can be determined, but also the first capacity can be updated according to the current full charge capacity. For example, the value of the original first capacity stored in the storage partition A of the flash memory is updated to the value of the current full charge capacity. In addition, the value of the current full charge capacity stored in the memory can also be used as the current remaining capacity. Similarly, a full charge capacity such as "100%" can be stored in the memory as the current remaining power. Exemplarily, the terminal device may include a display screen, and the current remaining power can be displayed using the display screen. For example, when the first battery is fully charged, information indicating that the battery level is 100% may be displayed on the interface displayed on the display screen, or a prompt message indicating that "charging is complete, please remove the power source in time" may be displayed.
[0087] Step S132, when it is determined according to the discharge data that the power of the first battery has been discharged, determine and update the current remaining capacity and / or the current remaining power of the first battery, wherein the current remaining capacity is equal to the discharged capacity, and the current remaining power is equal to the discharged power.
[0088] Similar to the solution of step S131 above, in this step, when it is determined that the power of the first battery has been discharged, the value of the original first capacity stored in the storage partition A can be updated to the value of the current full charge capacity. The value of the current discharged capacity (for example, "0") can be stored in the memory of the power meter as the current remaining capacity; and the discharged power such as "0%" can be stored in the memory of the power meter as the current remaining power.
[0089] The accuracy of the power display can be improved by updating the power data when the battery is fully charged or discharged. At these specific moments, the battery power status is the most clear, so more accurate power information can be provided. Updating data at the two extreme states of battery power (full and empty) simplifies the power calculation algorithm and can reduce errors that may accumulate due to continuous monitoring during battery use. In addition, accurate power display can increase user trust in the device power indication, thereby improving the user experience. This solution makes battery management more efficient and accurate by updating data at the two extreme states of battery power, which helps to improve battery efficiency, extend battery life, and enhance the safety and reliability of the device.
[0090] In one implementation, step S120 determines the current full charge capacity of the first battery according to at least one of the first capacity, the second capacity, and the third capacity, including:
[0091] Step S120a, when it is determined that the data update conditions are currently met, determine the current full charge capacity based on the power learning information of the power meter and one of the first capacity, the second capacity or the third capacity, wherein the power learning information includes: first information indicating that the power meter has not yet completed the first learning process for the first battery or second information indicating that the power meter has completed the first learning process for the first battery.
[0092] In an embodiment of the present application, when it is determined that the data update condition is currently met, the current power learning information of the fuel meter can be obtained first. The power learning information can be the power learning information of the fuel meter for the currently connected first battery, which can be information indicating whether the fuel meter has ever calibrated the power of the current first battery, that is, whether the fuel meter has completed the first learning process for the first battery. In an embodiment of the present application, the power learning information may be the first information indicating that the fuel meter has not yet completed the first learning process for the first battery, or it may be the second information indicating that the fuel meter has completed the first learning process for the first battery. For example, data of power learning information is stored in the memory of the fuel meter, such as the first learning completion flag. For example, a character string such as "0" or "1", "True" or "Fail se" is stored in the memory. For example, the character string number "True" is the first information, and "Fail se" is the second information. For example, in the above data update condition that the first battery is fully charged or the first battery is discharged, if the terminal device has been connected to the first battery for a period of time, and the first battery has been fully charged or discharged, and when the battery is fully charged or discharged, the fuel meter updates the current full charge capacity, then the fuel meter's fuel meter learning information is the second information, such as storing "True" in the memory; if the first battery has not been fully charged or discharged after the terminal device is connected to the first battery, then the fuel meter's fuel meter learning information is the first information, and "False" is stored in the memory.
[0093] In an embodiment of the present application, when it is determined that the data update condition is currently met, one of the first capacity, the second capacity, or the third capacity can be selected according to the power learning information of the current power meter as a basis for determining the current full charge capacity. For example, different power learning information corresponds to different screening results. After obtaining the screening results, the screened one can be directly used as the current full charge capacity. Alternatively, after obtaining the screening results, the current full charge capacity can also be further calculated.
[0094] It can be understood that the integrity of each charge and discharge learning process of the fuel meter can be more accurately determined by considering whether the fuel meter has completed the first learning process for the current battery. For example, in the above data update condition that the first battery is fully charged or the first battery is discharged, the fuel meter's power learning information can be used to more accurately determine whether the current charging process or discharging process is complete, thereby providing a more accurate reference for the subsequent determination of the current full charge capacity of the battery, so that the fuel meter can learn the accurate power more quickly and accurately.
[0095] In the above scheme, combined with whether the fuel gauge has completed the first learning process for the current battery, the current full charge capacity of the battery is determined according to one of the first capacity, the second capacity or the third capacity, which can significantly improve the accuracy and reliability of power monitoring, optimize battery use, extend battery life, and enhance user experience.
[0096] In one implementation, step S120a determines the current full charge capacity based on the power learning information of the power meter and one of the first capacity, the second capacity or the third capacity, including the following steps S120a.1 and S120a.2.
[0097] Step S120a.1: when the power learning information of the power meter is the first information, determine the current full charge capacity according to the first capacity or the second capacity.
[0098] The following description will be made by taking the data update condition that the first battery is fully charged or the first battery is discharged as an example.
[0099] For example, during the charging process of the first battery, if it is detected that the battery is fully charged, the first learning completion flag of the fuel meter stored in the memory of the fuel meter can be read. If it is "Fail", it can be determined that the fuel meter has not completed the first learning process for the currently connected first battery. In other words, after the terminal device is connected to the first battery, the battery has not been fully charged or emptied, indicating that the current charging process is likely not a complete charging process (indicating that the first battery may be a new battery that has never been used, or the first battery has been unplugged and plugged in), and the accumulated power charged this time is likely to be part of the battery capacity. Therefore, the current full charge capacity can be determined based on the first capacity (for example, the full charge capacity of the battery that the fuel meter has learned most recently, corresponding to the scenario where the first battery is unplugged and then installed) or the second capacity (the preset full charge capacity determined according to the battery curve parameters of the first battery, corresponding to the scenario where the first battery is a new battery).
[0100] Step S120a.2: when the power learning information of the power meter is the second information, determine the current full charge capacity according to one of the first capacity, the second capacity or the third capacity.
[0101] For example, during the charging process of the first battery, if it is detected that the battery is fully charged, the first learning completion flag of the fuel meter stored in the memory of the fuel meter can be read. If it is "True", it can be determined that the fuel meter has completed the first learning process for the currently connected first battery, or that other batteries of the same model as the currently connected first battery have completed the first learning process. Normally, the terminal device maintains a charging rule of "full--empty--full", so it means that the first battery has been emptied before the terminal device is charged this time, indicating that the current charging process can be a complete charging process. In this case, the current full charge capacity can be determined based on one of the first capacity, the second capacity, or the third capacity.
[0102] In one embodiment, the current full charge capacity can be determined directly based on the third capacity. For example, the third capacity is directly used as the current full charge capacity. If it is detected during the charging process that the battery is fully charged, the cumulative capacity charged during the current charging process can be used as the current full charge capacity. For another example, it can be determined during the charging process whether the open circuit voltage of the battery is the open circuit voltage at 95% of the charge in the corresponding relationship table. If so, it can be determined that the data update condition is currently met, and then the third capacity can be calculated (for example, the quotient of the third capacity and 85%) to obtain the current full charge capacity based on the fact that the fuel gauge has completed the first learning process.
[0103] In another embodiment, a variety of suitable screening conditions can be used to further select one from the first capacity, the second capacity and the third capacity to determine the current full charge capacity. For example, it can be further determined whether the first battery meets the attenuation condition, that is, whether the battery capacity is attenuated. If so, the current full charge capacity can be determined according to the third capacity (for example, when the battery reaches the full charge condition, the fuel gauge has completed the first power learning process, and the battery capacity is attenuated, the accumulated charged capacity is used as the current full charge capacity). If not, the current full charge capacity can be determined according to the second capacity (for example, when the battery reaches the full charge condition, the fuel gauge has completed the first power learning process, and the battery capacity is not attenuated, the preset full charge capacity of the first battery is used as the current full charge capacity). In this way, the full charge capacity of the battery can be updated in time when the battery capacity is attenuated, the accuracy of the power learning calibration can be improved, and the influence of data errors can be fully considered to reduce unnecessary update calculations. In another example, when it is determined according to the above method that the first battery meets the attenuation condition and the value of the first capacity is stored in the flash memory of the power meter, the third capacity and the first capacity can be compared; if the difference between the two is not large, the first capacity can be used as the current full charge capacity, and if the difference between the two is large, the third capacity can be used as the current full charge capacity, and the first capacity can be updated according to the third capacity. In this way, the full charge capacity of the battery can be updated in time when the battery capacity further decays, improving the accuracy of power learning calibration, and fully considering the impact of data errors to reduce unnecessary update calculations.
[0104] In the above scheme, different scenarios of whether the fuel gauge has completed the first learning process for the first battery are taken into consideration, and different capacity references are used accordingly to quickly and accurately determine the current full charge capacity, thereby further improving the accuracy and efficiency of power monitoring and learning.
[0105] In one implementation, step S120a.1, when the power learning information of the power meter is the first information, determines the current full charge capacity according to the first capacity or the second capacity, including the following steps:
[0106] Step S120a.11, reading the verification data stored in the flash memory of the power meter, wherein the verification data includes: a value of the first capacity and a first verification value determined according to the first capacity;
[0107] Step S120a.12, when the first verification value and the second verification value corresponding to the first capacity are equal, determining that the current full charge capacity is equal to the first capacity;
[0108] Step S120a.13, when the first verification value and the second verification value are not equal, or when the verification data is not read, determine that the current full charge capacity is equal to the second capacity.
[0109] As mentioned above, each time the power meter learns a new current full charge capacity, the value of the current full charge capacity can be written in the corresponding storage partition (for example, the aforementioned storage partition A) (erasing the old first capacity value), and for the convenience of subsequent verification, the verification value corresponding to the current full charge capacity can also be written in the storage partition A (the verification value can be obtained by encoding the value of the current full charge capacity using various suitable data encoding methods), and the verification value and the current full charge capacity value can be used as verification data. In other words, in the case where the power meter of the terminal device has calibrated the full charge capacity of the last connected battery or the currently connected battery, the flash memory of the power meter can store the value of the full charge capacity calibrated at that time, that is, the value of the historical full charge capacity, and also store the first verification value determined based on the value.
[0110] In a specific example, during the charging process of the first battery, if it is detected that the battery is fully charged, the first learning completion flag of the fuel meter stored in the memory of the fuel meter can be read. If it is "Fail", it can be determined that the fuel meter has not completed the first learning process for the currently connected first battery. Then, the value of the historical full charge capacity and the first check value stored in the storage partition A of the flash memory of the fuel meter can be read. And according to the preset check value determination method (for example, the preset data encoding method), the second check value corresponding to the value of the historical full charge capacity can be determined. After that, the first check value and the second check value can be compared. If the two are equal, it can be determined that the current full charge capacity is equal to the first capacity. On the contrary, if the two are not equal, or the value of the historical full charge capacity and the first check value are not read from the storage partition A (for example, in step S103, according to the situation that the battery curve parameters of the current first battery are different from the battery curve parameters of the battery last connected to the terminal device, these data are cleared), it can be determined that the current full charge capacity is equal to the second capacity.
[0111] It can be understood that in the above example, if the value of the historical full charge capacity of the battery learned by the fuel meter last time and the first verification value can be read from the storage partition A, it can be explained to a certain extent that the first battery is the same battery as the battery connected to the fuel meter when the full charge capacity was calibrated last time, and therefore the full charge capacity obtained in the last calibration can be used as the current full charge capacity, so that even after the same battery is plugged in and powered on again, the fuel meter can still quickly and accurately learn the full charge capacity of the battery. If the value of the historical full charge capacity of the battery learned by the fuel meter last time and the first verification value cannot be read from the storage partition A, it can be explained that the first battery is different from the battery connected to the fuel meter when the full charge capacity was calibrated last time. In this case, the preset full charge capacity determined according to the battery curve parameters of the first battery can be used as the current full charge capacity of the first battery. In this way, when the terminal device replaces a different battery, the fuel meter can also quickly and accurately learn the full charge capacity of the current battery. In addition, if the value of the historical full charge capacity of the battery learned by the power meter last time and the first verification value can be read from storage partition A, but the difference between the first verification value and the second verification value corresponding to the value of the historical full charge capacity is large, it is possible that the stored data is damaged, and there may be a problem with the value of the historical full charge capacity stored in storage partition A. In this case, the preset full charge capacity of the first battery can also be used as the current full charge capacity of the first battery, which can improve the accuracy of power learning.
[0112] The above method for calibrating the full charge capacity of the first battery fully considers a variety of possible scenarios, the determined full charge capacity is more accurate, and the amount of calculation is also small, thereby further improving the accuracy and efficiency of the fuel gauge power learning.
[0113] In one implementation, after step S110, the battery power learning method provided in the embodiment of the present application further includes the following steps:
[0114] Step S111, when it is determined that the data update condition is currently met and the power learning information of the power meter is the second information, determining whether the first battery reaches the attenuation condition according to the first difference between the third capacity and the second capacity and the first difference threshold;
[0115] Step S112, if yes, then when the second difference between the third capacity and the first capacity is greater than or equal to the second difference threshold, updating the verification data stored in the flash memory of the fuel meter according to the value of the third capacity and the third verification value corresponding to the third capacity;
[0116] Step S113: if not, clear the verification data stored in the flash memory of the fuel meter.
[0117] In a specific example, the first difference may be the absolute value of the first capacity difference between the third capacity and the second capacity, and the first difference threshold may be the first capacity difference threshold (which may be set according to actual needs, for example, the first capacity difference threshold is 5% of the second capacity). When the absolute value of the first capacity difference between the third capacity and the second capacity is greater than the first capacity difference threshold, it may be determined that the first battery has reached the attenuation condition, that is, the capacity of the first battery has decayed. Otherwise, it may be determined that the first battery has not reached the attenuation condition, that is, the battery capacity has not decayed relative to the last calibration.
[0118] Exemplarily, when it is determined that the first battery has not reached the attenuation condition, the current full charge capacity can be determined based on the second capacity (the preset full charge capacity of the first battery). For example, when the battery reaches the full charge condition, the fuel gauge has completed the first charge learning process, and the battery capacity has not decayed, the preset full charge capacity of the first battery is used as the current full charge capacity. For at least a period of time thereafter, the battery charge can be estimated based on the preset full charge capacity. In this way, the influence of data errors is fully considered, and unnecessary update calculations can be reduced. Moreover, in an embodiment of the present application, when it is determined that the first battery has not reached the attenuation condition, if the value of the first capacity is stored in the flash memory of the fuel gauge (for example, after replacing the first battery of the same model, the fuel gauge stores the full charge capacity data of the last connected battery with capacity decay), it can be cleared to reduce the interference of the data on the fuel gauge learning.
[0119] Exemplarily, when it is determined that the first battery reaches the attenuation condition, the value of the first capacity can be read first (for example, the verification data in the storage partition A is read). If no data is read, the third capacity can be directly used as the current full charge capacity. If the value of the first capacity is read, the first capacity and the third capacity can be further compared, and the current full charge capacity can be determined according to one of the two. Specifically, the second capacity difference between the first capacity and the third capacity can be calculated. If the absolute value of the second capacity difference is greater than the second capacity difference threshold (for example, 5% of the third capacity), it can be determined that the capacity of the first battery is further attenuated. In this case, the third capacity can be determined as the current full charge capacity. In addition, the value of the third capacity and the corresponding verification value (third verification value) can be written into the power learning storage area in the flash memory of the fuel meter. For example, the existing data in the storage partition A is erased, and the value of the third capacity and the third verification value are written into the storage partition A. In this way, the full charge capacity of the battery can be accurately calibrated, and the battery power can be determined according to the third capacity stored in the storage partition A for at least a period of time thereafter. If the absolute value of the second capacity difference is less than or equal to the second capacity difference threshold, it can be said that the capacity of the first battery has not decayed or has decayed slightly relative to the time point when the first capacity was last updated. Therefore, the first capacity can be used as the current full charge capacity. And the existing data in the current storage partition A can be kept unchanged. In this way, frequent data updates caused by data calculation errors can be reduced, and the amount of calculation can be reduced.
[0120] In one implementation, after step S110, the method for determining the battery power provided in the embodiment of the present application further includes the following steps S114 and / or S115.
[0121] Step S114: when it is determined that the data update condition is currently met and the power learning information of the power meter is the first information, the power learning information of the power meter is updated to the second information.
[0122] For example, during the charging process, when it is determined that the battery is fully charged and the first learning completion flag of the battery meter stored in the memory of the battery meter is "Fa l se", the current full charge capacity can be determined according to the first capacity or the second capacity, and the first learning completion flag of the battery meter stored in the memory can be updated to "True". Step S115, when it is determined that the terminal device is disconnected from the first battery, the battery meter's battery learning information is updated to the first information.
[0123] For example, when the first battery is disconnected from the terminal device, the first learning completion flag of the fuel gauge stored in the memory is updated to "Fa l se".
[0124] The above solution can make the power learning information accurately reflect the learning status of the power meter about the power of the currently connected battery, thereby improving the accuracy of the power learning of the power meter.
[0125] Combine the following Figure 3 and Figure 4 A method for determining the battery power provided in another embodiment of the present application is described. First, when the terminal device removes the previous battery (such as the lithium iron phosphate battery is unplugged), the fuel gauge learning mark is set to 0. Then, after the terminal device installs the battery and turns on the power, the CPU identifies the first battery curve parameters corresponding to the current battery. And determine whether an update is required. If so, update the battery curve parameters to the fuel gauge so that the fuel gauge is initialized and learns the power according to the updated battery curve parameters, and clears the full charge capacity data in the flash memory (such as the value of the aforementioned first capacity and the corresponding check value). Then, execute the fuel gauge initialization to obtain the initial power.
[0126] During the battery charging and discharging process, the fuel gauge performs power learning. During the discharge process, the fuel gauge collects battery discharge data and determines whether the power discharge condition is reached based on the discharge data. When the battery voltage in the zero time window is lower than the zero voltage (the voltage at which the battery power is 0%), it is determined that the battery power has been discharged. If not, continue to collect and judge. If the battery power has been discharged, the first learning completion flag of the fuel gauge is obtained. If the first learning completion flag is "0", the current full charge capacity can be determined based on the full charge capacity (first capacity) stored in the fuel gauge flash memory or the full charge capacity (preset full charge capacity) in the battery curve parameter. And the current full charge capacity is updated in the fuel gauge. Specifically, the full charge capacity (first capacity) and the corresponding check value can be read from the fuel gauge flash memory; the read data is checked; if the check passes, the full charge capacity stored in the flash memory is updated to the full charge capacity of the fuel gauge; if the check fails, the full charge capacity in the battery curve parameter is updated to the full charge capacity of the fuel gauge. And the first learning completion flag can be updated to "1". If the battery has been discharged and the first learning completion flag is "1", it is determined that the current full charge capacity is equal to the cumulative discharge capacity (third capacity). Then, the full charge capacity deviation between the discharge capacity and the full charge capacity in the battery curve parameter can be calculated. Then, it can be determined whether the battery capacity is attenuated according to the full charge capacity deviation, and the full charge capacity and verification value in the flash memory are erased according to the attenuation. Specifically, if the deviation value is less than the battery attenuation deviation threshold, the full charge capacity data stored in the fuel gauge flash memory is cleared (the deviation is less than the attenuation deviation threshold, indicating that the battery has not attenuated, then the data stored in the flash memory is cleared, and the full charge capacity in the battery curve parameter is directly used for the first learning). If the full charge capacity deviation value is greater than the battery attenuation deviation threshold (the attenuation deviation threshold is, for example, a parameter in the battery curve parameter), it is further determined whether the battery capacity is further attenuated. Specifically, the difference between the discharge capacity (third capacity) and the full charge capacity (first capacity) stored in the flash memory and the difference threshold can be compared. If the difference is greater than the difference threshold, it can be determined that the performance of the battery is further attenuated. And the current full charge capacity can be calculated as a verification value. Furthermore, the value of the current full charge capacity and the check value can be written into the learning data partition of the fuel gauge flash memory. The remaining capacity of the fuel gauge can also be updated to 0, and the current remaining capacity can be updated to 0%.
[0127] During the battery charging process, the battery charging data is collected and the full charging condition is determined based on the charging data. Specifically, the battery charging voltage and charging current are collected. When the full charging time window continuously meets the following conditions: <1> The battery voltage is greater than the charging cut-off voltage; <2> If the charging current is less than the cut-off current and greater than the minimum charging current, it is determined that the battery is fully charged. Otherwise, continue to collect and judge. If the battery is fully charged, the first learning completion flag of the fuel gauge is obtained. If the first learning completion flag is "0", the current full charge capacity can be determined according to the full charge capacity (first capacity) stored in the fuel gauge flash memory or the full charge capacity (preset full charge capacity) in the battery curve parameter. And the current full charge capacity is updated in the fuel gauge. Specifically, the full charge capacity (first capacity) and the corresponding check value can be read from the fuel gauge flash memory; the read data is checked; if the check passes, the full charge capacity stored in the flash memory is updated to the full charge capacity of the fuel gauge; if the check fails, the full charge capacity in the battery curve parameter is updated to the full charge capacity of the fuel gauge. And the first learning completion flag can be updated to "1". If the battery is already empty and the first learning completion flag is "1", it is determined that the current full charge capacity is equal to the cumulative charge capacity (third capacity). Then, the full charge capacity deviation between the charged capacity and the full charge capacity in the battery curve parameter can be calculated. It is possible to determine whether the battery capacity is decayed based on the full charge capacity deviation, and to erase the full charge capacity and check value in the flash memory based on the decay situation. Specifically, if the deviation value is less than the battery decay deviation threshold, the full charge capacity data stored in the fuel gauge flash memory is cleared (the deviation is less than the decay deviation threshold, indicating that the battery has not decayed, then the data stored in the flash memory is cleared, and the full charge capacity in the battery curve parameter is directly used for the first learning). If the full charge capacity deviation value is greater than the battery decay deviation threshold (the decay deviation threshold is, for example, a parameter in the battery curve parameter), it is further determined whether the battery capacity is further decayed. Specifically, the difference between the charged power (third capacity) and the full charge capacity (first capacity) stored in the flash memory and the difference threshold can be compared. If the difference is greater than the difference threshold, it can be determined that the battery performance is further decayed. And the check value can be calculated for the current full charge capacity. Furthermore, the value of the current full charge capacity and the check value can be written together into the learning data partition of the fuel gauge flash memory. The remaining capacity of the fuel gauge can also be updated to the current full charge capacity, and the current remaining power can be updated to 100%.
[0128] In the above scheme, during the learning process of the fuel gauge, if the battery is fully charged or discharged for the first time, the full charge capacity in the battery curve parameters can be updated to the fuel gauge, so that the fuel gauge can quickly learn an accurate capacity. In addition, the power with large errors in the initial initialization calculation is calibrated once. Strict control of the emptying and full charging conditions ensures the accuracy of full charging and emptying judgments in various usage scenarios. Through the battery curve parameters, various algorithm parameters (zero point voltage, zero point time window, battery cutoff voltage, battery cutoff current, battery minimum charging current, full charge time window, etc.) are controlled to ensure the flexibility of the algorithm. The static power calibration algorithm in the traditional fuel gauge learning algorithm is removed to solve the error introduced by the deviation of the voltage collected by the static power algorithm. In addition, the learning calibration of each full and emptying ensures the accuracy of the power when the battery decays due to battery aging.
[0129] A second aspect of the embodiments of the present application provides a device for determining battery power. Figure 5 As shown, the battery power determination device 500 includes:
[0130] An acquisition module 510 is used to acquire charge and discharge data during the charge and discharge process of the first battery currently connected to the terminal device, wherein the charge and discharge data includes charging data of the first battery during the charging process and / or discharging data of the first battery during the discharging process;
[0131] The first determination module 520 is used to determine the current full charge capacity of the first battery according to at least one of the first capacity, the second capacity, and the third capacity when it is determined that the data update condition is currently met according to the charge and discharge data, wherein the first capacity is the historical full charge capacity stored in the flash memory of the power meter of the terminal device, the second capacity is the preset full charge capacity of the first battery, and the third capacity is equal to the total capacity charged during the charging process or the total capacity discharged during the discharging process.
[0132] In one implementation, the first determining module 520 includes:
[0133] The first determination submodule is used to determine the current full charge capacity based on the power learning information of the power meter and one of the first capacity, the second capacity or the third capacity when it is determined that the data update condition is currently met, wherein the power learning information includes: first information indicating that the power meter has not completed the first learning process for the first battery or second information indicating that the power meter has completed the first learning process for the first battery.
[0134] In one implementation, the first determining submodule includes:
[0135] A first determining unit, configured to determine a current full charge capacity according to the first capacity or the second capacity when the power learning information of the power meter is the first information;
[0136] The second determining unit is used to determine the current full charge capacity according to one of the first capacity, the second capacity or the third capacity when the power learning information of the power meter is the second information.
[0137] In one implementation, the first determining unit includes:
[0138] A reading subunit, used to read the verification data stored in the flash memory of the electricity meter, wherein the verification data includes: a value of the first capacity and a first verification value determined according to the first capacity;
[0139] a first determining subunit, configured to determine that the current full charge capacity is equal to the first capacity when the first verification value is equal to the second verification value corresponding to the first capacity;
[0140] The second determination subunit is used to determine that the current full charge capacity is equal to the second capacity when the first verification value and the second verification value are not equal, or when the verification data is not read.
[0141] In one implementation, the battery power determination device 500 further includes:
[0142] a decay determination module, configured to determine whether the first battery reaches a decay condition according to a first difference between the third capacity and the second capacity and a first difference threshold value when it is determined that the data update condition is currently satisfied and the power learning information of the power meter is the second information;
[0143] a verification data updating module, configured to update the verification data stored in the flash memory of the fuel gauge according to the value of the third capacity and a third verification value corresponding to the third capacity if the second difference between the third capacity and the first capacity is greater than or equal to the second difference threshold;
[0144] The first clearing module is used for clearing the verification data stored in the flash memory of the fuel gauge if no.
[0145] In one implementation, the battery power determination device 500 further includes:
[0146] A first updating module, configured to update the electric quantity learning information of the electric quantity meter to the second information when it is determined that the data updating condition is currently satisfied and the electric quantity learning information of the electric quantity meter is the first information; and / or
[0147] The second updating module is used to update the power learning information of the power meter to the first information when it is determined that the terminal device is disconnected from the first battery.
[0148] In one implementation, the battery power determination device 500 further includes:
[0149] A full charge determination module, used to determine that the data update condition is currently met if it is determined according to the charging data that the power of the first battery is full during the charging process; and / or
[0150] The emptying determination module is used to determine that the data updating condition is currently met if it is determined according to the discharge data that the power of the first battery has been discharged during the discharge process.
[0151] In one implementation, the battery power determination device 500 further includes:
[0152] A first power update module is used to determine and update the current remaining capacity and / or the current remaining power of the first battery when it is determined according to the charging data that the power of the first battery is full, wherein the current remaining capacity is equal to the current full charge capacity, and the current remaining power is equal to the full charge capacity; and / or
[0153] The second power update module is used to determine and update the current remaining capacity and / or the current remaining power of the first battery when it is determined according to the discharge data that the power of the first battery has been discharged, wherein the current remaining capacity is equal to the discharged capacity, and the current remaining power is equal to the discharged power.
[0154] In one implementation, the battery power determination device 500 further includes:
[0155] A second determining module, configured to determine a first battery curve parameter corresponding to the first battery in response to a power-on instruction;
[0156] a third updating module, configured to update the first battery curve parameter to the fuel gauge if the first battery curve parameter is different from the second battery curve parameter stored in the fuel gauge, so that the fuel gauge determines the initial power of the first battery according to the first battery curve parameter;
[0157] The second clearing module is used to clear the first capacity stored in the flash memory of the power meter.
[0158] The present application also provides a terminal device. Figure 6 As shown, the terminal device 600 includes: at least one processor 610, at least one memory 620, and a computer program 630 stored in the memory 620 and executable on the at least one processor 610, and the processor 610 implements the steps of the above-mentioned method for determining the battery power when executing the computer program 630. Specifically, the terminal device 600 may include a power meter, and the power meter includes the above-mentioned processor 610 and the memory 620.
[0159] Figure 6It is only an example of a terminal device and does not constitute a limitation on the terminal device. It may include more components than shown in the figure, or combine certain components, or different components. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0160] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0161] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example for illustration. In actual applications, the above-mentioned function allocation can be completed by different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The functional modules in the embodiment can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated modules can be implemented in the form of hardware or in the form of software functional modules. In addition, the specific names of the functional modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0162] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method for determining the battery power can be implemented.
[0163] An embodiment of the present application provides a computer program product. When the computer program product is executed on a terminal device, the terminal device can implement the steps in the above-mentioned method for determining the battery power.
[0164] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A method for determining battery power, characterized in that: include: During the charging and discharging process of the first battery currently connected to the terminal device, acquiring charging and discharging data, wherein the charging and discharging data includes charging data of the first battery during the charging process and / or discharging data of the first battery during the discharging process; When it is determined that the data update condition is currently met based on the charge and discharge data, the current full charge capacity of the first battery is determined based on at least one of the first capacity, the second capacity, and the third capacity, wherein the first capacity is the historical full charge capacity stored in the flash memory of the power meter of the terminal device, the second capacity is the preset full charge capacity of the first battery, and the third capacity is equal to the total capacity charged during the charging process or the total capacity discharged during the discharging process.
2. The method for determining the battery power as claimed in claim 1, characterized in that: The determining, according to at least one of the first capacity, the second capacity, and the third capacity, of the current full charge capacity of the first battery includes: When it is determined that the data update conditions are currently met, the current full charge capacity is determined based on the power learning information of the power meter and one of the first capacity, the second capacity or the third capacity, wherein the power learning information includes: first information indicating that the power meter has not yet completed the first learning process for the first battery or second information indicating that the power meter has completed the first learning process for the first battery.
3. The method for determining the battery power as claimed in claim 2, characterized in that: The determining the current full charge capacity according to the power learning information of the power meter and one of the first capacity, the second capacity, or the third capacity includes: When the electric quantity learning information of the electric quantity meter is the first information, determining the current full charge capacity according to the first capacity or the second capacity; In a case where the power learning information of the power meter is the second information, the current full charge capacity is determined according to one of the first capacity, the second capacity, or a third capacity.
4. The method for determining the battery power as claimed in claim 3, characterized in that: When the electric quantity learning information of the electric quantity meter is the first information, determining the current full charge capacity according to the first capacity or the second capacity includes: Reading verification data stored in a flash memory of the electricity meter, wherein the verification data includes: a value of the first capacity and a first verification value determined according to the first capacity; When the first verification value is equal to a second verification value corresponding to the first capacity, determining that the current full charge capacity is equal to the first capacity; When the first verification value and the second verification value are not equal, or when the verification data is not read, it is determined that the current full charge capacity is equal to the second capacity.
5. The method for determining the battery power as claimed in claim 4, characterized in that: The method further comprises: When it is determined that the data update condition is currently met and the power learning information of the power meter is the second information, determining whether the first battery reaches the attenuation condition according to a first difference between the third capacity and the second capacity and a first difference threshold; If so, if a second difference between the third capacity and the first capacity is greater than or equal to a second difference threshold, updating the verification data stored in the flash memory of the fuel gauge according to the value of the third capacity and a third verification value corresponding to the third capacity; If not, the calibration data stored in the flash memory of the fuel gauge is cleared.
6. The method for determining the battery power as claimed in claim 3, characterized in that: The method further comprises: When it is determined that the data update condition is currently met and the electric quantity learning information of the electric quantity meter is the first information, updating the electric quantity learning information of the electric quantity meter to the second information; and / or When it is determined that the terminal device is disconnected from the first battery, the power learning information of the power meter is updated to the first information.
7. The method for determining the battery power according to any one of claims 1 to 6, characterized in that: Before determining the current full charge capacity of the first battery, the method further includes: During the charging process, if it is determined according to the charging data that the power of the first battery is full, it is determined that the data update condition is currently met; and / or During the discharging process, if it is determined according to the discharging data that the power of the first battery has been discharged, it is determined that a data updating condition is currently met.
8. The method for determining the battery power as claimed in claim 7, characterized in that: After determining the current full charge capacity of the first battery, the method further includes: In the case where it is determined according to the charging data that the first battery is fully charged, determining and updating a current remaining capacity and / or a current remaining power of the first battery, wherein the current remaining capacity is equal to the current fully charged capacity, and the current remaining power is equal to the fully charged power; and / or When it is determined according to the discharge data that the power of the first battery has been discharged, the current remaining capacity and / or the current remaining power of the first battery are determined and updated, wherein the current remaining capacity is equal to the discharged capacity, and the current remaining power is equal to the discharged power.
9. The method for determining the battery power according to any one of claims 1 to 6, characterized in that: The method further comprises: In response to a power-on instruction, determining a first battery curve parameter corresponding to the first battery; If the first battery curve parameter is different from a second battery curve parameter stored in the fuel gauge, updating the first battery curve parameter into the fuel gauge so that the fuel gauge determines the initial power of the first battery according to the first battery curve parameter; The first capacity stored in the flash memory of the fuel gauge is cleared.
10. A terminal device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method for determining the battery power according to any one of claims 1 to 8 are implemented.
Citation Information
Cited By
Method for determining battery level, and terminal device
WO2026097934A1