Method and device for determining electric quantity and electronic equipment

By switching from the working state to the sleep state and collecting data in the electronic device, the problem of low accuracy of the existing power acquisition method is solved, and a higher precision power calculation is achieved.

CN119916229APending Publication Date: 2025-05-02QUECLINK WIRELESS SOLUTIONS
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411996797.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-05-02

Smart Images

  • Figure CN119916229A_ABST
    Figure CN119916229A_ABST
Patent Text Reader

Abstract

The invention provides an electric quantity determination method and device and electronic equipment. Relates to the field of electronic equipment. The method comprises the following steps: when the electronic equipment is in a working state, collecting first state data; responding to the first state switching instruction, switching the electronic equipment from a working state to a dormant state, and determining estimated sampling time corresponding to the dormant state; determining a target sampling time range according to the estimated sampling time and the target function operation time range, and collecting second state data in the target sampling time range; and in response to the second state switching instruction, switching the electronic equipment from the dormant state to the working state, and determining the electric quantity according to the first state data and the second state data. The corresponding target sampling time range is determined based on the target function operation time range and the sleep time range, so that the accuracy of the sampling data is improved, and the precision of an electric quantity calculation result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic equipment, and in particular to a method and device for determining electric quantity, and electronic equipment. Background Art

[0002] Electronic devices are usually equipped with a power supply to output current and voltage signals to support various functions of the electronic device. The power of the power supply affects the working time of the electronic device.

[0003] Commonly used power collection methods mainly include power collection methods based on power collection chips and power collection methods based on voltage divider circuits. Due to the high cost of power collection methods based on power collection chips, users often use power collection methods based on voltage divider circuits to collect power.

[0004] The power collection method based on the voltage divider circuit usually realizes the power collection function by adding some components and corresponding circuits. However, during the sampling process, the above components and circuits will affect the accuracy of the sampled data (such as resistance, etc.). This makes the power data collected by the power collection method based on the voltage divider circuit inaccurate. Summary of the invention

[0005] The present application provides a method, device and electronic device for determining power level, which collect first state data when the electronic device is in a working state, switch the working state to a sleep state in response to a first state switching instruction, and determine a corresponding estimated sampling time, determine a target sampling time range according to the estimated sampling time and a target function operation time range, collect second state data within the target sampling time range, switch the sleep state to a working state in response to a second state switching instruction, and determine the power level according to the first state data and the second state data, so as to solve the problem of low accuracy of calculation results of existing power level collection methods.

[0006] In a first aspect, the present application provides a method for determining power, which is applied to an electronic device. The method for determining power includes:

[0007] When the electronic device is in working state, collecting first state data;

[0008] In response to a first state switching instruction, switching the electronic device from the working state to the sleeping state, and determining an estimated sampling time corresponding to the sleeping state;

[0009] Determine a target sampling time range according to the estimated sampling time and the target function operation time range, and collect second state data within the target sampling time range;

[0010] In response to the second state switching instruction, the electronic device is switched from the sleep state to the working state, and the power level is determined according to the first state data and the second state data.

[0011] In a possible implementation, in response to the first state switching instruction, switching the electronic device from the working state to the sleep state, and determining an estimated sampling time corresponding to the sleep state includes:

[0012] In response to the first state switching instruction, switching the electronic device from the working state to the sleeping state;

[0013] The estimated sampling time is determined according to the sleep time range of the sleep state.

[0014] In a possible implementation manner, determining the estimated sampling time according to the sleep time range of the sleep state includes:

[0015] Obtaining a sleep time range of the sleep state, and determining a sleep duration according to the sleep time range;

[0016] When the sleep time is less than a first preset time, a first estimated sampling time is determined; and a difference between the first estimated sampling time and an end time of the sleep time range is a first difference.

[0017] In a possible implementation, after determining the sleep duration according to the sleep time range, the method includes:

[0018] When the sleep duration is greater than or equal to the first preset duration, a second estimated sampling time is determined; the difference between the second estimated sampling time and the end time of the sleep time range is a second difference; and the first difference is less than the second difference.

[0019] In a possible implementation manner, determining a target sampling time range according to the estimated sampling time and the target function operation time range, and collecting the second state data within the target sampling time range, includes:

[0020] Obtain a target function running time range corresponding to the target function; the target function running time range includes the target function start time and the target function end time;

[0021] When the estimated sampling time is within the target function running time range, calculating a third difference between the estimated sampling time and the target function start time, and a fourth difference between the estimated sampling time and the target function end time;

[0022] When the third difference and the fourth difference are both less than or equal to the first preset time length, determining the target sampling time range according to the estimated sampling time and the target function operation time range;

