CN114661021A - Hardware-in-loop test method and device for controller - Google Patents

Hardware-in-loop test method and device for controller Download PDF

Info

Publication number
CN114661021A
CN114661021A CN202110361109.8A CN202110361109A CN114661021A CN 114661021 A CN114661021 A CN 114661021A CN 202110361109 A CN202110361109 A CN 202110361109A CN 114661021 A CN114661021 A CN 114661021A
Authority
CN
China
Prior art keywords
driving mode
key
test
virtual
test case
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110361109.8A
Other languages
Chinese (zh)
Inventor
张路
邵桂欣
黄颍华
刘三兵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Electric Vehicle Co Ltd
Original Assignee
Beijing Electric Vehicle Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Electric Vehicle Co Ltd filed Critical Beijing Electric Vehicle Co Ltd
Priority to CN202110361109.8A priority Critical patent/CN114661021A/en
Publication of CN114661021A publication Critical patent/CN114661021A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • G05B23/0205Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults
    • G05B23/0208Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterized by the configuration of the monitoring system
    • G05B23/0213Modular or universal configuration of the monitoring system, e.g. monitoring system having modules that may be combined to build monitoring program; monitoring system that can be applied to legacy systems; adaptable monitoring system; using different communication protocols
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/24Pc safety
    • G05B2219/24065Real time diagnostics

Abstract

The invention provides a hardware-in-loop test method and device of a controller, and relates to the technical field of tests. The method comprises the following steps: calling a test case set corresponding to the test instruction, and monitoring the virtual key state in the test case set; determining a virtual driving mode signal according to the virtual key state; configuring and executing a test case of the virtual driving mode of the current configuration key type according to the virtual driving mode signal; and testing the driving mode related functions of the vehicle according to the test cases which are configured and successfully executed. The technical scheme of the invention solves the problem of low test efficiency of the driving mode test in the prior art, reduces the time for modifying the test cases of the functions related to the driving mode in the test process and improves the test efficiency.

Description

