Skip to content

Commit

Permalink
move daeMode testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Aug 29, 2017
1 parent 9ed2db4 commit 7e16a2c
Show file tree
Hide file tree
Showing 12 changed files with 115 additions and 7 deletions.
54 changes: 54 additions & 0 deletions simulation/modelica/daemode/Makefile
@@ -0,0 +1,54 @@
TEST = ../../../rtest -v

TESTFILES = \
testDAEp1.mos \
testDAEp2.mos \
testDAEp3.mos \
testDAEp4.mos \
testDAEp5.mos \
testDAEp6.mos \
testDAEmodeDrumBoiler.mos \
testDAEScaling.mos

# Dependency files that are not .mo .mos or Makefile
# Add them here or they will be cleaned.
DEPENDENCIES = \
*.mo \
*.mos \
Makefile \


CLEAN = `ls | grep -w -v -f deps.tmp`

.PHONY : test clean getdeps

test:
@echo
@echo Running tests...
@echo
@echo OPENMODELICAHOME=" $(OPENMODELICAHOME) "
@$(TEST) $(TESTFILES)

# Cleans all files that are not listed as dependencies
clean :
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@rm -f $(CLEAN)

# Run this if you want to list out the files (dependencies).
# do it after cleaning and updating the folder
# then you can get a list of file names (which must be dependencies
# since you got them from repository + your own new files)
# then add them to the DEPENDENCIES. You can find the
# list in deps.txt
getdeps:
@echo $(DEPENDENCIES) | sed 's/ /\\|/g' > deps.tmp
@echo $(CLEAN) | sed -r 's/deps.txt|deps.tmp//g' | sed 's/ / \\\n/g' > deps.txt
@echo Dependency list saved in deps.txt.
@echo Copy the list from deps.txt and add it to the Makefile @DEPENDENCIES

failingtest :
@echo
@echo Running failing tests...
@echo
@$(TEST) $(FAILINGTESTFILES)

61 changes: 61 additions & 0 deletions simulation/modelica/daemode/testDAEScaling.mos
@@ -0,0 +1,61 @@
// name: testDAEScaling
// status: correct
// teardown_command: rm -f Test1* Test2* Test3 output.log

loadString("
model Test
parameter Integer N = 20;
parameter Real k_min = 1;
parameter Real k_max = 2;
parameter Real d_0 = 10;
Real d_tot(start = 0, fixed = true);
final parameter Real s_0 = d_0/N;
Real d[N+1];
Real s[N];
Real F[N];
Real k[N];
equation
der(d_tot) = 1;
d[1] = 0;
for i in 1:N loop
d[i+1] = d[i] + s[i];
s[i]*(1 + abs(s[i])/s_0)*k[i]*N = F[i];
k[i] = k_min + (k_max-k_min)/(N-1)*(i-1);
end for;
for i in 1:N-1 loop
F[i] = F[i+1];
end for;
d[end] = d_tot;
end Test;
");getErrorString();

setCommandLineOptions("--maxSizeNonlinearTearing=0 --daeMode=all");getErrorString();

// Test 1 well-scaled model
//loadString("model Test1 extends Test(N=100); end Test1;");
//simulate(Test1, stopTime = 2, simflags="-daeMode -s=ida -idaLS=klu -noEquidistantTimeGrid");getErrorString();

// Test 2 badly scaled model
//loadString("model Test2 extends Test(N=100,k_min = 1e8, k_max = 2e8); end Test2;");
//simulate(Test2, stopTime = 2, simflags="-daeMode -s=ida -idaLS=klu -noEquidistantTimeGrid");getErrorString();

// Test 3 badly scaled model with nominal attributes
loadString("model Test3 extends Test(N=100,k_min = 1e8, k_max = 2e8, F(each nominal=1e8)); end Test3;");
simulate(Test3, stopTime = 2, simflags="-daeMode -s=ida -idaLS=klu -noEquidistantTimeGrid");getErrorString();

// Result:
// true
// ""
// true
// ""
// true
// record SimulationResult
// resultFile = "Test3_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'Test3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode -s=ida -idaLS=klu -noEquidistantTimeGrid'",
// messages = "stdout | info | The initialization finished successfully without homotopy method.
// stdout | info | The simulation finished successfully.
// "
// end SimulationResult;
// "Warning: There are iteration variables with default zero start attribute. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
// "
// endResult
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions simulation/modelica/solver/Makefile
Expand Up @@ -37,13 +37,6 @@ problem5-symSolverExp.mos \
problem6-irksco.mos \
problem6-symSolverImp.mos \
problem6-symSolverExp.mos \
testDAEp1.mos \
testDAEp2.mos \
testDAEp3.mos \
testDAEp4.mos \
testDAEp5.mos \
testDAEp6.mos \
testDAEmodeDrumBoiler.mos

# run only symSolver tests
SYMSOLVER = \
Expand Down

0 comments on commit 7e16a2c

Please sign in to comment.