[0023] The second state data is collected within the target sampling time range, where the second state data includes a sampling voltage and a functional state code.

[0024] In a possible implementation, when the third difference and the fourth difference are both less than or equal to the first preset duration, determining the target sampling time range according to the estimated sampling time and the target function operation time range includes:

[0025] When the third difference and the fourth difference are both less than or equal to the first preset time length, determining the time length of the target function running time range;

[0026] When the time length is greater than the second preset time length, the time range between the estimated sampling time and the target function activation time is determined as the first target sampling time range;

[0027] or,

[0028] When the time length is less than or equal to the second preset time length, the time range between the target function activation time and the estimated sampling time is determined as the second target sampling time range.

[0029] In a possible implementation manner, after obtaining the target function running time range corresponding to the target function, the method includes:

[0030] When the estimated sampling time is not within the target function running time range, the second state data is collected based on the estimated sampling time.

[0031] In a possible implementation, when the estimated sampling time is within the target function running time range, after calculating a third difference between the estimated sampling time and the target function start time, and a fourth difference between the estimated sampling time and the target function end time, the method further includes:

[0032] When the third difference is greater than the first preset time length, and / or the fourth difference is greater than the first preset time length, the second state data is collected at the estimated sampling time.

[0033] In a possible implementation, in response to the second state switching instruction, switching the electronic device from the sleep state to the working state, and determining the power level according to the first state data and the second state data, includes:

[0034] In response to the second state switching instruction, switching the electronic device from the sleep state to the working state, and determining a wake-up mode of the electronic device;

[0035] When the wake-up mode is a normal wake-up mode, the power is determined according to the first state data and the second state data; the first state data includes at least one of temperature, output voltage, and output current.

[0036] In a possible implementation, after the electronic device is switched from the sleep state to the working state in response to the second state switching instruction and the wake-up mode of the electronic device is determined, the method further includes:

[0037] When the wake-up mode is an abnormal wake-up mode, the power is determined according to standby state data and the first state data; the standby state data includes at least one of a standby sampling temperature, a standby sampling voltage, and a standby sampling current.

[0038] In a second aspect, the present application provides a device for determining power, which is applied to an electronic device, and the device for determining power includes:

[0039] A first acquisition module, used for acquiring first state data when the electronic device is in working state;

[0040] a state switching module, configured to switch the electronic device from the working state to the sleeping state in response to a first state switching instruction, and determine an estimated sampling time corresponding to the sleeping state;

[0041] A second acquisition module, used to determine a target sampling time range according to the estimated sampling time and the target function operation time range, and to acquire second state data within the target sampling time range;

[0042] The determination module is used to switch the electronic device from the sleep state to the working state in response to the second state switching instruction, and determine the power level according to the first state data and the second state data.

[0043] In a third aspect, an embodiment of the present application provides an electronic device, comprising: at least one processor and a memory; the memory stores computer-executable instructions; at least one processor executes the computer-executable instructions stored in the memory, so that at least one processor executes the method for determining the amount of electricity involved in the first aspect and any item of the first aspect.

[0044] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, the method for determining the amount of electricity involved in the first aspect and any item of the first aspect is implemented.

[0045] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the method for determining the amount of electricity involved in the first aspect and any item of the first aspect.

[0046] The method, device and electronic device for determining power provided in the present application collect first state data when the electronic device is in a working state, and switch the working state to a sleep state in response to a first state switching instruction, and determine the corresponding estimated sampling time, determine the target sampling time range according to the estimated sampling time and the target functional operation time range, collect second state data within the target sampling time range, switch the sleep state to the working state in response to a second state switching instruction, and determine the power according to the first state data and the second state data, so as to collect data during the non-functional operation time in the sleep state and calculate the power data, thereby improving the accuracy of the power calculation result. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0048] Figure 1 It is a schematic diagram of the application of the power collection method in the prior art;

[0049] Figure 2 One of the flow charts of a method for determining electric quantity provided in an embodiment of the present application;

[0050] Figure 3 A second flow chart of a method for determining electric quantity provided in an embodiment of the present application;

[0051] Figure 4 A third flow chart of a method for determining electric quantity provided in an embodiment of the present application;

[0052] Figure 5 A fourth flow chart of a method for determining electric quantity provided in an embodiment of the present application;

[0053] Figure 6 A flowchart of a method for determining electric quantity provided in an embodiment of the present application;

[0054] Figure 7 A schematic diagram of the structure of a device for determining electric quantity provided in an embodiment of the present application;

[0055] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0056] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0057] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0058] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0059] It should be noted that the method, device and electronic device for determining electric quantity provided in the present application can be used in the field of electronic equipment, and can also be used in any field other than the field of electronic equipment. The application does not limit the application field of the method, device and electronic device for determining electric quantity.