Hardware-in-loop test method and device for controller
Technical Field
The present invention relates to the field of test technologies, and in particular, to a hardware-in-the-loop test method and apparatus for a controller.
Background
The driving mode is a mode setting for the driver to experience the driving pleasure, and includes a sport mode, a comfort mode, and an economy mode. More and more passenger cars are configuring the driving pattern. However, in the development and test stage, the driving mode of each vehicle type needs to be tested, each mode test needs to compile a test case, and the test of multiple modes increases the complexity and the complexity of the test of testers, so that the test efficiency is low.
Disclosure of Invention
The embodiment of the invention provides a method for testing the driving mode, which aims to solve the problem of low testing efficiency of the related function test of the driving mode in the prior art.
In order to solve the technical problems, the invention adopts the following technical scheme:
the embodiment of the invention provides a hardware-in-loop test method of a controller, which comprises the following steps:
calling a test case set corresponding to the test instruction, and monitoring the virtual key state in the test case set;
determining a virtual driving mode signal according to the virtual key state;
executing a test case of a virtual driving mode of the current configuration key type according to the virtual driving mode signal;
and testing the driving mode related functions of the vehicle according to the successfully configured test case.
Optionally, the monitoring the states of the virtual keys in the test case set includes:
if all the configuration key states in the test case set are monitored to be non-pressed states, determining that the current driving mode after being electrified again is a memory driving mode;
wherein the memory driving mode is a driving mode used before the last power-off of the vehicle.
Optionally, the monitoring the virtual key state in the test case set further includes:
if the controller detects that the virtual key generates a preset action, generating a first preset instruction according to the preset action of the virtual key;
and determining that the current driving mode is the first preset mode according to the first preset instruction.
Optionally, the determining a virtual driving mode signal according to the virtual key state includes:
and under the condition that the current driving mode is the first preset mode or the memory driving mode, determining that the virtual driving mode signal is a double-key virtual driving mode request.
Optionally, the configuring and executing a test case of a virtual driving mode of a current configuration key class includes:
acquiring the key type of the current driving mode under the double-key virtual driving mode request;
according to the key type, configuring and executing a test case of a virtual driving mode matched with the key type, and acquiring a bus driving mode corresponding to the virtual driving mode;
wherein the key categories of the current driving mode include: a driving mode in a single-key configuration, a driving mode in a two-key configuration, and a driving mode in a three-key configuration.
Optionally, the configuring and executing a test case of a virtual driving mode of a current configuration key class includes:
acquiring a corresponding relation between variables of the current key category and variable mapping from a first preset table;
according to the corresponding relation between the variable and the variable mapping, the test case of the virtual driving mode configured by the double keys is suitable for the test case of the driving mode configured by the three keys or the test case of the driving mode configured by the single key;
the first preset table at least stores variable and variable mapping of a first signal type under a plurality of entity environments and variable mapping of a second signal type under a plurality of virtual environments.
Optionally, the successfully configured test cases at least include the following test items:
the first test item: when the vehicle is powered on for the first time, determining that the current driving mode is a second preset mode;
the second test item: when the vehicle is powered off and is powered on again, determining that the current driving mode is the driving mode used before the last power off of the vehicle;
the successfully configured test case at least stores the following test information:
testing the time sequence, the input signal sequence and the output signal sequence;
the input signal at least comprises vehicle power-on information and virtual key state information; the output signal sequence comprises at least driving mode information and readiness information.
Optionally, the method further includes executing the test case that is successfully configured, and the step of executing the test case of the virtual driving mode of the current configuration key class includes:
reading a test time sequence in the test case, and receiving the input signal sequence;
after the test time sequence is read, determining the output signal sequence according to the time period of the test time sequence and the input signal sequence;
and determining to output a test result until a preset ending signal appears in the output signal sequence.
An embodiment of the present invention further provides a hardware-in-the-loop testing apparatus for a controller, including:
the first processing module is used for calling a test case set corresponding to the test instruction and monitoring the virtual key state in the test case set;
the determining module is used for determining a virtual driving mode signal according to the virtual key state;
the second processing module is used for configuring and executing a test case of the virtual driving mode of the current configuration key type according to the virtual driving mode signal;
and the test module is used for testing the relevant functions of the driving mode of the vehicle according to the test cases which are configured and successfully executed.
Embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps in the ring test method for hardware of a controller as described above.
The invention has the beneficial effects that:
in the above technical solution, the hardware-in-loop test method of the controller is applied to a hardware-in-loop test environment of the controller, and the method includes: calling a test case set corresponding to the test instruction, and monitoring the virtual key state in the test case set; determining a virtual driving mode signal according to the virtual key state; executing a test case of the virtual driving mode of the current configuration key type according to the virtual driving mode signal; and testing the driving mode related functions of the vehicle according to the successfully configured test case. According to the technical scheme, the test case does not need to be compiled before each test, the corresponding test case can be configured according to the driving modes of various key classes, the time for a test engineer to modify the test case with the related functions of the driving modes is greatly reduced, and the test efficiency is improved.
Drawings
Fig. 1 is a schematic flowchart of a hardware-in-the-loop testing method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a driving mode configuration for a two-key configuration;
FIG. 3 is a schematic diagram of a driving mode of a three-button configuration;
FIG. 4 is a schematic diagram of a driving mode configuration with a single key press;
fig. 5 is a block diagram of a hardware-in-the-loop testing apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantages of the present invention more apparent, the following detailed description is given with reference to the accompanying drawings and specific embodiments. In the following description, specific details such as specific configurations and components are provided only to help the full understanding of the embodiments of the present invention. Thus, it will be apparent to those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the invention. In addition, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
It should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
In various embodiments of the present invention, it should be understood that the sequence numbers of the following processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
It should be noted that the driving mode implementation approaches of the vehicle model configuration mentioned in the present invention are configured with three keys, a double key and a single key, respectively, and each configuration implements the driving mode switching manner as shown in fig. 2 to 4, and the driving mode includes a sport mode, a comfort mode and an economy mode. The first off-line driving mode of the vehicle is a comfortable mode by default, and the driving mode displayed by powering on again is a memory driving mode, namely the driving mode before power failure last time.
As shown in fig. 2, in the driving mode configured by two keys, if the current driving mode is the economy mode, the driving mode is still the economy mode by pressing the K-key, after the K + key is pressed and released, the driving mode is changed to the comfort mode, and the K + key is pressed again, the driving mode is changed to the sport mode, and the driving mode is still the sport mode by pressing the K + key again. The driving mode of the double-key configuration needs to be selected from a sport mode, a comfort mode and an economy mode through controlling the driving mode by two keys, namely K & lt- & gt and K & lt + & gt. As the driving mode of the three-button configuration shown in fig. 3, no matter what mode is currently being used, K1 is pressed, the driving mode is changed to the sport mode, K2 is pressed, the driving mode is changed to the comfort mode, and K3 is pressed, the driving mode is changed to the economy mode. As shown in the single button driving mode of fig. 4, if the current driving mode is the economy mode, the key K1 is pressed to change to the sport mode, the key K1 is pressed to turn to the comfort mode, and the key K1 is pressed to turn to the economy mode. The single-key driving mode realizes the cyclic switching of the driving mode through a single key of K1.
In the prior art, test cases related to a driving mode are all realized by double keys, the configuration of three keys and a single key is increased in the process of developing the vehicle type, and test cases related to functions of the driving mode need to be rewritten, so that the test process is complicated, and the test efficiency is low. The invention provides a hardware-in-loop test method and device of a controller, aiming at solving the problem of low test efficiency of a driving mode test in the prior art.
As shown in fig. 1, an alternative embodiment of the present invention provides a hardware-in-loop testing method for a controller, applied to an environment model of a hardware-in-loop of the controller, including:
step 100, calling a test case set corresponding to a test instruction, and monitoring the virtual key state in the test case set;
here, the test case set refers to a test case set of functions related to the driving mode; the virtual key states comprise a pressed state and an un-pressed state; the test case set is also a test case set different from the prior art, the test case set defines the type of the virtual key signal by rewriting, and the virtual key signal in the current test case set can be determined according to the redefined virtual key signal.
Step 200, determining a virtual driving mode signal according to the virtual key state;
step 300, configuring and executing a test case of the virtual driving mode of the current configuration key type according to the virtual driving mode signal;
it should be noted that the invention can apply the first developed related function test case of the three-key driving mode to a double-key or single-key vehicle type, or apply the first developed related function test case of the single-key driving mode to a double-key or three-key vehicle type.
And 400, testing the relevant functions of the driving mode of the vehicle according to the successfully configured test case.
In this embodiment, under an environment model with the controller hardware in a ring, the virtual key state is monitored and the virtual driving mode signal is determined by calling the improved test case set, and the method can be applied to the driving mode configured by a single key, the driving mode configured by a double key, and the driving mode configured by a triple key according to step 300 without writing a plurality of test cases, thereby realizing the uniformity of the test cases. In order to reduce the time for modifying the test case related to the driving mode by the test engineer and improve the test efficiency, the invention improves the hardware of the controller on the environmental model of the ring by comparing the implementation modes of the driving mode of the double keys and the triple keys and the single key, and finally realizes that the double-key test case is suitable for the configuration of the triple keys and the single key by the test engineer only by modifying the signal type of the mapping table.
It should be noted that the test cases related to the driving mode in the prior art are all implemented by using double keys, and the implementation manner of the double-key test case is to implement functional testing through a test scenario edited by EXCEL, then generate an executable case through a tool according to a mapping table (signal input and output category, signal name, type in the test case), and let the executable case run on the environment of the controller hardware in a ring through an automatic execution tool. The prior art test case of the dual-key driving mode and the related function case of the driving mode can be shown in table 1.
Table 1: double-key driving mode test case in prior art
Figure BDA0003005595900000061
Wherein "W10" in table 1 indicates that the expected result is achieved within 10s, and the expected result of the test case is output to the next row; "S0.2" means continue the current action for 0.2S; "sw" indicates that the switch state of the current configuration key state signal is "1" and the key state is "0". Use case scenarios in the prior art: after a Vehicle Control Unit (VCU) is powered on, a tester does not know what the driving mode is memorized, needs to continuously reset and press twice through a K + key and reset and press once through a K-key, so that the expected output result of a test case is a comfortable mode, the expected actual driving mode is not clear immediately after the VCU is powered on, and the test complexity is increased.
Optionally, the step 100 includes:
if the controller detects that the virtual key generates a preset action, generating a first preset instruction according to the preset action of the virtual key;
and determining that the current driving mode is the first preset mode according to the first preset instruction.
After the test case mapping table and the environment of the controller hardware in the ring are changed, the preset information of the preset virtual key is added in the improved test case mapping table, the logic of obtaining the expected virtual driving mode according to the state of the test case virtual key is added in the environment of the controller hardware in the ring, if the virtual key is detected to act, a first preset instruction is generated, and the bus driving mode is automatically adjusted to be the expected virtual driving mode by the configuration key according to the first preset instruction. The improved mapping table and the test environment provide convenience for the function test case related to the driving mode. The driving mode self function uses a configuration key, no virtual key signal exists in a driving mode test case, the state of the configuration key is set to be sw, when an sw instruction appears, the current driving mode is determined to be a first preset mode, and the first preset mode is a comfortable mode. Specifically, the improved driving pattern test case shown in table 2 may be used.
Table 2: improved test case for related functions of driving mode
Figure BDA0003005595900000071
After the test case mapping table and the environment model of the controller hardware in the ring are improved, the method can be directly suitable for the vehicle type configured by three keys or a single key, and the test case can be realized according to the table 2. Therefore, a test engineer is not required to lock the driving mode to the comfort mode according to the condition of the table 1, the driving mode is adjusted on the basis of the comfort mode, and writing of function test cases related to the driving mode is simplified. The test case related to the related functions of the driving mode is realized by using double buttons, and the double buttons of the test case after improvement are virtual keys in the invention. The virtual key state sw in the improved test case related to the driving mode related function is irrelevant to the memory driving function. The memory driving mode function is directed only to the driving mode function itself. It is specifically explained that the test case of the driving mode itself is to be rewritten according to the actual key configuration because the actual performance of the driving mode key needs to be tested, and the function related to the driving mode can be implemented by modifying the mapping table.
Optionally, the step 100 further includes:
if all the configuration key states in the test case set are monitored to be non-pressed states, determining that the current driving mode after being electrified again is a memory driving mode;
wherein the memory driving mode is a driving mode used before the last power-off of the vehicle. The test case set is a test case set of a driving mode.
In this embodiment, in the case where the vehicle has a driving mode with a memory driving function, the test for such a case requires that each power-on is a memory driving mode, which is a driving mode used before the last power-off of the vehicle. On the basis of table 2, the driving mode configured by three keys is used to explain how to realize the function test of memorizing the driving mode. Specifically, the results are shown in Table 3.
Table 3: improved three-key driving mode test case
Figure BDA0003005595900000081
In table 3, at "W10", and power ON, and when the key state is the "sw" state, it is determined that the vehicle is powered ON for the first time, and the current mode is determined to be the "comfort mode"; at time "W10" and power OFF, the K1 key state is "not pressed", at which time it is determined that the current vehicle state has been changed from a first power-on state to a first power-OFF state; "W10" again, and power ON, when it is determined that the vehicle is powered ON again (second time), the driving mode determined at this time is the driving mode before the last (first time) power off.
In another optional embodiment, the determining a virtual driving mode signal according to the virtual key status includes:
and under the condition that the current driving mode is the first preset mode or the memory driving mode, determining that the virtual driving mode signal is a double-key virtual driving mode request. Here, the first preset mode is preferably a comfort mode.
In this embodiment, when the current driving mode is the first preset mode or the memory driving mode, since the related function test case of the key type driving mode of the preferable dual key in the prior art already exists, the virtual driving mode signal is first matched as a dual key virtual driving mode request, and if the key type of the current vehicle is found to be another key type, the current key type is actively modified to be suitable for the key type of the vehicle.
In summary, the function of the virtual driving mode is added to the environment model of the controller hardware in the loop, so that the driving mode can be quickly adjusted to the comfortable mode after the vehicle controller is initialized, and the execution of the normal use case of the test engineer is not affected. Meanwhile, when the memory function of the driving mode is tested, the memory function of the driving mode can be realized only by the test case in the state that the configuration key switch is not cleared, namely in the state of 'not pressing'.
Specifically, the step 300 includes:
acquiring the key type of the current driving mode under the double-key virtual driving mode request;
configuring a test case of a virtual driving mode matched with the key type according to the key type;
wherein the key categories of the current driving mode include: a driving mode of a single-key configuration, a driving mode of a two-key configuration, and a driving mode of a three-key configuration.
In the embodiment, the key type of the current driving mode is obtained, the key type is the key type of the driving mode of the actual vehicle, and the test case which is suitable for the actual key type is matched, so that a new test case does not need to be rewritten, the automation of the test case is improved, and the test efficiency is improved.
Optionally, the test case for configuring the driving mode of the current key category includes:
acquiring a corresponding relation between variables of the current key category and variable mapping from a first preset table;
according to the corresponding relation between the variable and the variable mapping, the test case of the driving mode configured by double keys is suitable for the test case of the driving mode configured by three keys or the test case of the driving mode configured by single key;
the first preset table at least stores variable and variable mapping of a first signal type in a plurality of entity environments and variable mapping of a second signal type in a plurality of virtual environments.
It should be noted that each test case needs a mapping table to be implemented. For example, the prior art two-key mapping table is shown in table 4.
Table 4: double-key mapping relation table in prior art
Figure BDA0003005595900000091
As shown in table 4, each test case corresponds to one mapping table, and the key configuration is different, and each test case needs to modify the corresponding mapping table, which results in that a plurality of test cases in the prior art are not universal, and the test progress is slow.
In this embodiment, the present invention designs a mapping table of multi-configuration driving modes, as shown in table 5.
Table 5: mapping table for multiple configuration driving modes
Figure BDA0003005595900000101
The three keys are related as follows, in a double-key configuration driving mode, the signal type selects IO, and actually the K-key and the K + key perform mode switching according to fig. 2, in a three-key configuration driving mode, the K1, the K2 and the K3 key perform mode switching according to fig. 3, and in a single-key configuration, the K1 key performs mode switching according to fig. 4. The double-key is firstly configured on the vehicle model, and the double-configuration test case is suitable for the related functions of three keys, a single key and a driving mode by improving the test environment of the hardware of the controller in a ring and a mapping table without modifying the case. The signal type of the K-key and the K + key and the variable mapping are only required to be modified according to the table 5, the signal type is Driver, the variable mapping is KeyVirtual1 and KeyVirtual2, and test case platformization of various configured vehicle types is achieved.
According to the improvement mode of the invention, the firstly developed related function test case of the three-key driving mode can be applied to a double-key or single-key vehicle type, or the firstly developed related function test case of the single-key driving mode can be applied to a double-key or three-key vehicle type.
Optionally, the successfully configured test cases at least include the following test items:
the first test item: when the vehicle is powered on for the first time, determining that the current driving mode is a second preset mode;
the second test item: and when the vehicle is powered off and powered on again, determining that the current driving mode is the driving mode used before the last power off of the vehicle. Here, the second preset mode is a comfort mode.
The successfully configured test case at least stores the following test information:
testing the time sequence, the input signal sequence and the output signal sequence;
the input signal at least comprises vehicle power-on information and virtual key state information; the output signal sequence comprises at least driving mode information and readiness information. Table 6 shows the execution conditions of the three-key and the single-key corresponding to the virtual driving mode obtained by the virtual key, the driving mode is automatically adjusted to the comfort mode after each test case of the driving mode related functions is powered on, and the virtual driving key in the case is adjusted in the comfort mode.
Table 6: corresponding three-key and single-key virtual driving mode table
Figure BDA0003005595900000111
Optionally, the step 400 includes:
reading a test time sequence in the test case, and receiving the input signal sequence;
after the test time sequence is read, determining the output signal sequence according to the time period of the test time sequence and the input signal sequence;
and determining an output test result until a preset end signal appears in the output signal sequence.
The specific test flow is as follows: the controller hardware monitors the state of a configuration key in an automatic execution test case in an environment model of a ring, and if the state is not pressed before power-ON, a driving mode ON a bus is a memory driving mode; if the actual configuration key state in the monitoring automatic execution test case is sw, the driving mode on the bus can be changed into a comfortable mode. In the bus driving mode, the virtual double keys are used for obtaining an input signal instruction of the virtual driving mode, and the configuration keys are used for actually executing the obtained driving mode according to the table 6.
And analyzing in an environment model of the controller hardware in a ring according to the signals of the executable test cases K & lt- & gt and K & lt + & gt to obtain a virtual driving mode required by the tester. According to fig. 2, in order to correctly expect a driving mode on a bus, a test engineer presses a K + key twice and then presses a K-key once again, the driving mode of the bus is a comfortable mode, and needs two other modes, and then operates the K-key and the K + key.
When the driving mode is the three-key configuration, the three keys can be controlled to be correspondingly pressed by analyzing the virtual driving mode value, and if the virtual driving mode is the motion mode, the K1 keys are controlled to output signals 1, K2 and K3 to be 0; if the virtual driving mode is the comfortable mode, controlling the K2 keys to output signals 1, K1 and K3 to be 0; if the virtual driving mode is the economy mode, the K3 keys are controlled to output signals 1, K1 and K2 which are 0.
When the driving mode is the single-key configuration, the key action of the K1 is controlled according to the comparison of the actual driving mode of the bus and the value of the analyzed virtual driving mode. The current driving mode is a comfortable mode, the virtual driving mode is a comfortable mode, the K1 key does not need to be pressed, the virtual driving mode is an economic mode, the K1 key needs to be pressed once, the virtual driving mode is a sport mode, and the K1 key needs to be pressed twice; the current driving mode is an economic mode, the virtual driving mode is a comfortable mode, the K1 key needs to be pressed twice, the virtual driving mode is the economic mode, the K1 key does not need to be pressed, the virtual driving mode is a sport mode, and the K1 key needs to be pressed once; the current driving mode is a sport mode, the virtual driving mode is a comfort mode, the K1 key needs to be pressed once, the virtual driving mode is an economy mode, the K1 key needs to be pressed twice, the virtual driving mode is a sport mode, and the K1 key does not need to be pressed.
It should be noted that the execution case of the double keys is in a vehicle model configured by three keys and a single key, the double keys exist virtually, pressing cannot control the controller hardware to press in an actual driving mode of a ring, and the main function is to obtain a virtual driving mode request according to the test case of the double keys, and finally control the three keys of the controller or the single key to obtain the driving mode request of the test case of the double keys on the bus according to the virtual driving mode request.
In conclusion, the invention greatly reduces the time for a test engineer to modify the test cases of the related functions of the driving mode and improves the test efficiency by modifying the environmental model and the mapping table of the controller hardware in the ring; the invention improves the environmental model of the controller hardware in the ring, has no influence on the debugging of the test cases configured in different driving modes, and needs to use the actual configured keys aiming at the test cases of the functions of the driving modes; according to the invention, after the power is on, the bus driving mode of the controller is modulated into the comfortable mode, so that a test case developer can write a case, and a test engineer does not need to test the case and starts to adjust the driving mode in the comfortable mode in a case mode.
The driving mode function of the invention has a power-down storage function, the driving mode is the last stored mode after the next power-on, when the driving mode storage function needs to be tested, the test case does not clear the case input signal of the driving mode configuration key at the end, the corresponding driving mode configuration key signal before the power-down and after the power-on again is 'not pressed', the power-on again is carried out, and the driving mode is the memory driving mode.
As shown in fig. 5, an alternative embodiment of the present invention further provides a hardware-in-the-loop testing apparatus for a controller, including:
the first processing module 10 is configured to call a test case set corresponding to the test instruction, and monitor a virtual key state in the test case set;
a determining module 20, configured to determine a virtual driving mode signal according to the virtual key state;
the second processing module 30 is configured to configure and execute a test case of a virtual driving mode of a currently configured key class according to the virtual driving mode signal;
and the test module 40 is used for testing the relevant functions of the driving mode of the vehicle according to the test cases which are configured and successfully executed.
Optionally, the first processing module 10 includes:
the first determining unit is used for monitoring that all the configuration key states in the test case set are not pressed, and then determining that the current driving mode after being electrified again is a memory driving mode;
wherein the memory driving mode is a driving mode used before the last power-off of the vehicle.
Optionally, the first processing module 10 further includes:
the device comprises a first generation unit, a second generation unit and a control unit, wherein the first generation unit is used for generating a first preset instruction according to the preset action of a virtual key when the controller detects that the virtual key generates the preset action;
and the second determining unit is used for determining that the current driving mode is the first preset mode according to the first preset instruction.
Optionally, the determining module 20 includes:
a third determining unit, configured to determine that the virtual driving mode signal is a two-key virtual driving mode request when the current driving mode is the first preset mode or the memory driving mode.
Optionally, the second processing module 30 includes:
the first acquisition unit is used for acquiring the key type of the current driving mode under the double-key virtual driving mode request;
the configuration unit is used for configuring and executing a test case of the virtual driving mode matched with the key type and acquiring a bus driving mode corresponding to the virtual driving mode;
wherein the key categories of the current driving mode include: a driving mode in a single-key configuration, a driving mode in a two-key configuration, and a driving mode in a three-key configuration.
Optionally, the second processing module 30 includes:
the second obtaining unit is used for obtaining the corresponding relation between the variable of the current key type and the variable mapping from the first preset table;
the processing unit is used for enabling the test case of the virtual driving mode configured by the double keys to be suitable for the test case of the driving mode configured by the three keys or the test case of the driving mode configured by the single key according to the corresponding relation between the variable and the variable mapping;
the first preset table at least stores variable and variable mapping of a first signal type in a plurality of entity environments and variable mapping of a second signal type in a plurality of virtual environments.
It should be noted that the successfully configured test cases at least include the following test items:
first test item: when the vehicle is powered on for the first time, determining that the current driving mode is a second preset mode;
the second test item: when the vehicle is powered off and is powered on again, determining that the current driving mode is the driving mode used before the last power off of the vehicle;
the successfully configured test case at least stores the following test information:
testing the time sequence, the input signal sequence and the output signal sequence;
the input signal at least comprises vehicle power-on information and virtual key state information; the output signal sequence comprises at least driving mode information and readiness information.
Optionally, the test module 40 includes:
the receiving unit is used for reading the test time sequence in the test case and receiving the input signal sequence;
a fourth determining unit, configured to determine the output signal sequence according to a time period of the test time sequence and the input signal sequence after the test time sequence is read;
and the fifth determining unit is used for determining and outputting the test result until the output signal sequence generates a preset ending signal.
An embodiment of the present invention further provides a readable storage medium, where a program is stored on the readable storage medium, and when the program is executed by a processor, the program implements each process of the embodiment of the hardware-in-loop testing method for a controller, and can achieve the same technical effect, and in order to avoid repetition, the detailed description is omitted here. The readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "include", "including" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or terminal apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
While the preferred embodiments of the present invention have been described, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined in the following claims.

