Battery management system software formal verification method, system, equipment and medium
The battery management system software is verified through formal verification methods, which solves the unreliability and high cost problems of simulation testing, achieves software reliability and safety, and improves testing efficiency.
Patent Information
- Application Number
- CN202410705302.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-03
- Publication Date
- 2024-08-23
AI Technical Summary
Existing software simulation tests for battery management systems are unreliable, inaccurate, unstable, unsafe, and consume a lot of time and labor costs.
Adopt a formal verification method based on software logical reasoning, by extracting input, output and calibration interface data, build the logical reasoning relationship of the test case, build a formal verifier, verify the software components to be tested, compare the similarity of the results, if the predetermined If the conditions are met, the verification is passed.
It achieves the reliability, accuracy and stability of the battery management system software, reduces the failure rate, ensures safety, improves testing efficiency and reduces costs.
Smart Images

Figure CN118535473A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software testing, and in particular to a battery management system software formal verification method, system, equipment and computer storage medium. Background Art
[0002] With the development of electric vehicles, the requirements for various functions and functional safety of power batteries are becoming increasingly higher, which increases the attention to the complexity and software security of battery management system (BMS).
[0003] Software testing is to operate the program under specified conditions to find program errors. That is, to test a program or system by means of "manual operation (manual testing)" or "automated testing" to verify whether it meets the specified requirements or to find out the difference between the expected results and the actual results. Current software testing can reduce the failure rate of software, but it cannot prove that the battery management system has no defects, nor can it prove that the battery management system meets the predetermined property test requirements. Simulation testing is an important software testing method that can help us find defects in software more effectively. Simulation testing is a test that simulates the real use environment of the software and configures the software to the real use state. At present, the unit component software of the battery management system is mainly tested by simulation testing, which is an experience-based simulation verification method. Simulation testing is to try to find defects through repeated trials. It is necessary to try all possible combinations, which is time-consuming and will never be complete because all combinations cannot be exhausted. Therefore, the test results of software simulation testing are not reliable, accurate, stable and safe. In addition, during simulation testing, software engineers must define and design a large number of input conditions. The focus of their work has changed from how to design target software engineering to how to decompose the design based on non-design goals. Software engineers manually test the battery management system software, which consumes a lot of manpower and time costs. Summary of the invention
[0004] The purpose of the present invention is to solve the problems that the existing software simulation test is unreliable, inaccurate, unstable, unsafe, and consumes a lot of time and manpower costs.
[0005] On the first aspect, the battery management system software formal verification method provided by the present invention has reliability, accuracy, and stability, reduces the failure rate of the software, ensures the security of the software, improves the test verification efficiency, and reduces the test verification cost.
[0006] To solve the above technical problems, an embodiment of the present invention discloses a battery management system software formal verification method, comprising: extracting input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected; determining test cases according to the input interface data, output interface data and calibration interface data, and constructing logical reasoning relationships of the test cases; constructing a formal verifier according to the logical reasoning relationships of the test cases; inputting test data into the software component to be detected to obtain a first result; inputting test data into the formal verifier to obtain a second result; comparing the similarity between the first result and the second result; if the similarity meets a preset condition, the software component to be detected passes the verification, otherwise, the software component to be detected fails the verification.
[0007] By adopting the above technical solution, the battery management system software formal verification method provided by the present invention constructs test cases based on software logical reasoning, constructs a formal verifier based on the logical reasoning relationship of the test cases, verifies the software components to be tested through the formal verifier, realizes the reliability, accuracy and stability of the software components to be tested, reduces the failure rate of the software, and ensures the security of the software. At the same time, formal verification does not need manual verification like simulation testing, which improves verification efficiency and reduces verification costs.
[0008] According to another specific implementation of the present invention, a verification conclusion that the software component to be detected has passed the verification is output, or a verification conclusion that the software component to be detected has not passed the verification is output.
[0009] According to another specific embodiment of the present invention, Lambda expressions are used to construct the logical reasoning relationship of the test cases of each input interface data, output interface data and calibration interface data.
[0010] According to another specific embodiment of the present invention, in creating and simulating a dynamic system, a formal verifier is constructed according to the logical reasoning relationship of the test cases.
[0011] According to another specific implementation of the present invention, the preset condition is that the first result is equal to the second result.
[0012] In a second aspect, an embodiment of the present invention discloses a battery management system software formal verification system, including: a data extraction module, used to extract the input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected; a test case logical reasoning relationship construction module, used to determine the test case according to the input interface data, output interface data and calibration interface data, and construct the logical reasoning relationship of the test case; a formal verifier construction module, used to construct a formal verifier according to the logical reasoning relationship of the test case; a verification object module, used to input test data to the software component to be detected to obtain a first result; a formal verification module, used to input test data to the formal verifier to obtain a second result; a comparison and judgment module, used to compare the similarity between the first result and the second result; if the similarity meets the preset conditions, the software component to be detected passes the verification, otherwise, the software component to be detected fails the verification.
[0013] By adopting the above technical solution, in the battery management system software formal verification system, the data extraction module, the test case logic reasoning relationship construction module, the formal verifier construction module, the verification object module, the formal verification module and the comparison judgment module cooperate with each other and work together to build test cases based on the software logic reasoning method, build a formal verifier based on the logical reasoning relationship of the test case, and verify the software components to be tested through the formal verifier to achieve the reliability, accuracy and stability of the software, reduce the failure rate of the software, and ensure the safety of the software. At the same time, formal verification does not need manual verification like simulation testing, which improves the verification efficiency and reduces the verification cost.
[0014] The embodiment of the present invention also discloses a battery management system software formal verification system, including: a data extraction module, used to extract the input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected; a test case logical reasoning relationship construction module, used to determine the test case according to the input interface data, output interface data and calibration interface data, and construct the logical reasoning relationship of the test case; a formal verifier construction module, used to construct a formal verifier according to the logical reasoning relationship of the test case; a verification object module, used to input test data to the software component to be detected to obtain a first result; a formal verification module, used to input test data to the formal verifier to obtain a second result; the formal verification module is also used to receive the first result and compare the similarity between the first result and the second result; if the similarity meets the preset conditions, the software component to be detected passes the verification, otherwise, the software component to be detected fails the verification; a monitoring module, used to output whether the software component to be detected passes the verification or the software component to be detected fails the verification.
[0015] By adopting the above technical solution, in the battery management system software formal verification system, the data extraction module, the test case logic reasoning relationship construction module, the formal verifier construction module, the verification object module, the formal verification module and the monitoring module cooperate with each other and work together to build test cases based on software logic reasoning, build formal verifiers based on the logical reasoning relationship of test cases, and verify the software components to be tested through formal verifiers to achieve software reliability, accuracy and stability, reduce software failure rate and ensure software security. At the same time, formal verification does not need manual verification like simulation testing, which improves verification efficiency and reduces verification costs.
[0016] In a third aspect, an embodiment of the present invention discloses an electronic 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 battery management system software formal verification method in any embodiment of the first aspect is implemented.
[0017] By adopting the above technical solution, electronic equipment builds test cases based on software logical reasoning, builds formal verifiers based on the logical reasoning relationship of test cases, verifies the software components to be tested through formal verifiers, realizes software reliability, accuracy, and stability, reduces software failure rate, and ensures software security. At the same time, formal verification does not require manual verification like simulation testing, which improves verification efficiency and reduces verification costs.
[0018] In a fourth aspect, an embodiment of the present invention discloses a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the battery management system software formal verification method in any embodiment of the first aspect is implemented.
[0019] By adopting the above technical solution, the computer-readable storage medium constructs test cases based on software logical reasoning, constructs a formal verifier based on the logical reasoning relationship of the test cases, verifies the software components to be tested through the formal verifier, realizes the reliability, accuracy and stability of the software, reduces the failure rate of the software, and ensures the security of the software. At the same time, formal verification does not require manual verification like simulation testing, which improves verification efficiency and reduces verification costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flowchart of a battery management system software formal verification method according to an embodiment of the present invention is shown;
[0021] Figure 2 The structure of the battery management system software formal verification system in the embodiment of the present invention is shown as follows Figure 1 ;
[0022] Figure 3 The structure of the battery management system software formal verification system in the embodiment of the present invention is shown as follows Figure 1 The process flow of the formal verification method of battery management system software Figure 1 ;
[0023] Figure 4 The structure of the battery management system software formal verification system in the embodiment of the present invention is shown as follows Figure 2 ;
[0024] Figure 5 The structure of the battery management system software formal verification system in the embodiment of the present invention is shown as follows Figure 2 The process flow of the formal verification method of battery management system software Figure 2 ;
[0025] Figure 6 A schematic diagram showing the structure of an electronic device of a battery management system software formal verification method in an embodiment of the present invention. DETAILED DESCRIPTION
[0026] The following specific embodiments illustrate the implementation of the present invention, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Although the description of the present invention will be introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this implementation. On the contrary, the purpose of introducing the invention in conjunction with the implementation is to cover other options or modifications that may extend based on the claims of the present invention. In order to provide a deep understanding of the present invention, many specific details will be included in the following description. The present invention can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present invention, some specific details will be omitted in the description. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.
[0027] It should be noted that in this specification, similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings.
[0028] The terms “first”, “second”, etc. are only used for distinguishing descriptions and should not be understood as indicating or implying relative importance.
[0029] In the description of this embodiment, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in this embodiment can be understood according to specific circumstances.
[0030] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0031] Formal verification is a technique that ensures that the design of a system or component meets certain formal specifications. In hardware and software engineering, formal verification is particularly important because it can help find and correct errors in the design that may cause serious problems after actual deployment.
[0032] A formal verifier is a tool or software that uses mathematical techniques to check whether a system model satisfies a set of predefined properties or specifications. These properties can be safety, liveness, correctness, real-time performance, etc. The formal verifier determines whether these properties are met by analyzing the structure and behavior of the system model.
[0033] During formal verification, the verifier creates a mathematical model of the system and compares it to the specification. This process can be either static or dynamic. Static analysis: Checking the system model without running the system. This usually involves analyzing the structure of the system model, such as using model checking techniques. Dynamic analysis: Performed by simulating or testing the behavior of the system model. This can involve running various scenarios of the system model and observing whether its behavior matches the specification.
[0034] Formal verification can provide stricter assurance than traditional testing methods because it is based on mathematical proofs rather than on test cases that may not cover all possible situations.
[0035] In a first aspect, the present invention provides a battery management system software formal verification method, which has reliability, accuracy, and stability, reduces the failure rate of the software, ensures the security of the software, improves the test verification efficiency, and reduces the test verification cost.
[0036] refer to Figure 1 The present invention provides a battery management system software formal verification method, comprising:
[0037] S1: Extracting input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected.
[0038] Software design is divided into outline design and detailed design. Outline design is the process of analyzing design alternatives and defining software architecture, components, interfaces, and time and size estimates for a system or component. Outline design is used to implement the overall design, module division, user interface design, database design, etc. of the software. The purpose of outline design is to clarify the overall implementation plan. Detailed design is the process of refining and expanding the outline design of a system or component to achieve a fully complete and implementable design. Based on the module division made in the outline design, the detailed design implements the algorithm design of each module, realizes the refinement of the user interface design and data structure design, etc. The purpose of detailed design is to clarify how each module is done.
[0039] The detailed design document includes the introduction, overall design, and module description. The introduction includes the purpose of writing, project background, definition, and reference materials; the overall design includes requirements overview, software structure, etc.; the module description includes basic module information, function overview, algorithm, module processing logic, interface, performance, test plan, etc. Therefore, the detailed design document contains the content of input interface, output interface, and calibration interface, and the aforementioned interface data can be extracted through the detailed design document.
[0040] Input interface and output interface refer to the interfaces between peripherals and CPU that must go through functions such as buffering, latching data, address decoding, information format conversion, transferring peripheral status, issuing commands, etc. Calibration interface refers to the interface that changes the program structure by modifying the data of internal variables of the software during the running of the software program through the reserved data in the software.
[0041] Input interface data refers to the value of the input interface of the software component in the program code; output interface data refers to the value of the output interface of the software component in the program code; calibration interface data refers to the value of the calibration interface data of the software component in the program code.
[0042] In this embodiment, step S1 is to extract the input interface In = [In1, In2, In3...], the output interface Out = [Out1, Out2, Out3...] and the calibration interface Cal = [Cal1, Cal2, Cal3...] of the software component to be tested according to the detailed design document of the software component to be tested, thereby formalizing the logical relationship of the test units of the software component to be tested.
[0043] refer to Figure 1, execute step S2: determine the test case according to the input interface data, the output interface data and the calibration interface data, and construct the logical reasoning relationship of the test case.
[0044] A test case is a set of test inputs, execution conditions, and expected results compiled for a specific purpose in order to test a program path or verify whether a specific requirement is met.
[0045] Step S2 is to logically reason and decompose the test cases of the software components to be tested according to the system requirements, software requirements, detailed design documents and other information, and construct the logical reasoning relationship between the input interface In, output interface Out and calibration interface Cal of the test cases.
[0046] In this embodiment, each test case includes an input interface array, a calibration interface array, an output interface array, and a logical reasoning relationship among the input interface array, the calibration interface array, and the output interface array.
[0047] In some other possible embodiments, each test case includes not only the above four items but also a serial number, a description (such as formal requirement 1, formal requirement 2, formal requirement 3, ...), and other contents.
[0048] S3: Construct a formal verifier based on the logical reasoning relationship of the test cases.
[0049] After constructing the logical reasoning relationship of the test case in step S2, the test case is used for training and learning to construct a formal verifier. The formal verifier conforms to the mathematical logic relationship of the aforementioned test case, and the software components to be tested are verified by the formal verifier, which improves the reliability of the battery management system software, reduces the failure rate of the software, and ensures the safety of the software.
[0050] S4: Input test data to the software component to be tested to obtain a first result.
[0051] S5: Input test data into the formal verifier to obtain a second result.
[0052] The same test data is input into the software component to be tested and the formal verifier respectively to obtain a first result and a second result. The first result obtained by the software component to be tested is the actual running result of the software component to be tested. The second result obtained by the formal verifier is an ideal result or a standard result that conforms to the logical reasoning relationship of the aforementioned test case.
[0053] In some possible embodiments, the first result and the second result are numerical values. In some other possible embodiments, the first result and the second result are numerical value changes. In the embodiments provided by the present invention, the order of step S4 and step S5 is not limited, and step S4 may be performed first and then S5, or step S5 may be performed first and then S4, or step S4 and S5 may be performed simultaneously.
[0054] S6: Compare the similarity between the first result and the second result.
[0055] S7: Determine whether the similarity meets the preset conditions:
[0056] S8: If the similarity meets the preset conditions, the software component to be tested passes the verification;
[0057] S9: If the similarity does not meet the preset condition, the software component to be detected fails the verification.
[0058] Steps S6 to S9 are specific steps for comparing and determining whether the software component to be tested has passed the verification, wherein the second result, that is, the result obtained by the formal verifier, is used as the standard result and compared with the first result.
[0059] In some possible embodiments provided by the present invention, the preset condition is that the first result and the second result have high similarity. Exemplarily, high similarity, that is, the ratio of the first result to the second result ranges from 0.7 to 1.3. For another example, high similarity, that is, the ratio of the first result to the second result can be expressed in the form of a percentage, that is, 70% to 130%. That is to say, high similarity can be expressed in a variety of ways, such as in the form of ratios, percentages, etc. In some other possible embodiments, high similarity can be adjusted according to specific requirements, and the present invention does not specifically limit this. That is, when the preset condition is met, it means that the similarity between the first result and the second result is high similarity, which means that the software component to be detected meets the logical reasoning relationship of the test case, and the software component to be detected passes the verification. The software component to be detected has reliability, low failure rate of the software, and high security of the software. On the contrary, when the preset condition is not met, it means that the similarity between the first result and the second result is not high similarity, which means that the software component to be detected does not meet the logical reasoning relationship of the test case, and the software component to be detected fails to pass the verification. The software component to be tested has no reliability, a high failure rate and low software security.
[0060] In some other possible embodiments provided by the present invention, the preset condition is that the first result is equal to the second result. That is, only when the first result is the same as the second result, and the software component to be detected fully conforms to the logical reasoning relationship of the test case, the software component to be detected passes the verification. The software component to be detected has reliability, low software failure rate, and high software security. On the contrary, as long as the first result is different from the second result, it is considered that the software component to be detected does not conform to the logical reasoning relationship of the test case, that is, it has not passed the verification. The software component to be detected does not have reliability, high software failure rate, and low software security.
[0061] By adopting the above technical solution, the battery management system software formal verification method provided by the present invention generates test cases by means of software logical reasoning, and constructs a formal verifier based on these test cases to realize the formal verification of the software components to be tested, thereby realizing the reliability, accuracy and stability of the software components to be tested, reducing the failure rate of the software, and ensuring the security of the software. At the same time, formal verification does not require manual verification like simulation testing, which improves verification efficiency and reduces verification costs.
[0062] The battery management system software formal verification method provided by the present invention solves the problem that manual testing cannot meet the requirements of software failure rate as the safety requirements of power battery management system software increase. System engineers, software development engineers and test engineers jointly designed a formal verification method to achieve the reliability of the functions of the design and verification software components and improve the coverage of software testing.
[0063] Compared with traditional software simulation testing, the role and advantages of formal verification methods in achieving the safety of battery management system software are more obvious. Unlike software simulation testing, formal verification is based on mathematical logic. Through inductive structure and deductive reasoning, it can completely cover all possible situations of battery management system software execution, achieve true full coverage, and thus verify that the functions of the battery management system software are completely correct.
[0064] In some possible embodiments provided by the present invention, the battery management system software formal verification method further includes: outputting a verification conclusion that the software component to be tested has passed the verification or outputting a verification conclusion that the software component to be tested has not passed the verification. The verification result is fed back to the user so that the user can subsequently debug the software component to be tested.
[0065] In some possible embodiments provided by the present invention, Figure 1 Step S2 shown: determining a test case according to the input interface data, the output interface data and the calibration interface data, and constructing a logical reasoning relationship of the test case, including:
[0066] S21: Use Lambda expressions to construct the logical reasoning relationship of each test case for input interface data, output interface data, and calibration interface data.
[0067] A lambda expression is a small, anonymous, inline function that can have any number of parameters but only one expression. It is often used to write simple, one-line functions, for example, when a function needs to be passed as a parameter, such as in map(), filter(), reduce() and other functions in Python. The combination of lambda expressions and functional interfaces allows code to be written in a more concise and intuitive way, improving the readability and maintainability of the code; developers can also avoid wasting time and energy on irrelevant logic, improving their work efficiency and helping to improve the overall software development efficiency.
[0068] In some possible embodiments, step S21: using Lambda expressions to construct a logical reasoning relationship of a test case of input interface data, output interface data, and calibration interface data includes:
[0069] Step S211: List each test case in a visual manner, which facilitates the aggregation and detection of test cases.
[0070] As described above, in this embodiment, each test case includes an input interface array, a calibration interface array, an output interface array, and a logical reasoning relationship between the input interface array, the calibration interface array, and the output interface array.
[0071] In some other possible embodiments, each test case includes not only the above four items but also a serial number, a description (such as formal requirement 1, formal requirement 2, formal requirement 3, ...), and other contents.
[0072] Exemplarily, the visualization method includes tabulating the test cases in an EXCEL table format, as shown in Table 1.
[0073] Table 1:
[0074]
[0075] In some other possible embodiments, the test cases may be represented in the form of WORD documents, or in other software forms, to facilitate the aggregation and detection of the test cases.
[0076] For the detection of components to be detected in the battery management system, by visually listing each test case, the test can be quickly implemented by calling the standardized test case file and the fixed operation logic, and the batch verification and processing of the test data can be realized. There is no need to input a single test data at a time, which greatly saves time and labor costs, and significantly improves the reliability and accuracy of the test results. It also avoids the possibility of errors in the test results caused by manual input errors each time, while reducing the complexity of the operation. And the test case file can be repeatedly applied to the test, which saves manpower and significantly shortens the test time. Compared with manual input and operation, the method of this application is compatible with diversified data input and rich operation selectivity.
[0077] Step S212: Each test case is represented by code, so as to facilitate the subsequent calling of the test case to construct a formal verifier.
[0078] Exemplarily, according to the Lambda expression relationship of each test case in the EXCEL table of the aforementioned test case, the Lambda function in python is used to represent the logical relationship between the input interface In, the output interface Out and the calibration interface Cal, so as to realize the coding of the test case.
[0079] In some possible embodiments provided by the present invention, step S3: constructing a formal verifier according to the logical reasoning relationship of the test case includes:
[0080] S31: In creating and simulating dynamic systems, construct a formal verifier based on the logical reasoning relationships of test cases.
[0081] For example, the test case function implemented in Python is called by Matlab's m script language function system(command), and imported into the Simulink engineering environment to generate a formal verifier. The system function is used to execute external commands or system commands from Matlab; command is a string representing the external command to be executed.
[0082] In Matlab, if you want to integrate Python code into a Simulink model and generate a formal verifier, you usually use a more direct approach, such as using Matlab's Python interface or using Simulink's Simscape and other tools for model verification.
[0083] Specifically, an embodiment is used below to illustrate how to use the system function in Matlab to call a Python script, and this Python script is a test case function.
[0084] First, create a Python script test_case.py that contains a simple test function:
[0085] 1#test_case.py
[0086] 2def test_function():
[0087] 3print("Python test function executed!")
[0088] Then, in Matlab, use the system function to call this Python script:
[0089] 1% Matlab script
[0090] 2 command = 'python test_case.py'; % Assuming Python has been added to the environment variable
[0091] 3system(command);
[0092] In this embodiment, the command string represents a test case function written in Python. The above Matlab code will execute the test_case.py script and output "Python test function executed!".
[0093] Among them, Matlab is a commercial mathematical software used in data analysis, wireless communication, deep learning, image processing and computer vision, signal processing, quantitative finance and risk management, robotics, control systems and other fields. Simulink is a visual simulation tool in Matlab, a block diagram design environment based on Matlab, and a software package for dynamic system modeling, simulation and analysis. It is widely used in the modeling and simulation of linear systems, nonlinear systems, digital control and digital signal processing. Simulink provides an integrated environment for dynamic system modeling, simulation and comprehensive analysis. In this environment, complex systems can be constructed through simple and intuitive mouse operations without writing a lot of programs. Simulink has the advantages of wide adaptability, clear structure and process, fine simulation, close to reality, high efficiency and flexibility. Based on the above advantages, Simulink has been widely used in complex simulation and design of control theory and digital signal processing. At the same time, there are a large number of third-party software and hardware that can be applied to or are required to be applied to Simulink.
[0094] Second, reference Figure 2 and Figure 4, the present invention provides a battery management system software formal verification system.
[0095] In some possible embodiments provided by the present invention, reference is made to Figure 2 The battery management system software formal verification system 01 includes a data extraction module 1, a test case logic reasoning relationship construction module 2, a formal verifier construction module 3, an input module 31, a formal verifier 5 and a comparison judgment module 61.
[0096] The data extraction module 1 is used to extract the input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected.
[0097] The test case logic reasoning relationship construction module 2 is used to determine the test case according to the input interface data, the output interface data and the calibration interface data, and to construct the test case logic reasoning relationship.
[0098] The formal verifier construction module 3 is used to construct a formal verifier according to the logical reasoning relationship of the test case.
[0099] The input module 31 is used to input test data to the software component to be tested 4 to obtain a first result; and is used to input test data to the formal verifier 5 to obtain a second result.
[0100] The comparison and judgment module 61 is used to compare the similarity between the first result and the second result; if the similarity meets the preset condition, the software component to be detected passes the verification, otherwise, the software component to be detected fails the verification.
[0101] By adopting the above technical solution, in the battery management system software formal verification system 01, the data extraction module 1, the test case logic reasoning relationship construction module 2, the formal verifier construction module 3, the input module 31, the formal verifier 5 and the comparison and judgment module 61 cooperate with each other and work together to build test cases based on the software logic reasoning method, build a formal verifier based on the logical reasoning relationship of the test case, and verify the software components to be tested through the formal verifier to achieve the reliability, accuracy and stability of the software, reduce the failure rate of the software, and ensure the safety of the software. At the same time, formal verification does not need manual verification like simulation testing, which improves the verification efficiency and reduces the verification cost.
[0102] In the battery management system software formal verification system 01 , the input module 31 is connected to the software component to be tested 4 for inputting test data into the software component to be tested 4 ; the input module 31 is also connected to the formal verifier 5 for inputting test data into the formal verifier 5 .
[0103] In this embodiment, the software component to be detected 4 is connected to the comparison and judgment module 61, and is used to output the first result to the comparison and judgment module 61; the formal verifier 5 is connected to the comparison and judgment module 61, and is used to output the second result to the comparison and judgment module 61. The comparison and judgment module 61 receives the first result and the second result, and compares the similarity between the first result and the second result. If the similarity meets the preset condition, the software component to be detected passes the verification, otherwise, the software component to be detected fails the verification.
[0104] refer to Figure 3 Combined with Figure 2 and Figure 1 In one embodiment of the present invention, the input module 31 executes Figure 1 Step S4 shown in FIG. 1 is: inputting the logic signal A as the test data U1 into the software component to be tested 4 (i.e. Figure 3 The verification object shown in the figure) obtains the first result Y11.
[0105] Exemplarily, the logic signal A is a volume adjustment signal, which is input as the test data U1 into the software component to be detected 4, and the first result Y11 is obtained after being processed by the software component to be detected 4. For example, the first result Y11 is 10, which means that the volume is increased by 15%.
[0106] Input module 31 executes Figure 1 Step S5 shown in FIG. 1: Inputting the logic signal A as the test data U1 into the formal verifier 5 (eg Figure 3 As shown), a second result Y12 is obtained.
[0107] Exemplarily, the volume adjustment signal is input into the formal verifier 5 as the test data U1 , and the second result Y12 is obtained after being processed by the formal verifier 5 . For example, the second result Y12 is 9, which indicates that the volume is increased by 10%.
[0108] like Figure 2 The comparison and judgment module 61 shown executes steps S6 to S9, S6: compares the similarity between the first result Y11 and the second result Y12; S7: determines whether the similarity meets the preset conditions; S8: if yes, the software component 4 to be detected passes the verification; S9: if no, the software component 4 to be detected fails the verification.
[0109] Exemplarily, step S6 is performed: comparing the similarity between the first result Y11 and the second result Y12, for example, using a ratio of 9:10; or for another example, using a percentage of 90%.
[0110] Exemplarily, the preset condition in step S7 is high similarity, that is, the first result Y11 and the second result Y12 have high similarity, and the ratio result of the similarity degree is 0.75-1.25. Since the first result Y11 is 10 and the second result Y12 is 9, the ratio of the first result Y11 to the second result Y12 is 10:9, and the ratio result is 0.9. This ratio result is within the range of the ratio result of the similarity degree of 0.75-1.25, therefore, step S8 is executed: the software component 4 to be detected passes the verification. In this embodiment, the similarity degree between the first result Y11 and the second result Y12 is expressed as 90% using a percentage; the percentage range of the similarity degree of the preset condition is 75%-125%, and step S8 is also executed: the software component 4 to be detected passes the verification.
[0111] For example, in some other embodiments, the preset condition is that the first result Y11 is equal to the second result Y12. Since the first result Y11 is 10 and the second result Y12 is 9, the first result Y11 is not equal to the second result Y12. Therefore, step S9 is executed: the software component 4 to be detected fails the verification.
[0112] In another embodiment provided by the present invention, the difference from the previous embodiment is that the input module 31 inputs the logic signal B as the test data U2 to the software component to be tested 4 (ie Figure 3 Verification object shown) and formal verifier 5 (such as Figure 3 As shown), a first result Y21 and a second result Y22 are obtained.
[0113] In some possible embodiments provided by the present invention, the comparison and judgment module 61 can output a verification conclusion that the software component to be detected has passed the verification or output a verification conclusion that the software component to be detected has not passed the verification. The verification result is fed back to the user so that the user can perform subsequent debugging on the software component to be detected.
[0114] In some other possible embodiments provided by the present invention, the battery management system software formal verification system 01 further includes an output module, which is used to output a verification conclusion that the software component to be detected has passed the verification or output a verification conclusion that the software component to be detected has not passed the verification. The verification result is output and fed back to the user so that the user can perform subsequent debugging on the software component to be detected.
[0115] In this embodiment, in the battery management system software formal verification system 01, the set formal verifier 5 only performs data analysis processing on the input test data to obtain the second result. The set comparison and judgment module 61 compares, judges, and analyzes the similarity between the first result and the second result to obtain a conclusion on whether the software component to be tested has passed the verification.
[0116] The adoption of the above technical solution improves the efficiency of the test, reduces human errors during the test, and thus improves the accuracy of the test.
[0117] In some other possible embodiments provided by the present invention, refer to Figure 4 The battery management system software formal verification 02 system includes a data extraction module 1, a test case logic reasoning relationship construction module 2, a formal verifier construction module 3, an input module 31, a formal verifier 5 and a monitoring module 62.
[0118] The data extraction module 1 is used to extract the input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected;
[0119] The test case logic reasoning relationship construction module 2 is used to determine the test case according to the input interface data, the output interface data and the calibration interface data, and to construct the test case logic reasoning relationship;
[0120] Formal verifier construction module 3, used to construct a formal verifier according to the logical reasoning relationship of the test case;
[0121] An input module 31, used to input test data into the software component to be tested to obtain a first result, and used to input test data into a formal verifier to obtain a second result;
[0122] The formal verifier 5 is used to compare the similarity between the first result and the second result; if the similarity meets the preset condition, the software component to be detected passes the verification, otherwise, the software component to be detected fails the verification.
[0123] By adopting the above technical solution, in the battery management system software formal verification system 02, the data extraction module 1, the test case logic reasoning relationship construction module 2, the formal verifier construction module 3, the input module 31, the formal verifier 5 and the monitoring module 62 cooperate with each other, work together to build test cases based on software logic reasoning, build formal verifiers based on the logical reasoning relationship of test cases, and verify the software components to be tested through the formal verifier to achieve software reliability, accuracy, and stability, reduce software failure rate, and ensure software security. At the same time, formal verification does not need manual verification like simulation testing, which improves verification efficiency and reduces verification costs.
[0124] In some other possible embodiments provided by the present invention, the battery management system software formal verification system 02 further includes a monitoring module 62, which is used to output whether the software component 4 to be tested has passed the verification or whether the software component 4 to be tested has failed the verification. The verification result is output and fed back to the user so that the user can perform subsequent debugging on the software component to be tested.
[0125] In the battery management system software formal verification system 02 , the input module 31 is connected to the software component to be tested 4 for inputting test data into the software component to be tested 4 ; the input module 31 is also connected to the formal verifier 5 for inputting test data into the formal verifier 5 .
[0126] In this embodiment, the software component to be detected 4 is connected to the formal verifier 5, and is used to output a first result to the formal verifier 5; the formal verifier 5 receives the first result, and obtains a second result based on the test data input by the input module 31, and compares the similarity between the first result and the second result; if the similarity meets the preset conditions, the software component to be detected passes the verification, otherwise, the software component to be detected fails the verification.
[0127] refer to Figure 5 Combined with Figure 4 and Figure 1 In one embodiment of the present invention, the input module 31 executes Figure 1 Step S4 shown in FIG. 1 is: inputting the logic signal A as the test data U1 into the software component to be tested (ie Figure 5 The verification object shown in the figure) obtains the first result Y11.
[0128] Input module 31 executes Figure 1 Step S5 shown in FIG. 1: Inputting the logic signal A as the test data U1 into the formal verifier (eg Figure 5 As shown), a second result is obtained.
[0129] like Figure 4 The formal verifier 5 shown executes steps S6 to S9, S6: compares the similarity between the first result Y11 and the second result; S7: determines whether the similarity meets the preset conditions; S8: if yes, the software component to be tested passes the verification; S9: if no, the software component to be tested fails the verification.
[0130] like Figure 4 The monitoring module 62 shown is used to output the verification result (such as Figure 5 The verification result includes: the software component to be tested passes the verification or the software component to be tested fails the verification.
[0131] In another embodiment provided by the present invention, the difference from the previous embodiment is that the logic signal B is input as the test data U2 to the software component to be tested 4 (ie Figure 5 Verification object shown) and formal verifier 5 (such as Figure 5 As shown), the first result Y21 and the second result are obtained.
[0132] In this embodiment, in the battery management system software formal verification system 02, the formal verifier 5 is configured to receive the software component to be tested 4 (i.e. Figure 5 The first result output by the software component 4 to be tested is obtained by performing data analysis on the input test data to obtain a second result, comparing, judging, and analyzing the similarity between the first result and the second result, and obtaining a conclusion on whether the software component 4 to be tested has passed the verification. Furthermore, a monitoring module 62 is provided to output the verification result. That is, in this embodiment, the formal verifier 5 in the battery management system software formal verification system 02 integrates the functions of data reception, data processing, data comparison and judgment, and data analysis, thereby improving the efficiency and accuracy of data analysis and processing.
[0133] Thirdly, reference Figure 6 The present invention provides an electronic device 2, including a memory 201, a processor 202, and a computer program stored in the memory 201 and executable on the processor 202, wherein the processor 202 implements the battery management system software formal verification method in any of the aforementioned embodiments when executing the computer program. The memory 201 may include, for example, a system memory, a fixed non-volatile storage medium, etc. The system memory may store, for example, an operating system, an application program, a boot loader, and other programs.
[0134] In this embodiment, the electronic device constructs test cases based on software logic reasoning, constructs a formal verifier based on the logical reasoning relationship of the test cases, verifies the software components to be tested through the formal verifier, realizes the reliability, accuracy and stability of the software, reduces the failure rate of the software, and ensures the security of the software. At the same time, formal verification does not require manual verification like simulation testing, which improves verification efficiency and reduces verification costs.
[0135] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the battery management system software formal verification method in any of the aforementioned embodiments is implemented.
[0136] By adopting the above technical solution, the computer-readable storage medium constructs test cases based on software logical reasoning, constructs a formal verifier based on the logical reasoning relationship of the test cases, verifies the software components to be tested through the formal verifier, realizes the reliability, accuracy and stability of the software, reduces the failure rate of the software, and ensures the security of the software. At the same time, formal verification does not require manual verification like simulation testing, which improves verification efficiency and reduces verification costs.
[0137] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable non-transient storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0138] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0139] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0140] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0141] Although the present invention has been illustrated and described with reference to certain preferred embodiments of the present invention, it should be understood by those skilled in the art that the above is a further detailed description of the present invention in conjunction with specific embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. Those skilled in the art may make various changes in form and details, including making several simple deductions or substitutions, without departing from the spirit and scope of the present invention.
Claims
1. A battery management system software formal verification method, characterized in that: include: Extracting input interface data, output interface data, and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected; Determine a test case according to the input interface data, the output interface data and the calibration interface data, and construct a logical reasoning relationship of the test case; Constructing a formal verifier according to the logical reasoning relationship of the test case; Inputting test data into the software component to be tested to obtain a first result; Inputting the test data into the formal verifier to obtain a second result; comparing the similarity between the first result and the second result; If the similarity level meets a preset condition, the software component to be detected passes the verification; otherwise, the software component to be detected fails the verification.
2. The battery management system software formal verification method according to claim 1, characterized in that: A verification conclusion that the software component to be detected has passed the verification is output, or a verification conclusion that the software component to be detected has not passed the verification is output.
3. The battery management system software formal verification method according to claim 1, characterized in that: Lambda expressions are used to construct logical reasoning relationships among test cases of each of the input interface data, the output interface data, and the calibration interface data.
4. The battery management system software formal verification method according to claim 1, characterized in that: In creating and simulating a dynamic system, a formal verifier is constructed according to the logical reasoning relationship of the test cases.
5. The battery management system software formal verification method according to claim 1, characterized in that: The preset condition is that the first result is equal to the second result.
6. A battery management system software formal verification system, characterized in that: include: A data extraction module, used to extract input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected; A test case logic reasoning relationship construction module, used to determine the test case according to the input interface data, the output interface data and the calibration interface data, and to construct the test case logic reasoning relationship; A formal verifier construction module, used to construct a formal verifier according to the logical reasoning relationship of the test case; An input module, used for inputting test data into the software component to be detected to obtain a first result; Used to input the test data into the formal verifier to obtain a second result; A comparison and judgment module, used for comparing the similarity between the first result and the second result; If the similarity level meets a preset condition, the software component to be detected passes the verification; otherwise, the software component to be detected fails the verification.
7. A battery management system software formal verification system, characterized in that: include: A data extraction module, used to extract input interface data, output interface data and calibration interface data of the software component to be detected according to the detailed design document of the software component to be detected; A test case logic reasoning relationship construction module, used to determine the test case according to the input interface data, the output interface data and the calibration interface data, and to construct the test case logic reasoning relationship; A formal verifier construction module, used to construct a formal verifier according to the logical reasoning relationship of the test case; An input module, used to input test data into the software component to be detected to obtain a first result, and the input module is used to input test data into the formal verifier to obtain a second result; The formal verifier is used to compare the similarity between the first result and the second result; If the similarity level meets a preset condition, the software component to be detected passes the verification; otherwise, the software component to be detected fails the verification.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the battery management system software formal verification method according to any one of claims 1 to 5 is implemented.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the battery management system software formal verification method as described in any one of claims 1 to 5 is implemented.