[0060] Electronic devices are usually equipped with a power supply to output current and voltage signals to support various functions of the electronic device. The power of the power supply also affects the working time of the electronic device.

[0061] Commonly used power collection methods usually include power collection methods based on power collection chips and power collection methods based on voltage divider circuits. Among them, the power collection method based on chips (such as coulomb meters) is expensive. Therefore, users often use power collection methods based on voltage divider circuits.

[0062] See also Figure 1The power collection method based on the voltage divider circuit usually realizes the power collection function of the power supply 103 by adding some components 101 (such as GPIO pins, diodes) and corresponding circuits 102 (such as voltage divider circuits).

[0063] The chip in the electronic device can support the acquisition of the power supply terminal (VDD) voltage. For example, the power supply terminal (VDD) is used as the input source for ADC sampling, and a 1 / 4 voltage divider circuit is set up to collect the power supply terminal (VDD) voltage based on the 1 / 4 voltage divider circuit, and calculate the power.

[0064] However, during the sampling process, the above components and circuits will affect the accuracy of the sampled data. For example, the diode is added mainly to avoid the problem that the voltage drop at the baseband chip end is too large under high current conditions, which causes the power supply of the microcontroller unit (MCU) to be reduced and the MCU cannot work normally). This means that when the voltage is collected during the operation of some functions with sudden increase in power consumption (such as GPS positioning, network registration, etc.), the process of the voltage dropping to a stable value is long, making the calculated internal resistance smaller, resulting in inaccurate power data collected by the power collection method based on the voltage divider circuit.

[0065] In order to solve the above problems, the present application collects first state data when the electronic device is in a working state, switches the working state to a sleep state in response to a first state switching instruction, and determines the corresponding estimated sampling time, determines the target sampling time range according to the estimated sampling time and the target function running time range, collects second state data within the target sampling time range, switches the sleep state to the working state in response to a second state switching instruction, and determines the power according to the first state data and the second state data, so as to avoid collecting ADC data during the function running time in the sleep state, and calculate the power data, thereby improving the accuracy of the calculation results.

[0066] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0067] Figure 2 A flowchart of a method for determining power provided in an embodiment of the present application. Figure 2 As shown, the method may include the following steps:

[0068] S201. When the electronic device is in working state, collect first state data.

[0069] The execution subject of the embodiment of the present application may be an electronic device, or a power determination device set in the electronic device. The power determination device may be implemented by software, or by a combination of software and hardware.

[0070] Specifically, the state of the electronic device includes but is not limited to a working state and a sleep state, wherein the sleep state is used to indicate that the baseband chip in the electronic device is in a shutdown state.

[0071] Specifically, when the electronic device is in working state, first state data of the electronic device may be collected, and the first state data includes but is not limited to at least one of the temperature of the power supply, the output voltage of the power supply, and the output current of the power supply.

[0072] S202: In response to a first state switching instruction, switch the electronic device from the working state to the sleep state, and determine an estimated sampling time corresponding to the sleep state.

[0073] Specifically, the first state switching instruction indicates an instruction for controlling the electronic device to switch from the working state to the sleeping state. The first state switching instruction may be automatically generated by the electronic device, or sent by other terminal devices.

[0074] Specifically, in response to the first state switching instruction, the electronic device is switched from the working state to the sleeping state, and an estimated sampling time corresponding to the sleeping state is determined.

[0075] Optionally, the first state switching instruction includes a sleep time and a wake-up time. The sleep time is used to indicate the time point when the electronic device enters the sleep state. The wake-up time is used to indicate the time point when the electronic device wakes up from the sleep state and enters the working state. The sleep time range can be determined according to the sleep time and the wake-up time. The estimated sampling time is the sampling time point corresponding to the sleep time.

[0076] It can be understood that the above wake-up time is used to indicate the time point when the electronic device wakes up normally.

[0077] Optionally, the wake-up time may be an RTC alarm time sent by a baseband chip (BB).

[0078] It is understandable that since sampling takes a certain amount of time, after the electronic device wakes up, the output voltage and output current collected by the power supply may affect the accuracy of the power calculation result. Based on this, the estimated sampling time is set to be different from the wake-up time.

[0079] Optionally, the estimated sampling time is before the wake-up time. For example, if the wake-up time is 10 o'clock, the estimated sampling time is 9:59:30.

[0080] S203: Determine a target sampling time range according to the estimated sampling time and the target function operation time range, and collect second state data within the target sampling time range.

[0081] Specifically, when the electronic device is in a dormant state, a function enabled by the MCU is determined as the target function, and an operating time range of the target function is determined as the target function operating time range.

