Ticket #5813: Aliases.mo

File Aliases.mo, 2.5 KB (added by Francesco Casella, 7 years ago)
Line 
1package Aliases
2 type Temperature = Real(start = 300, unit="K");
3 type Power = Real(unit="W");
4
5 connector Port
6 Temperature T;
7 flow Power Q;
8 end Port;
9
10 model TemperatureSource
11 parameter Temperature Tstart = 320;
12 Temperature T1;
13 Temperature T2(start = 310);
14 Temperature T3(start = Tstart);
15 Port port;
16 equation
17 port.T = T1;
18 T1 = T2;
19 T2 = T3;
20 T1+1e-6*sin(T1) = 300 "Implicit equation on T1";
21 end TemperatureSource;
22
23 model PowerSource
24 parameter Temperature Tstart = 320;
25 Port port;
26 Temperature T1;
27 Temperature T2(start = 330);
28 Temperature T3(start = Tstart);
29 equation
30 port.T = T1;
31 T1 = T2;
32 T2 = T3;
33 port.Q - (port.T-300) = sin(time);
34 end PowerSource;
35
36 model WrappedTemperatureSource
37 parameter Temperature Tstart = 345;
38 Port port;
39 TemperatureSource ts(Tstart = Tstart);
40 equation
41 connect(ts.port, port);
42 end WrappedTemperatureSource;
43
44 model WrappedPowerSource
45 parameter Temperature Tstart = 345;
46 Port port;
47 PowerSource ts(Tstart = Tstart);
48 equation
49 connect(ts.port, port);
50 end WrappedPowerSource;
51
52
53 model System1
54 TemperatureSource ts;
55 PowerSource ps;
56 equation
57 connect(ts.port,ps.port);
58 annotation(__OpenModelica_commandLineOptions ="-d=aliasConflicts");
59 end System1;
60
61 model System2
62 TemperatureSource ts(Tstart = 350);
63 PowerSource ps;
64 equation
65 connect(ts.port,ps.port);
66 annotation(__OpenModelica_commandLineOptions ="-d=aliasConflicts");
67 end System2;
68
69 model System3
70 TemperatureSource ts(T1(start = 360));
71 PowerSource ps;
72 equation
73 connect(ts.port,ps.port);
74 annotation(__OpenModelica_commandLineOptions ="-d=aliasConflicts");
75 end System3;
76
77 model System4
78 WrappedTemperatureSource ts(Tstart = 370);
79 PowerSource ps;
80 equation
81 connect(ts.port,ps.port);
82 annotation(__OpenModelica_commandLineOptions ="-d=aliasConflicts");
83 end System4;
84
85 model System5
86 TemperatureSource ts;
87 WrappedPowerSource ps(Tstart = 380);
88 equation
89 connect(ts.port, ps.port);
90 annotation(__OpenModelica_commandLineOptions ="-d=aliasConflicts");
91 end System5;
92
93 model System6
94 WrappedTemperatureSource ts(ts(T1(start = 390)));
95 WrappedPowerSource ps(Tstart = 400);
96 equation
97 connect(ts.port, ps.port);
98 annotation(__OpenModelica_commandLineOptions ="-d=aliasConflicts");
99 end System6;
100end Aliases;