Computer and test pattern creation method
By automatically linking internal source code values with physical signals through a link database, the method addresses the inefficiencies in creating test patterns for ECUs, enhancing testing efficiency and quality.
Patent Information
- Application Number
- JP2024526191
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2022-06-10
- Publication Date
- 2025-09-10
- Estimated Expiration
- 2042-06-10
AI Technical Summary
Existing technologies struggle to efficiently create test patterns for electronic control units (ECUs) in automobiles, as manual creation of test cases leads to variations in quality and imperfect test results, and existing automatic methods fail to link internal source code values with physical signals effectively.
A method for automatically creating test patterns by linking internal values in source code with physical values using a link database, converting internal variables into thresholds and variables with physical meanings, and generating test patterns that can be executed on Hardware-In-the-Loop Simulation (HILS).
This approach enables the creation of HILS test patterns that require signals with physical meaning, thereby improving testing efficiency and ensuring consistent, high-quality test results for ECUs.
Smart Images

Figure 0007737556000001 
Figure 0007737556000002 
Figure 0007737556000003
Abstract
Description
[Technical Field]
[0001] The present invention relates to a method for generating test patterns for testing source code. [Background technology]
[0002] The use of electronics in control technologies related to the operation and movement of automobiles is increasing year by year. A single automobile is equipped with dozens of electronic control units called ECUs (Electronic Control Units), and the total size of the software (hereafter referred to as source code) implemented in these ECUs ranges from 1 million to 10 million lines.
[0003] While the scale of source code development is increasing, there is also a demand for shorter development times. Therefore, maintaining and improving the quality of source code in short development periods has become a major challenge for automakers and suppliers.
[0004] The following prior art exists as background art in this technical field: Patent Document 1 (JP 2014-63415 A) and Patent Document 2 (JP 2009-14406 A). Patent Document 1 (JP 2014-63415 A) describes an automatic test case generation device that generates software test specifications, the automatic test case generation device comprising: a branch record statement insertion means that inserts a record statement into the branch point of program code to record whether the branch point has been reached; a multi-step linking means that links one step of program code for multiple steps; and an analysis means that analyzes whether the branch point will be reached when the multi-step linked program code is executed.
[0005] Furthermore, Patent Document 2 (JP 2009-14406 A) describes an automatic testing device for an electronic control unit that takes in sensor signals and outputs actuator drive signals, comprising: a branch condition acquisition means that acquires the branch conditions of a control branch point to be tested from among the processes executed by the electronic control unit; an operation pattern generation means that outputs an operation pattern for executing the branch conditions in the electronic control unit; a simulator that generates, as a pseudo sensor signal, a signal equivalent to the sensor signal generated in response to the actuator drive signal when an actual machine that is the original control target of the electronic control unit operates in accordance with the operation pattern; a signal exchange means that supplies the pseudo sensor signal to the electronic control unit and receives the actuator drive signal issued from the electronic control unit; and an inspection means that uses computer hardware resources to inspect whether the processing results in the electronic control unit and / or the processing results in the simulator are normal. [Prior art documents] [Patent documents]
[0006] [Patent Document 1] Japanese Patent Application Laid-Open No. 2014-63415 [Patent Document 2] Japanese Patent Application Laid-Open No. 2009-14406 Summary of the Invention [Problem to be solved by the invention]
[0007] The automatic test case generation device described in JP 2014-63415 A automatically tests the ECU to be tested using HILS (Hardware In the Loop Simulation), so that pseudo sensor signals and actuator drive signals are sent and received between the ECU and the HILS, and the ECU operates in the same way as if it were connected to the actual device that is the intended control target. Then, depending on whether the ECU processing results created at that time are normal, it can be automatically tested whether the ECU functions normally when operating while sending and receiving signals to and from the actual device.
[0008] ECUs store various source codes for controlling vehicles. These source codes contain numerous control branch points, which allow for complex condition settings. Therefore, to maintain the quality of the source code, it is desirable to inspect all control branch points. However, test cases used in ECU debug inspections are often created manually. In other words, test cases are created based on the subjective judgment of the creator, resulting in variations in the quality of test cases depending on the creator. In this case, poor test results are produced due to imperfect test cases, reducing testing efficiency.
[0009] Japanese Patent Application Laid-Open No. 2014-63415 proposes a method for detecting branching points and automating the creation of test cases, but this proposal is intended to check the functional transitions in source code, and it is difficult to create test patterns that have physical meaning for sending and receiving pseudo sensor signals and actuator drive signals between the ECU and HILS.
[0010] Furthermore, Japanese Patent Application Laid-Open No. 2009-14406 proposes a method for automatically generating test patterns that are executed by simulation using HILS according to an execution list, by detecting control branch points (such as IF statements) to be inspected from source code and creating an execution list of the branch conditions and their expected results at the branch points. However, in reality, in many cases, values in source code are internal values that differ from physical values, and they need to be converted to physical values taking into account the bit rate of the internal values, but Japanese Patent Application Laid-Open No. 2009-14406 does not disclose a specific method for doing so.
[0011] The present invention has been made to solve the above-mentioned problems, and aims to automatically create test patterns for testing electronic control units by appropriately linking internal values in source code with physical values. [Means for solving the problem]
[0012] A representative example of the invention disclosed in the present application is as follows: That is, a computer that creates test patterns for testing a control program using a control model of a simulator, comprising: a link data storage unit that stores link data representing the physical meanings of variables used in the control program, a test case creation unit that creates test cases written with internal variables that have no physical meaning for testing branching or arithmetic processing of the control program, and a test pattern creation unit that uses the link data to convert the internal variables used in the test cases into thresholds and variables that have physical meanings, and creates test patterns written with the variables that have the physical meanings. [Effects of the Invention]
[0013] According to one aspect of the present invention, it is possible to create HILS test patterns that require signals with physical meaning from test cases created from the source code of a control program that is composed of internal values. Problems, configurations, and effects other than those described above will become clear from the description of the following embodiments. [Brief explanation of the drawings]
[0014] [Figure 1] FIG. 1 is a schematic configuration diagram of a test environment according to an embodiment of the present invention. [Figure 2] 1 is a flowchart of a process executed in this embodiment. [Figure 3] This is an example of source code in which branch condition checking is performed using HILS. [Figure 4] 10 is a flowchart of a process according to a test case. [Figure 5] FIG. 10 is a diagram illustrating an example of the configuration of a link database. [Figure 6] 10 is a flowchart of a process using a test pattern. [Figure 7] 10 is a time chart of an output signal for running a test pattern in HILS. DETAILED DESCRIPTION OF THE INVENTION
[0015] An embodiment of the present invention will be described below with reference to the drawings. An automated testing environment using HILS (Hardware In the Loop Simulation) according to this embodiment can create test patterns with physical meaning that operate HILS by passing them through an information link database, even for test cases created from source code consisting of internal values that have no physical meaning, thereby achieving efficient testing.
[0016] First, an automatic testing environment using the HILS of this embodiment will be described with reference to Fig. 1. Fig. 1 is a schematic diagram of a system for testing source code 30 configured with internal values according to this embodiment using the HILS operated by physical signals. In Fig. 1, the HILS is configured with a vehicle model 11 and a driving model 12. The HILS 10 of this embodiment is connected to an ECU (Electric Control Unit) 20 via an electrical connection line. The HILS 10 is also connected to a personal computer (PC) 70 via an electrical connection line.
[0017] The HILS 10 is a simulation system that realizes a desired simulation while exchanging signals with the ECU 20, just like a vehicle that is the original control target of the ECU 20. The PC 70 stores source code 30 that runs on the ECU 20. The PC 70 also includes an automatic test case creation tool 40 that analyzes the source code 30 and automatically creates test cases, and an automatic test pattern creation tool 50 that creates test patterns that run the HILS 10 via a link database 60 that gives physical meaning to test cases made up of internal values created by the automatic test case creation tool 40.
[0018] The HILS 10 includes a vehicle model 11 and a driving model 12. The driving model 12 is a model that simulates driving operations by a driver, calculates the accelerator opening to achieve a vehicle speed that matches the supplied test pattern, and outputs information about the accelerator opening to the vehicle model 11.
[0019] Vehicle model 11 is a model that simulates the functions of a vehicle. For example, an actual engine mounted on a vehicle is equipped with various sensors, such as an A / F sensor for measuring the exhaust air-fuel ratio, a crank angle sensor for measuring the crank angle, and an air flow meter for measuring the intake air amount Ga, as well as actuators such as fuel injection valves. Vehicle model 11 simulates the behavior of the actual engine and actuators in accordance with accelerator opening information output from driving model 12 and actuator signals output from ECU 20, and generates simulated sensor signals that are similar to the various sensor signals generated in the actual engine.
[0020] The pseudo sensor signals generated in the vehicle model 11 are supplied to the ECU 20 via a wire harness. The pseudo sensor signals supplied from the vehicle model 11 to the ECU 20 include signals required by the ECU 20 to calculate the fuel injection amount (fuel injection time TAU), such as a pseudo signal of an A / F sensor (a pseudo signal of the exhaust air-fuel ratio) or a pseudo signal of the intake air amount Ga, or signals required to synchronize the processing of the ECU 20 with the processing of the HILS system 10, such as a pseudo signal of a crank angle sensor.
[0021] The ECU 20 executes predetermined processing required for controlling the internal combustion engine based on the pseudo sensor signals supplied from the vehicle model 11, and outputs actuator signals generated by the processing again to the vehicle model 11. The ECU 20 of this embodiment executes processing such as calculating a fuel injection time in accordance with pseudo sensor signals such as the intake air amount and the exhaust air-fuel ratio A / F, and outputting an injection signal as an actuator drive signal for opening a fuel injection valve for a fuel injection time at an appropriate timing.
[0022] Next, an operation for executing processing at a control branch point in a simulation using the HILS 10 will be described. First, an operation for specifying a driving pattern will be described. The HILS 10 of this embodiment executes a simulation that simulates the actual vehicle, which is the target of control, according to input vehicle driving conditions. Therefore, vehicle driving conditions are specified so that processing at a control branch point is executed in a simulation using the HILS 10. Specifically, the HILS 10 detects a control branch point (e.g., an IF statement) to be inspected from the control source code of the CU 20 stored in the PC 70, and the branch conditions at the branch point and their expected results are stored in the PC 70 as an execution list. The HILS 10 then specifies a target vehicle speed and a target rotation speed as vehicle driving conditions so that a simulation in the HILS 10 is executed according to the execution list.
[0023] Next, the specific contents of the processing executed in this embodiment will be described with reference to FIG.
[0024] In step S1, control branch points (such as IF statements) are detected from the source code 30 of the control program stored in the HILS PC 70, and the branch conditions (variables, thresholds) and expected results are extracted. In step S2, the extracted branch conditions are stored as test cases in the PC 70. As mentioned above, the source code 30 used here is composed of internal values, so it is a test case using internal values.
[0025] In step S3, the test cases created using internal values are converted into physical signals using the link database 60, and in step S4, the PC 70 creates and stores test patterns that operate the HILS 10 using the converted physical signals.
[0026] In step S5, a test is performed by the HILS 10 using the test pattern created in step S4.
[0027] Figure 3 shows an example of source code 30 that constitutes a routine that executes branch condition checks using HILS10. The input and output of source code 30 consist of input and output variables. These input and output variables are expressed as internal values, which are converted to physical values through rates. Therefore, unlike physical values directly within the source code, these input and output variables are values that do not have physical meaning and do not specify signal attributes. Source code 30 uses these internal values to execute each process and branch process.
[0028] Next, the specific content of the processing of this embodiment will be described with reference to Fig. 4. Fig. 4 is a flowchart of the processing for executing branch condition check using the HILS 10.
[0029] 4, first, the branch conditions and their expected results at the control branch points are extracted (steps 100 to 102). Specifically, control branch points (such as IF statements) are detected from the control source code stored in the HILS PC 70, and their branch conditions and expected results are extracted. The extracted branch conditions and expected results are stored in the PC 70 as an execution list of the test cases.
[0030] FIG. 5 is a diagram showing an example of the configuration of a link database 60 that describes the relationship between internal values (control program signals) in the source code and physical signals that operate in the HILS 10.
[0031] As mentioned above, test cases created using internal values written in the program signal column have no physical meaning or attributes and therefore cannot be used as test patterns to be run on the HILS 10. However, they can be used as test patterns if the rates and attributes are associated with physical signals. Therefore, the link database 60 stores information about internal values (RAM (Random Access Memory), rates, and units) and the physical attributes of those internal values. Furthermore, information about the signals of test patterns used by the HILS 10 is stored and associated with the stored information as internal values. Internal values (variables, thresholds) used in test cases that do not have physical meaning or attributes are linearly convertible with the variables and thresholds of test patterns run on the HILS 10, and the conversion coefficients are written in the rate column. Furthermore, multiple internal values may be used in the control program for the same physical variable (e.g., engine speed). When the physical attributes are the same, there is only one signal in the test pattern run on the HILS, so multiple internal values of the same physical attribute are associated with a single signal of that physical attribute using different rate values.
[0032] FIG. 6 is a flowchart of a test pattern having a physical meaning that operates in the HILS 10 and that is associated with an internal value of a test case using the link database 60.
[0033] 6, the branch conditions and their expected results at control branch points are extracted (steps 300 to 302). Specifically, control branch points (such as IF statements) are detected from test cases stored in the HILS PC 70, and their branch conditions are extracted. The extracted branch conditions are stored in the PC 70 as an execution list of test patterns.
[0034] FIG. 7 is a time chart of signals output to run the test patterns stored in the PC 70 in the HILS 10.
[0035] The branch conditions in the test pattern shown in FIG. 6 are A to D below, and signals corresponding to the branch conditions A to D are output from the PC 70 at the timing shown in FIG. A: Engine RPM, water temperature conditions and judgment time conditions are branched to N in S200 B: Branch off to N at S201 C: Branch to N at S202 D: All conditions Y
[0036] Although the present invention has been described above in terms of an embodiment using HILS, the present invention can also be applied to MILS.
[0037] As described above, in the embodiment of the present invention, the internal values of test cases created from the source code 30 of the control program are associated with the link database 60, which stores the variable names, physical attributes, and rates for converting into physical values, and the link database 60 is referenced to create test patterns made up of physical signals that can be run on the HILS 10. This makes it possible to create test patterns that can be run on the HILS 10 from the source code 30 of the control program.
[0038] Furthermore, even when multiple internal values representing the same physical variable (for example, engine speed) are used in a control program, they can be associated with a single physical attribute signal using different rate values and consolidated into a single signal for the test pattern run by HILS.
[0039] The present invention is not limited to the above-described embodiments, but includes various modifications and equivalent configurations within the spirit and scope of the appended claims. For example, the above-described embodiments have been described in detail to clearly explain the present invention, and the present invention is not necessarily limited to configurations including all of the described configurations. Furthermore, part of the configuration of one embodiment may be replaced with the configuration of another embodiment. Furthermore, the configuration of another embodiment may be added to the configuration of one embodiment. Furthermore, part of the configuration of each embodiment may be added, deleted, or replaced with other configurations.
[0040] Furthermore, the aforementioned configurations, functions, processing units, processing means, etc. may be realized in part or in whole in hardware, for example by designing them as integrated circuits, or may be realized in software by having a processor interpret and execute a program that realizes each function.
[0041] Information such as programs, tables, and files that realize each function can be stored in a storage device such as a memory, a hard disk, or an SSD (Solid State Drive), or in a recording medium such as an IC card, an SD card, or a DVD.
[0042] In addition, the control lines and information lines shown are those that are considered necessary for explanation, and do not necessarily represent all the control lines and information lines that are necessary for implementation. In reality, it can be assumed that almost all components are interconnected. [Explanation of symbols]
[0043] 10...HILS system, 11...vehicle model, 12...driving model, 20...ECU, 30...source code, 40...automatic test case creation tool, 50...automatic test pattern creation tool, 60...link database, 70...HILS PC
Claims
1. A computer that generates test patterns for testing a control program using a control model of a simulator, a link data storage unit for storing link data representing the physical meanings of variables used in the control program; a test case creation unit that creates test cases described with internal variables that have no physical meaning for testing branching or arithmetic processing of the control program; a test pattern creation unit that uses the link data to convert internal variables used in the test cases into thresholds and variables having physical meanings, and creates test patterns described with the variables having physical meanings.
2. 2. The computer of claim 1, The internal variable having no physical meaning and the variable having physical meaning are in a linearly transformable relationship, The computer is characterized in that the link data storage unit stores a conversion coefficient between the internal variable having no physical meaning and the variable having a physical meaning.
3. 3. The computer of claim 2, The test pattern generation unit Extracting internal variables of branch processing and their thresholds from the control program; converting the internal variables and thresholds of the branching process into variables and thresholds having physical meanings by referring to the conversion coefficients stored in the link data storage unit; A computer that generates test patterns described by variables and thresholds having physical meanings.
4. 2. The computer of claim 1, The control program is a computer program that is executed by an on-vehicle electronic control unit.
5. 1. A test pattern generation method for generating a test pattern for testing a control program using a control model of a simulator, comprising: The computer that executes the test pattern generation method includes an arithmetic unit that executes predetermined arithmetic processing, and a storage device that is connected to the arithmetic unit; the storage device stores link data that represents the physical meaning of variables used in the control program; The test pattern creation method includes: a test case creation procedure in which the arithmetic device creates test cases described with internal variables that have no physical meaning for testing branching or arithmetic processing of the control program; a test pattern creation procedure in which the computing device uses the link data to convert internal variables used in the test case into variables having physical meanings, and creates a test pattern described with thresholds and variables having the physical meanings.
6. 6. The test pattern creation method according to claim 5, The internal variable having no physical meaning and the variable having physical meaning are in a linearly transformable relationship, The test pattern generating method according to the present invention, wherein the storage device stores conversion coefficients between the internal variables that do not have physical meaning and the variables that have physical meaning.
7. 7. The test pattern creation method according to claim 6, In the test pattern generation procedure, the arithmetic unit extracts an internal variable of a branch process and a threshold value thereof from the control program; the arithmetic unit converts the internal variables and thresholds of the branching process into variables and thresholds having physical meanings by referring to the conversion coefficients stored in the storage device; A test pattern generating method, characterized in that the arithmetic unit generates a test pattern described by the variables and threshold values having physical meanings.
Citation Information
Patent Citations
Automatic inspection apparatus for electronic control unit
JP2009014406A
Test case automatic generation device and test case automatic generation program
JP2014063415A