Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Belonging to [master]: - OpenModelica/OMCompiler#1872 - OpenModelica/OpenModelica-testsuite#730
- Loading branch information
1 parent
988a898
commit 12ed59f
Showing
11 changed files
with
1,205 additions
and
978 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// name: testArrayAlgDiff | ||
// keywords: differentiation linearization array algorithm | ||
// status: correct | ||
// teardown_command: rm -rf ticket4545* output.log linear_ticket4545* | ||
// | ||
// | ||
|
||
loadString(" | ||
package ticket4545 | ||
model Test_vector | ||
Real x[2](each start = 0, each fixed = true); | ||
discrete Real u[2](each start = 0, each fixed = true); | ||
Real y[2]; | ||
equation | ||
for i in 1:2 loop | ||
der(x[i]) = u[i]+y[i]; | ||
y[i] = 0.5*x[i]; | ||
end for; | ||
algorithm | ||
when sample(0,1) then | ||
for i in 1:2 loop | ||
u[i] := 1 - y[i]; | ||
end for; | ||
end when; | ||
annotation(experiment(StopTime = 10)); | ||
end Test_vector; | ||
end ticket4545; | ||
"); | ||
getErrorString(); | ||
|
||
setCommandLineOptions("--generateSymbolicLinearization"); | ||
getErrorString(); | ||
linearize(ticket4545.Test_vector, stopTime=0); | ||
getErrorString(); | ||
loadFile("linear_ticket4545.Test_vector.mo"); | ||
list(linear_ticket4545_Test__vector); | ||
getErrorString(); | ||
|
||
|
||
|
||
// Result: | ||
// true | ||
// "" | ||
// true | ||
// "" | ||
// record SimulationResult | ||
// resultFile = "ticket4545.Test_vector_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 0.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'ticket4545.Test_vector', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "stdout | info | Linearization will performed at point of time: 0.000000 | ||
// stdout | info | The initialization finished successfully without homotopy method. | ||
// stdout | info | The simulation finished successfully. | ||
// stdout | info | Linear model is created! | ||
// " | ||
// end SimulationResult; | ||
// "" | ||
// true | ||
// "model linear_ticket4545_Test__vector | ||
// parameter Integer n = 2; | ||
// // states | ||
// parameter Integer k = 0; | ||
// // top-level inputs | ||
// parameter Integer l = 0; | ||
// // top-level outputs | ||
// parameter Real x0[2] = {0, 0}; | ||
// parameter Real u0[0] = {i for i in 1:0}; | ||
// parameter Real A[2, 2] = [0.5, 0; 0, 0.5]; | ||
// parameter Real B[2, 0] = zeros(2, 0); | ||
// parameter Real C[0, 2] = zeros(0, 2); | ||
// parameter Real D[0, 0] = zeros(0, 0); | ||
// Real x[2](start = x0); | ||
// input Real u[0]; | ||
// output Real y[0]; | ||
// Real 'x_x[1]' = x[1]; | ||
// Real 'x_x[2]' = x[2]; | ||
// equation | ||
// der(x) = A * x + B * u; | ||
// y = C * x + D * u; | ||
// end linear_ticket4545_Test__vector;" | ||
// "" | ||
// endResult |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.