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#1972 - OpenModelica/OpenModelica-testsuite#760
- Loading branch information
1 parent
12b5caf
commit 663155c
Showing
22 changed files
with
786 additions
and
36 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,44 @@ | ||
// name: ActualStream | ||
// keywords: stream actualStream connector | ||
// status: correct | ||
// | ||
// Checks that actualStream is evaluated correctly. | ||
// | ||
|
||
connector S | ||
Real r; | ||
flow Real f; | ||
stream Real s; | ||
end S; | ||
|
||
model A | ||
S s1, s2; | ||
end A; | ||
|
||
model ActualStream | ||
A a; | ||
Real actual_stream_s1; | ||
Real actual_stream_s2; | ||
equation | ||
connect(a.s1, a.s2); | ||
actual_stream_s1 = actualStream(a.s1.s); | ||
actual_stream_s2 = actualStream(a.s2.s); | ||
end ActualStream; | ||
|
||
// Result: | ||
// class ActualStream | ||
// Real a.s1.r; | ||
// Real a.s1.f; | ||
// Real a.s1.s; | ||
// Real a.s2.r; | ||
// Real a.s2.f; | ||
// Real a.s2.s; | ||
// Real actual_stream_s1; | ||
// Real actual_stream_s2; | ||
// equation | ||
// actual_stream_s1 = smooth(0, if a.s1.f > 0.0 then a.s2.s else a.s1.s); | ||
// actual_stream_s2 = smooth(0, if a.s2.f > 0.0 then a.s1.s else a.s2.s); | ||
// a.s1.f + a.s2.f = 0.0; | ||
// a.s1.r = a.s2.r; | ||
// end ActualStream; | ||
// 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,63 @@ | ||
// name: ActualStreamMinMax | ||
// keywords: stream actualStream connector | ||
// status: correct | ||
// | ||
// Checks that actualStream is simplified when the flow direction can be | ||
// determined from the min/max attributes. | ||
// | ||
|
||
connector S | ||
Real r; | ||
flow Real f; | ||
stream Real s; | ||
end S; | ||
|
||
model A | ||
S s1(f(min = 0)), s2(f(max = 0)); | ||
S s3(f(min = -5)), s4(f(max = 3)); | ||
end A; | ||
|
||
model ActualStreamMinMax | ||
A a; | ||
Real actual_stream_s1; | ||
Real actual_stream_s2; | ||
Real actual_stream_s3; | ||
Real actual_stream_s4; | ||
equation | ||
connect(a.s1, a.s2); | ||
connect(a.s3, a.s4); | ||
actual_stream_s1 = actualStream(a.s1.s); | ||
actual_stream_s2 = actualStream(a.s2.s); | ||
actual_stream_s3 = actualStream(a.s3.s); | ||
actual_stream_s4 = actualStream(a.s4.s); | ||
end ActualStreamMinMax; | ||
|
||
// Result: | ||
// class ActualStreamMinMax | ||
// Real a.s1.r; | ||
// Real a.s1.f(min = 0.0); | ||
// Real a.s1.s; | ||
// Real a.s2.r; | ||
// Real a.s2.f(max = 0.0); | ||
// Real a.s2.s; | ||
// Real a.s3.r; | ||
// Real a.s3.f(min = -5.0); | ||
// Real a.s3.s; | ||
// Real a.s4.r; | ||
// Real a.s4.f(max = 3.0); | ||
// Real a.s4.s; | ||
// Real actual_stream_s1; | ||
// Real actual_stream_s2; | ||
// Real actual_stream_s3; | ||
// Real actual_stream_s4; | ||
// equation | ||
// actual_stream_s1 = smooth(0, a.s2.s); | ||
// actual_stream_s2 = smooth(0, a.s2.s); | ||
// actual_stream_s3 = smooth(0, if a.s3.f > 0.0 then a.s4.s else a.s3.s); | ||
// actual_stream_s4 = smooth(0, if a.s4.f > 0.0 then a.s3.s else a.s4.s); | ||
// a.s1.f + a.s2.f = 0.0; | ||
// a.s3.f + a.s4.f = 0.0; | ||
// a.s1.r = a.s2.r; | ||
// a.s3.r = a.s4.r; | ||
// end ActualStreamMinMax; | ||
// 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
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,48 @@ | ||
// name: ConnectDiffOrder1 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
connector C1 | ||
Real e1; | ||
flow Real f1; | ||
flow Real f2; | ||
Real e2; | ||
end C1; | ||
|
||
connector C2 | ||
flow Real f2; | ||
Real e2; | ||
flow Real f1; | ||
Real e1; | ||
end C2; | ||
|
||
model ConnectDiffOrder1 | ||
C1 c1; | ||
C2 c2; | ||
equation | ||
connect(c1, c2); | ||
end ConnectDiffOrder1; | ||
|
||
// Result: | ||
// class ConnectDiffOrder1 | ||
// Real c1.e1; | ||
// Real c1.f1; | ||
// Real c1.f2; | ||
// Real c1.e2; | ||
// Real c2.f2; | ||
// Real c2.e2; | ||
// Real c2.f1; | ||
// Real c2.e1; | ||
// equation | ||
// c1.e1 = c2.e1; | ||
// c1.e2 = c2.e2; | ||
// (-c1.f1) + (-c2.f1) = 0.0; | ||
// (-c1.f2) + (-c2.f2) = 0.0; | ||
// c1.f1 = 0.0; | ||
// c1.f2 = 0.0; | ||
// c2.f2 = 0.0; | ||
// c2.f1 = 0.0; | ||
// end ConnectDiffOrder1; | ||
// 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,74 @@ | ||
// name: ConnectDiffOrder2 | ||
// keywords: | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
|
||
connector C1 | ||
Real e1; | ||
flow Real f1; | ||
flow Real f2; | ||
Real e2; | ||
end C1; | ||
|
||
connector C2 | ||
flow Real f2; | ||
Real e2; | ||
flow Real f1; | ||
Real e1; | ||
end C2; | ||
|
||
connector C3 | ||
C1 c1; | ||
C2 c2; | ||
end C3; | ||
|
||
connector C4 | ||
C2 c2; | ||
C1 c1; | ||
end C4; | ||
|
||
model ConnectDiffOrder2 | ||
C3 c3; | ||
C4 c4; | ||
equation | ||
connect(c3, c4); | ||
end ConnectDiffOrder2; | ||
|
||
// Result: | ||
// class ConnectDiffOrder2 | ||
// Real c3.c1.e1; | ||
// Real c3.c1.f1; | ||
// Real c3.c1.f2; | ||
// Real c3.c1.e2; | ||
// Real c3.c2.f2; | ||
// Real c3.c2.e2; | ||
// Real c3.c2.f1; | ||
// Real c3.c2.e1; | ||
// Real c4.c2.f2; | ||
// Real c4.c2.e2; | ||
// Real c4.c2.f1; | ||
// Real c4.c2.e1; | ||
// Real c4.c1.e1; | ||
// Real c4.c1.f1; | ||
// Real c4.c1.f2; | ||
// Real c4.c1.e2; | ||
// equation | ||
// c3.c1.e1 = c4.c1.e1; | ||
// c3.c1.e2 = c4.c1.e2; | ||
// (-c3.c1.f1) + (-c4.c1.f1) = 0.0; | ||
// (-c3.c1.f2) + (-c4.c1.f2) = 0.0; | ||
// c3.c2.e1 = c4.c2.e1; | ||
// c3.c2.e2 = c4.c2.e2; | ||
// (-c3.c2.f1) + (-c4.c2.f1) = 0.0; | ||
// (-c3.c2.f2) + (-c4.c2.f2) = 0.0; | ||
// c3.c1.f1 = 0.0; | ||
// c3.c1.f2 = 0.0; | ||
// c3.c2.f2 = 0.0; | ||
// c3.c2.f1 = 0.0; | ||
// c4.c2.f2 = 0.0; | ||
// c4.c2.f1 = 0.0; | ||
// c4.c1.f1 = 0.0; | ||
// c4.c1.f2 = 0.0; | ||
// end ConnectDiffOrder2; | ||
// 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
Oops, something went wrong.