A method and device for calculating electric quantity based on neural network
By using two neural networks, BP neural network and reinforcement learning neural network in power calculation, combining the power difference and power integral difference, the power value is corrected in real time, and the power calculation accuracy and sample number problems in the existing technology are solved, and the power calculation accuracy and sample number problems are realized. High precision and high efficiency power calculation.
Patent Information
- Application Number
- CN202311705081.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-12
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2043-12-12
AI Technical Summary
In the prior art, in power calculation, the accuracy of the power integration method depends on the current detection accuracy, and errors are easy to accumulate. However, neural network algorithms require a large number of samples to train, and the sample data is high, and the collection of samples of aging batteries is cumbersome, which affects the calculation accuracy.
Two neural networks, BP neural network and reinforcement learning neural network, calculate the power difference and power integral difference through real-time battery data, combine the preset learning rate and discount rate to correct the power value in real time, and reduce the number of samples required for initial training. .
It improves the accuracy of power calculation, reduces the number of samples required for neural network training, realizes error correction, and improves calculation accuracy and training efficiency.
Smart Images

Figure CN117686917B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power calculation, and in particular to a method and device for power calculation based on a neural network. Background Art
[0002] Currently, the industry mostly uses power integration methods to accumulate the power charged / discharged into / from the battery pack, and also uses neural network algorithms to train supervised learning algorithms for power. However, the accuracy of the power integration method depends on the accuracy of current detection, and errors will accumulate over long periods of time. The neural network algorithm needs to collect a large number of battery charge and discharge samples during training, and has relatively high requirements for sample data accuracy. At the same time, the algorithm only uses the forward calculation of the neural network when applied, that is, when the battery pack actually used has different degrees of aging, in principle it needs to be reflected in the samples during training, and the sample collection process for this battery aging process will also be long and cumbersome. Summary of the invention
[0003] The present application provides a method and device for calculating electric quantity based on a neural network, which can improve the accuracy of electric quantity calculation results and reduce the number of samples required for initial neural network training.
[0004] In a first aspect, an embodiment of the present application provides a method for calculating electric quantity based on a neural network, comprising:
[0005] Get real-time battery data;
[0006] Inputting the real-time battery data into the first neural network to obtain a first power value at a corresponding moment;
[0007] Input the real-time battery data into the second neural network to obtain a second power value at the corresponding moment;
[0008] Obtain a first difference according to the first power value at the first moment and the first power value at the second moment;
[0009] Obtain power integral difference according to real-time battery data;
[0010] Obtaining a power adjustment value at the first moment based on the first difference, the power integral difference, the second power value at the first moment, and the second power value at the second moment;
[0011] The power adjustment value is added to the first power value at the first moment to obtain the output power value.
[0012] Further, obtaining the first difference according to the first power value at the first moment and the first power value at the second moment includes:
[0013] The first power value at the second moment is subtracted from the first power value at the first moment to obtain a first difference.
[0014] Furthermore, obtaining the power integral difference value according to the real-time battery data includes: using a power integral method to calculate the power of the real-time battery data to obtain the power integral difference value of the battery between the first moment and the second moment.
[0015] Further, the power adjustment value at the first moment is obtained based on the first difference, the power integral difference, the second power value at the first moment, and the second power value at the second moment, including:
[0016] Obtaining a time difference according to the first difference and the power integrated difference;
[0017] The power adjustment value at the first moment is obtained according to the time difference, the preset learning rate, the preset discount rate, the second power value at the first moment and the second power value at the second moment.
[0018] Further, the time difference is obtained according to the first difference and the power integrated difference, including:
[0019] Subtract the power integrated difference from the first difference to obtain the time difference.
[0020] Furthermore, the preset learning rate is 0.1 and the preset discount rate is 0.9.
[0021] Furthermore, the first neural network is a BP neural network, and the second neural network is a reinforcement learning neural network.
[0022] In a second aspect, an embodiment of the present application provides a power calculation device based on a neural network, comprising:
[0023] Data acquisition module, used to obtain real-time battery data;
[0024] A first input module, used to input real-time battery data into a first neural network to obtain a first power value at a corresponding moment;
[0025] A second input module, used to input the real-time battery data into the second neural network to obtain a second power value at a corresponding moment;
[0026] A first difference module, configured to obtain a first difference according to a first power value at a first moment and a first power value at a second moment;
[0027] A power integral difference module is used to obtain a power integral difference based on real-time battery data;
[0028] An adjustment calculation module, configured to obtain an electric quantity adjustment value at the first moment based on the first difference, the power integral difference, the second electric quantity value at the first moment, and the second electric quantity value at the second moment;
[0029] The output module is used to add the power adjustment value and the first power value at the first moment to obtain an output power value.
[0030] In a third aspect, an embodiment of the present application provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the neural network-based power calculation method in any of the above embodiments are performed.
[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method for calculating electric power based on a neural network as in any of the above embodiments are implemented.
[0032] In summary, compared with the prior art, the technical solution provided in the embodiment of the present application has at least the following beneficial effects:
[0033] A method for calculating power based on a neural network is provided in an embodiment of the present application. Two neural networks are used to calculate a power adjustment value at the first moment based on the power values at the first moment and the second moment output by the two neural networks, and the calculated power adjustment value at the first moment is added to the original first power value at the first moment to achieve error correction. This method is not only more accurate than the result calculated by the power integration method, but also eliminates the need for the first neural network to use too many samples for training to ensure calculation accuracy, as well as real-time training of the second neural network, thereby reducing the number of samples required for the initial neural network training. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A flowchart of a method for calculating power based on a neural network is provided for one embodiment of the present application.
[0035] Figure 2 A schematic diagram of a method for calculating power based on a neural network is provided for another embodiment of the present application.
[0036] Figure 3 A graph showing the prediction error of the first neural network with respect to different sample numbers provided in one embodiment of the present application.
[0037] Figure 4 A structural diagram of a power calculation device based on a neural network provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0038] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0039] Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making any creative work shall fall within the scope of protection of this application.
[0040] See also Figure 1 , the embodiment of the present application provides a method for calculating electric quantity based on a neural network, comprising:
[0041] Step S1, obtaining real-time battery data.
[0042] The real-time battery data includes the real-time current and real-time voltage of the battery to be tested.
[0043] Step S2, inputting the real-time battery data into the first neural network to obtain the first power value at the corresponding moment.
[0044] The first neural network may be a BP neural network.
[0045] Step S3, inputting the real-time battery data into the second neural network to obtain the second power value at the corresponding moment.
[0046] The second neural network may be a reinforcement learning neural network.
[0047] Step S4, obtaining a first difference according to the first power value at the first moment and the first power value at the second moment.
[0048] Specifically, the first power value at the second moment is subtracted from the first power value at the first moment to obtain a first difference.
[0049] Among them, the first moment is the previous moment, and the second moment is the current moment.
[0050] Step S5, obtaining the power integral difference according to the real-time battery data.
[0051] Specifically, the power integration method can be used to calculate the power of the real-time battery data to obtain the power integration difference between the first moment and the second moment. Because the power integration method is accurate in a short time, that is, during the power estimation period of two moments, the actual power difference can be calculated by the power integration method and recorded as SOC_div_real.
[0052] In the specific implementation process, the power integration method can adopt the formula: Perform calculations.
[0053] Among them, I is the current, the unit is ma (milliampere), and the unit of the power integral difference SOC_div_real is mah, that is, the integral of the current per second over time is calculated and superimposed.
[0054] Step S6, obtaining the power adjustment value at the first moment based on the first difference, the power integrated difference, the second power value at the first moment and the second power value at the second moment.
[0055] Step S7, adding the power adjustment value and the first power value at the first moment to obtain the output power value.
[0056] Specifically, see Figure 2 Steps S4, S6 and S7 are all executed by the second neural network, and the reinforcement learning neural network is used to correct the change in the error of the first power value predicted at two adjacent moments output by the first neural network.
[0057] In the specific implementation process, the reinforcement learning neural network runs according to the conventional training process (forward calculation + error back propagation), estimates the error predicted by the first neural network, and obtains the power adjustment value to adjust the output power value.
[0058] See also Figure 3 If the number of samples used in the training of the first neural network is large and the diversity is strong, then there is no need to combine it with the second neural network for correction; however, if the number and diversity of samples used by the first neural network in the training phase cannot be guaranteed, the deviation of the output prediction value of the first neural network will become larger, and if the number of samples is larger, the deviation will be smaller, that is, the number of training samples affects the output error of the first neural network.
[0059] Therefore, the present application adds a second neural network for online training to calculate and compensate for the error of the output of the first neural network, so that the first neural network does not need to be trained with too many samples to ensure output accuracy.
[0060] The above embodiment provides a method for calculating power based on a neural network, which adopts two neural networks, calculates the power adjustment value at the first moment based on the power values at the first moment and the second moment output by the two neural networks, and adds the calculated power adjustment value at the first moment to the original first power value at the first moment to achieve error correction. This method is not only more accurate than the result calculated by the power integration method, but also eliminates the need for the first neural network to use too many samples for training to ensure calculation accuracy, as well as real-time training of the second neural network, thereby reducing the number of samples required for the initial neural network training.
[0061] In some embodiments, the method of obtaining the power adjustment value at the first moment based on the first difference, the power integral difference, the second power value at the first moment, and the second power value at the second moment includes:
[0062] Step S61, obtaining a time difference according to the first difference and the power integrated difference.
[0063] Specifically, the power integrated difference is subtracted from the first difference to obtain the time difference.
[0064] Let the first difference be SOC_div_NN, then the time difference SOC_TD=SOC_div_NN-SOC_div_real.
[0065] Step S62, obtaining a power adjustment value at the first moment according to the time difference, the preset learning rate, the preset discount rate, the second power value at the first moment and the second power value at the second moment.
[0066] Specifically, the power adjustment value at the first moment is calculated using the formula: RL_SOC←RL_SOC+α*(SOC_TD+γ*RL_SOC_nest-RL_SOC).
[0067] Among them, RL_SOC on the left side of the arrow is the power adjustment value at the first moment; RL_SOC on the right side of the arrow is the second power value at the first moment, RL_SOC_nest is the second power value at the second moment, α is the preset learning rate, a custom constant, which can be set to 0.1, and γ is the preset discount rate, a custom constant, which can be set to 0.9.
[0068] Finally, the first power value at the first moment output by the first neural network is added to RL_SOC to obtain the output power value.
[0069] The output power value is the accurate power value after the error is corrected at the first moment, and the power values at other moments can also be calculated using the above method steps to achieve accurate calculation of the battery power at each moment.
[0070] It is preliminarily estimated that the method of the present application can reduce the number of training samples for the first neural network by about 30%.
[0071] See also Figure 4 Another embodiment of the present application provides a power calculation device based on a neural network, comprising:
[0072] The data acquisition module 101 is used to acquire real-time battery data.
[0073] The first input module 102 is used to input the real-time battery data into the first neural network to obtain a first power value at a corresponding moment.
[0074] The second input module 103 is used to input the real-time battery data into the second neural network to obtain a second power value at a corresponding moment.
[0075] The first difference module 104 is configured to obtain a first difference according to a first power value at a first moment and a first power value at a second moment.
[0076] The power integral difference module 105 is used to obtain the power integral difference according to the real-time battery data.
[0077] The adjustment calculation module 106 is used to obtain the power adjustment value at the first moment based on the first difference, the power integrated difference, the second power value at the first moment and the second power value at the second moment.
[0078] The output module 107 is used to add the power adjustment value and the first power value at the first moment to obtain an output power value.
[0079] The specific limitations of an electric quantity calculation device based on a neural network provided in this embodiment can be found in the above embodiment of an electric quantity calculation method based on a neural network, which will not be repeated here. Each module in the above-mentioned electric quantity calculation device based on a neural network can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0080] An embodiment of the present application provides a computer device, which may include a processor, a memory, a network interface, and a database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the processor executes the steps of a method for calculating power based on a neural network as in any of the above embodiments.
[0081] The working process, working details and technical effects of the computer device provided in this embodiment can be found in the above embodiment of a method for calculating power based on a neural network, which will not be described in detail here.
[0082] The embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of a method for calculating electric power based on a neural network as in any of the above embodiments are implemented. Wherein, the computer-readable storage medium refers to a carrier for storing data, which may include but is not limited to a floppy disk, an optical disk, a hard disk, a flash memory, a USB flash drive and / or a memory stick (Memory Stick), etc., and the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The working process, working details and technical effects of the computer-readable storage medium provided in this embodiment can be found in the above embodiment of a method for calculating electric power based on a neural network, and will not be repeated here.
[0083] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0084] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are 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.
[0085] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for calculating power based on neural network, It is characterized in that include: Get real-time battery data; Inputting the real-time battery data into a first neural network to obtain a first power value at a corresponding moment; Inputting the real-time battery data into a second neural network to obtain a second power value at a corresponding moment; Wherein, the first neural network is a BP neural network, and the second neural network is a reinforcement learning neural network; Obtain a first difference according to the first power value at the first moment and the first power value at the second moment; Obtaining a power integral difference according to the real-time battery data; The power adjustment value at the first moment is obtained based on the first difference, the power integral difference, the second power value at the first moment, and the second power value at the second moment; specifically, the time difference is obtained according to the first difference and the power integral difference; the power adjustment value at the first moment is obtained according to the time difference, the preset learning rate, the preset discount rate, the second power value at the first moment, and the second power value at the second moment; the calculation formula is: RL_SOC←RL_SOC+α*(SOC_TD+γ*RL_SOC_nest-RL_SOC); Wherein, RL_SOC on the left side of the arrow is the power adjustment value at the first moment; RL_SOC on the right side of the arrow is the second power value at the first moment, SOC_TD is the time difference, RL_SOC_nest is the second power value at the second moment, α is the preset learning rate, and γ is the preset discount rate; The power adjustment value is added to the first power value at the first moment to obtain an output power value.
2. The method for calculating electric quantity based on neural network according to claim 1, It is characterized in that The step of obtaining a first difference value according to the first power value at the first moment and the first power value at the second moment includes: The first power value at the second moment is subtracted from the first power value at the first moment to obtain the first difference.
3. The method for calculating electric quantity based on neural network according to claim 1, It is characterized in that The obtaining of the power integral difference according to the real-time battery data comprises: The power integration method is used to calculate the power of the real-time battery data to obtain the power integration difference of the battery between the first moment and the second moment.
4. The method for calculating electric quantity based on neural network according to claim 1, It is characterized in that The obtaining a time difference according to the first difference and the power integrated difference includes: The power integrated difference is subtracted from the first difference to obtain the time difference.
5. The method for calculating electric quantity based on neural network according to claim 1, It is characterized in that The preset learning rate is 0.1, and the preset discount rate is 0.
9.
6. A power calculation device based on neural network, It is characterized in that include: Data acquisition module, used to obtain real-time battery data; A first input module, used to input the real-time battery data into a first neural network to obtain a first power value at a corresponding moment; A second input module, used to input the real-time battery data into a second neural network to obtain a second power value at a corresponding moment; Wherein, the first neural network is a BP neural network, and the second neural network is a reinforcement learning neural network; A first difference module, configured to obtain a first difference according to a first power value at a first moment and a first power value at a second moment; A power integral difference module, used to obtain a power integral difference according to the real-time battery data; The adjustment calculation module is used to obtain the power adjustment value at the first moment based on the first difference, the power integral difference, the second power value at the first moment, and the second power value at the second moment; specifically, the time difference is obtained according to the first difference and the power integral difference; the power adjustment value at the first moment is obtained according to the time difference, the preset learning rate, the preset discount rate, the second power value at the first moment, and the second power value at the second moment; the calculation formula is: RL_SOC←RL_SOC+α*(SOC_TD+γ*RL_SOC_nest-RL_SOC); Wherein, RL_SOC on the left side of the arrow is the power adjustment value at the first moment; RL_SOC on the right side of the arrow is the second power value at the first moment, SOC_TD is the time difference, RL_SOC_nest is the second power value at the second moment, α is the preset learning rate, and γ is the preset discount rate; The output module is used to add the power adjustment value and the first power value at the first moment to obtain an output power value.
7. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the power calculation method based on a neural network as described in any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method for calculating electric quantity based on a neural network as claimed in any one of claims 1 to 5 are implemented.
