1 | within ;
|
---|
2 | package TestConnector
|
---|
3 |
|
---|
4 | connector Port
|
---|
5 | Real p;
|
---|
6 | flow Real q;
|
---|
7 | stream Real h;
|
---|
8 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
|
---|
9 | coordinateSystem(preserveAspectRatio=false)));
|
---|
10 | end Port;
|
---|
11 |
|
---|
12 | connector HierarchicalPort
|
---|
13 | Port port1;
|
---|
14 | Port port2;
|
---|
15 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
|
---|
16 | coordinateSystem(preserveAspectRatio=false)));
|
---|
17 | end HierarchicalPort;
|
---|
18 |
|
---|
19 | model Source
|
---|
20 | HierarchicalPort p;
|
---|
21 | equation
|
---|
22 | p.port1.q=1;
|
---|
23 | p.port1.h=1000;
|
---|
24 | p.port2.q=10;
|
---|
25 | p.port2.h=2000;
|
---|
26 |
|
---|
27 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
|
---|
28 | coordinateSystem(preserveAspectRatio=false)));
|
---|
29 | end Source;
|
---|
30 |
|
---|
31 | model Sink
|
---|
32 | HierarchicalPort p;
|
---|
33 | equation
|
---|
34 | p.port1.p=1e6;
|
---|
35 | p.port1.h=1000;
|
---|
36 | p.port2.p=2e6;
|
---|
37 | p.port2.h=2000;
|
---|
38 |
|
---|
39 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
|
---|
40 | coordinateSystem(preserveAspectRatio=false)));
|
---|
41 | end Sink;
|
---|
42 |
|
---|
43 | model Test
|
---|
44 | Source source;
|
---|
45 | Sink sink;
|
---|
46 | equation
|
---|
47 | connect(source.p, sink.p);
|
---|
48 | annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
|
---|
49 | coordinateSystem(preserveAspectRatio=false)));
|
---|
50 | end Test;
|
---|
51 | annotation (uses(Modelica(version="3.2.1")));
|
---|
52 | end TestConnector;
|
---|