Claims (10)

1. A hardware-in-loop test method of a controller is characterized by comprising the following steps:
calling a test case set corresponding to the test instruction, and monitoring the virtual key state in the test case set;
determining a virtual driving mode signal according to the virtual key state;
configuring and executing a test case of the virtual driving mode of the current configuration key type according to the virtual driving mode signal;
and testing the relevant functions of the driving mode of the vehicle according to the test cases which are configured and successfully executed.
2. The method according to claim 1, wherein the monitoring the virtual key status in the test case set comprises:
if all the configuration key states in the test case set are monitored to be non-pressed states, determining that the current driving mode after being electrified again is a memory driving mode;
wherein the memory driving mode is a driving mode used before the last power-off of the vehicle.
3. The method according to claim 2, wherein the monitoring of the virtual key status in the test case set further comprises:
if the controller detects that the virtual key generates a preset action, generating a first preset instruction according to the preset action of the virtual key;
and determining that the current driving mode is the first preset mode according to the first preset instruction.
4. The hardware-in-the-loop test method of the controller according to claim 3, wherein the determining a virtual driving mode signal according to the virtual key state comprises:
and under the condition that the current driving mode is the first preset mode or the memory driving mode, determining that the virtual driving mode signal is a double-key virtual driving mode request.
5. The hardware-in-loop test method of the controller according to claim 4, wherein the configuring and executing a test case of the virtual driving mode of the currently configured key class includes:
acquiring the key type of the current driving mode under the double-key virtual driving mode request;
according to the key type, configuring and executing a test case of a virtual driving mode matched with the key type, and acquiring a bus driving mode corresponding to the virtual driving mode;
wherein the key categories of the current driving mode include: a driving mode in a single-key configuration, a driving mode in a two-key configuration, and a driving mode in a three-key configuration.
6. The hardware-in-the-loop test method of the controller according to claim 1, wherein the configuring and executing the test case of the virtual driving mode of the current configuration key class comprises:
acquiring a corresponding relation between variables of the current key category and variable mapping from a first preset table;
according to the corresponding relation between the variable and the variable mapping, the test case of the virtual driving mode configured by the double keys is suitable for the test case of the driving mode configured by the three keys or the test case of the driving mode configured by the single key;
the first preset table at least stores variable and variable mapping of a first signal type in a plurality of entity environments and variable mapping of a second signal type in a plurality of virtual environments.
7. The method according to claim 1, wherein the successfully configured test cases comprise at least the following test items:
the first test item: when the vehicle is powered on for the first time, determining that the current driving mode is a second preset mode;
the second test item: when the vehicle is powered off and is powered on again, determining that the current driving mode is the driving mode used before the last power off of the vehicle;
the successfully configured test case at least stores the following test information:
testing the time sequence, the input signal sequence and the output signal sequence;
the input signal at least comprises vehicle power-on information and virtual key state information; the output signal sequence comprises at least driving mode information and readiness information.
8. The hardware-in-the-loop test method of the controller according to claim 7, wherein the step of executing the test case of the virtual driving mode of the currently configured key class comprises:
reading a test time sequence in the test case, and receiving the input signal sequence;
after the test time sequence is read, determining the output signal sequence according to the time period of the test time sequence and the input signal sequence;
and determining an output test result until a preset end signal appears in the output signal sequence.
9. A hardware-in-loop test apparatus for a controller, comprising:
the first processing module is used for calling a test case set corresponding to the test instruction and monitoring the virtual key state in the test case set;
the determining module is used for determining a virtual driving mode signal according to the virtual key state;
the second processing module is used for configuring and executing a test case of the virtual driving mode of the current configuration key type according to the virtual driving mode signal;
and the test module is used for testing the relevant functions of the driving mode of the vehicle according to the test cases which are configured and successfully executed.
10. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the steps of the hardware-in-loop test method of a controller according to any one of claims 1 to 7.
CN202110361109.8A 2021-04-02 2021-04-02 Hardware-in-loop test method and device for controller Pending CN114661021A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110361109.8A CN114661021A (en) 2021-04-02 2021-04-02 Hardware-in-loop test method and device for controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110361109.8A CN114661021A (en) 2021-04-02 2021-04-02 Hardware-in-loop test method and device for controller

