forked from modelica/ModelicaStandardLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CompareLineTrunks.mo
181 lines (181 loc) · 8.42 KB
/
CompareLineTrunks.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
within Modelica.Electrical.Analog.Examples.Lines;
model CompareLineTrunks "Compares oLine and tLine splitting lines into trunks"
extends Modelica.Icons.Example;
import Modelica.Units.SI;
import Modelica.Constants.small;
parameter SI.Resistance Rload=1000 "Load resistance";
parameter Real r1(final min=small, final unit="Ohm/m")=1e-6 "Resistance per meter";
parameter Real g1(final min=small, final unit="S/m")=1e-12 "Conductance per meter";
parameter Real l1(final min=small, final unit="H/m")=1e-6 "Inductance per meter";
parameter Real c1(final min=small, final unit="F/m")=1e-11 "Capacitance per meter";
parameter SI.Length len=100e3 "Length of line";
parameter Integer segsPerTrunk=7 "Segments per trunk";
parameter SI.Velocity c=1/sqrt(l1*c1) "Speed of EM wave";
parameter SI.Time td=len/c/4 "Transmission delay";
parameter SI.Impedance z0=sqrt(l1/c1) "Characteristic impedance for very high frequency";
Modelica.Blocks.Sources.Ramp ramp(startTime=400e-6, duration=50e-6)
annotation (Placement(transformation(extent={{-88,-10},{-68,10}})));
Modelica.Electrical.Analog.Sources.SignalVoltage srcLump annotation (
Placement(transformation(
origin={-40,30},
extent={{-10,10},{10,-10}},
rotation=-90)));
Modelica.Electrical.Analog.Basic.Ground ground1 annotation (Placement(transformation(extent={{-50,-10},{-30,10}})));
Modelica.Electrical.Analog.Lines.OLine oLine1(
N=segsPerTrunk,
r=r1,
l=l1,
g=g1,
c=c1,
length=len/4) annotation (Placement(transformation(extent={{-30,30},{-10,50}})));
Modelica.Electrical.Analog.Lines.OLine oLine2(
N=segsPerTrunk,
r=r1,
l=l1,
g=g1,
c=c1,
length=len/4) annotation (Placement(transformation(extent={{0,30},{20,50}})));
Modelica.Electrical.Analog.Lines.OLine oLine3(
N=segsPerTrunk,
r=r1,
l=l1,
g=g1,
c=c1,
length=len/4) annotation (Placement(transformation(extent={{30,30},{50,50}})));
Modelica.Electrical.Analog.Lines.OLine oLine4(
N=segsPerTrunk,
r=r1,
l=l1,
g=g1,
c=c1,
length=len/4) annotation (Placement(transformation(extent={{60,30},{80,50}})));
Modelica.Electrical.Analog.Basic.Resistor R1(R=Rload) annotation (Placement(
transformation(
origin={90,30},
extent={{-10,-10},{10,10}},
rotation=-90)));
Modelica.Electrical.Analog.Sources.SignalVoltage srcDistr annotation (
Placement(transformation(
origin={-40,-30},
extent={{-10,10},{10,-10}},
rotation=-90)));
Basic.Ground ground2 annotation (Placement(transformation(extent={{-50,-70},{-30,-50}})));
Modelica.Electrical.Analog.Lines.TLine tLine1(Z0=z0, TD=td,
er(start=0),
v2(start=0)) annotation (
Placement(transformation(extent={{-30,-40},{-10,-20}})));
Modelica.Electrical.Analog.Lines.TLine tline2(Z0=z0, TD=td,
er(start=0),
v2(start=0)) annotation (
Placement(transformation(
origin={32,4},
extent={{-32,-44},{-12,-24}})));
Modelica.Electrical.Analog.Lines.TLine tline3(Z0=z0, TD=td,
er(start=0),
v2(start=0)) annotation (
Placement(transformation(
origin={62,4},
extent={{-32,-44},{-12,-24}})));
Modelica.Electrical.Analog.Lines.TLine tline4(Z0=z0, TD=td,
er(start=0),
v2(start=0)) annotation (
Placement(transformation(
origin={92,4},
extent={{-32,-44},{-12,-24}})));
Modelica.Electrical.Analog.Basic.Resistor R2(R=Rload) annotation (Placement(
transformation(
origin={90,-30},
extent={{-10,-10},{10,10}},
rotation=-90)));
initial equation
oLine1.C.v=zeros(segsPerTrunk);
oLine1.L.i=zeros(segsPerTrunk + 1);
oLine2.C.v=zeros(segsPerTrunk);
oLine2.L.i=zeros(segsPerTrunk + 1);
oLine3.C.v=zeros(segsPerTrunk);
oLine3.L.i=zeros(segsPerTrunk + 1);
oLine4.C.v=zeros(segsPerTrunk);
oLine4.L.i=zeros(segsPerTrunk + 1);
equation
connect(srcLump.v, ramp.y)
annotation (Line(points={{-52,30},{-60,30},{-60,0},{-67,0}},
color={0,0,127}));
connect(oLine1.p1, srcLump.p) annotation (Line(points={{-30,40},{-40,40}},
color={0,0,255}));
connect(tLine1.p1, srcDistr.p) annotation (
Line(points={{-30,-20},{-40,-20}}, color={0,0,255}));
connect(srcDistr.n, tLine1.n1) annotation (
Line(points={{-40,-40},{-30,-40}}, color={0,0,255}));
connect(oLine1.p2, oLine2.p1)
annotation (Line(points={{-10,40},{0,40}}, color={0,0,255}));
connect(oLine2.p2, oLine3.p1)
annotation (Line(points={{20,40},{30,40}},color={0,0,255}));
connect(oLine3.p2, oLine4.p1)
annotation (Line(points={{50,40},{60,40}}, color={0,0,255}));
connect(oLine4.p2, R1.p)
annotation (Line(points={{80,40},{90,40}}, color={0,0,255}));
connect(srcDistr.v, ramp.y) annotation (Line(points={{-52,-30},{-60,-30},{-60,
0},{-67,0}}, color={0,0,127}));
connect(tline2.n1, tLine1.n2) annotation (
Line(points={{0,-40},{-10,-40}}, color={0,0,255}));
connect(tline2.p1, tLine1.p2) annotation (
Line(points={{0,-20},{-10,-20}}, color={0,0,255}));
connect(tline3.n1, tline2.n2) annotation (
Line(points={{30,-40},{20,-40}}, color={0,0,255}));
connect(tline3.p1, tline2.p2) annotation (
Line(points={{30,-20},{20,-20}}, color={0,0,255}));
connect(tline4.n1, tline3.n2) annotation (
Line(points={{60,-40},{50,-40}}, color={0,0,255}));
connect(tline4.p1, tline3.p2) annotation (
Line(points={{60,-20},{50,-20}}, color={0,0,255}));
connect(srcLump.n, ground1.p)
annotation (Line(points={{-40,20},{-40,10}}, color={0,0,255}));
connect(ground1.p, oLine1.p3)
annotation (Line(points={{-40,10},{-20,10},{-20,30}}, color={0,0,255}));
connect(ground1.p, oLine2.p3)
annotation (Line(points={{-40,10},{10,10},{10,30}}, color={0,0,255}));
connect(ground1.p, oLine3.p3)
annotation (Line(points={{-40,10},{40,10},{40,30}}, color={0,0,255}));
connect(ground1.p, oLine4.p3)
annotation (Line(points={{-40,10},{70,10},{70,30}}, color={0,0,255}));
connect(ground1.p, R1.n)
annotation (Line(points={{-40,10},{90,10},{90,20}}, color={0,0,255}));
connect(tline4.p2, R2.p)
annotation (Line(points={{80,-20},{90,-20}}, color={0,0,255}));
connect(tline4.n2, R2.n)
annotation (Line(points={{80,-40},{90,-40}}, color={0,0,255}));
connect(srcDistr.n, ground2.p)
annotation (Line(points={{-40,-40},{-40,-50}}, color={0,0,255}));
connect(ground2.p, tline2.n2)
annotation (Line(points={{-40,-50},{20,-50},{20,-40}}, color={0,0,255}));
connect(ground2.p, tline3.n2)
annotation (Line(points={{-40,-50},{50,-50},{50,-40}}, color={0,0,255}));
connect(ground2.p, tline4.n2)
annotation (Line(points={{-40,-50},{80,-50},{80,-40}}, color={0,0,255}));
connect(ground2.p, tLine1.n2)
annotation (Line(points={{-40,-50},{-10,-50},{-10,-40}}, color={0,0,255}));
annotation (
experiment(StopTime=0.004, Interval=4e-006, Tolerance=1e-06),
Documentation(info="<html>
<p>This example shows a way to look at the traveling wave moving along a power line.</p>
<p>This wave can be seen looking at intermediate points of the line, looking at both OLine (several segments per line trunk) and TLine models.</p>
<p>OLine in the lossless case is less accurate, since shows oscillations that are not present in a distributed parameter line but,
since it allows the addition of resistances and conductances, allows evaluation of losses.</p>
<p>Suggested tests:</p>
<h4>7 segments per trunk, lossless</h4>
<p>Run the model as it is. Since resistances and conductances are very small in OLine, the simulation is substantially lossless.</p>
<p>Show in the same plot <code>ramp.y</code>, <code>oLine1.p2.v</code>, <code>oLine2.p2.v</code>, <code>oLine3.p2.v</code>, <code>oLine4.p2.v</code>.</p>
<p>Show in another plot, simultaneously, <code>ramp.y</code>, <code>tLine1.p2.v</code>, <code>tLine2.p2.v</code>, <code>tLine3.p2.v</code>, <code>tLine4.p2.v</code>. Here oLine shows unreal oscillations, which, however, reduce if the number of segments per trunk increases.</p>
<h4>50 segments per trunk, lossless</h4>
<p>Try increasing this number from 7 to 50 using parameter <code>segsPerTrunk</code>, and look at the same plots as per test 1</p>
<h4>50 segments per trunk, losses</h4>
<p>Leave segsPerTrunk=50, change rl to 1e-3 ohms, re-simulate: the effect of losses is visible only on the oLine plot.</p>
</html>",
revisions="<html>
<ul>
<li><em>May, 2021</em>
implemented by Massimo Ceraolo, University of Pisa
</li>
</ul>
</html>"));
end CompareLineTrunks;