[0082] For example, the target function may be a sensor function (Sensor), a Bluetooth function (BLE), etc.

[0083] Specifically, the target sampling time range is determined based on the estimated sampling time and the target function operation time range, so that the target sampling time range is not within the target function operation time range of the electronic device in the sleep state as much as possible. In this way, the second state data collected within the target sampling time range is more accurate.

[0084] S204: In response to the second state switching instruction, switch the electronic device from the sleep state to the working state, and determine the power level according to the first state data and the second state data.

[0085] Specifically, the second state switching instruction indicates an instruction for controlling the electronic device to switch from the sleep state to the working state. The second state switching instruction may be automatically generated by the electronic device, or sent by other terminal devices.

[0086] Specifically, in response to the second state switching instruction, the state of the electronic device is switched from the sleep state to the working state, and the power level of the power supply in the electronic device is determined according to the first state data and the second state data.

[0087] It is understandable that the power level can be used to indicate the remaining power level of the power supply in the electronic device, or the power level can be used to indicate the power balance required to support the normal operation of the electronic device.

[0088] For example, when the power of an electronic device is less than 5%, the electronic device will trigger a protection mechanism to enter a shutdown state. When the remaining power is 80%, it can be determined that the remaining power to support the normal operation of the electronic device is 75%.

[0089] In some embodiments, S202 includes:

[0090] S2021, in response to the first state switching instruction, switching the electronic device from the working state to the sleep state;

[0091] S2022: Determine the estimated sampling time according to the sleep time range of the sleep state.

[0092] Specifically, in response to the first state switching instruction, the electronic device is switched from the working state to the sleeping state.

[0093] Optionally, in response to the first state switching instruction, state data when the switching is completed can be collected as standby state data, which is used as a data basis when the electronic device wakes up abnormally to determine the power level of the power supply in the electronic device.

[0094] Specifically, according to the first state switching instruction, the sleep time and wake-up time of the sleep state are determined. According to the sleep time and wake-up time, the sleep time range of the sleep state is determined, and according to the sleep time range of the sleep state, the estimated sampling time is determined.

[0095] Specifically, the estimated sampling time is within the sleep time range of the sleep state, that is, the estimated sampling time is after the sleep time and before the wake-up time.

[0096] The embodiment of the present application collects first state data when the electronic device is in a working state, switches the working state to a sleep state in response to a first state switching instruction, and determines a corresponding estimated sampling time, determines a target sampling time range according to the estimated sampling time and a target functional operation time range, collects second state data within the target sampling time range, switches the sleep state to a working state in response to a second state switching instruction, and determines the power level according to the first state data and the second state data, so as to collect data during the non-functional operation time in the sleep state and calculate the power level data, thereby improving the accuracy of the calculation results.

[0097] Figure 3 A flowchart of another method for determining the amount of electricity provided in an embodiment of the present application. Figure 3 , the method may include the following steps:

[0098] S20221. Obtain a sleep time range of the sleep state, and determine a sleep duration according to the sleep time range.

[0099] Specifically, the sleep time range of the sleep state is obtained, and the corresponding sleep duration is determined according to the start value (ie, the sleep time) and the end value (ie, the wake-up time) of the sleep time range.

[0100] For example, if the sleep time is 10:00:00 and the wake-up time is 11:00:00, the sleep time is 1 hour.

[0101] S20222: When the sleep time is less than a first preset time, determine a first estimated sampling time; a difference between the first estimated sampling time and an end time of the sleep time range is a first difference.

[0102] Specifically, the first preset duration and the first difference can be set according to actual conditions. For example, the first preset duration is set to 20 minutes; or, the first preset duration is set to 1 hour. For example, the first difference is set to 30 seconds, or, the first difference is set to 60 seconds.

[0103] Specifically, when the sleep duration of the sleep state is less than the first preset duration, the first estimated sampling time is determined to be before the end time of the sleep time range, and the difference between the first estimated sampling time and the end time of the sleep time range is the first difference. The end time of the sleep time range may also be referred to as the wake-up time.

[0104] In some possible implementations, after determining the sleep duration according to the sleep time range, the method includes:

[0105] When the sleep duration is greater than or equal to the first preset duration, a second estimated sampling time is determined; the difference between the second estimated sampling time and the end time of the sleep time range is a second difference; and the first difference is less than the second difference.

[0106] Specifically, the second difference can be set according to actual conditions, and the second difference is greater than the first difference. For example, the first difference is 30s, and the corresponding second difference is 50s. Alternatively, the first difference is 60s, and the corresponding second difference is 90s.

