FMUTester
ValidateResult
validate a simulation result against a reference result
Calling Sequence
Parameters
Returns
Options
Description
Examples
Compatibility
ValidateResult(result, reference, options)
result
-
one of Matrix, python or string; simulation result
reference
one of Matrix, python or string; reference result
true if result matches reference with maximum relative deviation maxrelout; otherwise, false
maxrelout: numeric
Maximum relative deviation for all output signals. This value is used as a boundary to determine if the validation is successful or not. The validation is unsuccessful if there is an output signal in result with relative deviation greater than maxrelout (more than maxrelout*100% of the samples are outside of the epsilon band around its corresponding reference signal). The default is 0.1.
The ValidateResult procedure validates a simulation result against a reference result.
ValidateResult uses the "fmpy.util.validate_result" function from the Python FMPy library, which creates an epsilon band around the reference signal and finds the values in the result signal that are outside of this band. This function returns the largest relative deviation of all output signals, i.e., the relative deviation for the output signal with the most outliers. The validation criterion is the same as that used in the "fmpy.cross_check" function, and can be changed through the maxrealout option.
The result and reference arguments can be specified as:
a Matrix : its first row contains strings specifying the time (first column) and the output variable names for the data in each subsequent Matrix column.
a python object : structured NumPy array (ndarray), or
a string : filename of the comma-separated value (CSV) file containing the data. This CSV file complies with the FMU GitHub repository rules, i.e., its first row must be a header with double-quoted strings which specify the time and the output variable names.
with⁡FMUTester:
Simulate the FMU
fmuname≔FileTools:-JoinPath⁡FMUs,CoupledClutches.fmu,base=datadir:
inputcsv≔FileTools:-JoinPath⁡FMUs,CoupledClutches_in.csv,base=datadir:
result≔SimulateFMU⁡fmuname,inputfile=inputcsv,returntype=Matrix
Specify the reference file
reference≔FileTools:-JoinPath⁡FMUs,CoupledClutches_ref.csv,base=datadir:
Compare and validate the simulation result with the reference file
ValidateResult⁡result,reference
true
The FMUTester[ValidateResult] command was introduced in Maple 2019.
For more information on Maple 2019 changes, see Updates in Maple 2019.
See Also
FMUTester[FetchFMU]
FMUTester[FMUInfo]
FMUTester[SimulateFMU]
Download Help Document