This repository has been archived by the owner on Apr 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
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#2203 - #856
- Loading branch information
1 parent
6737c2c
commit 5c54953
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
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,70 @@ | ||
// name: testSortFunction | ||
// keywords: jacobian differentiation linearization | ||
// status: correct | ||
// teardown_command: rm -rf SortTest* output.log | ||
// | ||
|
||
loadModel(Modelica);getErrorString(); | ||
loadString(" | ||
model SortTest | ||
input Real u; // prevent evaluation by frontend | ||
Real x(start=1); | ||
Real[:, :] M = [3, cos(x)*x; 1 + u, 2+time]; | ||
output Real[size(M, 1), size(M, 2)] N; | ||
equation | ||
der(x) = M[2,1]+sin(x); | ||
N = Modelica.Math.Matrices.sort(M); | ||
end SortTest; | ||
"); | ||
|
||
setCommandLineOptions("--generateSymbolicLinearization"); | ||
linearize(SortTest, stopTime=1.0);getErrorString(); | ||
|
||
loadFile("linear_SortTest.mo"); | ||
list(linear_SortTest); | ||
|
||
|
||
// Result: | ||
// true | ||
// "" | ||
// true | ||
// true | ||
// record SimulationResult | ||
// resultFile = "SortTest_res.mat", | ||
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'SortTest', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''", | ||
// messages = "stdout | info | Linearization will performed at point of time: 1.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 | ||
// "model linear_SortTest | ||
// parameter Integer n = 1; | ||
// // states | ||
// parameter Integer k = 1; | ||
// // top-level inputs | ||
// parameter Integer l = 4; | ||
// // top-level outputs | ||
// parameter Real x0[1] = {2.801060045691952}; | ||
// parameter Real u0[1] = {0}; | ||
// parameter Real A[1, 1] = [-0.9425769139614838]; | ||
// parameter Real B[1, 1] = [1]; | ||
// parameter Real C[4, 1] = [0; 0; 0; -1.878100615247814]; | ||
// parameter Real D[4, 1] = [1; 0; 0; 0]; | ||
// Real x[1](start = x0); | ||
// input Real u[1](start = u0); | ||
// output Real y[4]; | ||
// Real 'x_x' = x[1]; | ||
// Real 'u_u' = u[1]; | ||
// Real 'y_N[1,1]' = y[1]; | ||
// Real 'y_N[1,2]' = y[2]; | ||
// Real 'y_N[2,1]' = y[3]; | ||
// Real 'y_N[2,2]' = y[4]; | ||
// equation | ||
// der(x) = A * x + B * u; | ||
// y = C * x + D * u; | ||
// end linear_SortTest;" | ||
// endResult |