[0107] Specifically, when the sleep duration is greater than or equal to the first preset duration, the sleep duration that can be used for data sampling is longer. Therefore, it can be determined that the second estimated sampling time is before the end time of the sleep time range, and the difference between the second estimated sampling time and the end time is the second difference.

[0108] For example, if the first preset duration is 30 seconds and the sleep duration is 1 hour, the estimated sampling time can be set to 54 minutes after the device is in sleep mode, that is, the difference between the estimated sampling time and the end time in the sleep time range is 6 minutes.

[0109] Figure 4 A flowchart of another method for determining the amount of electricity provided in an embodiment of the present application. Figure 4 , the method may include the following steps:

[0110] S2031. Obtain a target function running time range corresponding to the target function; the target function running time range includes a target function start time and a target function end time.

[0111] Specifically, the target function of the electronic device in the sleep state and the target function running time range corresponding to the target function are obtained. The target function running time range includes the target function start time and the target function end time.

[0112] S2032. When the estimated sampling time is within the target function running time range, calculate a third difference between the estimated sampling time and the target function start time, and a fourth difference between the estimated sampling time and the target function end time.

[0113] Specifically, when the estimated sampling time is within the target function running time range, the estimated sampling time can be adjusted to calculate the third difference between the estimated sampling time and the target function start time, and the fourth difference between the estimated sampling time and the target function end time.

[0114] S2033: when the third difference and the fourth difference are both less than or equal to the first preset duration, determining the target sampling time range according to the estimated sampling time and the target function operation time range;

[0115] S2034. Collect second state data within the target sampling time range, where the second state data includes a sampling voltage and a functional state code.

[0116] Specifically, the first preset duration is used to indicate the time consumption of the sampling operation. When the third difference between the estimated sampling time and the target function start time is less than or equal to the first preset duration, and the fourth difference between the estimated sampling time and the target function end time is less than or equal to the first preset duration, the target sampling time range is determined according to the estimated sampling time and the target function operation time range, so that the difference between the target sampling time range and the target function operation time range is reduced, and the second state data is collected within the target sampling time range.

[0117] Specifically, the second state data includes but is not limited to a sampled voltage and a function state code, wherein the function state code is used to indicate the ID of a function, and the target function of the electronic device in the sleep state can be determined according to the function state code in the second state data.

[0118] In some possible implementations, after obtaining the target function running time range corresponding to the target function, the method includes:

[0119] When the estimated sampling time is not within the target function running time range, the second state data is collected based on the estimated sampling time.

[0120] Specifically, when the estimated sampling time is not within the target function running time range, it is determined that the accuracy of the data collected based on the estimated sampling time is higher, and the second state data is collected based on the estimated sampling time.

[0121] In some possible implementations, when the estimated sampling time is within the target function running time range, after calculating the third difference between the estimated sampling time and the target function start time, and the fourth difference between the estimated sampling time and the target function end time, the method further includes:

[0122] When the third difference is greater than the first preset time length, and / or the fourth difference is greater than the first preset time length, the second state data is collected at the estimated sampling time.

[0123] Specifically, when any one of the third difference between the estimated sampling time and the target function start time and the fourth difference between the estimated sampling time and the target function end time is greater than the first preset duration, it is determined that the time range of the sampling operation cannot avoid the target function running time range, and the second state data is collected at the estimated sampling time.

[0124] The embodiment of the present application flexibly sets the target sampling time range through the relationship between the target function running time range of the target function and the estimated sampling time, so as to improve the accuracy of the data collected within the target sampling time range, thereby improving the accuracy of the power calculation result.

[0125] Figure 5 A flowchart of another method for determining the amount of electricity provided in an embodiment of the present application. Figure 5 , the method may include the following steps:

[0126] S20331. When the third difference and the fourth difference are both less than or equal to the first preset duration, determine the duration of the target function running time range;

[0127] S20332: When the time length is greater than a second preset time length, determine the time range between the estimated sampling time and the target function activation time as a first target sampling time range.

[0128] Specifically, when the third difference between the estimated sampling time and the target function start time and the fourth difference between the estimated sampling time and the target function end time are both less than or equal to the first preset duration, the running time length of the target function is determined according to the target function running time range.

[0129] Specifically, when the running time length of the above-mentioned target function is greater than the second preset time length, it is determined that the running time of the target function is longer, and the time range between the estimated sampling time and the target function start time can be determined as the first target sampling time range.

[0130] The second preset duration is greater than the first preset duration.

[0131] Take the target function running time range as [t1, t2], the estimated sampling time as t, the first preset duration as 30s, and the second preset duration as 2h as an example: when t is between [t1, t2], t1-t is less than or equal to 30s and t2-t is less than or equal to 30s, and the running time between t1 and t2 is 5h, [t1, t] is determined as the first target sampling time range.

