Skip to content

Commit

Permalink
update daemode test on new implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Mar 21, 2018
1 parent 378084c commit 71a15a1
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 518 deletions.
10 changes: 4 additions & 6 deletions simulation/modelica/daemode/testDAEScaling.mos
Expand Up @@ -33,15 +33,15 @@ setCommandLineOptions("--maxSizeNonlinearTearing=0 --daeMode=all");getErrorStrin

// 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();
//simulate(Test1, stopTime = 2, simflags="-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();
//simulate(Test2, stopTime = 2, simflags="-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();
simulate(Test3, stopTime = 2, simflags="-noEquidistantTimeGrid");getErrorString();

// Result:
// true
Expand All @@ -51,15 +51,13 @@ simulate(Test3, stopTime = 2, simflags="-daeMode -s=ida -idaLS=klu -noEquidistan
// 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'",
// simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'Test3', 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;
// "Notification: Tearing is skipped for strong component 1 because system size of 199 exceeds maximum system size for tearing of nonlinear systems (0).
// To adjust the maximum system size for tearing use --maxSizeLinearTearing=<size> and --maxSizeNonlinearTearing=<size>.
// 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").
// Notification: Tearing is skipped for strong component 2 because system size of 199 exceeds maximum system size for tearing of nonlinear systems (0).
// To adjust the maximum system size for tearing use --maxSizeLinearTearing=<size> and --maxSizeNonlinearTearing=<size>.
// "
// endResult
4 changes: 2 additions & 2 deletions simulation/modelica/daemode/testDAEmodeDrumBoiler.mos
Expand Up @@ -7,7 +7,7 @@ loadModel(Modelica,{"3.2.1"});
getErrorString();

setCommandLineOptions("--daeMode=new");
simulate(Modelica.Fluid.Examples.DrumBoiler.DrumBoiler, method="ida", simflags="-daeMode");
simulate(Modelica.Fluid.Examples.DrumBoiler.DrumBoiler, method="ida");
getErrorString();

res := OpenModelica.Scripting.compareSimulationResults("Modelica.Fluid.Examples.DrumBoiler.DrumBoiler_res.mat",
Expand All @@ -21,7 +21,7 @@ res := OpenModelica.Scripting.compareSimulationResults("Modelica.Fluid.Examples.
// true
// record SimulationResult
// resultFile = "Modelica.Fluid.Examples.DrumBoiler.DrumBoiler_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 5400.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'Modelica.Fluid.Examples.DrumBoiler.DrumBoiler', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// simulationOptions = "startTime = 0.0, stopTime = 5400.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'Modelica.Fluid.Examples.DrumBoiler.DrumBoiler', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
Expand Down
55 changes: 2 additions & 53 deletions simulation/modelica/daemode/testDAEp1.mos
Expand Up @@ -7,7 +7,7 @@ loadFile("./testDAEPackage.mo");
getErrorString();

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

val(x,0.0);
Expand All @@ -16,36 +16,13 @@ val(y,0.0);
val(x,1.0);
val(y,1.0);

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

val(x,0.0);
val(y,0.0);

val(x,1.0);
val(y,1.0);

setCommandLineOptions("+daeMode=dynamic");

simulate(testDAE.p1, simflags="-daeMode", method="ida");
getErrorString();

val(x,0.0);
val(y,0.0);

val(x,1.0);
val(y,1.0);



// Result:
// true
// ""
// true
// record SimulationResult
// resultFile = "testDAE.p1_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
Expand All @@ -56,32 +33,4 @@ val(y,1.0);
// 1.0
// 0.459699946509931
// 0.4056181325367908
// true
// record SimulationResult
// resultFile = "testDAE.p1_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
// "
// 0.0
// 1.0
// 0.4596985627122833
// 0.4056206599963859
// true
// record SimulationResult
// resultFile = "testDAE.p1_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
// "
// 0.0
// 1.0
// 0.4596985627122833
// 0.4056206599963859
// endResult
77 changes: 6 additions & 71 deletions simulation/modelica/daemode/testDAEp2.mos
Expand Up @@ -7,7 +7,7 @@ loadFile("./testDAEPackage.mo");
getErrorString();

setCommandLineOptions("+daeMode=new");
simulate(testDAE.p2, tolerance = 1e-10, method="ida", simflags="-daeMode");
simulate(testDAE.p2, tolerance = 1e-10);
getErrorString();

val(v,0.0);
Expand All @@ -20,43 +20,13 @@ val(w,1.0);
val(x,1.0);
val(y,1.0);

setCommandLineOptions("+daeMode=dynamic");
simulate(testDAE.p2, simflags="-daeMode", tolerance = 1e-10, method="ida");
getErrorString();

val(v,0.0);
val(w,0.0);
val(x,0.0);
val(y,0.0);

val(v,1.0);
val(w,1.0);
val(x,1.0);
val(y,1.0);

setCommandLineOptions("+daeMode=all");
simulate(testDAE.p2, simflags="-daeMode", tolerance = 1e-10, method="ida");
getErrorSall;

val(v,0.0);
val(w,0.0);
val(x,0.0);
val(y,0.0);

val(v,1.0);
val(w,1.0);
val(x,1.0);
val(y,1.0);



// Result:
// true
// ""
// true
// record SimulationResult
// resultFile = "testDAE.p2_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-10, method = 'ida', fileNamePrefix = 'testDAE.p2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-10, method = 'ida', fileNamePrefix = 'testDAE.p2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
Expand All @@ -67,43 +37,8 @@ val(y,1.0);
// 0.0
// 0.0
// 1.0
// 0.3246821977551445
// 1.489289931917652
// 0.6009269148612983
// 0.5377305316363155
// true
// record SimulationResult
// resultFile = "testDAE.p2_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-10, method = 'ida', fileNamePrefix = 'testDAE.p2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. For more information set -d=initialization. In OMEdit Tools->Options->Simulation->OMCFlags, in OMNotebook call setCommandLineOptions("-d=initialization").
// "
// 0.0
// 0.0
// 0.0
// 1.0
// 0.3246821977596118
// 1.489289932205172
// 0.600926914864676
// 0.5377305320239022
// true
// record SimulationResult
// resultFile = "testDAE.p2_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-10, method = 'ida', fileNamePrefix = 'testDAE.p2', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
//
// 0.0
// 0.0
// 0.0
// 1.0
// 0.3246821977596118
// 1.489289932205172
// 0.600926914864676
// 0.5377305320239022
// 0.3246821983221472
// 1.489289929722723
// 0.6009269159058254
// 0.5377305293678811
// endResult
60 changes: 5 additions & 55 deletions simulation/modelica/daemode/testDAEp3.mos
Expand Up @@ -7,7 +7,7 @@ loadFile("./testDAEPackage.mo");
getErrorString();

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

val(x,0.0);
Expand All @@ -16,72 +16,22 @@ val(y,0.0);
val(x,1.0);
val(y,1.0);

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

val(x,0.0);
val(y,0.0);

val(x,1.0);
val(y,1.0);

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

val(x,0.0);
val(y,0.0);

val(x,1.0);
val(y,1.0);




// Result:
// true
// ""
// true
// record SimulationResult
// resultFile = "testDAE.p3_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | 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").
// "
// 0.9
// 0.5122399993895521
// 1.201680492697133
// 1.02593354337205
// true
// record SimulationResult
// resultFile = "testDAE.p3_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | 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").
// "
// 0.9
// 0.5122399993895521
// 1.201679838469092
// 1.025932958278486
// true
// record SimulationResult
// resultFile = "testDAE.p3_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-daeMode'",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'ida', fileNamePrefix = 'testDAE.p3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | 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").
// "
// 0.9
// 0.5122399993895521
// 1.201679838469092
// 1.025932958278486
// 0.512240001019491
// 1.201683485715925
// 1.025938907621438
// endResult

0 comments on commit 71a15a1

Please sign in to comment.