Skip to content

Commit

Permalink
- added test-case for noEquidistant mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun committed Oct 27, 2015
1 parent 2a0c529 commit ca92c9c
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions openmodelica/cruntime/simoptions/Makefile
Expand Up @@ -2,6 +2,7 @@ TEST = ../../../rtest -v


TESTFILES = \
testDASSLnoEquidistant.mos \
testOutputIntervalDASSL.mos \
testOutputIntervalDASSLsteps.mos \
testOutputIntervalDASSLstepsnoEquidistant.mos \
Expand Down
80 changes: 80 additions & 0 deletions openmodelica/cruntime/simoptions/testDASSLnoEquidistant.mos
@@ -0,0 +1,80 @@
// name: testDASSLnoEquidistant
// keywords: emit, results, dassl
// status: correct
// teardown_command: rm -rf testModel* output.log
//
//
loadString("
model testModel
parameter Real m=0.5;
parameter Real g=9.82;
parameter Real L=1;
Real x(start=L),y(start=0),xd,yd;
Real Fo;
Real z;
equation
der(y)=yd;
der(x)=xd;
m*der(xd) = -x*Fo/L;
m*der(yd) = -m*g-Fo*y/L;
x*x+y*y=L^2;
der(z) = der(x)+der(y);
when sample(0, 3) then
reinit(z,0);
end when;
end testModel;
");

simulate(testModel, stopTime=50.0, numberOfIntervals = 1000, method="dassl");
val(x,5);
val(y,5);
val(z,5);
val(x,25);
val(y,25);
val(z,25);
val(x,45);
val(y,45);
val(z,45);

simulate(testModel, stopTime=50.0, numberOfIntervals = 1000, method="dassl", simflags="-noEquidistantTimeGrid");
val(x,5);
val(y,5);
val(z,5);
val(x,25);
val(y,25);
val(z,25);
val(x,45);
val(y,45);
val(z,45);

// Result:
// true
// record SimulationResult
// resultFile = "testModel_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 50.0, numberOfIntervals = 1000, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'testModel', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// 0.9400817201006211
// -0.3409492037425187
// 1.765471500926897
// -0.9938618504643499
// -0.1106283064661939
// -1.446513992917458
// 0.9999849889806949
// -0.00547921648409935
// 0.0
// record SimulationResult
// resultFile = "testModel_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 50.0, numberOfIntervals = 1000, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'testModel', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-noEquidistantTimeGrid'",
// messages = ""
// end SimulationResult;
// 0.9399131777155256
// -0.3409917555699257
// 1.765205861031661
// -0.9938699424824931
// -0.110452669808188
// -1.44697468894188
// 0.9999852421758963
// -0.005432810544649265
// 0.0
// endResult

0 comments on commit ca92c9c

Please sign in to comment.