Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added test-case for noEquidistant mode
- Loading branch information
Willi Braun
committed
Oct 27, 2015
1 parent
2a0c529
commit ca92c9c
Showing
2 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
openmodelica/cruntime/simoptions/testDASSLnoEquidistant.mos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |