Skip to content

Commit df1b413

Browse files
committed
Implement existing structure of electrical package of Buildings library #1575
1 parent 12993e5 commit df1b413

File tree

225 files changed

+11664
-45
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

225 files changed

+11664
-45
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
within IBPSA.Electrical.AC.Interfaces;
2+
connector PowerOutput
3+
"Connector with real power, reactive power and power factor"
4+
output Modelica.Units.SI.Power real "Real power";
5+
output Modelica.Units.SI.ReactivePower apparent "Apparent power";
6+
output Modelica.Units.SI.Angle phi "Phase shift";
7+
output Real cosPhi "Power factor";
8+
9+
annotation (Icon(graphics={ Polygon(
10+
points={{-100,100},{100,0},{-100,-100},{-100,100}},
11+
lineColor={0,0,127},
12+
fillColor={255,255,255},
13+
fillPattern=FillPattern.Solid)}), Diagram(graphics={
14+
Polygon(
15+
points={{-100,50},{0,0},{-100,-50},{-100,50}},
16+
lineColor={0,0,127},
17+
fillColor={255,255,255},
18+
fillPattern=FillPattern.Solid), Text(
19+
extent={{30,110},{30,60}},
20+
textColor={0,0,127},
21+
textString="%name")}),
22+
Documentation(info="<html>
23+
This connector contains multiple quantities that can be used to monitor
24+
the power consumption of a generic AC systems.
25+
</html>", revisions="<html>
26+
<ul>
27+
<li>
28+
March 19, 2015, by Marco Bonvini:<br/>
29+
Added documentation.
30+
</li>
31+
</ul>
32+
</html>"));
33+
end PowerOutput;
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
within IBPSA.Electrical.AC;
2+
package Interfaces "Package that contains some useful interfaces"
3+
extends Modelica.Icons.InterfacesPackage;
4+
5+
6+
annotation (Documentation(info="<html>
7+
<p>
8+
This package contains interfaces that are used by the models in the
9+
<a href=\"modelica://IBPSA.Electrical.AC\">IBPSA.Electrical.AC</a> package.
10+
</p>
11+
</html>"));
12+
end Interfaces;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PowerOutput
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
within IBPSA.Electrical.AC.OnePhase.Basics;
2+
model Ground "Ground connection"
3+
extends IBPSA.Electrical.Interfaces.Ground(
4+
redeclare package PhaseSystem = PhaseSystems.OnePhase,
5+
redeclare Interfaces.Terminal_n terminal);
6+
annotation (
7+
defaultComponentName="gnd",
8+
Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
9+
{100,100}}), graphics={
10+
Line(
11+
points={{0,90},{0,0}},
12+
color={0,120,120},
13+
smooth=Smooth.None),
14+
Line(
15+
points={{-80,0},{80,0}},
16+
color={0,120,120},
17+
smooth=Smooth.None),
18+
Line(
19+
points={{-60,-20},{60,-20}},
20+
color={0,120,120},
21+
smooth=Smooth.None),
22+
Line(
23+
points={{-40,-40},{40,-40}},
24+
color={0,120,120},
25+
smooth=Smooth.None)}), Documentation(info="<html>
26+
<p>
27+
This model represents a connection to the ground.
28+
</p>
29+
</html>", revisions="<html>
30+
<ul>
31+
<li>
32+
June 4, 2014, by Marco Bonvini:<br/>
33+
Added User's guide.
34+
</li>
35+
</ul>
36+
</html>"));
37+
end Ground;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
within Buildings.Electrical.AC.OnePhase;
2+
package Basics "Package with basic models"
3+
extends Modelica.Icons.BasesPackage;
4+
5+
6+
annotation (Documentation(info="<html>
7+
<p>
8+
This package contains simple models used in AC single phase networks.
9+
</p>
10+
</html>", revisions="<html>
11+
<ul>
12+
<li>
13+
June 4, 2014, by Marco Bonvini:<br/>
14+
Added User's guide.
15+
</li>
16+
</ul>
17+
</html>"));
18+
end Basics;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ground
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
within IBPSA.Electrical.AC.OnePhase.Conversion;
2+
model ACACConverter "AC AC converter single phase systems"
3+
extends IBPSA.Electrical.Icons.RefAngleConversion;
4+
extends IBPSA.Electrical.Interfaces.PartialConversion(
5+
redeclare package PhaseSystem_p = PhaseSystems.OnePhase,
6+
redeclare package PhaseSystem_n = PhaseSystems.OnePhase,
7+
redeclare replaceable Interfaces.Terminal_n terminal_n
8+
constrainedby Interfaces.Terminal_n(
9+
i(start = zeros(PhaseSystem_n.n),
10+
each stateSelect = StateSelect.prefer)),
11+
redeclare replaceable Interfaces.Terminal_p terminal_p
12+
constrainedby Interfaces.Terminal_p(
13+
i(start = zeros(PhaseSystem_p.n),
14+
each stateSelect = StateSelect.prefer)));
15+
parameter Real conversionFactor(min = Modelica.Constants.eps)
16+
"Ratio of QS rms voltage on side 2 / QS rms voltage on side 1";
17+
parameter Real eta(min=0, max=1)
18+
"Converter efficiency, pLoss = (1-eta) * Ptr";
19+
parameter Boolean ground_1 = false
20+
"If true, connect side 1 of converter to ground"
21+
annotation(Evaluate=true,Dialog(tab = "Ground", group="side 1"));
22+
parameter Boolean ground_2 = true
23+
"If true, connect side 2 of converter to ground"
24+
annotation(Evaluate=true, Dialog(tab = "Ground", group="side 2"));
25+
Modelica.Units.SI.Power LossPower[2] "Loss power";
26+
protected
27+
Modelica.Units.SI.Power P_p[2]=PhaseSystem_p.phasePowers_vi(terminal_p.v,
28+
terminal_p.i) "Power transmitted at pin p";
29+
Modelica.Units.SI.Power P_n[2]=PhaseSystem_n.phasePowers_vi(terminal_n.v,
30+
terminal_n.i) "Power transmitted at pin n";
31+
equation
32+
33+
// Ideal transformation
34+
terminal_p.v = conversionFactor*terminal_n.v;
35+
36+
// Power loss term
37+
terminal_p.i[1] = terminal_n.i[1]/conversionFactor*
38+
IBPSA.Utilities.Math.Functions.spliceFunction(eta-2, 1/(eta-2), P_p[1], deltax=0.1);
39+
terminal_p.i[2] = terminal_n.i[2]/conversionFactor*
40+
IBPSA.Utilities.Math.Functions.spliceFunction(eta-2, 1/(eta-2), P_p[1], deltax=0.1);
41+
LossPower = P_p + P_n;
42+
43+
// The two sides have the same reference angle
44+
terminal_p.theta = terminal_n.theta;
45+
46+
if ground_1 then
47+
Connections.potentialRoot(terminal_n.theta);
48+
end if;
49+
if ground_2 then
50+
Connections.root(terminal_p.theta);
51+
end if;
52+
53+
annotation (
54+
defaultComponentName="conACAC",
55+
Icon(coordinateSystem(preserveAspectRatio=false,
56+
extent={{-100,-100},{100,100}}),
57+
graphics={
58+
Line(
59+
points={{2,60},{2,60},{82,60},{2,60},{82,-60},{2,-60},{2,60},{2,-60}},
60+
color={0,120,120},
61+
smooth=Smooth.None),
62+
Line(
63+
points={{-2,60},{-2,60},{-82,60},{-2,60},{-82,-60},{-2,-60},{-2,60},{
64+
-2,-60}},
65+
color={11,193,87},
66+
smooth=Smooth.None),
67+
Text(
68+
extent={{-100,92},{100,60}},
69+
textColor={0,0,0},
70+
textString="%name"),
71+
Text(
72+
extent={{-100,-60},{100,-92}},
73+
textColor={0,0,0},
74+
textString="%conversionFactor"),
75+
Text(
76+
extent={{-100,-100},{100,-132}},
77+
textColor={0,120,120},
78+
textString="%eta"),
79+
Text(
80+
extent={{-132,78},{-72,38}},
81+
textColor={11,193,87},
82+
textString="1"),
83+
Text(
84+
extent={{-88,52},{-28,12}},
85+
textColor={11,193,87},
86+
textString="AC"),
87+
Text(
88+
extent={{32,52},{92,12}},
89+
textColor={0,120,120},
90+
textString="AC"),
91+
Text(
92+
extent={{70,78},{130,38}},
93+
textColor={0,120,120},
94+
textString="2")}),
95+
Documentation(info="<html>
96+
<p>
97+
This is an AC/AC converter, based on a power balance between both circuit sides.
98+
The parameter <i>conversionFactor</i> defines the ratio between the RMS voltages
99+
as
100+
</p>
101+
102+
<p align=\"center\" style=\"font-style:italic;\">
103+
V<sub>2</sub> = conversionFactor V<sub>1</sub>
104+
</p>
105+
106+
<p>
107+
where <i>V<sub>1</sub></i> and <i>V<sub>2</sub></i> are the RMS voltages
108+
at the primary and secondary sides of the transformer, i.e., the
109+
connector N and P, respectively.
110+
</p>
111+
112+
<p>
113+
The loss of the converter is proportional to the power transmitted.
114+
The parameter <code>eta</code> is the efficiency of the transfer.
115+
The loss is computed as
116+
</p>
117+
<p align=\"center\" style=\"font-style:italic;\">
118+
P<sub>loss</sub> = (1-&eta;) P<sub>tr</sub>,
119+
</p>
120+
<p>
121+
where <i>P<sub>tr</sub></i> is the power transmitted. The model is bi-directional
122+
and the power can flow from the primary to the secondary side and vice-versa.
123+
Furthermore, reactive power on both side are set to zero.
124+
</p>
125+
<h4>Note:</h4>
126+
<p>
127+
This model is derived from
128+
<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Utilities.IdealACDCConverter\">
129+
Modelica.Electrical.QuasiStationary.SinglePhase.Utilities.IdealACDCConverter</a>.
130+
</p>
131+
</html>", revisions="<html>
132+
<ul>
133+
<li>
134+
January 30, 2019, by Michael Wetter:<br/>
135+
Added missing <code>replaceable</code> for the terminal.
136+
</li>
137+
<li>
138+
September 4, 2014, by Michael Wetter:<br/>
139+
Revised model.
140+
</li>
141+
<li>
142+
August 5, 2014, by Marco Bonvini:<br/>
143+
Revised documentation.
144+
</li>
145+
<li>
146+
June 9, 2014, by Marco Bonvini:<br/>
147+
Revised implementation and added <code>stateSelect</code> statement to use
148+
the current <code>i[:]</code> on the connectors as iteration variable for the
149+
initialization problem.
150+
</li>
151+
<li>
152+
January 29, 2012, by Thierry S. Nouidui:<br/>
153+
First implementation.
154+
</li>
155+
</ul>
156+
</html>"));
157+
end ACACConverter;

0 commit comments

Comments
 (0)