Skip to content

Commit

Permalink
add dae tests to the testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun committed Aug 29, 2016
1 parent 4248392 commit 7496b21
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 12 deletions.
13 changes: 2 additions & 11 deletions simulation/modelica/solver/Makefile
Expand Up @@ -23,14 +23,12 @@ problem2-symEuler.mos \
problem2-ida.mos \
problem2-idaLinearSolver.mos \
problem3-symEuler.mos

#runonly DAE tests
DAETESTFILES = \
testDAEp1.mos \
testDAEp2.mos \
testDAEp3.mos \
testDAEp4.mos \
testDAEp5.mos \
testDAEp6.mos \
testDAEmodeDrumBoiler.mos


Expand All @@ -52,14 +50,7 @@ test:
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
rm -rf externalInput.csv
@$(TEST) $(TESTFILES) $(DAETESTFILES)

testDAE:
@echo
@echo Running DAE tests...
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(DAETESTFILES)
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
clean :
Expand Down
7 changes: 6 additions & 1 deletion simulation/modelica/solver/testDAEPackage.mo
Expand Up @@ -58,6 +58,11 @@ package testDAE
der(y) = x^2-y*w;
end p5;


model p6
Real x[2];
Real A[2,2] = [3,1;2,1];
equation
A*der(x)={1,2};
end p6;

end testDAE;
82 changes: 82 additions & 0 deletions simulation/modelica/solver/testDAEp6.mos
@@ -0,0 +1,82 @@
// name: testDAE.p5
// status: correct
// teardown_command: rm -f testDAE.p5* output.log


loadFile("./testDAEPackage.mo");
getErrorString();

simulate(testDAE.p6);
getErrorString();

val(x[1],0.0);
val(x[2],0.0);

val(x[1],1.0);
val(x[2],1.0);

setCommandLineOptions("+daeMode=dynamic");
simulate(testDAE.p6, simflags="-daeMode", method="ida");
getErrorString();

val(x[1],0.0);
val(x[2],0.0);

val(x[1],1.0);
val(x[2],1.0);

setCommandLineOptions("+daeMode=all");
simulate(testDAE.p6, simflags="-daeMode", method="ida");
getErrorString();

val(x[1],0.0);
val(x[2],0.0);

val(x[1],1.0);
val(x[2],1.0);

// Result:
// true
// ""
// record SimulationResult
// resultFile = "testDAE.p5_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'testDAE.p5', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// "
// 0.0
// 1.0
// -3.0
// 0.2519655435313273
// 0.7318517148672625
// -3.0
// true
// record SimulationResult
// resultFile = "testDAE.p5_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p5', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = ""
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// "
// 0.0
// 1.0
// -3.0
// 0.2519641224122206
// 0.7318508241807287
// -3.0
// true
// record SimulationResult
// resultFile = "testDAE.p5_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p5', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = ""
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// "
// 0.0
// 1.0
// -3.0
// 0.2519641224122206
// 0.7318508241807287
// -3.0
// endResult

0 comments on commit 7496b21

Please sign in to comment.