CN112084734A - Test result processing method and device and electronic equipment - Google Patents
Test result processing method and device and electronic equipment Download PDFInfo
- Publication number
- CN112084734A CN112084734A CN202010961899.9A CN202010961899A CN112084734A CN 112084734 A CN112084734 A CN 112084734A CN 202010961899 A CN202010961899 A CN 202010961899A CN 112084734 A CN112084734 A CN 112084734A
- Authority
- CN
- China
- Prior art keywords
- output
- data
- expected
- simulation
- obtaining
- 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 151
- 238000003672 processing method Methods 0.000 title abstract description 8
- 238000004088 simulation Methods 0.000 claims abstract description 171
- 238000000034 method Methods 0.000 claims abstract description 31
- 238000012545 processing Methods 0.000 claims abstract description 16
- 238000004364 calculation method Methods 0.000 claims description 43
- 230000006870 function Effects 0.000 claims description 21
- 238000004422 calculation algorithm Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 9
- 230000002159 abnormal effect Effects 0.000 description 8
- 238000012512 characterization method Methods 0.000 description 1
- 230000003247 decreasing effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/30—Circuit design
- G06F30/32—Circuit design at the digital level
- G06F30/333—Design for testability [DFT], e.g. scan chain or built-in self-test [BIST]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The application discloses a test result processing method, a test result processing device and electronic equipment, wherein the method comprises the following steps: obtaining expected output data of a Functional Model Unit (FMU) model, wherein the expected output data comprises at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model; obtaining a simulation operation result of the FMU model for performing simulation operation on test input data; and obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, wherein the simulation test result represents whether the function of the FMU model is normal or not.
Description
Technical Field
The present application relates to the field of simulation technologies, and in particular, to a method and an apparatus for processing a test result, and an electronic device.
Background
In Functional model Unit FMU (Functional Mock-up Unit) testing, an FMU is typically tested using a large number of test cases. Each test case generates a large amount of output data in one simulation process.
At present, after the simulation output data is obtained, whether the simulation output data meets expectations is generally compared manually by a worker, so that the problem of low efficiency caused by large workload exists.
Disclosure of Invention
In view of the above, the present application provides a method, an apparatus and an electronic device for processing a test result, including:
a method of test result processing, the method comprising:
obtaining expected output data of a Functional Model Unit (FMU) model, wherein the expected output data comprises at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model;
obtaining a simulation operation result of the FMU model for performing simulation operation on test input data;
and obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, wherein the simulation test result represents whether the function of the FMU model is normal or not.
Preferably, the above method, obtaining the simulation test result of the FMU model according to the output value corresponding to each output variable at each operation time in the simulation operation result and the expected value corresponding to the output value, includes:
and comparing the output value of each output variable in the simulation operation result at each operation moment with the corresponding expected value to obtain the simulation test result of the FMU model.
The above method, preferably, further comprises:
obtaining tolerance data corresponding to each output variable;
obtaining a simulation test result of the FMU model according to an output value corresponding to each output variable in the simulation operation result at each operation time and an expected value corresponding to the output value, wherein the simulation test result comprises:
obtaining deviation data corresponding to each output variable according to an output value corresponding to each output variable at each operation time in the simulation operation result and an expected value corresponding to the output value;
and judging whether the deviation data corresponding to each output variable is matched with the corresponding tolerance data so as to obtain a simulation test result of the FMU model.
The above method, preferably, the tolerance data at least comprises: a deviation calculation mode and a deviation threshold corresponding to the deviation calculation mode, wherein the deviation calculation mode and the deviation threshold correspond to the variable type of the output variable;
wherein, the deviation calculation mode is as follows: a relative difference calculation mode or an absolute difference calculation mode for the continuous variable, or the deviation calculation mode is as follows: time tolerance calculation for discrete variables.
In the above method, it is preferable that, when the output variable is a continuous variable, the obtaining of the deviation data corresponding to each of the output variables based on the output value corresponding to each of the output variables at each of the operation times and the expected value corresponding to the output value in the simulation operation result includes:
comparing the output value of each output variable in the simulation operation result at each operation time with the corresponding expected value thereof to obtain a relative difference or an absolute difference between the output value of each output variable at each operation time and the corresponding expected value thereof.
In the above method, it is preferable that, when the output variables are discrete variables, the obtaining deviation data corresponding to each of the output variables based on an output value corresponding to each of the output variables at each of the operation times and an expected value corresponding to the output value in the simulation operation result includes:
comparing the output value corresponding to each output variable in the simulation operation result at each operation time with the corresponding expected value to obtain target operation time at which the output value corresponding to each output variable is different from the corresponding expected value;
and obtaining a time difference value corresponding to each output variable at least according to the target operation time.
In the above method, preferably, the matching of the deviation data corresponding to the output variable with the tolerance data corresponding to the output variable includes:
and the difference value in the deviation data corresponding to the output variable is less than or equal to the deviation threshold value in the tolerance data corresponding to the output variable.
The above method, preferably, obtaining the expected output data of the FMU model, comprises:
obtaining an expected file, wherein the expected file corresponds to the FMU model and at least comprises at least one time data and at least one output data;
and generating expected output data according to the expected file, wherein the expected output data comprises at least one output variable, the output variable at least corresponds to an expected value at the operation moment, the expected output data is at least used for generating the test case, and the test case is used for testing the FMU model and obtaining a simulation test result of the FMU model.
A test result processing apparatus, the apparatus comprising:
the FMU model comprises a data obtaining unit, a data obtaining unit and a data processing unit, wherein the data obtaining unit is used for obtaining expected output data of an FMU model, the expected output data comprises at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model;
the operation obtaining unit is used for obtaining a simulation operation result of the FMU model for carrying out simulation operation on the test input data;
and the test obtaining unit is used for obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, and the simulation test result represents whether the function of the FMU model is normal or not.
An electronic device, comprising:
a memory for storing an application program and data generated by the application program running;
a processor for executing the application to implement: obtaining expected output data of an FMU (frequency modulation unit) model, wherein the expected output data comprise at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model; obtaining a simulation operation result of the FMU model for performing simulation operation on test input data; and obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, wherein the simulation test result represents whether the function of the FMU model is normal or not.
According to the technical scheme, the test result processing method, the test result processing device and the electronic equipment disclosed by the application can obtain the simulation test result of the FMU model according to the corresponding output value of each output variable in the simulation operation result at each operation time and the expected value of the output variable in the expected output data at the operation time by obtaining the expected output data of the FMU model and simultaneously obtaining the simulation operation result of the FMU model for carrying out simulation operation on the test input data, and the simulation test result can represent whether the function of the FMU model is normal or not. Therefore, whether the simulation output result meets the expectation or not is not needed to be manually compared by a worker, and a simulation test result which can represent whether the FMU model is normal or not can be obtained through the simulation operation result and the expected output data of the FMU model, so that the efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a flowchart of a test result processing method according to an embodiment of the present disclosure;
FIG. 2 is a diagram showing a capacitance difference in an embodiment of the present application;
FIGS. 3-6 are schematic diagrams illustrating the comparison between the output and the expectation of the discrete output variable in the embodiment of the present application;
fig. 7 is a partial flowchart of a test result processing method according to an embodiment of the present application;
FIG. 8 is an exemplary diagram of desired output data in an embodiment of the present application;
fig. 9 is a schematic structural diagram of a test result processing apparatus according to a second embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to a third embodiment of the present application;
FIG. 11 is a schematic flow chart diagram illustrating an embodiment of the present application in a specific implementation;
fig. 12 is an exemplary diagram of a simulation operation result in the embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
Fig. 1 is a flowchart illustrating an implementation of a test result processing method according to an embodiment of the present invention, where the method may be applied to an electronic device capable of data processing, such as a computer or a server. The technical scheme in the embodiment is mainly used for automatically obtaining the simulation test result representing whether the FMU model is normal or not so as to improve the efficiency.
Specifically, the method in this embodiment may include the following steps:
step 101: desired output data for the FMU model is obtained.
The expected output data comprises at least one output variable, the output variable corresponds to an expected value at least one operation moment of the FMU model, and the expected value refers to an ideal value output by the output variable at the corresponding operation moment under the condition that the FMU model is normal in function.
Specifically, in this embodiment, the expected output data of the FMU model may be obtained in a test case of the FMU model, where the test case of the FMU model is generated according to an input file and an expected file, the test case includes, in addition to the expected output data, test input data, where the test input data includes at least one simulation parameter, at least one operation time, and at least one input variable, the simulation parameter corresponds to a parameter value at the operation time, and the input variable corresponds to an input value at the operation time.
It should be noted that the number of operation times in the expected output data may not be completely consistent with the operation times in the test input data, because the operation times in the expected output data are times at which the comparison between the output value and the corresponding expected value is required, and the operation times in the test input data are times at which the FMU model needs to perform one simulation operation, so the operation times in the expected output data may be completely consistent with the operation times in the test input data to represent that the comparison between the output value and the expected value at each operation time is required, or the operation times in the expected output data are a part of the operation times in the test input data to represent that the comparison between the output value and the expected value at part of the operation times is required.
Step 102: and obtaining a simulation operation result of the FMU model for performing simulation operation on the test input data.
The simulation operation result may be: and the FMU model calculates the input values of the input variables according to each calculation time in the test input data sequence based on the parameter values of the corresponding simulation parameters to obtain a result, wherein the result comprises the corresponding output value of each output variable in the FMU model at each calculation time.
It should be noted that the execution sequence between step 101 and step 102 is not limited by the execution sequence shown in the figures.
The simulation parameters are variable parameters in the FMU model, and the simulation parameters are changed in the simulation operation at each simulation time.
Step 103: and obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value.
And the simulation test result represents whether the function of the FMU model is normal or not.
Specifically, in this embodiment, the output value and the expected value may be compared to obtain a simulation test result, and if the comparison is consistent or the comparison result satisfies a certain condition, the simulation test result indicates that the FMU model functions normally, that is: the FMU model can perform normal simulation operation; if the comparison is inconsistent or the comparison result does not satisfy the condition, the simulation test result indicates that the FMU model does not function normally, namely: the FMU model cannot perform normal simulation operations.
It can be seen from the foregoing technical solutions that, in the test result processing method provided in the embodiment of the present application, the expected output data of the FMU model is obtained, and the simulation operation result of the FMU model performing simulation operation on the test input data is obtained at the same time, so that the simulation test result of the FMU model can be obtained according to the output value of each output variable in the simulation operation result corresponding to each operation time and the expected value of the output variable in the expected output data at the operation time, and the simulation test result can represent whether the function of the FMU model is normal. Therefore, whether the simulation output result meets the expectation or not is not needed to be manually compared by a worker, and a simulation test result which can represent whether the FMU model is normal or not can be obtained through the simulation operation result and the expected output data of the FMU model, so that the efficiency is improved.
Based on this, in this embodiment, after the simulation test result is obtained, the test result of whether the output value of each output variable at each operation time and the deviation data corresponding to the output value and the expected value match with the tolerance data may be output in a table manner, or the output value and the expected value of each output variable at each operation time may be output in a curve manner, so as to prompt the user to test the normal and abnormal output variables in an intuitive manner.
In an implementation manner, when the simulation test result is obtained in step 103, the following may be specifically implemented:
and comparing the output value corresponding to each output variable in the simulation operation result at each operation moment with the corresponding expected value to obtain the simulation test result of the FMU model.
For example, if the corresponding output value and the expected value of each output variable at each operation time are compared and consistent, the obtained simulation test result represents that the FMU model is normal; if the corresponding output value and the expected value of each output variable at each operation time are not consistent or only partially consistent in comparison, the obtained simulation test result represents that the function of the FMU model on each output variable is abnormal; if the corresponding output values and expected values of only part of the output variables at each operation time are consistent, the obtained simulation test result indicates that the FMU model only functions normally on the output variables.
In another implementation manner, when the simulation test result is obtained in step 103, the following may also be implemented:
firstly, obtaining tolerance data corresponding to each output variable, wherein the tolerance data can comprise the tolerance data corresponding to each output variable at each operation moment;
then, obtaining deviation data corresponding to each output variable according to an output value corresponding to each output variable at each operation time in the simulation operation result and an expected value corresponding to the output value, wherein the deviation data comprises the deviation data corresponding to each output variable at each operation time;
and finally, judging whether the deviation data corresponding to each output variable is matched with the corresponding tolerance data so as to obtain a simulation test result of the FMU model.
The method specifically comprises the following steps: and judging whether the deviation data corresponding to each output variable at each operation moment is matched with the tolerance data corresponding to the corresponding output variable at the corresponding operation moment, and further obtaining the simulation test result of the FMU model according to the matching result.
The tolerance data at least comprises a deviation calculation mode and a deviation threshold value corresponding to the deviation calculation mode. The deviation calculation method is mainly used for calculating deviation data corresponding to output values of corresponding output variables at the operation time and expected values, and the deviation threshold is a basis for judging whether the deviation data is within a reasonable or allowed deviation range.
Note that the deviation calculation method and the deviation threshold value correspond to the variable type of the output variable. For example, the deviation calculation method may be: for the relative difference calculation manner or the absolute difference calculation manner of the continuous variable, the corresponding deviation threshold is a threshold corresponding to the relative difference calculation manner or the absolute difference calculation manner, as shown in fig. 2, the continuous output variable real _ continuous _ out corresponds to the deviation threshold of 1% and 0.01 in the relative difference calculation manner and the absolute difference calculation manner, respectively; alternatively, the deviation calculation method may be: for the time tolerance calculation manner of the discrete variable, the corresponding deviation threshold is a threshold corresponding to the time tolerance calculation manner, as shown in fig. 2, the discrete output variables real _ discrete _ out, int _ out and boul _ out correspond to deviation thresholds shifted forward by 10 ms and backward by 10 ms.
Thus, matching the deviation data corresponding to the output variable with its corresponding tolerance data means: and the difference value in the deviation data corresponding to the output variable is less than or equal to the deviation threshold value in the corresponding tolerance data. The method specifically comprises the following steps: the difference value of the deviation data corresponding to the output variable at each operation moment is less than or equal to the deviation threshold value of the corresponding tolerance data at the corresponding operation moment.
Based on this, in the case that the output variable is a continuous variable, when obtaining deviation data corresponding to each output variable in step 103, the following method may be specifically implemented:
comparing the output value corresponding to each output variable at each operation time in the simulation operation result with the expected value corresponding to the output variable at each operation time to obtain a relative difference or an absolute difference, such as a relative difference of 1% and an absolute difference of 0.01, between the output value corresponding to each output variable at each operation time and the expected value corresponding to each output variable.
Therefore, in step 103, the relative difference or the absolute difference can be compared with the corresponding deviation threshold, and then the simulation test result can be obtained according to the comparison result. For example, if the relative difference between the output value of the output variable at one or more operation moments and the expected value corresponding to the output variable is less than or equal to the deviation threshold corresponding to the relative difference calculation mode, the obtained simulation test result indicates that the FMU model functions normally on the output variable; if the absolute difference between the output value of the output variable at one or more operation moments and the corresponding expected value is larger than the deviation threshold value corresponding to the absolute difference calculation mode, the obtained simulation test result indicates that the function of the FMU model on the output variable is abnormal.
When the output variables are discrete variables, the deviation data corresponding to each output variable in step 103 may be specifically obtained by:
comparing the output value corresponding to each output variable in the simulation operation result at each operation time with the corresponding expected value to obtain target operation time at which the output value corresponding to each output variable is different from the corresponding expected value;
then, the time difference corresponding to each output variable can be obtained according to the target operation time.
Specifically, in this embodiment, the duration formed by the target operation time may be used as the time difference. For example, the output value corresponding to the output variable is different from the expected value corresponding to the output variable by 5 milliseconds, as shown in fig. 3, when the time difference is 5 milliseconds forward; or the output value corresponding to the output variable and the expected value corresponding to the output variable are different in value from 20 milliseconds to 40 milliseconds, as shown in fig. 4, and the time difference is 20 milliseconds with different values; or, the output value corresponding to the output variable is different from the expected value corresponding to the output variable by 10 milliseconds ahead, as shown in fig. 5, the time difference at this time is 10 milliseconds ahead; alternatively, the output value corresponding to the output variable is different from the expected value corresponding thereto from the 45 th millisecond to the 50 th millisecond, as shown in fig. 6, at which the time difference is abnormal 5 milliseconds. Based on the different types of time difference values, corresponding deviation thresholds can be provided, for example, a forward or backward shift corresponding to an offset duration threshold, such as 10 ms; the different value type corresponds to a particular threshold, such as 10 milliseconds; and the type of exception corresponds to another particular threshold, such as 0.
Therefore, in step 103, the time difference can be compared with the corresponding deviation threshold, and a simulation test result can be obtained according to the comparison result. For example, if the time difference is an offset duration that is shifted forward or backward, then the resulting simulation test results characterize that the FMU model is functioning properly on the output variable if the offset duration is less than or equal to the corresponding duration threshold, e.g., the FMU model is normal if shifted forward by 5 milliseconds, as shown in fig. 3, and not normal if shifted forward by 10 milliseconds, as shown in fig. 5; if the time difference is of different durations, then the duration is greater than the corresponding duration threshold, then the resulting simulation test results characterize that the FMU model is abnormal in this output variable, e.g., the FMU model value is abnormal for a duration of 20 milliseconds, as shown in FIG. 4; for another example, if the time difference is the duration of an anomaly, the duration of the anomaly is greater than 0 whenever any, and the resulting simulation test results indicate that the FMU model is abnormal at that output variable, e.g., the FMU model is abnormal in the case of a 5 millisecond anomaly, as shown in fig. 6.
Based on the implementation, when the deviation data corresponding to one or more output variables in the simulation test result is not matched with the tolerance data, the algorithm or the parameters in the FMU model can be modified according to the specific unmatched condition, and then the test case is reused for model testing.
In one implementation, when obtaining the desired output data in step 101, the following may be specifically implemented, as shown in fig. 7:
step 701: a desired file is obtained.
The expected file corresponds to the FMU model, and at least one time data and at least one output data are contained in the expected file. Based on this, in a specific implementation, the desired file may be a table file, and a plurality of table data, such as time column data composed of at least one time data and output column data composed of at least one output data, is contained in the desired file.
In one implementation, the expected file in this embodiment may be imported manually, so that the test system implemented in this application can obtain the imported expected file;
in another implementation manner, in this embodiment, the desired file may be read in the storage area where the desired file is located through the import interface, for example, the desired file having the same name or a matching name may be searched in the storage area according to the model name of the FMU model, and the desired file may be obtained by importing the desired file.
Step 702: desired output data is generated from the desired file.
The expected output data comprises at least one output variable, the output variable at least corresponds to an expected value at the operation time, and the expected value refers to an ideal value output by the output variable at the corresponding operation time under the condition that the FMU model is normal in function. As shown by the time in the time column in fig. 8, in seconds; the output data may be a data stream containing expected values of one or more output variables corresponding to each operation, as shown by expected values in the real _ continuous _ out column, the real _ discrete _ out column, the int _ out column, and the pool _ out column shown in fig. 8.
It should be noted that the number of operation times in the expected output data may not be completely consistent with the operation times in the test input data, because the operation times in the expected output data are times at which the comparison between the output value and the corresponding expected value is required, and the operation times in the test input data are times at which the FMU model needs to perform one simulation operation, so the operation times in the expected output data may be completely consistent with the operation times in the test input data to represent that the comparison between the output value and the expected value at each operation time is required, or the operation times in the expected output data are a part of the operation times in the test input data to represent that the comparison between the output value and the expected value at part of the operation times is required.
Based on the above implementation, after the expected file is obtained, in this embodiment, it may be determined whether the file format of the expected file meets a preset expected file format, such as whether the file attribute of the expected file, the format of each file column in the expected file, the data attribute of each file column, and the like are consistent with the preset file attribute, column format, and data attribute.
If the file format of the expected file meets the preset expected file format, generating expected output data according to the expected file, and if the file format of the expected file does not meet the preset expected file format, outputting prompt information for prompting the expected file to be modified.
Specifically, the prompt message may include a file name of a desired file to be modified, and may further include a name of a file column or a name of a file row of the desired file to be modified, so as to prompt a user to modify the desired file.
Referring to fig. 9, a schematic structural diagram of a test result processing apparatus provided in the second embodiment of the present application is shown, where the apparatus may be applied to an electronic device capable of performing data processing, such as a computer or a server. The technical scheme in the embodiment is mainly used for automatically obtaining the simulation test result representing whether the FMU model is normal or not so as to improve the efficiency.
Specifically, the apparatus in this embodiment may include the following units:
a data obtaining unit 901, configured to obtain expected output data of an FMU model, where the expected output data includes at least one output variable, and the output variable corresponds to an expected value at least one operation time of the FMU model;
an operation obtaining unit 902, configured to obtain a simulation operation result of the FMU model performing simulation operation on test input data;
a test obtaining unit 903, configured to obtain a simulation test result of the FMU model according to an output value of each output variable in the simulation operation result at each operation time and an expected value thereof, where the simulation test result represents whether the FMU model functions normally.
It can be seen from the foregoing technical solutions that, in the test result processing apparatus provided in the second embodiment of the present application, the expected output data of the FMU model is obtained, and the simulation operation result of the FMU model performing simulation operation on the test input data is obtained at the same time, so that the simulation test result of the FMU model can be obtained according to the output value of each output variable in the simulation operation result corresponding to each operation time and the expected value of the output variable in the expected output data at the operation time, and the simulation test result can represent whether the function of the FMU model is normal. Therefore, whether the simulation output result meets the expectation or not is not needed to be manually compared by a worker, and a simulation test result which can represent whether the FMU model is normal or not can be obtained through the simulation operation result and the expected output data of the FMU model, so that the efficiency is improved.
In one implementation, the test obtaining unit 903 is specifically configured to: and comparing the output value of each output variable in the simulation operation result at each operation moment with the corresponding expected value to obtain the simulation test result of the FMU model.
In one implementation, the test obtaining unit 903 is specifically configured to: obtaining tolerance data corresponding to each output variable; obtaining deviation data corresponding to each output variable according to an output value corresponding to each output variable at each operation time in the simulation operation result and an expected value corresponding to the output value; and judging whether the deviation data corresponding to each output variable is matched with the corresponding tolerance data so as to obtain a simulation test result of the FMU model.
Optionally, the tolerance data at least includes: a deviation calculation mode and a deviation threshold corresponding to the deviation calculation mode, wherein the deviation calculation mode and the deviation threshold correspond to the variable type of the output variable; wherein, the deviation calculation mode is as follows: a relative difference calculation mode or an absolute difference calculation mode for the continuous variable, or the deviation calculation mode is as follows: time tolerance calculation for discrete variables.
Based on this, in the case where the output variables are continuous variables, the test acquisition unit 903 acquires deviation data corresponding to each of the output variables by: comparing the output value of each output variable in the simulation operation result at each operation time with the corresponding expected value thereof to obtain a relative difference or an absolute difference between the output value of each output variable at each operation time and the corresponding expected value thereof.
In the case where the output variables are discrete variables, the test acquisition unit 903 acquires deviation data corresponding to each of the output variables by: comparing the output value corresponding to each output variable in the simulation operation result at each operation time with the corresponding expected value to obtain target operation time at which the output value corresponding to each output variable is different from the corresponding expected value; and obtaining a time difference value corresponding to each output variable at least according to the target operation time.
Wherein, the deviation data corresponding to the output variable is matched with the corresponding tolerance data, and the method comprises the following steps:
and the difference value in the deviation data corresponding to the output variable is less than or equal to the deviation threshold value in the tolerance data corresponding to the output variable.
In one implementation, the data obtaining unit 901 obtains the desired output data by: obtaining an expected file, wherein the expected file corresponds to the FMU model and at least comprises at least one time data and at least one output data; and generating expected output data according to the expected file, wherein the expected output data comprises at least one output variable, the output variable at least corresponds to an expected value at the operation moment, the expected output data is at least used for generating the test case, and the test case is used for testing the FMU model and obtaining a simulation test result of the FMU model.
It should be noted that, for the specific implementation of each unit in the present embodiment, reference may be made to the corresponding content in the foregoing, and details are not described here.
Referring to fig. 10, a schematic structural diagram of an electronic device according to a third embodiment of the present application is provided, where the electronic device may be an electronic device capable of performing data processing, such as a computer or a server. The technical scheme in the embodiment is mainly used for automatically obtaining the simulation test result representing whether the FMU model is normal or not so as to improve the efficiency.
Specifically, the electronic device in this embodiment may include the following structure:
a memory 1001 for storing an application program and data generated by the operation of the application program;
a processor 1002 for executing the application to implement: obtaining expected output data of an FMU (frequency modulation unit) model, wherein the expected output data comprise at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model; obtaining a simulation operation result of the FMU model for performing simulation operation on test input data; and obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, wherein the simulation test result represents whether the function of the FMU model is normal or not.
It should be noted that, the specific implementation of the processor in the present embodiment may refer to the corresponding content in the foregoing, and is not described in detail here.
It can be seen from the foregoing technical solutions that, in the electronic device provided in the third embodiment of the present application, the expected output data of the FMU model is obtained, and the simulation operation result of the FMU model performing the simulation operation on the test input data is obtained at the same time, so that the simulation test result of the FMU model can be obtained according to the output value of each output variable in the simulation operation result corresponding to each operation time and the expected value of the output variable in the expected output data at the operation time, and the simulation test result can represent whether the function of the FMU model is normal. Therefore, whether the simulation output result meets the expectation or not is not needed to be manually compared by a worker, and a simulation test result which can represent whether the FMU model is normal or not can be obtained through the simulation operation result and the expected output data of the FMU model, so that the efficiency is improved.
The technical solution of the present application is illustrated in detail by taking the flowchart shown in fig. 11 as an example:
firstly, after an expected file is imported, judging whether the format of the expected file conforms to a preset expected file format, if not, prompting a user to modify the expected file until the expected file meets the preset expected file format;
then, in case that the expected file satisfies the expected file format, automatically associating the output variables to obtain the expected output data, and matching the expected output data to the corresponding tolerance algorithm, i.e. the deviation calculation manner and the corresponding deviation threshold according to the types of the variables, for example, using the amplitude tolerance for the continuous output variables, such as real _ continuous _ out, default selecting "relative or absolute tolerance algorithm" and setting the default parameter relative tolerance error rate to 1%, the absolute tolerance error value to 0.01, the discrete output variables to match the time tolerance algorithm, and setting the default parameter to 10 ms before and after, as shown in fig. 2.
Under the condition that the default tolerance algorithm in the test system realized by the application is not matched with the current variable type, the tolerance algorithm can be modified into the tolerance algorithm matched with the variable type;
in addition, the deviation threshold in the tolerance algorithm can be set according to requirements, such as increasing the threshold or decreasing the threshold;
then, after the FMU model performs the simulation operation according to the test input data in the test case, the simulation operation result is obtained, and the test system implemented in this embodiment compares the output value of each output variable in the simulation operation result at each operation time with the corresponding expected value in the expected output data, so as to obtain the comparison result at each operation time.
It should be noted that the simulation step length of the FMU model is generally much smaller than the time interval in the expected file, and for comparison of the result of the amplitude tolerance algorithm, only the output value at the same time may be compared with the corresponding expected value in the expected output data, and all the output values need to be compared when the result of the time tolerance algorithm is compared. As shown in fig. 8, the expected values of the output variables in the expected output data are shown, and fig. 12 shows the output values of the simulation operation results.
Finally, after the simulation is finished, a detailed comparison result, namely a simulation test result, is output, and a user can see the comparison result representing whether the FMU model is normal or not.
Wherein, the following illustrates the conditions of passing the characterization test in the simulation test result:
in the case where the output variable is a continuous type variable:
in the case where the amplitude tolerance is a relative tolerance, the comparison pass condition is: the ratio of the absolute difference between the output value and the expected value to the output value is less than or equal to the relative tolerance value;
in the case where the amplitude tolerance is an absolute tolerance, the comparison passing condition is: the absolute difference between the output value and the expected value is less than or equal to the absolute tolerance value;
in the case of relative or relative tolerance of the amplitude, the comparison pass condition is: both pass through one.
In the case where the output variable is a discrete variable:
the comparison of the time tolerance is carried out under the following conditions: the output values in the time interval corresponding to the difference of the desired time and the forward offset threshold, the sum of the desired time and the backward offset threshold are the same as the respective desired values, as shown in several cases in fig. 3-6.
After the simulation is finished, if all the output values meet the comparison passing condition, the test case is a passing test, and if any output value does not meet the expectation, the comparison result can be checked, so that the model is convenient to modify and is verified again.
Finally, the simulation test result may be output according to the variable type corresponding to the output variable, for example, the output value and the expected value of the output variable are displayed for the output variable corresponding to the time tolerance. And displaying the output value, the expected value, the proportion and the absolute value which are beyond the expected value of the output variable at any time, and the like for the output variable corresponding to the amplitude tolerance.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. 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 application. Thus, the present application 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 (10)
1. A method for processing test results, the method comprising:
obtaining expected output data of a Functional Model Unit (FMU) model, wherein the expected output data comprises at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model;
obtaining a simulation operation result of the FMU model for performing simulation operation on test input data;
and obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, wherein the simulation test result represents whether the function of the FMU model is normal or not.
2. The method of claim 1, wherein obtaining the simulation test result of the FMU model according to the corresponding output value and the corresponding expected value of each output variable at each operation time in the simulation operation result comprises:
and comparing the output value of each output variable in the simulation operation result at each operation moment with the corresponding expected value to obtain the simulation test result of the FMU model.
3. The method of claim 1, further comprising:
obtaining tolerance data corresponding to each output variable;
obtaining a simulation test result of the FMU model according to an output value corresponding to each output variable in the simulation operation result at each operation time and an expected value corresponding to the output value, wherein the simulation test result comprises:
obtaining deviation data corresponding to each output variable according to an output value corresponding to each output variable at each operation time in the simulation operation result and an expected value corresponding to the output value;
and judging whether the deviation data corresponding to each output variable is matched with the corresponding tolerance data so as to obtain a simulation test result of the FMU model.
4. The method of claim 3, wherein the tolerance data comprises at least: a deviation calculation mode and a deviation threshold corresponding to the deviation calculation mode, wherein the deviation calculation mode and the deviation threshold correspond to the variable type of the output variable;
wherein, the deviation calculation mode is as follows: a relative difference calculation mode or an absolute difference calculation mode for the continuous variable, or the deviation calculation mode is as follows: time tolerance calculation for discrete variables.
5. The method according to claim 4, wherein obtaining deviation data corresponding to each of the output variables according to an output value corresponding to each of the output variables at each of the operation times in the simulation operation result and an expected value corresponding to the output value in the case where the output variable is a continuous variable comprises:
comparing the output value of each output variable in the simulation operation result at each operation time with the corresponding expected value thereof to obtain a relative difference or an absolute difference between the output value of each output variable at each operation time and the corresponding expected value thereof.
6. The method according to claim 4, wherein in a case where the output variables are discrete variables, obtaining deviation data corresponding to each of the output variables according to an output value corresponding to each of the output variables at each of the operation times in the simulation operation result and an expected value corresponding to the output value, comprises:
comparing the output value corresponding to each output variable in the simulation operation result at each operation time with the corresponding expected value to obtain target operation time at which the output value corresponding to each output variable is different from the corresponding expected value;
and obtaining a time difference value corresponding to each output variable at least according to the target operation time.
7. The method of claim 4, wherein matching the deviation data corresponding to the output variable with its corresponding tolerance data comprises:
and the difference value in the deviation data corresponding to the output variable is less than or equal to the deviation threshold value in the tolerance data corresponding to the output variable.
8. The method of claim 1, wherein obtaining desired output data for the FMU model comprises:
obtaining an expected file, wherein the expected file corresponds to the FMU model and at least comprises at least one time data and at least one output data;
and generating expected output data according to the expected file, wherein the expected output data comprises at least one output variable, the output variable at least corresponds to an expected value at the operation moment, the expected output data is at least used for generating the test case, and the test case is used for testing the FMU model and obtaining a simulation test result of the FMU model.
9. A test result processing apparatus, characterized in that the apparatus comprises:
the FMU model comprises a data obtaining unit, a data obtaining unit and a data processing unit, wherein the data obtaining unit is used for obtaining expected output data of an FMU model, the expected output data comprises at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model;
the operation obtaining unit is used for obtaining a simulation operation result of the FMU model for carrying out simulation operation on the test input data;
and the test obtaining unit is used for obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, and the simulation test result represents whether the function of the FMU model is normal or not.
10. An electronic device, comprising:
a memory for storing an application program and data generated by the application program running;
a processor for executing the application to implement: obtaining expected output data of an FMU (frequency modulation unit) model, wherein the expected output data comprise at least one output variable, and the output variable corresponds to an expected value at least one operation moment of the FMU model; obtaining a simulation operation result of the FMU model for performing simulation operation on test input data; and obtaining a simulation test result of the FMU model according to the output value corresponding to each output variable in the simulation operation result at each operation moment and the expected value corresponding to the output value, wherein the simulation test result represents whether the function of the FMU model is normal or not.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010961899.9A CN112084734A (en) | 2020-09-14 | 2020-09-14 | Test result processing method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010961899.9A CN112084734A (en) | 2020-09-14 | 2020-09-14 | Test result processing method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112084734A true CN112084734A (en) | 2020-12-15 |
Family
ID=73736998
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010961899.9A Pending CN112084734A (en) | 2020-09-14 | 2020-09-14 | Test result processing method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112084734A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10312311A (en) * | 1997-05-13 | 1998-11-24 | Mitsubishi Electric Corp | Logical simulation method and computer-readable recording medium record with program for implementing logical simulation method |
CN106354924A (en) * | 2016-08-29 | 2017-01-25 | 中冶赛迪工程技术股份有限公司 | FMI-based equipment cooperation simulation system and construction method |
CN107908830A (en) * | 2017-10-26 | 2018-04-13 | 北京动力机械研究所 | Model conversion method and model conversion system based on FMI standards |
CN108628594A (en) * | 2017-11-08 | 2018-10-09 | 北京世冠金洋科技发展有限公司 | A kind of graphical user interface design method of system simulation model |
CN109948213A (en) * | 2019-03-11 | 2019-06-28 | 北京世冠金洋科技发展有限公司 | A kind of synergy emulation method and device based on FMI standard |
DE102019003851A1 (en) * | 2018-06-01 | 2019-12-05 | The Mathworks, Inc. | Systems and methods for the automatic realization of models for co-simulation |
CN111552636A (en) * | 2020-04-17 | 2020-08-18 | 中国航空无线电电子研究所 | Method for supporting AADL integration simulation by applying FMI protocol |
-
2020
- 2020-09-14 CN CN202010961899.9A patent/CN112084734A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH10312311A (en) * | 1997-05-13 | 1998-11-24 | Mitsubishi Electric Corp | Logical simulation method and computer-readable recording medium record with program for implementing logical simulation method |
CN106354924A (en) * | 2016-08-29 | 2017-01-25 | 中冶赛迪工程技术股份有限公司 | FMI-based equipment cooperation simulation system and construction method |
CN107908830A (en) * | 2017-10-26 | 2018-04-13 | 北京动力机械研究所 | Model conversion method and model conversion system based on FMI standards |
CN108628594A (en) * | 2017-11-08 | 2018-10-09 | 北京世冠金洋科技发展有限公司 | A kind of graphical user interface design method of system simulation model |
DE102019003851A1 (en) * | 2018-06-01 | 2019-12-05 | The Mathworks, Inc. | Systems and methods for the automatic realization of models for co-simulation |
CN109948213A (en) * | 2019-03-11 | 2019-06-28 | 北京世冠金洋科技发展有限公司 | A kind of synergy emulation method and device based on FMI standard |
CN111552636A (en) * | 2020-04-17 | 2020-08-18 | 中国航空无线电电子研究所 | Method for supporting AADL integration simulation by applying FMI protocol |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CA2370283A1 (en) | Method and apparatus for conducting linked simulation operations utilizing a computer-based system model | |
CN103235759A (en) | Method and device for generating test cases | |
CN112084668A (en) | Simulation test method and device and electronic equipment | |
WO2008019832A1 (en) | Improved monte carlo simulation and display of results thereof | |
CN110990295B (en) | Verification method and device for test cases and electronic equipment | |
CN109522296B (en) | Engine ECU data matching calibration method and device | |
CN112084734A (en) | Test result processing method and device and electronic equipment | |
CN112084667A (en) | Test case generation method and device and electronic equipment | |
CN113051014A (en) | Eye protection prompting method and device, storage medium and computer equipment | |
CN112884280A (en) | Failure analysis method and device embedded in FMEA system | |
CN112487588A (en) | Wind power plant reactive voltage regulation function test method, terminal equipment and storage medium | |
CN112507685B (en) | YANG file verification method and device, electronic equipment and storage medium | |
CN112084117B (en) | Test method and device | |
CN115470095A (en) | Test method, test system, electronic equipment and computer storage medium | |
CN109815145B (en) | Batch measurement order testing method and device | |
CN112084666A (en) | Test output method and device and electronic equipment | |
US20080281549A1 (en) | Test Apparatus for Control Unit, Pattern Signal Creating Apparatus, and Test Program Generating Apparatus | |
CN114116244A (en) | Data processing method, device and system, electronic equipment and storage medium | |
JP2002055853A (en) | Log comparison debugging support device, method and program | |
CN112256552A (en) | Pressure testing method and device for map engine | |
CN110908661B (en) | Method, device, equipment and storage medium for verifying vue component through interface | |
JP5849525B2 (en) | Simulation device, simulation program, and simulation method | |
CN114385511A (en) | Test data generation method and device, electronic equipment and storage medium | |
CN110750684B (en) | Message prompting method for multi-dimensional verification, storage medium, electronic device and system | |
CN113986641B (en) | Method, system, equipment and storage medium for verifying chip hardware function |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20201215 |