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

added test for ticket:4254 #1052

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added ReferenceFiles/linear_system/Ticket4254.mat.xz
Binary file not shown.
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