/
test_04.mos
129 lines (124 loc) · 4.96 KB
/
test_04.mos
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
// name: test_04.mos
// keywords: <...>
// status: correct
// cflags: +postOptModules=inlineArrayEqn,constantLinearSystem,removeSimpleEquations,generateSymbolicLinearization
// teardown_command: rm -rf *simple_test* output.log
//
// <insert description here>
//
loadFile("test_04.mo");
linearize(simple_test, stopTime=0);
getErrorString();
loadFile("linear_simple_test.mo");
simulate(linear_simple__test,method="euler");
getErrorString();
list(linear_simple__test);
readFile("linear_simple__test.log"); // Check that output log is empty
//
// Case for numeric linearization of LotkaVolterra model
//
//linearize with numeric linearization and data recovery
simulate(simple_test, simflags="-l=0 -l_datarec");
getErrorString();
loadFile("linear_simple_test.mo");
simulate(linear_simple__test, method="euler");
getErrorString();
list(linear_simple__test);
readFile("linear_simple__test.log"); // Check that output log is empty
// Result:
// true
// record SimulationResult
// resultFile = "simple_test_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 0.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'simple_test', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = "stdout | info | Linearization will performed at point of time: 0.000000
// stdout | info | Linear model is created!
// "
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// "
// true
// record SimulationResult
// resultFile = "linear_simple__test_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'euler', fileNamePrefix = 'linear_simple__test', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// "
// "model linear_simple__test
// parameter Integer n = 2;
// // states
// parameter Integer k = 1;
// // top-level inputs
// parameter Integer l = 1;
// // top-level outputs
// parameter Real x0[2] = {1, 2};
// parameter Real u0[1] = {0};
// parameter Real A[2, 2] = [0, -1; -2, -1];
// parameter Real B[2, 1] = [0; 0];
// parameter Real C[1, 2] = [0, 0];
// parameter Real D[1, 1] = [3];
// Real x[2](start = x0);
// input Real u[1](start = u0);
// output Real y[1];
// Real 'x_Px1' = x[1];
// Real 'x_Px2' = x[2];
// Real 'u_Pu' = u[1];
// Real 'y_Py' = y[1];
// equation
// der(x) = A * x + B * u;
// y = C * x + D * u;
// end linear_simple__test;"
// ""
// record SimulationResult
// resultFile = "simple_test_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'simple_test', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = '-l=0 -l_datarec'",
// messages = "stdout | info | Linearization will performed at point of time: 0.000000
// stdout | info | Jacobian or SparsePattern is not generated or failed to initialize! Switch back to normal.
// stdout | info | Linear model is created!
// "
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// "
// true
// record SimulationResult
// resultFile = "linear_simple__test_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'euler', fileNamePrefix = 'linear_simple__test', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// "Warning: The initial conditions are not fully specified. Use +d=initialization for more information.
// "
// "model linear_simple__test
// parameter Integer n = 2;
// // states
// parameter Integer k = 1;
// // top-level inputs
// parameter Integer l = 1;
// // top-level outputs
// parameter Integer nz = 2;
// // data recovery variables
// parameter Real x0[2] = {1, 2};
// parameter Real u0[1] = {0};
// parameter Real z0[2] = {0, 0};
// parameter Real A[2, 2] = [-2.665600749850023e-07, -1.000000001354202; -2.000000002708404, -1.00000010131423];
// parameter Real B[2, 1] = [0; 0];
// parameter Real C[1, 2] = [0, 0];
// parameter Real D[1, 1] = [3];
// parameter Real Cz[2, 2] = [0, 0; 0, 0];
// parameter Real Dz[2, 1] = [1; 3];
// Real x[2](start = x0);
// input Real u[1](start = u0);
// output Real y[1];
// output Real z[2];
// Real 'x_Px1' = x[1];
// Real 'x_Px2' = x[2];
// Real 'u_Pu' = u[1];
// Real 'y_Py' = y[1];
// Real 'z_Pu' = z[1];
// Real 'z_Py' = z[2];
// equation
// der(x) = A * x + B * u;
// y = C * x + D * u;
// z = Cz * x + Dz * u;
// end linear_simple__test;"
// ""
// endResult