/
Nodes.mo
287 lines (270 loc) · 9.48 KB
/
Nodes.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
within PowerSystems.AC1ph_DC;
package Nodes "Nodes "
extends Modelica.Icons.VariantsPackage;
model Ground "Ground, 1-phase"
extends Ports.Port_p;
equation
term.v = zeros(2);
annotation (defaultComponentName = "grd1",
Documentation(
info="<html>
<p>Zero voltage on both conductors of terminal.</p>
</html>
"), Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={Line(points={{-90,0},{-4,0}}, color={0,0,255}),
Rectangle(
extent={{-4,60},{4,-60}},
lineColor={128,128,128},
fillColor={160,160,164},
fillPattern=FillPattern.Solid)}),
Diagram(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={Line(
points={{-80,0},{-60,0}},
color={0,128,255},
thickness=0.5), Rectangle(
extent={{-60,20},{-54,-20}},
lineColor={128,128,128},
fillColor={160,160,164},
fillPattern=FillPattern.Solid)}));
end Ground;
model PolarityGround "Polarity grounding, 1-phase"
extends Ports.Port_p;
parameter Integer pol(min=-1,max=1)=-1 "grounding scheme" annotation(Evaluate=true,
choices(choice=1 "plus", choice=0 "symmetrical", choice=-1 "negative"));
equation
if pol==1 then
term.v[1] = 0;
term.i[2] = 0;
elseif pol==-1 then
term.v[2] = 0;
term.i[1] = 0;
else
term.v[1] + term.v[2] = 0;
term.i[1] = term.i[2];
end if;
annotation (defaultComponentName = "polGrd1",
Documentation(
info="<html>
<p>Zero voltage depending on polarity choice.</p>
<pre>
pol = 1 conductor 1 grounded (DC: positive)
pol = 0 symmetrically grounded
pol = -1 conductor 2 grounded (DC: negative)
</pre>
</html>
"), Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={
Line(points={{-50,0},{-4,0}}, color={0,0,255}),
Rectangle(
extent={{-4,60},{4,-60}},
lineColor={128,128,128},
fillColor={160,160,164},
fillPattern=FillPattern.Solid),
Line(
points={{-80,10},{-50,0}},
color={0,0,255},
pattern=LinePattern.Dot),
Line(
points={{-80,0},{-50,0}},
color={0,0,255},
pattern=LinePattern.Dot),
Line(
points={{-80,-10},{-50,0}},
color={0,0,255},
pattern=LinePattern.Dot)}),
Diagram(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={
Line(
points={{-80,-4},{-60,-4}},
color={0,0,255},
pattern=LinePattern.Dot,
thickness=0.5),
Rectangle(
extent={{-60,20},{-54,-20}},
lineColor={128,128,128},
fillColor={160,160,164},
fillPattern=FillPattern.Solid),
Line(
points={{-80,4},{-60,4}},
color={0,0,255},
pattern=LinePattern.Dot,
thickness=0.5),
Line(
points={{-80,0},{-60,0}},
color={0,0,255},
pattern=LinePattern.Dot,
thickness=0.5)}));
end PolarityGround;
model GroundOne "Ground, one conductor"
Interfaces.Electric_p term annotation (Placement(transformation(extent={{
-110,-10},{-90,10}}, rotation=0)));
equation
term.v = 0;
annotation (
defaultComponentName="grdOne1",
Documentation(
info="<html>
<p>Zero voltage on terminal.</p>
</html>
"),
Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={
Text(
extent={{-100,-90},{100,-130}},
lineColor={0,0,0},
textString=
"%name"),
Rectangle(
extent={{-4,50},{4,-50}},
lineColor={128,128,128},
fillColor={160,160,164},
fillPattern=FillPattern.Solid),
Line(points={{-90,0},{-4,0}}, color={0,0,255})}),
Diagram(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={Line(
points={{-60,0},{-80,0}},
color={0,128,255},
thickness=0.5), Rectangle(
extent={{-60,20},{-54,-20}},
lineColor={128,128,128},
fillColor={160,160,164},
fillPattern=FillPattern.Solid)}));
end GroundOne;
model BusBar "Busbar, 1-phase"
output SI.Voltage v(stateSelect=StateSelect.never);
Ports.TwoPin_p term
annotation (Placement(transformation(extent={{-7,-60},{7,60}}, rotation=0)));
equation
term.i = zeros(2);
v = term.v[1] - term.v[2];
annotation (defaultComponentName = "bus1",
Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={Text(
extent={{-100,-90},{100,-130}},
lineColor={0,0,0},
textString=
"%name"), Rectangle(
extent={{-10,80},{10,-80}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,255},
fillPattern=FillPattern.Solid)}),
Diagram(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics),
Documentation(
info="<html>
<p>Calculates difference voltage conductor 1 - conductor 2.</p>
</html>
"));
end BusBar;
model Electric_pn_p_n "Adaptor ElectricV[2] (vector) to Electric (scalar)."
Ports.TwoPin_p term_pn "vector pin {p,n}"
annotation (Placement(transformation(extent={{-70,-10},{-50,10}},
rotation=0)));
Interfaces.Electric_p term_p "scalar p"
annotation (Placement(transformation(extent={{70,30},{50,50}}, rotation=
0)));
Interfaces.Electric_n term_n "scalar n"
annotation (Placement(transformation(extent={{50,-50},{70,-30}},
rotation=0)));
equation
term_pn.v = {term_p.v, term_n.v};
term_pn.i + {term_p.i, term_n.i} = zeros(2);
annotation (defaultComponentName = "pn_p_n",
Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={
Text(
extent={{-100,-90},{100,-130}},
lineColor={0,0,0},
textString=
"%name"),
Rectangle(
extent={{-40,60},{40,-60}},
lineColor={255,255,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(points={{-40,-10},{-10,-10},{-10,-40},{40,-40}}, color={0,0,255}),
Line(points={{-40,10},{-10,10},{-10,40},{40,40}}, color={0,0,255})}),
Documentation(
info="<html>
</html>
"), Diagram(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={Line(points={{-40,5},{0,5},{0,40},{40,40}},
color={0,0,255}), Line(points={{-40,-5},{0,-5},{0,-40},{40,-40}},
color={0,0,255})}));
end Electric_pn_p_n;
/*
model Electric_abc_a_b_c "Adaptor ElectricV[3] (vector) to Electric (scalar)"
Basic.Interfaces.ElectricV_p term_abc(
final m=3) "vector {a,b,c}"
annotation (Placement(transformation(extent={{-70,-10},{-50,10}},
rotation=0)));
Interfaces.Electric_n term_a "scalar a"
annotation (Placement(transformation(extent={{50,30},{70,50}}, rotation=
0)));
Interfaces.Electric_n term_b "scalar b"
annotation (Placement(transformation(extent={{50,-10},{70,10}},
rotation=0)));
Interfaces.Electric_n term_c "scalar c"
annotation (Placement(transformation(extent={{50,-50},{70,-30}},
rotation=0)));
equation
{term_a.v,term_b.v,term_c.v} = term_abc.v;
term_abc.i + {term_a.i,term_b.i,term_c.i} = zeros(3);
annotation (defaultComponentName = "abc_a_b_c",
Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={
Rectangle(
extent={{-40,60},{40,-60}},
lineColor={255,255,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(points={{-40,10},{-10,10},{-10,40},{40,40}}, color={0,0,255}),
Line(points={{-40,-10},{-10,-10},{-10,-40},{40,-40}}, color={0,0,255}),
Line(points={{-40,0},{40,0}}, color={0,0,255}),
Text(
extent={{-100,-90},{100,-130}},
lineColor={0,0,0},
textString=
"%name")}),
Documentation(info="<html>
</html>
"), Diagram(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics={
Line(points={{-40,5},{0,5},{0,40},{40,40}}, color={0,0,255}),
Line(points={{-40,-5},{0,-5},{0,-40},{40,-40}}, color={0,0,255}),
Line(points={{-40,0},{40,0}}, color={0,0,255})}));
end Electric_abc_a_b_c;
*/
annotation (preferredView="info",
Documentation(info="<html>
</html>"),
Icon(coordinateSystem(
preserveAspectRatio=false,
extent={{-100,-100},{100,100}},
grid={2,2}), graphics));
end Nodes;