Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
added test for ticket:4254
Browse files Browse the repository at this point in the history
Belonging to [master]:
  - OpenModelica/OMCompiler#2726
  - #1052
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Oct 16, 2018
1 parent f5699c9 commit 12ad189
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
Binary file added ReferenceFiles/linear_system/Ticket4254.mat.xz
Binary file not shown.
1 change: 1 addition & 0 deletions simulation/modelica/linear_system/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ problem3.mos \
constantStates.mos \
Ticket2404.mos \
Ticket3926.mos \
Ticket4254.mos \

# test that currently fail. Move up when fixed.
# Run make failingtest
Expand Down
53 changes: 53 additions & 0 deletions simulation/modelica/linear_system/Ticket4254.mos
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// name: Ticket4254
// keywords: parameter
// status: correct

loadString("
model foo
Real s(start = -0.05, fixed = true), v(start = 0, fixed = true), a, Tw, Pw, Aw;
parameter Real m = 0.1;
parameter Real Av = 1;
equation
if s > 0 then
Tw = 0;
Pw + Aw = 0;
Pw = s * Av;
else
Pw = 0;
Aw + Tw = 0;
Aw = s * Av;
end if;

// mechanical equation
v = der(s);
a = der(v);
m*a = 1;
annotation(
experiment(StartTime = 0, StopTime = 0.15, Tolerance = 1e-06, Interval = 0.00015),
__OpenModelica_simulationFlags(noEquidistantTimeGrid = \"()\"));
end foo;
");getErrorString();

simulate(foo);getErrorString();
filterSimulationResults("foo_res.mat", "Ticket4254.mat", {"Pw"});

res := OpenModelica.Scripting.compareSimulationResults("foo_res.mat",
getEnvironmentVar("REFERENCEFILES")+"/linear_system/Ticket4254.mat",
"Ticket4254_diff.csv",0.01,0.0001,
{"Pw"});


// Result:
// true
// ""
// record SimulationResult
// resultFile = "foo_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 0.15, numberOfIntervals = 1000, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'foo', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-noEquidistantTimeGrid'",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
// ""
// true
// {"Files Equal!"}
// endResult

0 comments on commit 12ad189

Please sign in to comment.