Skip to content

Commit bf60ef8

Browse files
authored
Initialization of Polyphase.Basic.{Capacitor, Inductor} (#4488)
* introduced initialization menu in Polyphase.Basic.{Capacitor, Inductor} * usage of annotation(Dialog(showStartAttribute=true))
1 parent 7bc29a0 commit bf60ef8

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

Diff for: Modelica/Electrical/Polyphase/Basic/Capacitor.mo

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ model Capacitor "Ideal linear electrical capacitors"
33
extends Interfaces.TwoPlug;
44
parameter SI.Capacitance C[m](start=fill(1, m))
55
"Capacitance";
6+
SI.Voltage vC[m](start=zeros(m), fixed=fill(false,m))=v "Capacitor voltages"
7+
annotation(Dialog(showStartAttribute=true));
68
Modelica.Electrical.Analog.Basic.Capacitor capacitor[m](final C=C)
79
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
810
equation

Diff for: Modelica/Electrical/Polyphase/Basic/Inductor.mo

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ within Modelica.Electrical.Polyphase.Basic;
22
model Inductor "Ideal linear electrical inductors"
33
extends Interfaces.TwoPlug;
44
parameter SI.Inductance L[m](start=fill(1, m)) "Inductance";
5+
SI.Current iL[m](start=zeros(m), fixed=fill(false,m))=i "Inductor currents"
6+
annotation(Dialog(showStartAttribute=true));
57
Modelica.Electrical.Analog.Basic.Inductor inductor[m](final L=L)
68
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
79
equation

Diff for: Modelica/Electrical/Polyphase/Examples/TransformerYY.mo

+27-9
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ model TransformerYY "Test example with polyphase components"
4040
transformation(extent={{-30,-100},{-10,-80}})));
4141
Basic.Resistor transformerR(m=m, R=fill(RT, m)) annotation (Placement(
4242
transformation(extent={{0,10},{20,30}})));
43-
Basic.Inductor transformerL(m=m, L=fill(LT, m)) annotation (Placement(
43+
Basic.Inductor transformerL(m=m, L=fill(LT, m),
44+
iL(start=zeros(m), fixed=cat(1,fill(true,m-1),{false}))) annotation (Placement(
4445
transformation(extent={{30,10},{50,30}})));
4546
Basic.Resistor loadR(m=m, R=fill(RL, m)) annotation (Placement(
4647
transformation(extent={{70,10},{90,30}})));
@@ -50,9 +51,6 @@ model TransformerYY "Test example with polyphase components"
5051
rotation=270)));
5152
Modelica.Electrical.Analog.Basic.Ground groundT1 annotation (Placement(
5253
transformation(extent={{-50,-100},{-30,-80}})));
53-
initial equation
54-
transformerL.i[1:m - 1] = zeros(m - 1) "Y-connection";
55-
5654
equation
5755
connect(starS.pin_n, groundS.p)
5856
annotation (Line(points={{-90,-72},{-90,-80}}, color={0,0,255}));
@@ -77,12 +75,32 @@ equation
7775
connect(loadR.plug_n, starL.plug_p)
7876
annotation (Line(points={{90,20},{90,-52}}, color={0,0,255}));
7977
annotation (Documentation(info="<html>
78+
<p>Test example with polyphase components:</p>
79+
<p>Star-connected voltage source feeds via a Y-Y-transformer with internal impedance (RT, LT) a load resistor RT.</p>
80+
<p>Using f=5 Hz LT=3mH defines nominal voltage drop of approximately 10 &percnt;.</p>
81+
<p>Simulate for 1 second (2 periods) and compare voltages and currents of source, transformer and load. </p>
82+
<h4>Note</h4>
8083
<p>
81-
Test example with polyphase components:<br>
82-
Star-connected voltage source feeds via a Y-Y-transformer with internal impedance (RT, LT) a load resistor RT.<br>
83-
Using f=5 Hz LT=3mH defines nominal voltage drop of approximately 10 %.<br>
84-
Simulate for 1 second (2 periods) and compare voltages and currents of source, transformer and load.
84+
From the <code>m</code> currents <code>m-1</code> have to be initialized with fixed = true, one of the <code>m</code> currents with fixed = false,
85+
due to the fact that the star connection enforces sum of the currents = 0.
86+
</p>
87+
<p>
88+
Tools are expected to present a proper initialization section of the menu of <code>transformerL</code> which allows
89+
to set the start values of the <code>m</code> currents and the fixed attributes individually, i.e. as an array.
90+
Especially, a checkbox for the fixed attributes should be avoided.
91+
</p>
92+
<p>
93+
If this is not the case, you have to write the code manually:
94+
</p>
95+
<p><code>
96+
Modelica.Electrical.PolyPhase.Basic.Inductor transformerL(m=m, L=fill(LT, m),
97+
<strong>iL(start=zeros(m), fixed=cat(1,fill(true,m-1),{false}))</strong>);</code>
8598
</p>
8699
</html>"),
87-
experiment(StopTime=1.0, Interval=0.001));
100+
experiment(StopTime=1.0, Interval=0.001),
101+
Diagram(graphics={Text(
102+
extent={{0,60},{80,40}},
103+
textColor={28,108,200},
104+
textString="Regarding initialization:
105+
see Documentation")}));
88106
end TransformerYY;

0 commit comments

Comments
 (0)