ValidateResult - Maple Help

FMUTester

 ValidateResult
 validate a simulation result against a reference result

 Calling Sequence ValidateResult(result, reference, options)

Parameters

 result - one of Matrix, python or string; simulation result reference - one of Matrix, python or string; reference result

 Returns true if result matches reference with maximum relative deviation maxrelout; otherwise, false

Options

 • 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.

Description

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{FMUTester}\right):$

Simulate the FMU

 > $\mathrm{fmuname}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left[\mathrm{kernelopts}\left('\mathrm{datadir}'\right),"FMUs","CoupledClutches.fmu"\right]\right):$
 > $\mathrm{inputcsv}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left[\mathrm{kernelopts}\left('\mathrm{datadir}'\right),"FMUs","CoupledClutches_in.csv"\right]\right):$
 > $\mathrm{result}≔\mathrm{SimulateFMU}\left(\mathrm{fmuname},'\mathrm{inputfile}'=\mathrm{inputcsv},'\mathrm{returntype}'=\left["Matrix"\right]\right)$
 ${\mathrm{result}}{≔}\begin{array}{c}\left[\begin{array}{ccccc}{"time"}& {"outputs\left[1\right]"}& {"outputs\left[2\right]"}& {"outputs\left[3\right]"}& {"outputs\left[4\right]"}\\ {0.}& {10.}& {0.}& {0.}& {0.}\\ {0.00200000000000000}& {9.98072059414111}& {0.0199999714244791}& {0.}& {0.}\\ {0.00400000000000000}& {9.96265963989597}& {0.0399997685806836}& {0.}& {0.}\\ {0.00600000000000000}& {9.94583123755172}& {0.0599992904472829}& {0.}& {0.}\\ {0.00800000000000000}& {9.93018787953862}& {0.0799983902310639}& {0.}& {0.}\\ {0.0100000000000000}& {9.91569578866751}& {0.0999965083146854}& {0.}& {0.}\\ {0.0120000000000000}& {9.90238156217304}& {0.119994085358667}& {0.}& {0.}\\ {0.0140000000000000}& {9.89024520005521}& {0.139991121363009}& {0.}& {0.}\\ {0.0160000000000000}& {9.87928670231401}& {0.159987616327712}& {0.}& {0.}\\ {⋮}& {⋮}& {⋮}& {⋮}& {⋮}\end{array}\right]\\ \hfill {\text{797 × 5 Matrix}}\end{array}$ (1)

Specify the reference file

 > $\mathrm{reference}≔\mathrm{FileTools}:-\mathrm{JoinPath}\left(\left[\mathrm{kernelopts}\left('\mathrm{datadir}'\right),"FMUs","CoupledClutches_ref.csv"\right]\right):$

Compare and validate the simulation result with the reference file

 > $\mathrm{ValidateResult}\left(\mathrm{result},\mathrm{reference}\right)$
 ${\mathrm{true}}$ (2)

Compatibility

 • The FMUTester[ValidateResult] command was introduced in Maple 2019.