Automatic test method and system for safety protection function of battery management system
By automatically controlling the startup and fault judgment of the battery management system, combined with image comparison of the perceived hash algorithm, the problems of low efficiency and poor accuracy of manual testing in the existing technology are solved, and efficient and accurate automated testing of the battery management system is achieved.
Patent Information
- Application Number
- CN202411937359.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-29
AI Technical Summary
The fault alarm test of existing battery management systems relies on manual operation, is inefficient and prone to omissions or misjudgments, affecting the comprehensiveness and accuracy of the test.
By obtaining the access path information of the battery management system, the automatic control system is started and powered up, inputting battery simulation data for fault judgment, and using the perceived hash algorithm to compare the image information of the fault alarm trigger result to judge the correctness of the result.
It realizes automated testing of the safety protection function of the battery management system, improves testing efficiency, comprehensiveness and accuracy, and ensures the reliability and safety of the system.
Smart Images

Figure CN119902076A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of battery testing, and in particular to an automated testing method and system for safety protection functions of a battery management system. Background Art
[0002] In recent years, driven by the strong wave of new energy industry, many countries and regions have elevated energy storage to the strategic height of national energy security. However, behind the booming development of the energy storage industry, frequent safety accidents in energy storage power stations have become a hidden pain that the industry cannot ignore. According to incomplete statistics, since 2023, there have been more than 70 energy storage accidents worldwide, most of which were caused by internal battery cell failures, battery and module failures, and thermal runaway of energy storage systems. The key to improving energy storage safety lies in the system fault alarm protection capability.
[0003] Therefore, the fault alarm strategy for large-scale energy storage BMS (Battery Management System) systems needs to be tested in the factory before shipment. The traditional fault alarm strategy test of large-scale energy storage BMS systems mainly triggers fault alarms by sending simulated data manually, and checks whether the fault alarm of the BMS system is triggered after reaching the threshold. In addition, manual inspection requires a lot of manpower, and manual inspection is bound to have omissions and careless inspections. Summary of the invention
[0004] In view of this, the present invention provides an automated testing method and system for the safety protection function of a battery management system, so as to solve the problem that the battery management system relies on manual testing.
[0005] In a first aspect, the present invention provides an automated testing method for a safety protection function of a battery management system, the method comprising:
[0006] Obtain access path information of the battery management system, and control the battery management system to start and power on according to the access path information;
[0007] Acquire battery simulation data, and input the battery simulation data into a battery management system, so that the battery management system performs fault judgment based on the battery simulation data;
[0008] Obtain image information of the fault alarm trigger result obtained by the battery management system, and determine whether the fault alarm trigger result is correct based on the perceptual hash algorithm and the image information.
[0009] The automated testing method for the safety protection function of the battery management system provided by the present invention controls the startup and power-on of the battery management system according to the access path information of the battery management system, inputs the acquired battery simulation data into the battery management system, so that the battery management system performs fault judgment, obtains the image information of the fault alarm trigger result, and judges whether the fault alarm trigger result is correct based on the perceptual hash algorithm and the image information. The present invention can automatically test the safety protection function of the battery management system by controlling the battery management system, without the need for the tester to operate the system and judge the results, thereby improving the test efficiency, test comprehensiveness and test accuracy, ensuring that the battery management system has a reliable safety protection function and can monitor the safety of the battery.
[0010] In an optional embodiment, access path information of a battery management system is obtained, and the battery management system is controlled to start and power on according to the access path information, including: obtaining first access path information, and a preset account and a preset password, and entering the preset account and the preset password into a login page determined based on the first access path information; obtaining second access path information, and triggering a login button of the login page based on the second access path information, so that the battery management system enters the management page; obtaining third access path information, and triggering a start / stop control button of the management page based on the third access path information, so that the battery management system starts to enter the system control page; obtaining fourth access path information, and triggering a system power-on button of the system control page based on the fourth access path information, so that the battery management system powers on.
[0011] The present invention can control the battery management system to automatically perform corresponding actions according to the operation process by acquiring the access path information of the battery management system, without manual operation, thus saving human resources.
[0012] In an optional embodiment, obtaining battery simulation data includes: calling a test tool through a component interaction tool and obtaining a configuration file of the test tool; setting battery simulation data of preset battery parameters based on the configuration file, the preset battery parameters include any one of the following: voltage, current and temperature, and the battery simulation data includes: voltage simulation data, current simulation data and temperature simulation data.
[0013] The present invention can automatically input battery simulation data into a battery management system by calling a test tool, so that the battery management system can make fault judgments based on the data, thereby realizing automation and intelligence of the test.
[0014] In an optional implementation, image information of a fault alarm trigger result obtained by a battery management system is obtained, and image comparison is performed based on a perceptual hash algorithm and the image information to determine whether the fault alarm trigger result is correct, including: taking a screenshot of a preset area in a display page of the battery management system to obtain image information of the fault alarm trigger result; performing grayscale processing on the image information, and extracting low-frequency information of the image information after grayscale processing; calculating the grayscale mean of the image information after grayscale processing based on the low-frequency information, and obtaining a hash value based on the grayscale mean; calculating the Hamming distance between the image information and the preset standard image based on the hash value and the standard hash value of the preset standard image; comparing the Hamming distance with a preset distance threshold, if it is lower than the preset distance threshold, determining that the fault alarm trigger result is correct, otherwise determining that it is incorrect.
[0015] The present invention can automatically determine whether the fault alarm triggering result of the battery management system is correct by comparing pictures, avoiding omissions or misjudgments due to manual judgment, thereby accurately testing whether the fault judgment logic of the battery management system is correct, so that software developers can correct and improve the battery management system according to the test results, and ensure the reliability of subsequent actual battery tests.
[0016] In a second aspect, the present invention provides an automated testing device for a safety protection function of a battery management system, the device comprising:
[0017] A system control module, used to obtain access path information of the battery management system, and control the battery management system to start and power on according to the access path information;
[0018] A system test module, used for acquiring battery simulation data and inputting the battery simulation data into a battery management system so that the battery management system can make fault judgment based on the battery simulation data;
[0019] The result judgment module is used to obtain the image information of the fault alarm trigger result obtained by the battery management system, and perform image comparison based on the perceptual hash algorithm and the image information to determine whether the fault alarm trigger result is correct.
[0020] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to execute the automated testing method for the safety protection function of the battery management system of the first aspect or any corresponding embodiment thereof.
[0021] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the automated testing method for the safety protection function of a battery management system according to the first aspect or any corresponding embodiment thereof.
[0022] In a fifth aspect, the present invention provides a computer program product, including computer instructions, which are used to enable a computer to execute the automated testing method for the safety protection function of a battery management system according to the first aspect or any corresponding embodiment thereof.
[0023] In a sixth aspect, the present invention provides an automated testing system for a safety protection function of a battery management system, the system comprising:
[0024] A test system for executing the automated test method for the safety protection function of a battery management system according to the first aspect or any corresponding embodiment thereof;
[0025] A test tool, connected to the test system, for generating battery simulation data based on a call of the test system;
[0026] The battery management system is connected to the test system and is used to control the test system, make fault judgments based on battery simulation data, and display the fault alarm triggering results.
[0027] The automated testing system for the safety protection function of the battery management system provided by the present invention can control the test tools and the battery management system based on the test system, thereby realizing automated testing of the safety protection function of the battery management system. There is no need for testers to operate the system and judge the results, thereby improving test efficiency, test comprehensiveness and test accuracy.
[0028] In an optional embodiment, the battery management system includes: a data storage module, used to store configuration parameters; a data acquisition module, connected to the data storage module, used to obtain battery simulation data, and perform fault judgment based on the battery simulation data and configuration parameters; a data transmission module, connected to the data acquisition module, used to receive the battery simulation data and fault judgment results uploaded by the data acquisition module; a fault display module, connected to the data transmission module, used to perform visual display based on the battery simulation data and fault judgment results transmitted by the data transmission module.
[0029] The present invention can monitor the operation of the battery and determine whether the battery is abnormal by constructing a battery management system. If an abnormality occurs, an alarm is issued so that the technicians can take timely measures to prevent malfunctions caused by battery abnormalities and ensure personal safety and property safety. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0031] Figure 1 is a flow chart of an automated testing method for a safety protection function of a battery management system according to an embodiment of the present invention;
[0032] Figure 2 is a flow chart of another automated testing method for the safety protection function of a battery management system according to an embodiment of the present invention;
[0033] Figure 3 is a flow chart of another automated testing method for the safety protection function of a battery management system according to an embodiment of the present invention;
[0034] Figure 4 is a schematic screenshot diagram of another automated testing method for the safety protection function of a battery management system according to an embodiment of the present invention;
[0035] Figure 5 is a low-frequency information schematic diagram of another automated testing method for the safety protection function of a battery management system according to an embodiment of the present invention;
[0036] Figure 6 is a schematic diagram of binary hash values of another automated testing method for a safety protection function of a battery management system according to an embodiment of the present invention;
[0037] Figure 7 is a schematic diagram of a hexadecimal hash value of another automated testing method for a safety protection function of a battery management system according to an embodiment of the present invention;
[0038] Figure 8 is a structural block diagram of an automated testing device for a safety protection function of a battery management system according to an embodiment of the present invention;
[0039] Fig. 9 is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention;
[0040] Fig.10 is a structural block diagram of an automated testing system for a battery management system safety protection function according to an embodiment of the present invention;
[0041] Fig.11 is a schematic diagram of the structure of a battery management system according to an automated testing system for a safety protection function of a battery management system according to an embodiment of the present invention;
[0042] Fig.12 The figure is a schematic diagram of the operation flow of the automatic testing system for the safety protection function of the battery management system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0044] The embodiment of the present invention is applicable to the scenario of conducting performance testing before the developed battery management system is promoted and used, taking a large energy storage battery management system as an example. The embodiment of the present invention provides an automated testing method for the safety protection function of a battery management system, which controls the battery management system according to the test process to achieve the effect of not relying on manual operation and improving the test efficiency.
[0045] According to an embodiment of the present invention, an embodiment of an automated testing method for a safety protection function of a battery management system is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in an order different from that shown here.
[0046] In this embodiment, an automated testing method for the safety protection function of a battery management system is provided, which can be used in mobile terminals, such as computers, etc. Figure 1 : is a flow chart of an automated testing method for a battery management system safety protection function according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0047] Step S101, obtaining access path information of the battery management system, and controlling the battery management system to start and power on according to the access path information.
[0048] Specifically, in an embodiment of the present invention, in order to avoid thermal runaway and other reasons caused by the failure of the internal battery cells of the battery module, the battery management system is developed through software, which can determine whether the current battery has an abnormality based on the collected battery operation data based on the pre-set fault alarm strategy, so as to take timely actions when an abnormality occurs to prevent accidents. For this scenario, it is necessary to ensure that the monitoring results of the battery management system are accurate and reliable. Therefore, after the software developers complete the development of the battery management system, they need to conduct relevant tests. Only after determining that there are no errors in the fault alarm strategy of the battery management system will it be promoted for use. In general, the top-level main control of the developed battery management system includes an embedded layer and a WEB layer. The embedded layer is used for the collection of battery operation data, and the WEB layer displays the operation data and fault judgment results on the WEB page. The user needs to enter the WEB page and perform operations such as login, startup and power-on to successfully power on the battery management system. In order to realize the automation of the test, the embodiment of the present invention uses Python to develop a UI automation login script, and obtains the function control path of the battery management system by executing the script. Different function control paths correspond to different text input areas or buttons of the WEB page, and then the battery management system can be automatically executed according to the manual operation process by controlling the text input information of the text input area or triggering the button, completing the automatic startup and power-on of the battery management system. At this time, the battery management system has completed the preparations for battery fault judgment.
[0049] Step S102, obtaining battery simulation data, and inputting the battery simulation data into a battery management system, so that the battery management system performs fault judgment based on the battery simulation data.
[0050] Specifically, in an embodiment of the present invention, before testing the battery management system based on the battery module, the battery management system is generally tested based on the battery simulation data by simulating relevant data, thereby reducing the testing cost. Moreover, the simulation data is relatively rich and accurate, and can even obtain operating data that the actual battery module cannot reach, so as to perform testing based on a large amount of battery simulation data, thereby improving the reliability of the monitoring results of the battery management system. Those skilled in the art have developed various testing tools, through which simulation data of different battery parameters can be generated, such as CANoe, the full name of CANoe is CAN open environment, which supports the entire system development process from demand analysis to system implementation, including the development, testing and analysis of networks and ECUs, for example only, not limited thereto. The embodiment of the present invention uses Python to develop test scripts, which can directly call and start the CANoe software, and then generate battery simulation data of different battery parameters, such as voltage simulation data, current simulation data or temperature simulation data, but not limited thereto.
[0051] In some optional implementations, the test script can directly input various acquired battery simulation data into the battery management system, which is equivalent to the relevant data actually collected by the battery management system on the battery module, so as to make fault judgments based on the battery simulation data. Generally, the battery management system stores preset thresholds for different battery parameters. By comparing the battery simulation data with the corresponding preset thresholds, it is determined whether the current battery has a fault. This process is the above-mentioned fault alarm strategy.
[0052] Step S103, obtaining image information of the fault alarm triggering result obtained by the battery management system, and judging whether the fault alarm triggering result is correct based on the perceptual hash algorithm and the image information.
[0053] Specifically, in an embodiment of the present invention, after the battery management system performs fault detection on the battery module, it will trigger a fault alarm on the WEB page according to the fault judgment result, and the WEB page will display a corresponding fault alarm mark in a preset area, for example, a fault alarm mark displayed in the center area of the WEB page, but not limited thereto. Therefore, the fault alarm mark displayed on the WEB page directly represents the fault judgment result, and the tester can directly judge whether the current battery module has a fault and what the fault type is according to the fault alarm mark displayed on the WEB page. In order to ensure that the fault judgment result obtained by the tester is correct, it is necessary to ensure that the judgment result of the fault alarm strategy of the battery management system is correct. Therefore, the embodiment of the present invention determines the expected result at this time in advance according to the battery simulation data. When the battery management system completes the fault judgment, the image information of the fault alarm trigger result displayed by the battery management system on the WEB page is obtained, that is, the fault alarm mark in the preset area, so as to compare it with the expected result based on the perceptual hash algorithm (PHA) to judge whether the fault alarm trigger result is correct, that is, to determine whether the judgment logic of the fault alarm strategy of the battery management system is correct. If the currently triggered fault alarm is different from the expected result, it means that there is an error in the fault alarm strategy of the battery management system. The program developer will troubleshoot the battery management system program based on the comparison results. Therefore, through a large number of automated tests of the battery management system, the error judgment logic in the system can be discovered in time, so as to eliminate the fault of the battery management system in the subsequent battery module detection process and conduct targeted troubleshooting on other aspects.
[0054] The automated testing method for the safety protection function of the battery management system provided by the present invention controls the startup and power-on of the battery management system according to the access path information of the battery management system, inputs the acquired battery simulation data into the battery management system, so that the battery management system performs fault judgment, obtains the image information of the fault alarm trigger result, and judges whether the fault alarm trigger result is correct based on the perceptual hash algorithm and the image information. The present invention can automatically test the safety protection function of the battery management system by controlling the battery management system, without the need for the tester to operate the system and judge the results, thereby improving the test efficiency, test comprehensiveness and test accuracy, ensuring that the battery management system has a reliable safety protection function and can monitor the safety of the battery.
[0055] In this embodiment, an automated testing method for the safety protection function of a battery management system is provided, which can be used in the above-mentioned mobile terminals, such as computers, etc. Figure 2 : is a flow chart of an automated testing method for a battery management system safety protection function according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0056] Step S201, obtaining access path information of the battery management system, and controlling the battery management system to start and power on according to the access path information.
[0057] Specifically, the above step S201 includes:
[0058] Step S2011, obtaining first access path information, a preset account and a preset password, and inputting the preset account and the preset password into a login page determined based on the first access path information.
[0059] Step S2012: obtaining the second access path information, and triggering the login button of the login page based on the second access path information, so that the battery management system enters the management page.
[0060] Specifically, in an embodiment of the present invention, in the WEB layer development of the battery management system, each button or each text input box on the WEB page will have an access path Xpath, such as the account input box, password input box, login button of the login page corresponding to the battery management system, the start / stop control button of the management page (system homepage), the system power-on button of the system control page, etc. When developing a UI automation login script, the corresponding access path Xpath information can be set in the script code, so that during the script running process, the script directly and automatically triggers the corresponding click event according to the access path to complete the corresponding operation process.
[0061] In some optional implementations, according to the operation flow of the battery management system, during the operation of the UI automated login script, the Xpath information of the account input box and the password input box in the login page, as well as the pre-set account and password, are first obtained, the position of the account input box and the password input box on the login page are identified through the Xpath information, and the predetermined account and password are automatically entered. When the information input is completed, the script continues to run, obtains the Xpath information of the login button in the login interface, identifies the position of the login button through the Xpath information, and the script automatically triggers the click event to log in to the management page of the battery management system, i.e., the system homepage, and the automatic login is completed at this time.
[0062] Step S2013, obtaining the third access path information, and triggering the start / stop control button of the management page based on the third access path information, so that the battery management system starts to enter the system control page.
[0063] Step S2014: Acquire fourth access path information, and trigger a system power-on button on the system control page based on the fourth access path information to power on the battery management system.
[0064] Specifically, in an embodiment of the present invention, after the battery management system enters the home page, the UI automation login script continues to run, obtains the Xpath information of the start / stop control button on the home page, identifies the position of the start / stop control button on the home page through the Xpath information, and the script automatically triggers a click event to log in to the system control page of the battery management system. Next, obtain the Xpath information of the system power-on button on the system control page, identify the position of the system power-on button on the system control page through the Xpath information, and the script automatically triggers a click event. At this time, it automatically returns to the home page, and after waiting for about 5 seconds, the battery management system is successfully powered on. By obtaining the access path information of the battery management system, the present invention can control the battery management system to automatically perform corresponding actions according to the operating process, without the need for manual operation, thus saving human resources.
[0065] Step S202, obtaining battery simulation data, and inputting the battery simulation data into a battery management system, so that the battery management system performs fault judgment based on the battery simulation data.
[0066] Specifically, the above step S202 includes:
[0067] Step S2021, calling the test tool through the component interaction tool and obtaining the configuration file of the test tool.
[0068] Step S2022, setting battery simulation data of preset battery parameters based on the configuration file, the preset battery parameters include any one of the following: voltage, current and temperature, and the battery simulation data includes: voltage simulation data, current simulation data and temperature simulation data.
[0069] Specifically, in an embodiment of the present invention, the test tool is CANoe, and the developed test script uses win32com.client as a component interaction tool to automatically control CANoe to send simulation messages, that is, simulate battery data. Among them, win32com.client is a Python module for interacting with COM components in the Windows system. The CANoe tool can be automatically operated by Python to replace the previous manual method to set the value of the battery simulation data. Among them, the battery parameters include voltage, current and temperature, and the corresponding battery simulation parameters are voltage simulation data, current simulation data and temperature simulation data. Moreover, the voltage, current or temperature of all battery clusters, a single battery cluster or a battery cell in the battery module can be simulated. Taking the current and voltage settings as an example, the script execution process is as follows:
[0070] (1) Start the CANoe software by calling the DispatchEx method of win32com.client;
[0071] (2) Open the cfg file (configuration file) by calling the open method of win32com.client;
[0072] (3) By calling win32com.client's set_Sigval, the current signal of all clusters is assigned 30A, and the total voltage value of all clusters is assigned 13123V, so that the entire BMS system enters the charging state, where 30A and 13123V are both within the normal range;
[0073] (4) By calling set_Sigval of win32com.client, the highest voltage of a cell in a cluster is assigned a value of 3.66V, where the voltage threshold of a cell overvoltage mild alarm is 3.65V. Therefore, it is expected that a mild alarm of excessive cell voltage will be triggered.
[0074] In some optional implementations, after setting the battery simulation parameters, the test tool can directly transmit the battery simulation data to the battery management system, which is equivalent to the battery data collected by the embedded layer of the battery management system, so as to make a fault judgment according to the internal fault alarm strategy, and trigger the fault alarm of the WEB page according to the judgment result. If the fault alarm strategy is correct, it will trigger a mild alarm of excessive single cell voltage, and the corresponding fault alarm mark will pop up on the WEB page. The present invention can automatically input the battery simulation data into the battery management system by calling the test tool, so that the battery management system can make a fault judgment according to the data, realizing the automation and intelligence of the test.
[0075] Step S203, obtaining the image information of the fault alarm triggering result obtained by the battery management system, and judging whether the fault alarm triggering result is correct based on the perceptual hash algorithm and the image information. Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.
[0076] The automated testing method for the safety protection function of the battery management system provided by the present invention controls the startup and power-on of the battery management system according to the access path information of the battery management system, inputs the acquired battery simulation data into the battery management system, so that the battery management system performs fault judgment, obtains the image information of the fault alarm trigger result, and judges whether the fault alarm trigger result is correct based on the perceptual hash algorithm and the image information. The present invention can automatically test the safety protection function of the battery management system by controlling the battery management system, without the need for the tester to operate the system and judge the results, thereby improving the test efficiency, test comprehensiveness and test accuracy, ensuring that the battery management system has a reliable safety protection function and can monitor the safety of the battery.
[0077] In this embodiment, an automated testing method for the safety protection function of a battery management system is provided, which can be used in the above-mentioned mobile terminals, such as computers, etc. Figure 3 : is a flow chart of an automated testing method for a battery management system safety protection function according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0078] Step S301, obtain the access path information of the battery management system, and control the battery management system to start and power on according to the access path information. Figure 2 Step S201 of the illustrated embodiment will not be described in detail here.
[0079] Step S302, obtaining battery simulation data, and inputting the battery simulation data into the battery management system, so that the battery management system performs fault judgment based on the battery simulation data. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0080] Step S303, obtaining image information of the fault alarm triggering result obtained by the battery management system, and judging whether the fault alarm triggering result is correct based on the perceptual hash algorithm and the image information.
[0081] Specifically, the above step S303 includes:
[0082] Step S3031, taking a screenshot of a preset area in a display page of the battery management system to obtain image information of the fault alarm triggering result.
[0083] Specifically, in an embodiment of the present invention, the battery management system performs fault judgment based on the battery simulation data, and displays the fault judgment result in a preset area of the WEB page. At this time, the test script directly takes a screenshot of the fault alarm triggered by the preset area through the driver.get_screenshot_as_png() method, obtains the image information of the fault alarm logo, and saves the image information in the specified path.
[0084] Step S3032, grayscale processing is performed on the image information, and low-frequency information of the grayscale processed image information is extracted.
[0085] Specifically, in the embodiment of the present invention, in general, the fault warning mark displayed on the WEB page is a color picture, but whether there is a fault warning mark and the fault warning marks of different faults are differences in the content of the picture, and the color difference can be ignored. Therefore, the original picture is gray-scaled to obtain a gray-scaled picture, such as Figure 4 As shown. At the same time, the grayscale processed images are uniformly compressed into 32×32 images, but not limited to this. The grayscale processed images are divided into a blank background with a larger proportion and a foreground with a smaller proportion. By performing discrete cosine transform (DCT) on the image, the transformation formula is as follows:
[0086]
[0087] Among them, N is the number of pixels, u and v are the positions of pixels. The discrete cosine transform can transform the image from the pixel domain to the frequency domain. At this time, the background corresponds to high-frequency information and the foreground corresponds to low-frequency information. Therefore, extracting the low-frequency information in the image is equivalent to extracting the feature information of the image.
[0088] Step S3033, calculating the grayscale mean of the image information after grayscale processing based on the low-frequency information, and obtaining a hash value according to the grayscale mean.
[0089] Specifically, in the embodiment of the present invention, after DCT transformation, the frequency features corresponding to the low-frequency information of the picture are concentrated in the upper left corner of the picture, and the 8×8 coefficient sub-matrix in the upper left corner of the coefficient matrix is retained, such as Figure 5 As shown. The grayscale mean of the image at this time is calculated based on the low-frequency information, and a binary hash value is generated based on the grayscale mean. If the DCT coefficient is higher than the grayscale mean, it is assigned a value of 1, otherwise it is assigned a value of 0. For example, the grayscale value of 8×8, a total of 64 pixels, is compared with the grayscale mean. If the grayscale value of the pixel is greater than the grayscale mean, it is assigned a value of 1, otherwise it is assigned a value of 0, thereby generating a 64-bit hash value (composed of 0 and 1), as shown in Figure 6Further, the 64-bit hash value is grouped into 4 characters, and the binary hash value is converted into a hexadecimal hash value, as shown in Figure 7 shown.
[0090] Step S3034, based on the hash value and the standard hash value of the preset standard picture, calculate the Hamming distance between the picture information and the preset standard picture.
[0091] Specifically, in the embodiment of the present invention, each time a set of battery simulation data is determined, the expected result can be obtained, that is, whether a fault alarm will be triggered. If triggered, the fault alarm mark will pop up, and if not triggered, it will not pop up. Therefore, the WEB interface corresponding to the expected result is displayed as a preset standard picture, and the standard hash value corresponding to the preset standard picture is calculated. The hash value of the picture corresponding to the fault alarm trigger result currently obtained is compared with the standard hash value, and the Hamming Distance between the two pictures is calculated. The calculation process is: the strings corresponding to the two hash values are XORed, and the number of non-0 in the statistical result is the Hamming distance. For example, for the strings "10010" and "10000", the Hamming distance is 1. This is only an example and is not limited to this.
[0092] Step S3035, comparing the Hamming distance with a preset distance threshold, if it is lower than the preset distance threshold, it is determined that the fault alarm triggering result is correct, otherwise it is determined to be incorrect.
[0093] Specifically, in an embodiment of the present invention, the result of the fault alarm is only an alarm or no alarm, so the screenshot of the preset area only includes two results: one with a fault alarm mark and one without a fault alarm mark. Therefore, if the fault alarm trigger result is correct, then the picture is the same as the standard picture at this time, and there is generally no difference, so the preset distance threshold is set to 0, but not limited to this. When the calculated Hamming Distance is 0, it is directly judged that the two pictures are the same. At this time, the fault alarm is triggered normally, otherwise it is triggered incorrectly. The present invention can automatically determine whether the fault alarm trigger result of the battery management system is correct through image comparison, avoiding omissions or misjudgments due to manual judgment, thereby accurately testing whether the fault judgment logic of the battery management system is correct, so that software developers can correct and improve the battery management system according to the test results, and ensure the reliability of subsequent actual battery tests.
[0094] The automated testing method for the safety protection function of the battery management system provided by the present invention controls the startup and power-on of the battery management system according to the access path information of the battery management system, inputs the acquired battery simulation data into the battery management system, so that the battery management system performs fault judgment, obtains the image information of the fault alarm trigger result, and judges whether the fault alarm trigger result is correct based on the perceptual hash algorithm and the image information. The present invention can automatically test the safety protection function of the battery management system by controlling the battery management system, without the need for the tester to operate the system and judge the results, thereby improving the test efficiency, test comprehensiveness and test accuracy, ensuring that the battery management system has a reliable safety protection function and can monitor the safety of the battery.
[0095] In this embodiment, an automated testing device for the safety protection function of a battery management system is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and will not be repeated hereafter. As used below, the term "module" may be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0096] This embodiment provides an automated testing device for the safety protection function of a battery management system. Figure 8 As shown, including:
[0097] The system control module 801 is used to obtain access path information of the battery management system, and control the battery management system to start and power on according to the access path information.
[0098] The system test module 802 is used to obtain battery simulation data and input the battery simulation data into the battery management system so that the battery management system performs fault judgment based on the battery simulation data.
[0099] The result judgment module 803 is used to obtain the image information of the fault alarm triggering result obtained by the battery management system, and perform image comparison based on the perceptual hash algorithm and the image information to determine whether the fault alarm triggering result is correct.
[0100] In some optional implementations, the system control module 801 includes:
[0101] The input unit is used to obtain the first access path information, a preset account and a preset password, and input the preset account and the preset password into a login page determined based on the first access path information.
[0102] The login unit is used to obtain the second access path information and trigger the login button of the login page based on the second access path information so that the battery management system enters the management page.
[0103] The starting unit is used to obtain the third access path information and trigger the start / stop control button of the management page based on the third access path information so that the battery management system starts to enter the system control page.
[0104] The power-on unit is used to obtain fourth access path information and trigger a system power-on button on the system control page based on the fourth access path information to power on the battery management system.
[0105] In some optional implementations, the system testing module 802 includes:
[0106] The file acquisition unit is used to call the test tool through the component interaction tool and obtain the configuration file of the test tool.
[0107] The data simulation unit is used to set battery simulation data of preset battery parameters based on the configuration file. The preset battery parameters include any one of the following: voltage, current and temperature. The battery simulation data includes: voltage simulation data, current simulation data and temperature simulation data.
[0108] In some optional implementations, the result determination module 803 includes:
[0109] The image acquisition unit is used to take a screenshot of a preset area in the display page of the battery management system to obtain image information of the fault alarm triggering result.
[0110] The grayscale processing unit is used to perform grayscale processing on the image information and extract low-frequency information of the grayscale processed image information.
[0111] The hash value calculation unit is used to calculate the grayscale mean of the image information after grayscale processing based on the low-frequency information, and obtain the hash value according to the grayscale mean.
[0112] The hash value comparison unit is used to calculate the Hamming distance between the image information and the preset standard image based on the hash value and the standard hash value of the preset standard image.
[0113] The result determination unit is used to compare the Hamming distance with a preset distance threshold. If the Hamming distance is lower than the preset distance threshold, the fault alarm triggering result is determined to be correct, otherwise it is determined to be incorrect.
[0114] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0115] The automated testing device for the safety protection function of the battery management system in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0116] The embodiment of the present invention also provides a computer device having the above Figure 8 The automated testing device for the safety protection function of the battery management system shown.
[0117] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig. 9 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the computer device, including instructions stored in or on the memory to display graphical information of a GUI (Graphical User Interface) on an external input / output device (such as a display device coupled to an interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.
[0118] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0119] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0120] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0121] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0122] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0123] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0124] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0125] The embodiment of the present invention also provides an automated testing system for the safety protection function of a battery management system. Fig.10 As shown, including:
[0126] Test system for the above Figure 1 , Figure 2 or Figure 3 The automated testing method for the safety protection function of the battery management system shown;
[0127] A test tool, connected to the test system, for generating battery simulation data based on a call of the test system;
[0128] The battery management system is connected to the test system and is used to control the test system, make fault judgments based on battery simulation data, and display the fault alarm triggering results.
[0129] Specifically, in the embodiment of the present invention, the test system is a script developed using Python, the test tool is CANoe, and the battery management system includes: a data storage module, a data acquisition module, a data transmission module, and a fault display module. Fig.11 As shown, the data acquisition module corresponds to Fig.11 BMS-APP is the embedded layer of the top-level master control of the energy storage BMS system. It is mainly responsible for receiving battery data, making logical judgments, and uploading data to the BMS-WEB layer for display. At the same time, BMS-APP performs relevant data interaction and control on the Energy Management System (EMS) and the Power Conversion System (PCS). Fig.11BMS-Redis in the BNS system is the data transmission layer of the BNS system. It is mainly responsible for receiving real-time data uploaded from the BMS-APP, including battery temperature, battery voltage, etc. It also receives fault alarm information uploaded from the BMS-APP. Fig.11 The BMS-WEB in the Module is the WEB layer of the top-level control of the energy storage BMS system. It mainly queries battery data (battery temperature, battery voltage, etc.), fault alarms and other information from BMS-Redis, and renders and displays the data. At the same time, it also backs up historical data. Fig.11 The BMS-PG in the BMS is the data storage layer of the BMS system, which mainly stores historical data and basic configuration data. By constructing a battery management system, the present invention can monitor the operation of the battery, determine whether the battery is abnormal, and issue an alarm if an abnormality occurs, so that the technicians can take timely measures to prevent failures caused by battery abnormalities and ensure personal safety and property safety.
[0130] In some optional embodiments, such as Fig.12 In the embodiment of the present invention, the UI automation technology is mainly used to replace the manual operation of the WEB page; at the same time, CANoe is automatically controlled by calling win32com.client through Python to replace the manual sending of simulation messages; finally, the perception hash algorithm is used to compare the screenshots of the page alarm area to determine whether the fault alarm is triggered normally. In the BMS system, BMS-APP obtains the battery simulation data obtained by the test system, and performs fault judgment according to the configuration parameters stored in BMS-PG. The battery simulation data and fault judgment results are transmitted to BMS-WEB through BMS-Redis for display. Fig.12 As shown, the embodiment of the present invention can gradually increase the battery simulation data during the automated test process, thereby triggering a mild alarm, a moderate alarm, and a severe alarm at one time, thereby performing a comprehensive test on the BMS. The embodiment of the present invention explores a unique automated testing method for the fault alarm safety protection function of a large energy storage BMS by combining Web automation, CANoe simulation data technology, and machine vision technology within the full life cycle of the battery system. Compared with conventional manual testing, it can greatly save human testing resources. At the same time, manual testing is bound to have omissions, which can be well compensated by automated machine testing.
[0131] The automated testing system for the safety protection function of the battery management system provided by the present invention can control the test tools and the battery management system based on the test system to realize automated testing of the safety protection function of the battery management system without the need for testers to operate the system and judge the results, thereby improving the test efficiency, comprehensiveness and accuracy, ensuring that the battery management system has a reliable safety protection function and can monitor the safety of the battery.
[0132] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. An automated testing method for the safety protection function of a battery management system, characterized in that: The method comprises: Acquire access path information of a battery management system, and control the battery management system to start and power on according to the access path information; Acquire battery simulation data, and input the battery simulation data into the battery management system, so that the battery management system performs fault judgment based on the battery simulation data; Obtain image information of the fault alarm trigger result obtained by the battery management system, and determine whether the fault alarm trigger result is correct based on the perceptual hash algorithm and the image information.
2. The method according to claim 1, characterized in that: The obtaining access path information of the battery management system and controlling the battery management system to start and power on according to the access path information includes: Obtaining first access path information, a preset account and a preset password, and inputting the preset account and the preset password into a login page determined based on the first access path information; Acquire second access path information, and trigger a login button of the login page based on the second access path information, so that the battery management system enters a management page; Acquire third access path information, and trigger the start / stop control button of the management page based on the third access path information, so that the battery management system starts to enter the system control page; Acquire fourth access path information, and trigger a system power-on button of the system control page based on the fourth access path information to power on the battery management system.
3. The method according to claim 1, characterized in that The obtaining of battery simulation data comprises: Calling a test tool through a component interaction tool and obtaining a configuration file of the test tool; The battery simulation data of the preset battery parameters is set based on the configuration file, the preset battery parameters include any one of the following: voltage, current and temperature, and the battery simulation data includes: voltage simulation data, current simulation data and temperature simulation data.
4. The method according to claim 1, characterized in that: The obtaining of image information of the fault alarm triggering result obtained by the battery management system, and performing image comparison based on the image information to determine whether the fault alarm triggering result is correct, includes: Taking a screenshot of a preset area in a display page of the battery management system to obtain image information of the fault alarm triggering result; Performing grayscale processing on the image information, and extracting low-frequency information of the image information after the grayscale processing; Calculating a grayscale mean value of the image information after grayscale processing based on the low-frequency information, and obtaining a hash value according to the grayscale mean value; Based on the hash value and a standard hash value of a preset standard picture, calculating a Hamming distance between the picture information and the preset standard picture; The Hamming distance is compared with a preset distance threshold. If the Hamming distance is lower than the preset distance threshold, it is determined that the fault alarm triggering result is correct; otherwise, it is determined that it is incorrect.
5. An automated testing device for the safety protection function of a battery management system, characterized in that: The device comprises: A system control module, used to obtain access path information of a battery management system, and control the battery management system to start and power on according to the access path information; A system testing module, used for acquiring battery simulation data and inputting the battery simulation data into the battery management system, so that the battery management system performs fault judgment based on the battery simulation data; The result judgment module is used to obtain the image information of the fault alarm trigger result obtained by the battery management system, and perform image comparison based on the perceptual hash algorithm and the image information to determine whether the fault alarm trigger result is correct.
6. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the automated testing method for the safety protection function of the battery management system according to any one of claims 1 to 4 by executing the computer instructions.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the automated testing method for the safety protection function of a battery management system according to any one of claims 1 to 4.
8. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to enable a computer to execute the automated testing method for the safety protection function of a battery management system according to any one of claims 1 to 4.
9. An automated testing system for the safety protection function of a battery management system, characterized in that: The system comprises: A test system for executing an automated test method for a safety protection function of a battery management system according to any one of claims 1 to 4; A testing tool, connected to the testing system, for generating battery simulation data based on the call of the testing system; A battery management system is connected to the test system and is used to perform fault judgment based on the battery simulation data based on the control of the test system and to display the fault alarm triggering result.
10. The automated testing system according to claim 9, characterized in that: The battery management system comprises: A data storage module, used for storing configuration parameters; A data acquisition module, connected to the data storage module, for acquiring the battery simulation data and performing fault judgment based on the battery simulation data and the configuration parameters; A data transmission module, connected to the data acquisition module, for receiving the battery simulation data and fault judgment results uploaded by the data acquisition module; A fault display module is connected to the data transmission module and is used for visually displaying the battery simulation data and the fault judgment result transmitted by the data transmission module.