CN113342693A - Test data generation method, device and system and controller - Google Patents
Test data generation method, device and system and controller Download PDFInfo
- Publication number
- CN113342693A CN113342693A CN202110764143.XA CN202110764143A CN113342693A CN 113342693 A CN113342693 A CN 113342693A CN 202110764143 A CN202110764143 A CN 202110764143A CN 113342693 A CN113342693 A CN 113342693A
- Authority
- CN
- China
- Prior art keywords
- model
- test
- interface
- semi
- controller
- 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
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 305
- 238000000034 method Methods 0.000 title claims abstract description 46
- 238000004088 simulation Methods 0.000 claims abstract description 115
- 230000006870 function Effects 0.000 claims abstract description 63
- 238000013101 initial test Methods 0.000 claims abstract description 49
- 238000004519 manufacturing process Methods 0.000 claims abstract description 44
- 238000012795 verification Methods 0.000 claims description 16
- 230000002159 abnormal effect Effects 0.000 claims description 8
- 238000013507 mapping Methods 0.000 claims description 8
- 230000008569 process Effects 0.000 description 12
- 238000004891 communication Methods 0.000 description 8
- 230000001360 synchronised effect Effects 0.000 description 5
- 101100190528 Arabidopsis thaliana PIN6 gene Proteins 0.000 description 3
- 230000000712 assembly Effects 0.000 description 3
- 238000000429 assembly Methods 0.000 description 3
- 230000005856 abnormality Effects 0.000 description 2
- 230000009471 action Effects 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000013100 final test Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3696—Methods or tools to render software testable
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Testing And Monitoring For Control Systems (AREA)
Abstract
The invention provides a method, a device, a system and a controller for generating test data, wherein production attribute information is used for setting a universal interface to obtain an interface model, namely the universal interface can be set to obtain the interface model corresponding to a required manufacturer, a plug-in used for generating the interface model is not required to be installed in a test data generating tool, so that the problems of unloading and reinstalling the plug-in when a semi-physical simulation test bench of different manufacturers is replaced are solved, and the test data used when the semi-physical simulation test benches of different manufacturers are generated by using the controller. Furthermore, when the initial test model is generated, at least one functional module is selected from a plurality of functional modules with different functions, and then the selected at least one functional module is connected, so that compared with a mode of combining smaller components, the generation efficiency of the initial test model can be improved.
Description
Technical Field
The invention relates to the field of simulation testing, in particular to a method, a device, a system and a controller for generating test data.
Background
Semi-physical simulation test benches may be used to test the performance of controllers, such as optical storage controllers, before they are used. A plurality of manufacturers can produce the semi-physical simulation test bench, and the corresponding plug-ins of the manufacturers of different semi-physical simulation test benches are different. Wherein, semi-physical simulation test bench includes semi-physical simulation machine.
During testing, a plug-in corresponding to a manufacturer of a used semi-physical simulation test bench needs to be installed in a test model generation tool so that the test model generation tool generates an interface model corresponding to the manufacturer based on the plug-in, and then generates test data based on data such as the interface model and the like and loads the test data into a semi-physical simulation machine.
In practical application, if a semi-physical simulation test bench of another manufacturer needs to be replaced for testing, the original plug-in the test data generation tool needs to be unloaded, and then a new plug-in of the manufacturer is installed, so that the test data can be generated, and the simulation test operation is complex.
Disclosure of Invention
In view of this, the present invention provides a method, an apparatus, a system and a controller for generating test data, so as to solve the problem that if a semi-physical simulation test bench of another manufacturer needs to be replaced for testing, an original plug-in a test data generation tool needs to be unloaded, and then a new plug-in of the manufacturer needs to be installed, so that the simulation test operation is complicated.
In order to solve the technical problems, the invention adopts the following technical scheme:
a test data generation method is applied to a controller, a plurality of functional modules with different functions after the function of the controller to be tested is split are stored in the controller, and the test model generation method comprises the following steps:
receiving a test data generation request; the test data generation request comprises production attribute information of the semi-physical simulation test bench and at least one functional module selected from the plurality of functional modules with different functions;
connecting the selected at least one functional module to obtain an initial test model;
setting a universal interface by using the production attribute information to obtain an interface model, and connecting the interface model with the initial test model to obtain a test model;
and compiling the test model to obtain test data.
Optionally, connecting the selected at least one functional module to obtain an initial test model, including:
and under the condition that a plurality of selected functional modules are available, acquiring a preset functional module connection rule, and connecting the selected functional modules according to the functional module connection rule to obtain an initial test model.
Optionally, setting a generalized interface by using the production attribute information to obtain an interface model, including:
acquiring interface information when a controller to be tested is in hardware connection with a semi-physical simulator; the semi-physical simulation machine is a semi-physical simulation machine in a semi-physical simulation test rack corresponding to the production attribute information;
adjusting a generalized interface to obtain an initial interface model matched with the interface information;
and establishing a mapping relation between the initial interface model and the interface information to obtain an interface model.
Optionally, connecting the interface model and the initial test model to obtain a test model, including:
and acquiring a model interface definition rule, and connecting the interface model to a corresponding position in the initial test model according to the model interface definition rule to obtain the test model.
Optionally, compiling the test model to obtain test data, including:
configuring a compiling environment corresponding to the production attribute information;
and compiling the test model in the compiling environment to obtain test data.
Optionally, in the process of compiling the test model, the method further includes:
and if the compiling error occurs, returning to the step of configuring the compiling environment corresponding to the production attribute information, and outputting the compiling environment.
Optionally, after the interface model and the initial test model are connected to obtain a test model, the method further includes:
and performing function verification on the test model, and if the test model passes the verification, executing the step of compiling the test model to obtain test data.
Optionally, performing functional verification on the test model includes:
verifying whether the function of the functional module in the test model is normal;
verifying whether an interface model in the test model meets an interface definition rule of a semi-physical simulator corresponding to the production attribute information;
and verifying whether the test model can normally operate.
Optionally, in a case that the test model is not verified, the method further includes:
and acquiring error prompt information when the verification fails, and determining an abnormal reason corresponding to the error prompt information.
A test data generation device is applied to a controller, a plurality of functional modules with different functions are stored in the controller after the controller to be tested is subjected to function splitting, and the test model generation device comprises:
the request receiving module is used for receiving a test data generation request; the test data generation request comprises production attribute information of the semi-physical simulation test bench and at least one functional module selected from the plurality of functional modules with different functions;
the connection module is used for connecting the at least one selected functional module to obtain an initial test model;
the model generation module is used for setting a universal interface by using the production attribute information to obtain an interface model, and connecting the interface model with the initial test model to obtain a test model;
and the compiling module is used for compiling the test model to obtain test data.
A controller, comprising: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to execute the above test data generation method.
A test data generation system comprises the controller, a semi-physical simulator and a controller to be tested; the semi-physical simulator is respectively connected with the controller to be tested and the controller;
the controller is used for transmitting the test data to the semi-physical simulation machine;
and the semi-physical simulator is used for operating the test data so as to realize the test of the controller to be tested.
Compared with the prior art, the invention has the following beneficial effects:
the invention provides a method, a device, a system and a controller for generating test data, wherein a generalized interface is set by using production attribute information to obtain an interface model, namely the generalized interface can be set to obtain the interface model corresponding to a required manufacturer, a plug-in for generating the interface model is not required to be installed in a test data generating tool, so that the problems of unloading and reinstalling the plug-in when a semi-physical simulation test bench of different manufacturers is replaced are solved, and the controller can be used for generating the test data used when the semi-physical simulation test benches of different manufacturers are generated. Further, in the invention, when the initial test model is generated, at least one functional module is selected from a plurality of functional modules with different functions, and then the selected at least one functional module is connected, compared with a mode of combining smaller components, the generation efficiency of the initial test model can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for generating test data according to an embodiment of the present invention;
fig. 2 is a scene schematic diagram of a method for generating test data according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for generating test data according to another embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device for generating test data according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
During testing, a plug-in corresponding to a manufacturer of a used semi-physical simulation test bench needs to be installed in a test model generation tool so that the test model generation tool generates an interface model corresponding to the manufacturer based on the plug-in, and then generates test data based on data such as the interface model and the like and loads the test data into a semi-physical simulation machine.
In the process of testing by using the existing semi-physical simulation test bench, a test model generation tool arranged in an upper computer is needed, such as a Matlab/Simulink tool, to build a semi-physical simulation test model, which is called a test model for short.
For different manufacturers of semi-physical simulation test benches, such as NI, Vector, dsp, OPAL-RT, etc., when building test models, and when building test models based on Matlab (matrix laboratory)/Simulink tools, the used interface models have large differences, and meanwhile, different manufacturers compile the test models and generate different compiling environments of executable files, thereby causing testers to build specific test models for each semi-physical simulation platform. When a test model is built, a plug-in of the manufacturer needs to be loaded into the Matlab/Simulink tool, and then the Matlab/Simulink tool uses the plug-in to generate an interface model corresponding to the manufacturer and a subsequent compiling process. If the manufacturer of the semi-physical simulation test bench needs to be replaced, the plug-in unit of the original manufacturer needs to be unloaded, and then the plug-in unit of a new manufacturer is installed into the Matlab/Simulink tool. The operation is complex, and further the simulation test complexity is high.
For example, for an existing NI and OPAL-RT two sets of motor controller semi-physical simulation test benches in a certain department, because differences between test models and compiling environments in the NI semi-physical simulation test bench and the OPAL-RT semi-physical simulation test bench cannot be directly multiplexed with each other, in the existing solution, a tester needs to install a plug-in corresponding to NI into a Matlab/Simulink tool, then uses the Matlab/Simulink tool to generate a set of motor controller test models a corresponding to the NI semi-physical simulation test bench, and needs to compile the test models a into specific executable files according to the compiling environment defined by NI and download the executable files into corresponding semi-physical simulation machines.
Then, unloading the plug-in corresponding to NI in the Matlab/Simulink tool, installing the plug-in corresponding to OPAL-RT, then using the plug-in to build another set of motor controller test model B based on the OPAL-RT semi-physical simulation test bench, and compiling the test model B into a specific executable file according to the compiling environment defined by the OPAL-RT and downloading the executable file into a corresponding semi-physical simulation machine. Both of them have different test model interface definitions and compiling environments, so the tester must first uninstall the plug-in and install a new plug-in.
From the above, if a manufacturer needs to replace the semi-physical simulation test bench many times, the plug-in unit needs to be repeatedly unloaded and installed, and the operation is complex. The inventor finds that if the test model can be generated for different manufacturers of the semi-physical simulation test bench without installing additional plug-ins, the problem of complex operation caused by the installation of the plug-ins can be avoided.
Furthermore, in the embodiment of the invention, an initial test model is generated by using a Matlab/Simulink tool in an upper computer, and then the Matlab/Simulink tool is controlled by using upper computer software to realize the generation and subsequent compiling processes of an interface model, namely, the functions of the original plug-in are realized by adopting a software mode, so that the problem of complex operation caused by repeatedly installing the plug-in can be avoided.
Specifically, in the embodiment of the present invention, the production attribute information is used to set the generic interface to obtain the interface model, that is, the present invention can set the generic interface to obtain the interface model corresponding to the required manufacturer, and it is no longer necessary to install a plug-in for generating the interface model in the test data generation tool, thereby avoiding the problem that the plug-in needs to be uninstalled and reinstalled when the semi-physical simulation test racks of different manufacturers are replaced, and further, the controller can be used to generate the test data used when the semi-physical simulation test racks of different manufacturers are generated. Further, in the invention, when the initial test model is generated, at least one functional module is selected from a plurality of functional modules with different functions, and then the selected at least one functional module is connected, compared with a mode of combining smaller components, the generation efficiency of the initial test model can be improved.
On the basis of the above, the embodiment of the present invention provides a method for generating test data, which is applied to a controller, where the controller in this embodiment is the above-mentioned upper computer.
The controller is stored with a plurality of functional modules with different functions after the function of the controller to be tested is split.
Specifically, in the original Matlab/Simulink tool, when the test model is built, the components are manually selected in a dragging mode and assembled, the components in the embodiment can be photovoltaic panels, photovoltaic panel connecting lines, photovoltaic panel supporting pieces and the like, technicians can select the photovoltaic panels, the photovoltaic panel connecting lines and the photovoltaic panel supporting pieces and connect the photovoltaic panels, and the photovoltaic array model is obtained. And because the assembly is smaller, the splicing of a plurality of assemblies is easy to make mistakes, so that the problem of error of the generated test model is caused. In order to avoid the technical problem, the method can be realized in a functional module mode, namely, a plurality of assemblies are assembled into the functional module in advance, then the functional module is spliced in a mode of dragging the functional module directly when the test model is generated, and compared with the mode of assembling the assemblies with smaller granularity, the error rate of the generated test model can be reduced.
In practical application, a tester decomposes and manufactures specific functional modules according to the specific functional characteristics of the controller to be tested, such as the same functional modules of the controller to be tested in different semi-physical simulation test benches, and adds the functional modules into a test model library.
For example, the semi-physical simulation test model of the light storage controller can be decomposed into a PV photovoltaic array model (function module A), an inverter switch model (function module B) and a power grid model (function module C); and the tester specifically manufactures the functional module according to the function of the specific functional module and adds the functional module into the test module library, so that the later tester can automatically build a test model by selecting the specific functional module in the upper computer. The test model library may include a plurality of specific modules for the same functional module, for example, the test model library includes a power grid model, the power grid model further includes a 17 bus power grid model or a 19 bus power grid model for a tester to select, and the same inverter model further includes a two-level inverter model and a three-level inverter model.
Subsequently, according to the semi-physical simulation test requirement of the controller to be tested, a tester selects a specific functional module from the test model library through the upper computer and automatically generates a test model through upper computer matched software.
By the method for constructing the test model library in the embodiment of the invention, the original test model is subjected to modularization processing according to function division, and the appropriate test module is selected by the upper computer to automatically generate the semi-physical simulation test model, so that the difficulty of model construction is greatly reduced.
Before starting the test model generation, the connection of the devices needs to be performed. Specifically, the connection of the upper computer in fig. 2, the semi-physical simulation machine in the semi-physical simulation test rack (for example, A, B, C three semi-physical simulation machines, each simulation machine is a simulation machine produced by a manufacturer), the DIO board/AIO board/communication board, and the controller to be tested is performed. The controller to be tested in this embodiment is the controller that needs to perform the simulation test.
When equipment is connected, the controller to be tested is connected with a DIO board card, an AIO board card and a communication board card of the semi-physical simulation machine, and the connection mode is through hard line connection. And simultaneously, the DIO board card, the AIO board card and the communication board card of the semi-physical simulator perform data interaction with the semi-physical simulator. The semi-physical simulation machine is connected with the upper computer through a TCP/IP network cable, and then the hardware connection process of the controller to be tested, the semi-physical simulation machine and the upper computer can be completed. The functions of the upper computer mainly comprise parameter control and data monitoring of a semi-physical simulation test model of the controller to be tested and a model matching function.
Referring to fig. 1, a method of generating test data may include:
and S11, receiving a test data generation request.
The test data generation request includes production attribute information of the semi-physical simulation test bench and at least one functional module selected from the plurality of functional modules having different functions.
Specifically, the tester can select a proper functional module from the test model library through the upper computer according to the semi-physical simulation test requirement of the controller to be tested, and the selection mode can adopt a dragging mode.
The attribute information of the function module is preset, and the attribute information may be the number of interfaces to be set by each function module, the attribute of each interface, the position of the interface set in the function module, and the connection relationship between the interface of the function module and the interfaces of other function modules.
Then, the tester inputs the production attribute information of the semi-physical simulation test bench in the upper computer, and the production attribute information can be identification information of a manufacturer. Or the specific model of the semi-physical simulation test bench can represent the information of the manufacturer of the semi-physical simulation test bench, such as the NI semi-physical simulation test bench.
After the functional module and the production attribute information are input, the upper computer is considered to receive the test data generation request, then the test data generation request is responded, and the subsequent operation is executed.
In order that the invention may be clearly understood by those skilled in the art, an illustration thereof will now be given.
According to the scheme, a semi-physical simulation test is performed on a motor controller on the basis of an NI semi-physical simulation test bench, a permanent magnet synchronous motor model is adopted as a motor model, and a two-level IGBT inverter model is adopted as an inverter model. Firstly, a tester accesses a controller to be tested into the NI platform semi-physical simulation machine, and then connects the upper computer with the NI platform semi-physical simulation machine.
On the basis of completing hardware connection, a tester utilizes an upper computer to select corresponding model function blocks in a test model library, namely a permanent magnet synchronous motor model and a two-level IGBT inverter model, and sets a current semi-physical simulation test rack as an NI semi-physical simulation test rack through the upper computer.
And S12, connecting the selected at least one functional module to obtain an initial test model.
And under the condition that a plurality of selected functional modules are available, acquiring a preset functional module connection rule, and connecting the selected functional modules according to the functional module connection rule to obtain an initial test model.
In practical application, if the tester selects a plurality of function modules, a preset function module connection rule is obtained, where the preset function module connection rule may be a connection relationship between interfaces of the function modules in the attribute information of the function modules and interfaces of other function modules, or a total connection relationship obtained by summarizing connection relationships in the attribute information of each function module.
The connection relationship between the interface of the functional module and the interfaces of other functional modules is preset, and then the functional modules are connected according to the connection relationship, for example, the interface of the functional module A is connected with the interface of the functional module B, and an initial test model is obtained. The generation process of the initial test model is generated in the Matlab/Simulink tool.
In this step, only an initial test model including a plurality of functional modules and connection relationships between the functional modules, such as a PV photovoltaic array model of a specific platform, is generated, and an interface model corresponding to a manufacturer of the semi-physical simulation test bench is not generated yet, and the interface model is generated in step S13.
S13, setting a universal interface by using the production attribute information to obtain an interface model, and connecting the interface model with the initial test model to obtain a test model.
The generalized interface in this embodiment is a preset interface, and one end of the interface (for example, the C interface) is connected to the function module, and the other end (the D interface) is connected to the DIO/AIO/communication board in fig. 2.
For the C interface connected to the functional module, the C interface may be adjusted according to the number of interfaces that each functional module should set in the attribute information of the functional module, the attribute of each interface, and the position where the interface is set in the functional module.
If one functional module needs an X-type interface and the other functional module needs a Y-type interface, two interfaces may be set, and the ends of the two interfaces connected to the functional module are set according to the attribute information of the functional module.
For a D interface connected with a DIO board card/AIO board card/communication board card, a generalized interface needs to be set according to production attribute information to obtain an interface model.
Specifically, referring to fig. 3, the production attribute information is used to set a generalized interface to obtain an interface model, which may be a matching action for automatically performing a test model, where the matching action is mainly based on the initial test model, and an interface model of a controller to be tested is generated according to an interface definition of a semi-physical simulator of a specific test bench, and the interface model is integrated on the initial test model, and is mapped to a board card channel interface corresponding to the specific semi-physical simulator, so as to finally generate a complete test model capable of being matched with the semi-physical simulator applied to a specific platform.
Referring to fig. 3, setting a generalized interface using the production attribute information to obtain an interface model may include:
and S31, acquiring interface information when the controller to be tested is connected with the hardware of the semi-physical simulation machine.
The semi-physical simulation machine is a semi-physical simulation machine in the semi-physical simulation test bench corresponding to the production attribute information.
In this embodiment, according to the production attribute information, a corresponding semi-physical simulation test bench is determined, and then a semi-physical simulator in the semi-physical simulation test bench is determined.
And acquiring interface information when the controller to be tested is in hardware connection with the semi-physical simulation machine.
For example, the controller to be tested is connected with the semi-physical simulator through a DIO board card/an AIO board card/a communication board card. If the controller to be tested is connected with 6 interfaces PIN 1-6 of the DIO board card, the 6 interfaces PIN 1-6 of the DIO board card are required to be connected with the semi-physical simulation machine. At this time, the generalized interface needs to be adjusted to obtain 6 interfaces matching the 6 interfaces of PIN1-PIN6, such as VT1-CT 6. How the VT1-CT6 is connected with the PIN1-PIN6 can be preset or can be set at the present, such as connecting the VT1 with the CT1, connecting the CT6 with the PIN6, and the like.
And S32, adjusting the generalized interface to obtain an initial interface model matched with the interface information.
Specifically, the interfaces connected to the DIO/AIO/communication boards in the generalized interface may be adjusted to the above-mentioned 6 interfaces VT1-CT 6.
S33, establishing a mapping relation between the initial interface model and the interface information to obtain an interface model.
Specifically, if VT1 is connected with CT1 and CT6 is connected with PIN6, a mapping relationship between VT1 and CT1 and a mapping relationship between CT6 and PIN6 are established, and then interface connection and data communication are performed according to the mapping relationships.
After the mapping relation is established, an interface model can be obtained, wherein the interface model is matched with a manufacturer of the semi-physical simulation test bench. The process of establishing the interface model is realized by adopting a software control Matlab/Simulink tool in an upper computer.
And after the interface model is obtained, connecting the interface model and the initial test model according to the interface definition to obtain the test model.
Specifically, a model interface definition rule is obtained, and the interface model is connected to a corresponding position in the initial test model according to the model interface definition rule, so as to obtain the test model.
If one functional module needs an X-type interface and the other functional module needs a Y-type interface, two interfaces may be provided, and the X-type interface and the Y-type interface are connected to the corresponding functional modules, respectively.
Still taking the above-mentioned motor controller as an example, in step S12, the upper computer configures software to control the Matlab/Simulink tool to drag and automatically generate independent models of the permanent magnet synchronous motor model and the two-level IGBT inverter model, and perform automatic connection. And then, automatically generating an interface model of a specific motor controller according to the NI semi-physical simulation machine through step S13, wherein the interface model comprises a signal control and signal acquisition interface model of the motor controller to be tested, a permanent magnet synchronous motor model and a two-level IGBT inverter model in a test model, integrating the interface model of the motor controller, the permanent magnet synchronous motor model and the two-level IGBT inverter model through model interface definition, and automatically generating a test model of the NI semi-physical simulation platform, wherein the test model is a final test model in the NI semi-physical simulation test bench.
The test model generated in this embodiment is a semi-physical simulation test model corresponding to the test bench, and a test model compiling environment may be subsequently set according to a specific semi-physical simulator, so that the simulation test model is compiled into an executable file and downloaded to the corresponding semi-physical simulator, thereby completing a subsequent semi-physical simulation test.
And S14, compiling the test model to obtain test data.
In practical application, the step can be realized by controlling a Matlab/Simulink tool through upper computer software.
Specifically, a compiling environment corresponding to the production attribute information may be configured, and the test model is compiled in the compiling environment to obtain test data. After the test model is compiled and an executable file (such as an executable code) is generated, the executable file is automatically downloaded to a specific semi-physical simulation machine for the next semi-physical simulation test of the controller to be tested.
Specifically, by configuring a compiling environment for the test model, a tester needs to configure a corresponding model compiling environment according to the semi-physical simulator of the specific test bench through the upper computer, and automatically compiles the test model in the compiling environment to obtain test data.
Still taking the above-mentioned motor controller as an example, a tester configures a compiling environment of the test model according to the NI semi-physical simulation machine through the upper computer and compiles the test model based on the compiling environment, and after the test model is compiled successfully, the test model generates an executable file that can be identified and run by the NI semi-physical simulation machine, and the executable file is automatically downloaded to the NI semi-physical simulation machine for the later-stage motor controller semi-physical simulation test.
In practical applications, the compiling process may also have a compiling error or a compiling exception. At this time, if a compiling error or a compiling abnormality occurs, returning to the step of configuring the compiling environment corresponding to the production attribute information, and outputting the compiling environment, so that a tester can confirm whether the compiling environment is matched and meets the configuration requirements of the concrete platform semi-physical simulator.
In this embodiment, the production attribute information is used to set the generalized interface to obtain the interface model, that is, the present invention can set the generalized interface to obtain the interface model corresponding to the required manufacturer, and it is no longer necessary to install a plug-in for generating the interface model in the test data generation tool, so as to avoid the problem that the plug-in needs to be uninstalled and reinstalled when the semi-physical simulation test racks of different manufacturers are replaced, and further, the controller can be used to generate the test data used when the semi-physical simulation test racks of different manufacturers are generated. Further, in the invention, when the initial test model is generated, at least one functional module is selected from a plurality of functional modules with different functions, and then the selected at least one functional module is connected, compared with a mode of combining smaller components, the generation efficiency of the initial test model can be improved.
In addition, in the invention, a tester selects a proper function module from a test model library through an upper computer according to the used semi-physical simulator, an initial test model can be automatically generated, a corresponding interface model is obtained according to a semi-physical simulator platform, the interface model and the initial test model are connected, the construction work of a corresponding semi-physical simulation test overall model can be automatically completed, a specific model compiling environment is configured according to different semi-physical simulator platforms, and finally a corresponding executable file is generated. Due to the fact that plug-ins do not need to be installed any more, the upper computer can generate test models corresponding to different test racks according to test requirements and carry out unified compiling, the plug-ins do not need to be installed for many times, and the situation that operation is complex due to the fact that the plug-ins are installed is avoided.
In addition, according to the invention, a tester can configure parameters of the semi-physical simulation machines of different platforms and automatically generate a specific semi-physical simulation test model by controlling the upper computer, and the test model can be automatically downloaded into the corresponding semi-physical simulation machine, namely, the generation and compilation of the test model can be automatically realized, the manual participation is less, and the labor cost is saved. In addition, the invention can also greatly reduce the difficulty of building the test model, is suitable for different semi-physical simulation test benches and greatly improves the test efficiency.
In the above embodiment, the test model is constructed, and after the test model is obtained, the test model is compiled, and if the constructed test model is inaccurate, a subsequent compiling process may also be mistaken, so that the test model may be functionally verified after the interface model and the initial test model are connected to obtain the test model, and if the verification is passed, the test model is compiled to obtain the test data.
In another implementation manner of the present invention, a specific process of performing function verification on the test model is provided, and specifically, the following three functions may be verified:
1) and verifying whether the function of the functional module in the test model is normal.
In this step, it is verified whether the functional module is a functional module required for the simulation test and can normally operate.
2) And verifying whether an interface model in the test model meets the interface definition rule of the semi-physical simulator corresponding to the production attribute information.
The step is to verify whether the interface model is set according to the interface definition rule of the semi-physical simulator.
3) And verifying whether the test model can normally operate.
Specifically, the test model may be actually run to determine whether the test model can be normally run.
If the three functions are verified to be passed, the test model is correct and has no error, if one function is not verified to be passed, error information is prompted on a display interface, error prompt information when the verification is not passed is obtained, and an abnormal reason corresponding to the error prompt information is determined.
Specifically, the fault analysis module in the upper computer can be used for realizing that the corresponding relation between the prompt information and the abnormal reason is preset, when the interface prompt error information appears, the corresponding relation is searched, the corresponding abnormal reason is obtained, and the corresponding abnormal reason is fed back to the data monitoring interface of the upper computer. And (4) the abnormal reason may appear in the generation process of the test model, and the tester analyzes the test model according to the abnormal reason fed back by the fault analysis module and generates the test model again.
In this embodiment, after the test model is generated, the test model can be verified to avoid the occurrence of a subsequent test model compiling error due to a test model generating error.
Optionally, on the basis of the embodiment of the method for generating test data, another embodiment of the present invention provides a device for generating test data, which is applied to a controller, where a plurality of functional modules with different functions, obtained by splitting functions of a controller to be tested, are stored in the controller, and the device for generating test models includes:
a request receiving module 11, configured to receive a test data generation request; the test data generation request comprises production attribute information of the semi-physical simulation test bench and at least one functional module selected from the plurality of functional modules with different functions;
a connection module 12, configured to connect the selected at least one function module to obtain an initial test model;
the model generation module 13 is configured to set a generalized interface by using the production attribute information to obtain an interface model, and connect the interface model and the initial test model to obtain a test model;
and the compiling module 14 is used for compiling the test model to obtain test data.
Further, the connection module 12 is specifically configured to:
and under the condition that a plurality of selected functional modules are available, acquiring a preset functional module connection rule, and connecting the selected functional modules according to the functional module connection rule to obtain an initial test model.
Further, the model generation module 13 is configured to set a generalized interface using the production attribute information, and when obtaining an interface model, is specifically configured to:
the method comprises the steps of obtaining interface information when a controller to be tested is in hardware connection with a semi-physical simulation machine, adjusting a universal interface to obtain an initial interface model matched with the interface information, and establishing a mapping relation between the initial interface model and the interface information to obtain an interface model. The semi-physical simulation machine is a semi-physical simulation machine in the semi-physical simulation test bench corresponding to the production attribute information.
Further, the model generation module 13 is configured to connect the interface model and the initial test model, and when obtaining the test model, is specifically configured to:
and acquiring a model interface definition rule, and connecting the interface model to a corresponding position in the initial test model according to the model interface definition rule to obtain the test model.
Further, compiling module 14 is specifically configured to:
and configuring a compiling environment corresponding to the production attribute information, and compiling the test model in the compiling environment to obtain test data.
Further, compiling module 14 is further configured to:
and if the compiling error occurs, returning to the step of configuring the compiling environment corresponding to the production attribute information, and outputting the compiling environment.
Further, the test data generation device further includes:
the function verification module is used for performing function verification on the test model;
the compiling module 14 is further configured to compile the test model to obtain test data if the verification is passed.
Further, the function verification module is specifically configured to:
verifying whether the function of the functional module in the test model is normal;
verifying whether an interface model in the test model meets an interface definition rule of a semi-physical simulator corresponding to the production attribute information;
and verifying whether the test model can normally operate.
Further, the function verification module is further configured to, when the test model fails to be verified, obtain error prompt information when the verification fails, and determine an abnormality cause corresponding to the error prompt information.
In this embodiment, the production attribute information is used to set the generalized interface to obtain the interface model, that is, the present invention can set the generalized interface to obtain the interface model corresponding to the required manufacturer, and it is no longer necessary to install a plug-in for generating the interface model in the test data generation tool, so as to avoid the problem that the plug-in needs to be uninstalled and reinstalled when the semi-physical simulation test racks of different manufacturers are replaced, and further, the controller can be used to generate the test data used when the semi-physical simulation test racks of different manufacturers are generated. Further, in the invention, when the initial test model is generated, at least one functional module is selected from a plurality of functional modules with different functions, and then the selected at least one functional module is connected, compared with a mode of combining smaller components, the generation efficiency of the initial test model can be improved.
It should be noted that, for the working process of each module in this embodiment, please refer to the corresponding description in the above embodiments, which is not described herein again.
Optionally, on the basis of the embodiments of the method and the apparatus for generating test data, another embodiment of the present invention provides a controller, including: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is used to execute the above test data generation method.
Further, on the basis of the embodiment of the controller, another embodiment of the invention provides a test data generation system, which comprises the controller, a semi-physical simulator and a controller to be tested; the semi-physical simulation machine is respectively connected with the controller to be tested and the controller, and the specific connection relation refers to the corresponding description.
The controller is used for transmitting the test data to the semi-physical simulation machine;
and the semi-physical simulator is used for operating the test data so as to realize the test of the controller to be tested.
Please refer to the above description for the specific functions of the controller and the semi-physical simulation machine.
In this embodiment, the production attribute information is used to set the generalized interface to obtain the interface model, that is, the present invention can set the generalized interface to obtain the interface model corresponding to the required manufacturer, and it is no longer necessary to install a plug-in for generating the interface model in the test data generation tool, so as to avoid the problem that the plug-in needs to be uninstalled and reinstalled when the semi-physical simulation test racks of different manufacturers are replaced, and further, the controller can be used to generate the test data used when the semi-physical simulation test racks of different manufacturers are generated. Further, in the invention, when the initial test model is generated, at least one functional module is selected from a plurality of functional modules with different functions, and then the selected at least one functional module is connected, compared with a mode of combining smaller components, the generation efficiency of the initial test model can be improved.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims (12)
1. A method for generating test data is applied to a controller, wherein a plurality of functional modules with different functions obtained by splitting functions of a controller to be tested are stored in the controller, and the method for generating the test model comprises the following steps:
receiving a test data generation request; the test data generation request comprises production attribute information of the semi-physical simulation test bench and at least one functional module selected from the plurality of functional modules with different functions;
connecting the selected at least one functional module to obtain an initial test model;
setting a universal interface by using the production attribute information to obtain an interface model, and connecting the interface model with the initial test model to obtain a test model;
and compiling the test model to obtain test data.
2. The method according to claim 1, wherein connecting the selected at least one functional module to obtain an initial test model comprises:
and under the condition that a plurality of selected functional modules are available, acquiring a preset functional module connection rule, and connecting the selected functional modules according to the functional module connection rule to obtain an initial test model.
3. The generation method according to claim 1, wherein setting a generalized interface using the production attribute information to obtain an interface model comprises:
acquiring interface information when a controller to be tested is in hardware connection with a semi-physical simulator; the semi-physical simulation machine is a semi-physical simulation machine in a semi-physical simulation test rack corresponding to the production attribute information;
adjusting a generalized interface to obtain an initial interface model matched with the interface information;
and establishing a mapping relation between the initial interface model and the interface information to obtain an interface model.
4. The method of claim 1, wherein connecting the interface model and the initial test model to obtain a test model comprises:
and acquiring a model interface definition rule, and connecting the interface model to a corresponding position in the initial test model according to the model interface definition rule to obtain the test model.
5. The method of claim 1, wherein compiling the test model to obtain test data comprises:
configuring a compiling environment corresponding to the production attribute information;
and compiling the test model in the compiling environment to obtain test data.
6. The generation method according to claim 5, further comprising, during the compiling of the test model:
and if the compiling error occurs, returning to the step of configuring the compiling environment corresponding to the production attribute information, and outputting the compiling environment.
7. The method of generating as claimed in claim 1, wherein after connecting the interface model and the initial test model to obtain a test model, further comprising:
and performing function verification on the test model, and if the test model passes the verification, executing the step of compiling the test model to obtain test data.
8. The method of generating as claimed in claim 7, wherein functionally validating the test model comprises:
verifying whether the function of the functional module in the test model is normal;
verifying whether an interface model in the test model meets an interface definition rule of a semi-physical simulator corresponding to the production attribute information;
and verifying whether the test model can normally operate.
9. The method according to claim 7, further comprising, in case the test model is not verified, the step of:
and acquiring error prompt information when the verification fails, and determining an abnormal reason corresponding to the error prompt information.
10. The utility model provides a generation device of test data, its characterized in that is applied to the controller, a plurality of functional modules that have different functions after the controller that will await measuring carries out the function split in the controller have been stored to the controller, test model generation device includes:
the request receiving module is used for receiving a test data generation request; the test data generation request comprises production attribute information of the semi-physical simulation test bench and at least one functional module selected from the plurality of functional modules with different functions;
the connection module is used for connecting the at least one selected functional module to obtain an initial test model;
the model generation module is used for setting a universal interface by using the production attribute information to obtain an interface model, and connecting the interface model with the initial test model to obtain a test model;
and the compiling module is used for compiling the test model to obtain test data.
11. A controller, comprising: a memory and a processor;
wherein the memory is used for storing programs;
the processor calls a program and is arranged to perform the method of generating test data according to claims 1-9.
12. A test data generation system comprising the controller of claim 11, and further comprising a semi-physical simulator and a controller under test; the semi-physical simulator is respectively connected with the controller to be tested and the controller;
the controller is used for transmitting the test data to the semi-physical simulation machine;
and the semi-physical simulator is used for operating the test data so as to realize the test of the controller to be tested.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110764143.XA CN113342693A (en) | 2021-07-06 | 2021-07-06 | Test data generation method, device and system and controller |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110764143.XA CN113342693A (en) | 2021-07-06 | 2021-07-06 | Test data generation method, device and system and controller |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113342693A true CN113342693A (en) | 2021-09-03 |
Family
ID=77482706
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110764143.XA Pending CN113342693A (en) | 2021-07-06 | 2021-07-06 | Test data generation method, device and system and controller |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113342693A (en) |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1519721A (en) * | 2003-01-23 | 2004-08-11 | 英业达股份有限公司 | Dynamic extendable computer testing system as well as method |
CN103488835A (en) * | 2013-09-26 | 2014-01-01 | 国家电网公司 | Simulation platform and method for dispatching automation system |
CN103559112A (en) * | 2013-11-05 | 2014-02-05 | 北京经纬恒润科技有限公司 | Software fault injection method and system |
CN103984335A (en) * | 2013-02-07 | 2014-08-13 | 国家电网公司 | Testing method and system for power distribution automation system |
CN107122297A (en) * | 2017-04-18 | 2017-09-01 | 上海雷腾软件股份有限公司 | The method and apparatus that request message for test interface is generated |
DE102017106023A1 (en) * | 2016-03-22 | 2017-09-28 | Tata Consultancy Services Limited | Method and system for automated user interface testing via model-driven techniques |
CN107944193A (en) * | 2017-12-15 | 2018-04-20 | 四川汉科计算机信息技术有限公司 | Avionics semi-matter simulating system |
CN109376091A (en) * | 2018-10-31 | 2019-02-22 | 中国银行股份有限公司 | A kind of generation method and device of interface testing data |
CN109948201A (en) * | 2019-03-04 | 2019-06-28 | 中国人民解放军国防大学联合作战学院 | A kind of model component management system and scheduling implementation method based on platform and plug-in unit |
CN111026071A (en) * | 2018-10-09 | 2020-04-17 | 株洲中车时代电气股份有限公司 | Simulation test method and system for rail vehicle control unit |
CN111580409A (en) * | 2020-04-02 | 2020-08-25 | 北京机电工程研究所 | Fault simulation test method for real-time embedded system |
CN112925706A (en) * | 2021-02-08 | 2021-06-08 | 北京世冠金洋科技发展有限公司 | Data processing method and device |
-
2021
- 2021-07-06 CN CN202110764143.XA patent/CN113342693A/en active Pending
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1519721A (en) * | 2003-01-23 | 2004-08-11 | 英业达股份有限公司 | Dynamic extendable computer testing system as well as method |
CN103984335A (en) * | 2013-02-07 | 2014-08-13 | 国家电网公司 | Testing method and system for power distribution automation system |
CN103488835A (en) * | 2013-09-26 | 2014-01-01 | 国家电网公司 | Simulation platform and method for dispatching automation system |
CN103559112A (en) * | 2013-11-05 | 2014-02-05 | 北京经纬恒润科技有限公司 | Software fault injection method and system |
DE102017106023A1 (en) * | 2016-03-22 | 2017-09-28 | Tata Consultancy Services Limited | Method and system for automated user interface testing via model-driven techniques |
CN107122297A (en) * | 2017-04-18 | 2017-09-01 | 上海雷腾软件股份有限公司 | The method and apparatus that request message for test interface is generated |
CN107944193A (en) * | 2017-12-15 | 2018-04-20 | 四川汉科计算机信息技术有限公司 | Avionics semi-matter simulating system |
CN111026071A (en) * | 2018-10-09 | 2020-04-17 | 株洲中车时代电气股份有限公司 | Simulation test method and system for rail vehicle control unit |
CN109376091A (en) * | 2018-10-31 | 2019-02-22 | 中国银行股份有限公司 | A kind of generation method and device of interface testing data |
CN109948201A (en) * | 2019-03-04 | 2019-06-28 | 中国人民解放军国防大学联合作战学院 | A kind of model component management system and scheduling implementation method based on platform and plug-in unit |
CN111580409A (en) * | 2020-04-02 | 2020-08-25 | 北京机电工程研究所 | Fault simulation test method for real-time embedded system |
CN112925706A (en) * | 2021-02-08 | 2021-06-08 | 北京世冠金洋科技发展有限公司 | Data processing method and device |
Non-Patent Citations (3)
Title |
---|
XIUHAI CUI 等: "A Universal Test System Framework and Its Application on Satellite Test", 《2017 ASSOCIATION FOR COMPUTING MACHINERY》, pages 283 - 288 * |
李刚 等: "电子设备测试装置的通用测试工装及其测试方法", pages 71 - 74 * |
马长林: "《数字液压缸建模仿真及测试》", 31 August 2020, pages: 28 - 31 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109740222B (en) | Testing device and system for automobile networking scene | |
CN104281518A (en) | Terminal application test method, device, system and platform and mobile terminal | |
CN109726061B (en) | SoC chip verification method | |
CN110928556A (en) | Automatic program burning method and device for railway vehicle, and testing method and system | |
CN110501998B (en) | BMS hardware in-loop test system and test method | |
CN110990289B (en) | Method and device for automatically submitting bug, electronic equipment and storage medium | |
CN114817900A (en) | Verification method and system for over-the-air download upgrade of vehicle master control system | |
CN114513438A (en) | Over-the-air test system and method | |
CN113342693A (en) | Test data generation method, device and system and controller | |
KR20060098679A (en) | A system for checking a system in communication system and system method thereof | |
CN115455431A (en) | Method, device, terminal and medium for automatic code security detection and vulnerability repair | |
CN114492266A (en) | Chip verification method and device, electronic equipment and storage medium | |
CN115729798A (en) | Automatic testing method, device and platform for automobile | |
CN113868140A (en) | Automatic testing method and storage medium | |
CN111506981A (en) | Method, device and equipment for realizing logic simulation of nuclear power plant field control object | |
CN113392508B (en) | Integrated simulation test system for automobile power chassis | |
CN117148018B (en) | Function test system and method for power distribution module | |
CN113608996B (en) | Mirror image compiling test method, system, device and readable storage medium | |
CN114090454B (en) | Interface automation test method, device, equipment and storage medium | |
CN114138645B (en) | Servo automatic testing method and device | |
CN117851253A (en) | TEST environment building method, system, medium and device based on ECU-TEST | |
Yu et al. | Research on Automotive UDS Diagnostic Protocol Stack Test System | |
CN112114868B (en) | Real-time control device for task of working vehicle and protocol adaptation method thereof | |
CN111736490B (en) | Combined simulation method, device and system and electronic equipment | |
CN117872209A (en) | Universal test equipment for direct-current power supply module and test method thereof |
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 |