Skip to content

Commit

Permalink
Add scaling test and expected output
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardbachmann authored and OpenModelica-Hudson committed Sep 13, 2017
1 parent 1e8090d commit 2965425
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 11 deletions.
Expand Up @@ -33,6 +33,9 @@ runScript(modelTesting);getErrorString();
// assert | warning | The following assertion has been violated at time 5.000000
// | | | | overflow.flowModel.states[1].p >= 0.0 and overflow.flowModel.states[1].p <= 100000000.0
// assert | warning | Variable violating min/max constraint: 0.0 <= overflow.flowModel.states[1].p <= 100000000.0, has value: -93465.5
// assert | warning | The following assertion has been violated at time 70.000000
// | | | | lowerTank.ports[2].p >= 0.0 and lowerTank.ports[2].p <= 100000000.0
// assert | warning | Variable violating min/max constraint: 0.0 <= lowerTank.ports[2].p <= 100000000.0, has value: -14378
// stdout | info | The simulation finished successfully.
//
// "true
Expand Down
1 change: 1 addition & 0 deletions simulation/modelica/nonlinear_system/Makefile
Expand Up @@ -47,6 +47,7 @@ problem11.mos \
problem12.mos \
TestInputIteration.mos \
TestFalseIterationNLS.mos \
ScalingTest1.mos \

# test that currently fail. Move up when fixed.
# Run make testfailing
Expand Down
59 changes: 59 additions & 0 deletions simulation/modelica/nonlinear_system/ScalingTest1.mos
@@ -0,0 +1,59 @@
// name: ScalingTest1
// status: correct
//
//