[0132] or,

[0133] S20333: When the time length is less than or equal to the second preset time length, determine the time range between the target function activation time and the estimated sampling time as the second target sampling time range.

[0134] Specifically, when the running time of the target function is less than or equal to the second preset time, it is determined that the running time of the target function is short, and the time range between the target function start time and the estimated sampling time can be determined as the second target sampling time range.

[0135] Still taking the target function running time range as [t1, t2], the estimated sampling time as t, the first preset duration as 30s, and the second preset duration as 2h as an example: when t is between [t1, t2], t1-t is less than or equal to 30s and t2-t is less than or equal to 30s, and the running time between t1 and t2 is 1h, [t, t2] is determined as the second target sampling time range.

[0136] Figure 6 A flowchart of another method for determining the amount of electricity provided in an embodiment of the present application. Figure 6 , the method may include the following steps:

[0137] S2041, in response to the second state switching instruction, switching the electronic device from the sleep state to the working state, and determining a wake-up mode of the electronic device;

[0138] S2042. When the wake-up mode is a normal wake-up mode, determine the power level according to the first state data and the second state data; the first state data includes at least one of temperature, output voltage, and output current.

[0139] Specifically, in response to the second state switching instruction, the electronic device is switched from the sleep state to the working state, and the wake-up mode of the electronic device is determined.

[0140] There are many methods for determining the wake-up mode of an electronic device.

[0141] Exemplarily, when the user presses an external button and the electronic device wakes up, it can be determined that the wake-up mode of the electronic device is an abnormal wake-up mode. Alternatively, when the electronic device wakes up after receiving a forced wake-up instruction sent by other terminal devices, it can be determined that the wake-up mode of the electronic device is an abnormal wake-up mode. Alternatively, when the wake-up time of the sleep state is reached at a time point and the electronic device automatically wakes up, it can be determined that the wake-up mode of the electronic device is a normal wake-up mode.

[0142] Specifically, when the wake-up mode of the electronic device from the sleep state to the working state is the normal wake-up mode, the corresponding power is determined according to the first state data collected by the electronic device in the working state and the second state data collected in the sleep state.

[0143] In some possible implementations, after the electronic device is switched from the sleep state to the working state in response to the second state switching instruction and the wake-up mode of the electronic device is determined, the method further includes:

[0144] When the wake-up mode is an abnormal wake-up mode, the power is determined according to standby state data and the first state data; the standby state data includes at least one of a standby sampling temperature, a standby sampling voltage, and a standby sampling current.

[0145] Specifically, when the wake-up mode of the electronic device from the sleep state to the working state is an abnormal wake-up mode, the electronic device may not collect the second state data, or the accuracy of the second state data collected by the electronic device is not high. At this time, the power level can be determined based on the standby state data and the first state data.

[0146] The standby state data is used to indicate the state data of the electronic device collected when the electronic device switches from the working state to the awake state in response to the first state switching instruction. The standby state data includes but is not limited to at least one of the standby sampling temperature, the standby sampling voltage, and the standby sampling current.

[0147] Optionally, the corresponding power data can be found in a pre-set data association table according to the standby state data and the first state data. The data association table includes a state code of each function, at least two power data corresponding to each state code, and parameters such as the output voltage of the power supply, the power supply temperature, the power supply output current, and the state code of the function corresponding to each power data.

[0148] The present application collects standby state data of the electronic device when the electronic device switches from a working state to a wake-up state, and determines the corresponding power level based on the standby state data when the electronic device wakes up abnormally, thereby reducing the problem of low accuracy of power data caused by insufficient sampling data or inaccurate sampling data due to abnormal conditions, and thus improving the accuracy of power data.

[0149] Figure 7 This is a schematic diagram of a device for determining the amount of electricity provided in an embodiment of the present application. Figure 7 , the electric quantity determining device 700 comprises:

[0150] A first acquisition module 701, configured to acquire first state data when the electronic device is in working state;

[0151] A state switching module 702, configured to switch the electronic device from the working state to the sleeping state in response to a first state switching instruction, and determine an estimated sampling time corresponding to the sleeping state;

[0152] The second acquisition module 703 is used to determine a target sampling time range according to the estimated sampling time and the target function operation time range, and to acquire second state data within the target sampling time range;

[0153] The determination module 704 is used to switch the electronic device from the sleep state to the working state in response to the second state switching instruction, and determine the power level according to the first state data and the second state data.

[0154] In some possible implementations, the state switching module 702 includes:

