Skip to content

Commit

Permalink
Use the MSL 3.1 reference for CharacteristicThyristors
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund committed May 18, 2015
1 parent 7e98375 commit 8064091
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 34 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion simulation/libraries/common/ModelTesting.mos
Expand Up @@ -150,7 +150,7 @@ elseif (modelTestingType == OpenModelicaModelTesting.Kind.VerifiedSimulation) or
end if;
/* We can only compare to a reference file if we have one */
modelNameStr := typeNameString(modelName);
referenceFile := if referenceFile == "" then getEnvironmentVar("REFERENCEFILES") + "/msl32/" + modelNameStr + ".mat" else referenceFile;
referenceFile := if referenceFile == "" then getEnvironmentVar("REFERENCEFILES") + "/"+referenceFileDir+"/" + modelNameStr + ".mat" else referenceFile;
if regularFileExists(referenceFile+".xz") then
system("if test ! -f "+referenceFile+" || test "+referenceFile+".xz -nt "+referenceFile+"; then xz --keep --decompress --force "+referenceFile+".xz ; fi");
referenceExists := true;
Expand Down
3 changes: 2 additions & 1 deletion simulation/libraries/common/ModelTestingDefaults.mos
Expand Up @@ -10,7 +10,8 @@ stopTime := 0.0; // 0.0 means to read the stopTime from the experiment annotatio
relTol := 0.01; // Tolerance for the simulation comparison
absTol := 0.0001; // Tolerance for the simulation comparison
compareVars := fill("",0); // Default compares all variables. Not recommended, but is the only reasonable default'
referenceFile := ""; // Default reference file is $REFERENCEFILES/msl32/modelName.mat
referenceFileDir := "msl32"; // Default directory of reference files
referenceFile := ""; // Default reference file is $REFERENCEFILES/referenceFileDir/modelName.mat
modelTesting := getEnvironmentVar("OMLIBRARYCOMMON")+"/ModelTesting.mos";
outputFormat :="mat";
simflags := ""; // Options sent to the simulation runtime
Expand Down
Expand Up @@ -2,44 +2,45 @@
// keywords: simulation MSL Examples
// status: correct
//
// Simulation Results
// Simulation Results
// Modelica Standard Library
//

loadModel(Modelica,{"3.1"});

runScript("../common/ModelTestingDefaults.mos"); getErrorString();
packageVersion:="3.1";
referenceFileDir := "msl31";
setTearingMethod("omcTearing");

simulate(Modelica.Electrical.Analog.Examples.CharacteristicThyristors);
res := OpenModelica.Scripting.compareSimulationResults("Modelica.Electrical.Analog.Examples.CharacteristicThyristors_res.mat",
getEnvironmentVar("REFERENCEFILES")+"/msl32/Modelica.Electrical.Analog.Examples.CharacteristicThyristors.mat","Modelica.Electrical.Analog.Examples.CharacteristicThyristors_diff.csv",0.01,0.00001,
{"IdealThyristor1.v",
"IdealThyristor1.LossPower",
"SineVoltage1.p.v",
"SineVoltage1.p.i",
"Ground1.p.i",
"R3.p.v",
"R3.n.i",
"R3.LossPower",
"IdealGTOThyristor1.v",
"IdealGTOThyristor1.LossPower",
"R1.p.v",
"R1.n.i",
"R1.LossPower",
"SineVoltage1.n.v",
"Ground1.p.v",
"R3.n.v",
"R1.n.v",
"R1.R_actual",
"R3.R_actual"});
modelTestingType := OpenModelicaModelTesting.Kind.VerifiedSimulation;
modelName := $TypeName(Modelica.Electrical.Analog.Examples.CharacteristicThyristors);
compareVars :=
{
"R1.i",
"R1.v",
"R3.i",
"R3.v"
};

runScript(modelTesting);getErrorString();

// Result:
// "true
// "
// ""
// "3.1"
// "msl31"
// true
// true
// record SimulationResult
// resultFile = "Modelica.Electrical.Analog.Examples.CharacteristicThyristors_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Electrical.Analog.Examples.CharacteristicThyristors', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// {"Files Equal!"}
// OpenModelicaModelTesting.Kind.VerifiedSimulation
// Modelica.Electrical.Analog.Examples.CharacteristicThyristors
// {"R1.i","R1.v","R3.i","R3.v"}
// Simulation options: startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Modelica.Electrical.Analog.Examples.CharacteristicThyristors', options = '', outputFormat = 'mat', variableFilter = 'time|R1.i|R1.v|R3.i|R3.v', cflags = '', simflags = ' -abortSlowSimulation -alarm=360 -emit_protected'
// Result file: Modelica.Electrical.Analog.Examples.CharacteristicThyristors_res.mat
// Files Equal!
// [Modelica 3.1/Electrical/Analog/Sources.mo:361:5-361:68:writable] Warning: Parameter SineVoltage1.freqHz has no value, and is fixed during initialization (fixed=true), using available start value (start=1.0) as default value.
// Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// Warning: There are iteration variables with default zero start attribute. Use +d=initialization for more information.
//
// "true
// "
// ""
// endResult

0 comments on commit 8064091

Please sign in to comment.