1 | within ;
|
---|
2 | package P
|
---|
3 | connector RealInput = input Real;
|
---|
4 | connector RealOutput = output Real;
|
---|
5 |
|
---|
6 | expandable connector MyBus
|
---|
7 | end MyBus;
|
---|
8 |
|
---|
9 | expandable connector MyBusB
|
---|
10 | end MyBusB;
|
---|
11 |
|
---|
12 | block MyBlock
|
---|
13 | parameter Real k = 0.0;
|
---|
14 | RealInput x;
|
---|
15 | RealOutput y;
|
---|
16 | equation
|
---|
17 | y = x * k;
|
---|
18 | end MyBlock;
|
---|
19 |
|
---|
20 | block Const
|
---|
21 | parameter Real k = 0;
|
---|
22 | RealOutput y;
|
---|
23 | equation
|
---|
24 | y = k;
|
---|
25 | end Const;
|
---|
26 |
|
---|
27 | model B
|
---|
28 | parameter Real i = 0;
|
---|
29 | MyBlock myBlock(k=i);
|
---|
30 | MyBusB busB;
|
---|
31 | MyBus bus;
|
---|
32 | equation
|
---|
33 | connect(bus.x, myBlock.x);
|
---|
34 | connect(myBlock.y, busB.y);
|
---|
35 | end B;
|
---|
36 |
|
---|
37 | model A
|
---|
38 | MyBus bus;
|
---|
39 | MyBusB busB1;
|
---|
40 | MyBusB busB2;
|
---|
41 | B b1(i=1);
|
---|
42 | B b2(i=2);
|
---|
43 | Const const(k=42);
|
---|
44 | equation
|
---|
45 | connect(busB1.y, bus.b1);
|
---|
46 | connect(busB2.y, bus.b2);
|
---|
47 | connect(busB1, b1.busB);
|
---|
48 | connect(busB2, b2.busB);
|
---|
49 | connect(bus, b1.bus);
|
---|
50 | connect(bus, b2.bus);
|
---|
51 | connect(const.y, bus.x);
|
---|
52 | end A;
|
---|
53 |
|
---|
54 | end P;
|
---|