[0155] A first switching unit, configured to switch the electronic device from the working state to the sleeping state in response to the first state switching instruction;

[0156] The first determining unit is used to determine the estimated sampling time according to the sleep time range of the sleep state.

[0157] In some possible implementations, the first determining unit includes:

[0158] An acquisition subunit, used to acquire a sleep time range of the sleep state, and determine a sleep duration according to the sleep time range;

[0159] The first determining subunit is used to determine a first estimated sampling time when the sleep time is less than a first preset time; the difference between the first estimated sampling time and the end time of the sleep time range is a first difference.

[0160] In some possible implementations, the first determining unit includes:

[0161] The second determination subunit is used to determine a second estimated sampling time when the sleep time is greater than or equal to the first preset time; the difference between the second estimated sampling time and the end time of the sleep time range is a second difference; the first difference is less than the second difference.

[0162] In some possible implementations, the second acquisition module 703 includes:

[0163] An acquisition unit, configured to acquire a target function running time range corresponding to a target function; the target function running time range includes a target function start time and a target function end time;

[0164] a calculation unit, configured to calculate, when the estimated sampling time is within the target function running time range, a third difference between the estimated sampling time and the target function start time, and a fourth difference between the estimated sampling time and the target function end time;

[0165] A second determining unit is configured to determine the target sampling time range according to the estimated sampling time and the target function running time range when the third difference and the fourth difference are both less than or equal to the first preset time length;

[0166] The first acquisition unit is used to acquire second state data within the target sampling time range, where the second state data includes a sampling voltage and a functional state code.

[0167] In some possible implementations, the second determining unit is specifically configured to:

[0168] When the third difference and the fourth difference are both less than or equal to the first preset time length, determining the time length of the target function running time range;

[0169] When the time length is greater than the second preset time length, the time range between the estimated sampling time and the target function activation time is determined as the first target sampling time range;

[0170] or,

[0171] When the time length is less than or equal to the second preset time length, the time range between the target function activation time and the estimated sampling time is determined as the second target sampling time range.

[0172] In some possible implementations, the second acquisition module 703 includes:

[0173] The second collecting unit is used to collect the second state data based on the estimated sampling time when the estimated sampling time is not within the target function running time range.

[0174] In some possible implementations, the second acquisition module 703 includes:

[0175] The third collection unit is used to collect the second state data at the estimated sampling time when the third difference is greater than the first preset time length and / or the fourth difference is greater than the first preset time length.

[0176] In some possible implementations, the determination module 704 includes:

[0177] a second switching unit, configured to switch the electronic device from the sleep state to the working state in response to the second state switching instruction, and determine a wake-up mode of the electronic device;

[0178] The third determination unit is used to determine the power according to the first state data and the second state data when the wake-up mode is the normal wake-up mode; the first state data includes at least one of temperature, output voltage, and output current.

[0179] In some possible implementations, the determination module 704 includes:

[0180] The fourth determination unit is used to determine the power according to the standby state data and the first state data when the wake-up mode is an abnormal wake-up mode; the standby state data includes at least one of a standby sampling temperature, a standby sampling voltage, and a standby sampling current.

[0181] The device for determining the amount of electricity provided in the embodiment of the present application can execute the method shown in the above method embodiment, and its implementation principle and beneficial effects are similar, which will not be repeated here.

[0182] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 20 may include: a transceiver 21 , a processor 22 , and a memory 23 .

[0183] The processor 22 executes the computer execution instructions stored in the memory, so that the processor 22 executes the scheme in the above embodiment. The processor 22 can be a general-purpose processor, including a central processing unit CPU, a network processor (NP), etc.; it can also be a digital signal processor DSP, an application-specific integrated circuit ASIC, a field programmable gate array FPGA or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0184] The memory 23 is connected to the processor 22 via a system bus and completes communication between them. The memory 23 is used to store computer program instructions.

[0185] The transceiver 21 may be used to obtain first state data, second state data, standby state data, first state switching instructions, second state switching instructions, and the like.

[0186] The system bus can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The system bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The transceiver is used to realize the communication between the database access device and other computers (such as clients, read-write libraries, and read-only libraries). The memory may include random access memory (RAM) and may also include non-volatile memory.

[0187] An embodiment of the present application also provides a chip for running instructions, which is used to execute the technical solution of the method for determining the power amount in the above embodiment.

[0188] An embodiment of the present application further provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer, the computer executes the technical solution of the method for determining electric quantity in the above embodiment.

[0189] An embodiment of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, the technical solution of the method for determining the electric quantity in the above embodiment can be implemented.

[0190] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0191] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0192] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0193] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0194] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.

