Ticket #4290: P.mo

File P.mo, 827 bytes (added by Francesco Casella, 7 years ago)
Line 
1within ;
2package P
3connector RealInput = input Real;
4connector RealOutput = output Real;
5
6expandable connector MyBus
7end MyBus;
8
9expandable connector MyBusB
10end MyBusB;
11
12block MyBlock
13 parameter Real k = 0.0;
14 RealInput x;
15 RealOutput y;
16equation
17 y = x * k;
18end MyBlock;
19
20block Const
21 parameter Real k = 0;
22 RealOutput y;
23equation
24 y = k;
25end Const;
26
27model B
28 parameter Real i = 0;
29 MyBlock myBlock(k=i);
30 MyBusB busB;
31 MyBus bus;
32equation
33 connect(bus.x, myBlock.x);
34 connect(myBlock.y, busB.y);
35end B;
36
37model 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);
44equation
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);
52end A;
53
54end P;