loadModel(Modelica); getErrorString();
loadString("
model ScalingTest1
parameter Real nom1 = 1e30;
parameter Real nom2 = 1e-12;
parameter Real fnom1 = 1e25;
parameter Real fnom2 = 1e-13;
Real x1(start=4*nom1,nominal=nom1);
Real x2(start=2*nom2,nominal=nom2);
equation
0 = sin(x1/nom1)*cos(x2/nom2)*fnom2 - cos(x1/nom1)*sin(x2/nom2)*fnom2;
0 = log(x1/nom1)*log(x2/nom2)*fnom1 - log(3)^2*fnom1;
end ScalingTest1;
"); getErrorString();

simulate(ScalingTest1); getErrorString();
val(x1, 0.0); getErrorString();
val(x2, 0.0); getErrorString();

simulate(ScalingTest1, simflags="-override nom1=1,nom2=1,fnom1=1,fnom2=1"); getErrorString();
val(x1, 0.0); getErrorString();
val(x2, 0.0); getErrorString();


// Result:
// true
// ""
// true
// ""
// record SimulationResult
// resultFile = "ScalingTest1_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'ScalingTest1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "stdout | info | The initialization finished successfully without homotopy method.
// stdout | info | The simulation finished successfully.
// "
// end SimulationResult;
// ""
// 5.217839301454226e+30
// ""
// 2.076246647864433e-12
// ""
// record SimulationResult
// resultFile = "ScalingTest1_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'ScalingTest1', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-override nom1=1,nom2=1,fnom1=1,fnom2=1'",
// messages = "stdout | info | The initialization finished successfully without homotopy method.
// stdout | info | The simulation finished successfully.
// "
// end SimulationResult;
// ""
// 5.217839301454226
// ""
// 2.076246647864433
// ""
// endResult
18 changes: 9 additions & 9 deletions simulation/modelica/nonlinear_system/bug_2841.mos
Expand Up @@ -81,13 +81,13 @@ simulate(nonlinearSolverTests.bug_2841, stopTime=0.0, simflags="-lv=LOG_INIT,LOG
// LOG_NLS_V | info | function values: [2-dim]
// | | | | | -0.35724392 0.25583073
// LOG_NLS_V | info | scaled function values: [2-dim]
// | | | | | -0.17862196 0.25583073
// | | | | | -0.17862196 0.32849316
// LOG_NLS_V | info | error measurements:
// LOG_NLS_V | info | delta_x = 2.5510381250e+05
// LOG_NLS_V | info | delta_x_scaled = 2.5510381250e+00
// LOG_NLS_V | info | delta_x_scaled = 2.6029017761e+00
// LOG_NLS_V | info | newtonXTol = 1.0000000000e-12
// LOG_NLS_V | info | error_f = 4.3940025040e-01
// LOG_NLS_V | info | error_f_scaled = 3.1201789440e-01
// LOG_NLS_V | info | error_f_scaled = 3.7391651425e-01
// LOG_NLS_V | info | newtonFTol = 1.0000000000e-12
// LOG_NLS_V | info | Iteration: 2
// LOG_NLS_V | info | newton step
Expand All @@ -105,7 +105,7 @@ simulate(nonlinearSolverTests.bug_2841, stopTime=0.0, simflags="-lv=LOG_INIT,LOG
// | | | | | -0.012979095 -0.023836877
// LOG_NLS_V | info | error measurements:
// LOG_NLS_V | info | delta_x = 2.9711975486e+04
// LOG_NLS_V | info | delta_x_scaled = 2.9711975486e-01
// LOG_NLS_V | info | delta_x_scaled = 3.2668067324e-01
// LOG_NLS_V | info | newtonXTol = 1.0000000000e-12
// LOG_NLS_V | info | error_f = 8.9380216642e-02
// LOG_NLS_V | info | error_f_scaled = 2.7141364009e-02
Expand All @@ -126,7 +126,7 @@ simulate(nonlinearSolverTests.bug_2841, stopTime=0.0, simflags="-lv=LOG_INIT,LOG
// | | | | | 0.00038176671 0.00055228655
// LOG_NLS_V | info | error measurements:
// LOG_NLS_V | info | delta_x = 3.8894602256e+03
// LOG_NLS_V | info | delta_x_scaled = 3.8894602256e-02
// LOG_NLS_V | info | delta_x_scaled = 3.9405401054e-02
// LOG_NLS_V | info | newtonXTol = 1.0000000000e-12
// LOG_NLS_V | info | error_f = 2.2072982312e-03
// LOG_NLS_V | info | error_f_scaled = 6.7139128116e-04
Expand All @@ -147,7 +147,7 @@ simulate(nonlinearSolverTests.bug_2841, stopTime=0.0, simflags="-lv=LOG_INIT,LOG
// | | | | | 2.4931307e-07 2.6503402e-07
// LOG_NLS_V | info | error measurements:
// LOG_NLS_V | info | delta_x = 6.2746972448e+01
// LOG_NLS_V | info | delta_x_scaled = 6.2746972448e-04
// LOG_NLS_V | info | delta_x_scaled = 6.9380430845e-04
// LOG_NLS_V | info | newtonXTol = 1.0000000000e-12
// LOG_NLS_V | info | error_f = 1.4052454980e-06
// LOG_NLS_V | info | error_f_scaled = 3.6386816259e-07
Expand All @@ -168,7 +168,7 @@ simulate(nonlinearSolverTests.bug_2841, stopTime=0.0, simflags="-lv=LOG_INIT,LOG
// | | | | | 1.0271701e-13 8.595627e-14
// LOG_NLS_V | info | error measurements:
// LOG_NLS_V | info | delta_x = 2.7596879198e-02
// LOG_NLS_V | info | delta_x_scaled = 2.7596879199e-07
// LOG_NLS_V | info | delta_x_scaled = 3.6775904375e-07
// LOG_NLS_V | info | newtonXTol = 1.0000000000e-12
// LOG_NLS_V | info | error_f = 5.5523886249e-13
// LOG_NLS_V | info | error_f_scaled = 1.3393753756e-13
Expand All @@ -189,7 +189,7 @@ simulate(nonlinearSolverTests.bug_2841, stopTime=0.0, simflags="-lv=LOG_INIT,LOG
// | | | | | 0 -4.6312676e-17
// LOG_NLS_V | info | error measurements:
// LOG_NLS_V | info | delta_x = 7.4635040900e-09
// LOG_NLS_V | info | delta_x_scaled = 7.4635040908e-14
// LOG_NLS_V | info | delta_x_scaled = 1.3268481481e-13
// LOG_NLS_V | info | newtonXTol = 1.0000000000e-12
// LOG_NLS_V | info | error_f = 1.1102230246e-16
// LOG_NLS_V | info | error_f_scaled = 4.6312676255e-17
Expand Down Expand Up @@ -259,7 +259,7 @@ simulate(nonlinearSolverTests.bug_2841, stopTime=0.0, simflags="-lv=LOG_INIT,LOG
// | | | | | 8.8472946e-17 9.2625353e-17
// LOG_NLS_V | info | error measurements:
// LOG_NLS_V | info | delta_x = 7.7595205169e-12
// LOG_NLS_V | info | delta_x_scaled = 7.7595205169e-17
// LOG_NLS_V | info | delta_x_scaled = 7.9960543487e-17
// LOG_NLS_V | info | newtonXTol = 1.0000000000e-12
// LOG_NLS_V | info | error_f = 4.9650683065e-16
// LOG_NLS_V | info | error_f_scaled = 1.2808949265e-16
Expand Down
2 changes: 0 additions & 2 deletions simulation/modelica/tearing/dynamicTearing1.mos
Expand Up @@ -596,8 +596,6 @@ val(z2,1.1); getErrorString();
// LOG_DT | info | Constraints of the casual tearing set are violated! Now the strict tearing set is used.
// LOG_DT | info | Solving nonlinear system 18 (STRICT TEARING SET if tearing enabled) at time = 1.0000000000e+00
// LOG_DT | info | Solving nonlinear system 33 (CASUAL TEARING SET, strict: 28) at time = 1.0000000000e+00
// LOG_DT | info | The determinant of the casual tearing set is vanishing, let's fail if this is not the solution...
// LOG_DT | info | It is not the solution.
// LOG_DT | info | Solving the casual tearing set failed! Now the strict tearing set is used.
// LOG_DT | info | Solving nonlinear system 28 (STRICT TEARING SET if tearing enabled) at time = 1.0000000000e+00
// LOG_DT | info | Solving nonlinear system 23 (CASUAL TEARING SET, strict: 18) at time = 1.0040000000e+00
Expand Down

0 comments on commit 2965425

Please sign in to comment.