Skip to content

Commit 8422ae5

Browse files
kabdelhakadrpo
authored andcommitted
[testsuite] add testcase for ticket #5807
1 parent 772e2dc commit 8422ae5

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

testsuite/simulation/modelica/start_value_selection/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ TESTFILES = \
55
UnevaluateableFixedAttribute.mos \
66
MinimalModel.mos \
77
asmaFlow.mos \
8+
ticket5807.mos \
89

910

1011
# test that currently fail. Move up when fixed.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// name: ticket #5807 [backend]
2+
// keywords: start value selection
3+
// status: correct
4+
// teardown_command: rm -rf TestInitStart* _TestInitStart*
5+
6+
loadString("
7+
model TestInitStart
8+
final parameter Real p(start = p_start, fixed = false);
9+
parameter Real p_start = -2;
10+
initial equation
11+
(p - 1)*p*(p+2) = 0;
12+
annotation(__OpenModelica_simulationFlags(lv=LOG_NLS_V));
13+
end TestInitStart;
14+
"); getErrorString();
15+
16+
simulate(TestInitStart); getErrorString();
17+
// Result:
18+
// true
19+
// ""
20+
// record SimulationResult
21+
// resultFile = "TestInitStart_res.mat",
22+
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'TestInitStart', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-lv=LOG_NLS_V'",
23+
// messages = "LOG_NLS | info | initialize mixed system solvers
24+
// | | | | | 0 mixed systems
25+
// LOG_NLS | info | initialize non-linear system solvers
26+
// | | | | | 1 non-linear systems
27+
// LOG_NLS | info | update static data of non-linear system solvers
28+
// LOG_NLS | info | ############ Solve nonlinear system 2 at time 0 ############
29+
// | | | | | initial variable values:
30+
// | | | | | | [ 1] p = -2 nom = 1
31+
// LOG_NLS_V | info | ------------------------------------------------------
32+
// LOG_NLS_V | info | SOLVING NON-LINEAR SYSTEM USING MIXED SOLVER (Newton/Homotopy solver)
33+
// LOG_NLS_V | info | EQUATION NUMBER: 2
34+
// LOG_NLS_V | info | TIME: 0.0000000000e+00
35+
// LOG_NLS_V | info | number of function calls (so far!): 0
36+
// LOG_NLS_V | info | System values [1-dim]
37+
// | | | | | -2
38+
// LOG_NLS_V | info | Nominal values [1-dim]
39+
// | | | | | 1
40+
// LOG_NLS_V | info | Scaling values [2-dim]
41+
// | | | | | 2 1
42+
// LOG_NLS_V | info | x0 [1-dim]
43+
// | | | | | -2
44+
// LOG_NLS_V | info | NO ITERATION NECESSARY!!!
45+
// LOG_NLS_V | info | ******************************************************
46+
// LOG_NLS_V | info | SYSTEM SOLVED
47+
// LOG_NLS_V | info | number of function calls: 1
48+
// LOG_NLS_V | info | ------------------------------------------------------
49+
// LOG_NLS_V | info | Solution [1-dim]
50+
// | | | | | -2
51+
// LOG_NLS | info | | Solution status: SOLVED
52+
// | | | | | | number of iterations : 0
53+
// | | | | | | number of function evaluations : 1
54+
// | | | | | | number of jacobian evaluations : 0
55+
// | | | | | | solution values:
56+
// | | | | | | [ 1] p = -2
57+
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
58+
// LOG_SUCCESS | info | The simulation finished successfully.
59+
// LOG_NLS | info | free mixed system solvers
60+
// LOG_NLS | info | free non-linear system solvers
61+
// "
62+
// end SimulationResult;
63+
// ""
64+
// endResult

0 commit comments

Comments
 (0)