[0195] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0196] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0197] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0198] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for determining electric quantity, characterized in that: Applied to electronic equipment, the method comprises: When the electronic device is in working state, collecting first state data; In response to a first state switching instruction, switching the electronic device from the working state to the sleeping state, and determining an estimated sampling time corresponding to the sleeping state; Determine a target sampling time range according to the estimated sampling time and the target function operation time range, and collect second state data within the target sampling time range; In response to the second state switching instruction, the electronic device is switched from the sleep state to the working state, and the power level is determined according to the first state data and the second state data.

2. The method according to claim 1, characterized in that The step of switching the electronic device from the working state to the sleeping state in response to the first state switching instruction and determining an estimated sampling time corresponding to the sleeping state includes: In response to the first state switching instruction, switching the electronic device from the working state to the sleeping state; The estimated sampling time is determined according to the sleep time range of the sleep state.

3. The method according to claim 2, characterized in that The step of determining the estimated sampling time according to the sleep time range of the sleep state includes: Obtaining a sleep time range of the sleep state, and determining a sleep duration according to the sleep time range; When the sleep time is less than a first preset time, a first estimated sampling time is determined; and a difference between the first estimated sampling time and an end time of the sleep time range is a first difference.

4. The method according to claim 3, characterized in that After determining the sleep duration according to the sleep time range, the method further includes: When the sleep duration is greater than or equal to the first preset duration, a second estimated sampling time is determined; the difference between the second estimated sampling time and the end time of the sleep time range is a second difference; and the first difference is less than the second difference.

5. The method according to claim 1, characterized in that The step of determining a target sampling time range according to the estimated sampling time and the target function operation time range, and collecting second state data within the target sampling time range, includes: Obtain a target function running time range corresponding to the target function; the target function running time range includes the target function start time and the target function end time; When the estimated sampling time is within the target function running time range, calculating a third difference between the estimated sampling time and the target function start time, and a fourth difference between the estimated sampling time and the target function end time; When the third difference and the fourth difference are both less than or equal to the first preset time length, determining the target sampling time range according to the estimated sampling time and the target function operation time range; The second state data is collected within the target sampling time range, where the second state data includes a sampling voltage and a functional state code.

6. The method according to claim 5, characterized in that When the third difference and the fourth difference are both less than or equal to the first preset duration, determining the target sampling time range according to the estimated sampling time and the target function running time range includes: When the third difference and the fourth difference are both less than or equal to the first preset time length, determining the time length of the target function running time range; When the time length is greater than the second preset time length, the time range between the estimated sampling time and the target function activation time is determined as the first target sampling time range; or, When the time length is less than or equal to the second preset time length, the time range between the target function activation time and the estimated sampling time is determined as the second target sampling time range.

7. The method according to claim 5, characterized in that After obtaining the target function running time range corresponding to the target function, the method includes: When the estimated sampling time is not within the target function running time range, the second state data is collected based on the estimated sampling time.

8. The method according to claim 5, characterized in that When the estimated sampling time is within the target function running time range, after calculating a third difference between the estimated sampling time and the target function start time, and a fourth difference between the estimated sampling time and the target function end time, the method further comprises: When the third difference is greater than the first preset time length, and / or the fourth difference is greater than the first preset time length, the second state data is collected at the estimated sampling time.

9. The method according to claim 1, characterized in that: The step of switching the electronic device from the sleep state to the working state in response to the second state switching instruction, and determining the power level according to the first state data and the second state data, includes: In response to the second state switching instruction, switching the electronic device from the sleep state to the working state, and determining a wake-up mode of the electronic device; When the wake-up mode is a normal wake-up mode, the power is determined according to the first state data and the second state data; the first state data includes at least one of temperature, output voltage, and output current.

10. The method according to claim 9, characterized in that After the electronic device is switched from the sleep state to the working state in response to the second state switching instruction and the wake-up mode of the electronic device is determined, the method further comprises: When the wake-up mode is an abnormal wake-up mode, the power is determined according to standby state data and the first state data; the standby state data includes at least one of a standby sampling temperature, a standby sampling voltage, and a standby sampling current.

11. A device for determining electric quantity, characterized in that: Applied to electronic equipment, the device comprises: A first acquisition module, used for acquiring first state data when the electronic device is in working state; a state switching module, configured to switch the electronic device from the working state to the sleeping state in response to a first state switching instruction, and determine an estimated sampling time corresponding to the sleeping state; A second acquisition module, used to determine a target sampling time range according to the estimated sampling time and the target function operation time range, and to acquire second state data within the target sampling time range; The determination module is used to switch the electronic device from the sleep state to the working state in response to the second state switching instruction, and determine the power level according to the first state data and the second state data.

12. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 10.