Skip to content

Commit

Permalink
added testcase for inverse algorithm initialization
Browse files Browse the repository at this point in the history
 - adjust dumping test

Belonging to [master]:
  - OpenModelica/OMCompiler#2249
  - OpenModelica/OpenModelica-testsuite#866
  • Loading branch information
Willi Braun authored and OpenModelica-Hudson committed Mar 2, 2018
1 parent 78e4cba commit 25f7007
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
43 changes: 43 additions & 0 deletions simulation/modelica/algorithms_functions/InverseAlgorithm3.mos
@@ -0,0 +1,43 @@
// name: InverseAlgorithm3
// keywords: inverse algorithm
// status: correct

loadString("
model InverseAlgorithm
Real x(start=1);
Real y(start=1), z[2];
initial equation
der(x) = 0;
equation
der(x) = x*y;
algorithm
y := sin(x)+y;
for i in 1:2 loop
z[i] := cos(y)+i;
end for;
end InverseAlgorithm;
"); getErrorString();

simulate(InverseAlgorithm, simflags="-lv=LOG_SOTI"); getErrorString();

// Result:
// true
// ""
// record SimulationResult
// resultFile = "InverseAlgorithm_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'InverseAlgorithm', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-lv=LOG_SOTI'",
// messages = "LOG_SOTI | info | ### SOLUTION OF THE INITIALIZATION ###
// | | | | | states variables
// | | | | | | [1] Real x(start=1, nominal=1) = 7.42794e-27 (pre: 1)
// | | | | | derivatives variables
// | | | | | | [2] Real der(x) = 0 (pre: 0)
// | | | | | other real variables
// | | | | | | [3] Real y(start=1, nominal=1) = 1 (pre: 1)
// | | | | | | [4] Real z[1](start=0, nominal=1) = 1.5403 (pre: 0)
// | | | | | | [5] Real z[2](start=0, nominal=1) = 2.5403 (pre: 0)
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// end SimulationResult;
// ""
// endResult
1 change: 1 addition & 0 deletions simulation/modelica/algorithms_functions/Makefile
Expand Up @@ -27,6 +27,7 @@ FunctionTupleRecord.mos \
Interpolation.mos \
InverseAlgorithm1.mos \
InverseAlgorithm2.mos \
InverseAlgorithm3.mos \
LocalVariableInit.mos \
ModelicaTest.Fluid.Dissipation.Verifications.HeatTransfer.Channel.kc_evenGapLaminar.mos \
SimplePeriodicSampler.mos \
Expand Down
1 change: 1 addition & 0 deletions simulation/modelica/tearing/dynamicTearing3.mos
Expand Up @@ -67,6 +67,7 @@ simulate(dynamicTearing3,startTime=0,stopTime=2,numberOfIntervals=500,simflags="
// Equations (4, 4)
// ========================================
// 1/1 (1): algorithm
// a := $START.a;
// a := 2.0 * x;
// [dynamic]
// 2/2 (1): g * a * x + time - y ^ 2.0 = 0.0 [dynamic]
Expand Down

0 comments on commit 25f7007

Please sign in to comment.