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#2160 - OpenModelica/OpenModelica-testsuite#841
- Loading branch information
1 parent
dad2e98
commit 2008d81
Showing
11 changed files
with
212 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// name: ConnectArrays1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model ConnectArrays1 | ||
connector A | ||
Real e; | ||
end A; | ||
|
||
constant Integer n=5; | ||
A a[n]; | ||
equation | ||
a[1].e = 1; | ||
connect(a[1:n-1],a[2:n]); | ||
end ConnectArrays1; | ||
|
||
// Result: | ||
// class ConnectArrays1 | ||
// constant Integer n = 5; | ||
// Real a[1].e; | ||
// Real a[2].e; | ||
// Real a[3].e; | ||
// Real a[4].e; | ||
// Real a[5].e; | ||
// equation | ||
// a[4].e = a[5].e; | ||
// a[4].e = a[3].e; | ||
// a[4].e = a[2].e; | ||
// a[4].e = a[1].e; | ||
// a[1].e = 1.0; | ||
// end ConnectArrays1; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// name: ConnectArrays2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model ConnectArrays2 | ||
connector InReal = input Real; | ||
connector OutReal = output Real; | ||
parameter Integer p = 3; | ||
InReal x[p]; | ||
OutReal y[p+1]; | ||
equation | ||
connect(x,y[2:p+1]); | ||
end ConnectArrays2; | ||
|
||
// Result: | ||
// class ConnectArrays2 | ||
// parameter Integer p = 3; | ||
// input Real x[1]; | ||
// input Real x[2]; | ||
// input Real x[3]; | ||
// output Real y[1]; | ||
// output Real y[2]; | ||
// output Real y[3]; | ||
// output Real y[4]; | ||
// equation | ||
// x[1] = y[2]; | ||
// x[2] = y[3]; | ||
// x[3] = y[4]; | ||
// end ConnectArrays2; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// name: ConnectArrays3 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model ConnectArrays3 | ||
model B | ||
connector InReal = input Real; | ||
connector OutReal = output Real; | ||
parameter Integer p = 3; | ||
InReal x[p]; | ||
OutReal y[p+1]; | ||
end B; | ||
|
||
B b1[3], b2[3]; | ||
equation | ||
connect(b1[1:3].x[1:3], b2[1:3].y[1:3]); | ||
end ConnectArrays3; | ||
|
||
// Result: | ||
// class ConnectArrays3 | ||
// parameter Integer b1[1].p = 3; | ||
// Real b1[1].x[1]; | ||
// Real b1[1].x[2]; | ||
// Real b1[1].x[3]; | ||
// Real b1[1].y[1]; | ||
// Real b1[1].y[2]; | ||
// Real b1[1].y[3]; | ||
// Real b1[1].y[4]; | ||
// parameter Integer b1[2].p = 3; | ||
// Real b1[2].x[1]; | ||
// Real b1[2].x[2]; | ||
// Real b1[2].x[3]; | ||
// Real b1[2].y[1]; | ||
// Real b1[2].y[2]; | ||
// Real b1[2].y[3]; | ||
// Real b1[2].y[4]; | ||
// parameter Integer b1[3].p = 3; | ||
// Real b1[3].x[1]; | ||
// Real b1[3].x[2]; | ||
// Real b1[3].x[3]; | ||
// Real b1[3].y[1]; | ||
// Real b1[3].y[2]; | ||
// Real b1[3].y[3]; | ||
// Real b1[3].y[4]; | ||
// parameter Integer b2[1].p = 3; | ||
// Real b2[1].x[1]; | ||
// Real b2[1].x[2]; | ||
// Real b2[1].x[3]; | ||
// Real b2[1].y[1]; | ||
// Real b2[1].y[2]; | ||
// Real b2[1].y[3]; | ||
// Real b2[1].y[4]; | ||
// parameter Integer b2[2].p = 3; | ||
// Real b2[2].x[1]; | ||
// Real b2[2].x[2]; | ||
// Real b2[2].x[3]; | ||
// Real b2[2].y[1]; | ||
// Real b2[2].y[2]; | ||
// Real b2[2].y[3]; | ||
// Real b2[2].y[4]; | ||
// parameter Integer b2[3].p = 3; | ||
// Real b2[3].x[1]; | ||
// Real b2[3].x[2]; | ||
// Real b2[3].x[3]; | ||
// Real b2[3].y[1]; | ||
// Real b2[3].y[2]; | ||
// Real b2[3].y[3]; | ||
// Real b2[3].y[4]; | ||
// equation | ||
// b1[1:3].x[1] = b2[1:3].y[1]; | ||
// b1[1:3].x[2] = b2[1:3].y[2]; | ||
// b1[1:3].x[3] = b2[1:3].y[3]; | ||
// end ConnectArrays3; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// name: Subscript2 | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model Subscript2 | ||
Real x[3] = {1, 2, 3}; | ||
Real y[2] = x[2:3]; | ||
end Subscript2; | ||
|
||
// Result: | ||
// class Subscript2 | ||
// Real x[1]; | ||
// Real x[2]; | ||
// Real x[3]; | ||
// Real y[1]; | ||
// Real y[2]; | ||
// equation | ||
// x = {1.0, 2.0, 3.0}; | ||
// y = x[2:3]; | ||
// end Subscript2; | ||
// 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// name: Subscript3 | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// | ||
|
||
model Subscript3 | ||
Real x[3, 2] = {{1, 2}, {3, 4}, {5, 6}}; | ||
Real y[2, 1]; | ||
equation | ||
y = x[2:3, 1:1]; | ||
end Subscript3; | ||
|
||
// Result: | ||
// class Subscript3 | ||
// Real x[1,1]; | ||
// Real x[1,2]; | ||
// Real x[2,1]; | ||
// Real x[2,2]; | ||
// Real x[3,1]; | ||
// Real x[3,2]; | ||
// Real y[1,1]; | ||
// Real y[2,1]; | ||
// equation | ||
// x = {{1.0, 2.0}, {3.0, 4.0}, {5.0, 6.0}}; | ||
// y[1,1] = x[2,1]; | ||
// y[2,1] = x[3,1]; | ||
// end Subscript3; | ||
// endResult |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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