-
Notifications
You must be signed in to change notification settings - Fork 298
/
test_05.mos
135 lines (129 loc) · 6.17 KB
/
test_05.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
130
131
132
133
134
135
// name: test_05.mos
// keywords: <...>
// status: correct
// teardown_command: rm -rf *simple_test* output.log
//
// <insert description here>
//
loadFile("test_05.mo");
setCommandLineOptions("--generateSymbolicLinearization");
getErrorString();
linearize(simple_test, stopTime=0);
getErrorString();
setCommandLineOptions("--generateSymbolicLinearization=false");
getErrorString();
loadFile("linearized_model.mo");
simulate(linearized_model, method="euler");
getErrorString();
list(linearized_model);
readFile("linearized_model.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("linearized_model.mo");
simulate(linearized_model, method="euler");
getErrorString();
list(linearized_model);
readFile("linearized_model.log"); // Check that output log is empty
// Result:
// true
// 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 be performed at point of time: 0.000000
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// stdout | info | Linear model is created.
// "
// 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\").
// "
// true
// ""
// true
// record SimulationResult
// resultFile = "linearized_model_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'euler', fileNamePrefix = 'linearized_model', 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: 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\").
// "
// "model linearized_model \"simple_test\"
// parameter Integer n = 2 \"number of states\";
// parameter Integer m = 0 \"number of inputs\";
// parameter Integer p = 0 \"number of outputs\";
// parameter Real x0[n] = {0, 0};
// parameter Real u0[m] = zeros(0);
// parameter Real A[n, n] = [6, 0; 0, 4];
// parameter Real B[n, m] = zeros(n, m);
// parameter Real C[p, n] = zeros(p, n);
// parameter Real D[p, m] = zeros(p, m);
// Real x[n](start = x0);
// input Real u[m];
// output Real y[p];
// Real 'x_a' = x[1];
// Real 'x_b' = x[2];
// equation
// der(x) = A * x + B * u;
// y = C * x + D * u;
// end linearized_model;"
// "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// 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 be performed at point of time: 0.000000
// LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// stdout | info | Linear model is created.
// "
// 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\").
// "
// true
// record SimulationResult
// resultFile = "linearized_model_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'euler', fileNamePrefix = 'linearized_model', 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: 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\").
// "
// "model linearized_model \"simple_test\"
// parameter Integer n = 2 \"number of states\";
// parameter Integer m = 0 \"number of inputs\";
// parameter Integer p = 0 \"number of outputs\";
// parameter Integer nz = 0 \"data recovery variables\";
// parameter Real x0[2] = {0, 0};
// parameter Real u0[0] = zeros(0);
// parameter Real z0[0] = zeros(0);
// parameter Real A[n, n] = [5.999999866719962, 0; 0, 3.999999933359981];
// parameter Real B[n, m] = zeros(n, m);
// parameter Real C[p, n] = zeros(p, n);
// parameter Real D[p, m] = zeros(p, m);
// parameter Real Cz[nz, n] = zeros(nz, n);
// parameter Real Dz[nz, m] = zeros(nz, m);
// Real x[n](start = x0);
// input Real u[m];
// output Real y[p];
// output Real z[nz];
// Real 'x_a' = x[1];
// Real 'x_b' = x[2];
// equation
// der(x) = A * x + B * u;
// y = C * x + D * u;
// z = Cz * x + Dz * u;
// end linearized_model;"
// "LOG_SUCCESS | info | The initialization finished successfully without homotopy method.
// LOG_SUCCESS | info | The simulation finished successfully.
// "
// endResult