Publications (1)

Publication Number Publication Date
CN114661021A true CN114661021A (en) 2022-06-24

Family

ID=82026469

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110361109.8A Pending CN114661021A (en) 2021-04-02 2021-04-02 Hardware-in-loop test method and device for controller

Country Status (1)

Country Link
CN (1) CN114661021A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114674571A (en) * 2021-07-29 2022-06-28 北京新能源汽车股份有限公司 Driving mode testing method and device and vehicle

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114674571A (en) * 2021-07-29 2022-06-28 北京新能源汽车股份有限公司 Driving mode testing method and device and vehicle
CN114674571B (en) * 2021-07-29 2024-03-26 北京新能源汽车股份有限公司 Driving mode testing method and device and vehicle

Similar Documents

Publication Publication Date Title
CN111934908A (en) Internet of things simulation method, device and system and storage medium
CN114661021A (en) Hardware-in-loop test method and device for controller
JP4321976B2 (en) Microcomputer with debug support function
US7158906B2 (en) Test method, test system, and program therefor
US20080243283A1 (en) Process Control Simulator and Process Control Simulating Method
CN111858203B (en) Server performance detection method, system, programmable controller and storage medium
US20220297731A1 (en) Train signal system and linkage method therefor
CN114674571B (en) Driving mode testing method and device and vehicle
EP2788865B1 (en) Method, device and computer program product for measuring user perception quality of a processing system comprising a user interface
CN216118765U (en) Multifunctional intelligent SMART CAN adapter
CN114384847B (en) Vehicle management mode switching method and system for vehicle system and function verification
CN117791620A (en) Control circuit and method for switching load control source state and intelligent ammeter
CN216927595U (en) Automatic testing device and system of vehicle-mounted equipment
CN114610003B (en) Vehicle diagnosis method, device, equipment and medium
CN115729831A (en) Vehicle diagnosis configuration method and device, vehicle and storage medium
JPH07271287A (en) Plant simulation device and method for setting its initial state
JP2887515B2 (en) Recorder simulator
CN107885185B (en) Method and system for simulating automatic operation of automobile air conditioner controller key knob
CN113946405A (en) Virtual controller simulation test method, system and storage medium
JPS6158052A (en) Simplified debugging device of microcomputer program
CN113005708A (en) Control method and device of washing machine, controller and washing machine
CN117572843A (en) Vehicle electric side sliding door testing method and device, electronic equipment and storage medium
CN115903732A (en) In-loop testing method for vehicle body hardware, platform system and storage medium
JPH0417444B2 (en)
CN117596173A (en) Time parameter testing method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination