// Run as mos-script using OpenModelica 1.9.1+dev (r18507) (RML version)
"Modelica.Blocks.Examples.InverseModel";
echo(false);
loadString("
function cell
input Real time;
input Boolean greenOnOk := false;
input String greenColor := \"#00FF00\";
output String str;
algorithm
str := if time==-1.0 then \"
\" else ((if greenOnOk then \"
\" else \"
\") +
OpenModelica.Scripting.Internal.Time.readableTime(if time < 1e-5 then 0 else time)+\"
\");
end cell;
function length input String str; output Integer len; external \"C\" len=ModelicaStrings_length(str); end length;
function substring input String str; input Integer i1,i2; output String out; external \"C\" out=ModelicaStrings_substring(str,i1,i2); end substring;
function firstPart input String str; input Integer maxLength := 4096; output String out; algorithm out := if length(str) < maxLength then str else (substring(str,1,maxLength) + \"
... (output truncated, was \" + String(length(str)) + \" bytes)\"); end firstPart;
function csvFileToVariable
input String str;
output String out;
protected
String matches[2];
algorithm
(,matches) := OpenModelica.Scripting.regex(str,\"^.*[.]diff[.](.*)$\",2);
out := matches[2];
end csvFileToVariable;
function testcase
input Real time;
input Boolean success;
input String errXMLLong;
output String str;
protected
String errXML;
algorithm
errXML := firstPart(errXMLLong,16*1024); // 16 kB log per test should be enough; increase if there is a good reason to do so
str:=\"\"+(
if not success then \"\"
else \"\"
)+(
if errXML <> \"\" then (\"\" + errXML + \"\")
else \"\"
)+
\"
\";
end testcase;
");getErrorString();
statFile := "Modelica.Blocks.Examples.InverseModel.stat";
writeFile("BuildModelRecursive.html","Modelica.Blocks.Examples.InverseModel
",append=true);
writeFile(statFile,"
Parameters used for the comparison: Relative tolerance "+String(reference_reltol)+" (local), "+String(reference_reltolDiffMinMax)+" (relative to max-min). Range delta "+String(reference_rangeDelta)+".