Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve handling of expandable connectors (#10540)
- Split complex components into parts when augmenting an expandable connector.
- Loading branch information
Showing
5 changed files
with
81 additions
and
8 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
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
46 changes: 46 additions & 0 deletions
46
testsuite/flattening/modelica/scodeinst/ExpandableConnectorComplex1.mo
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,46 @@ | ||
// name: ExpandableConnectorComplex1 | ||
// keywords: expandable connector | ||
// status: correct | ||
// cflags: -d=newInst | ||
// | ||
// Checks that augmenting an expandable connector with a connector works. | ||
// | ||
|
||
expandable connector Bus | ||
end Bus; | ||
|
||
connector PositivePin | ||
Real v; | ||
flow Real i; | ||
end PositivePin; | ||
|
||
model M | ||
parameter Real A = 1; | ||
parameter Real w = 1; | ||
PositivePin a; | ||
equation | ||
a.v = A*sin(w*time); | ||
end M; | ||
|
||
model ExpandableConnectorComplex1 | ||
Bus bus; | ||
M m; | ||
equation | ||
connect(m.a, bus.a); | ||
end ExpandableConnectorComplex1; | ||
|
||
// Result: | ||
// class ExpandableConnectorComplex1 | ||
// Real bus.a.i "virtual variable in expandable connector"; | ||
// Real bus.a.v "virtual variable in expandable connector"; | ||
// parameter Real m.A = 1.0; | ||
// parameter Real m.w = 1.0; | ||
// Real m.a.v; | ||
// Real m.a.i; | ||
// equation | ||
// m.a.v = bus.a.v; | ||
// bus.a.i = 0.0; | ||
// m.a.i - bus.a.i = 0.0; | ||
// m.a.v = m.A * sin(m.w * time); | ||
// end ExpandableConnectorComplex1; | ||
// 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