forked from modelica/ModelicaStandardLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CompareTransformers.mo
160 lines (158 loc) · 7.62 KB
/
CompareTransformers.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
within Modelica.Electrical.Analog.Examples;
model CompareTransformers
"Transformer circuit to show the magnetization facilities"
import Modelica.Constants.pi;
extends Modelica.Icons.Example;
parameter SI.Voltage Vdc=0.1 "DC offset of voltage source";
parameter SI.Voltage Vpeak=0.1 "Peak voltage of voltage source";
parameter SI.Frequency f=10 "Frequency of voltage source";
parameter SI.Angle phi0=pi/2 "Phase of voltage source";
parameter Real n=2 "Turns ratio primary:secondary voltage";
parameter SI.Resistance R1=0.01
"Primary resistance w.r.t. primary side";
parameter SI.Inductance L1sigma=0.05/(2*pi*f)
"Primary leakage inductance w.r.t. primary side";
parameter SI.Inductance Lm1= 10./(2*pi*f)
"Magnetizing inductance w.r.t. primary side";
parameter SI.Inductance L2sigma=0.05/(2*pi*f)/n^2
"Secondary leakage inductance w.r.t. secondary side";
parameter SI.Resistance R2=0.01/n^2
"Secondary resistance w.r.t. secondary side";
parameter SI.Resistance RL=1/n^2 "Load resistance";
final parameter SI.Inductance L1=L1sigma + M*n
"Primary no-load inductance";
final parameter SI.Inductance L2=L2sigma + M/n
"Secondary no-load inductance";
final parameter SI.Inductance M=Lm1/n "Mutual inductance";
output SI.Voltage v1B = resistor11.n.v
"Primary voltage, basic transformer";
output SI.Current i1B = resistor11.i
"Primary current, basic transformer";
output SI.Voltage v2B = resistor12.p.v
"Secondary voltage, basic transformer";
output SI.Current i2B = resistor12.i
"Secondary current, basic transformer";
output SI.Voltage v1I = resistor21.n.v
"Primary voltage, basic transformer";
output SI.Current i1I = resistor21.i
"Primary current, basic transformer";
output SI.Voltage v2I = resistor22.p.v
"Secondary voltage, basic transformer";
output SI.Current i2I = resistor22.i
"Secondary current, basic transformer";
Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage1(
V=Vpeak,
phase=phi0,
f=f,
offset=Vdc)
annotation (Placement(transformation(
origin={-80,40},
extent={{-10,-10},{10,10}},
rotation=270)));
Modelica.Electrical.Analog.Basic.Ground ground11
annotation (Placement(transformation(extent={{-90,0},{-70,20}})));
Modelica.Electrical.Analog.Basic.Resistor resistor11(R=R1)
annotation (Placement(transformation(extent={{-80,50},{-60,70}})));
Modelica.Electrical.Analog.Basic.Resistor resistor12(R=R2)
annotation (Placement(transformation(extent={{60,50},{80,70}})));
Modelica.Electrical.Analog.Basic.Resistor load1(R=RL)
annotation (Placement(transformation(
origin={80,40},
extent={{-10,-10},{10,10}},
rotation=270)));
Modelica.Electrical.Analog.Basic.Ground ground12
annotation (Placement(transformation(extent={{70,0},{90,20}})));
Modelica.Electrical.Analog.Sources.SineVoltage sineVoltage2(
V=Vpeak,
phase=phi0,
f=f,
offset=Vdc)
annotation (Placement(transformation(
origin={-80,-50},
extent={{-10,-10},{10,10}},
rotation=270)));
Modelica.Electrical.Analog.Basic.Ground ground21
annotation (Placement(transformation(extent={{-90,-90},{-70,-70}})));
Modelica.Electrical.Analog.Basic.Resistor resistor21(R=R1)
annotation (Placement(transformation(extent={{-80,-40},{-60,-20}})));
Modelica.Electrical.Analog.Basic.Inductor inductor21(L=L1sigma)
annotation (Placement(transformation(extent={{-50,-40},{-30,-20}})));
Modelica.Electrical.Analog.Basic.Inductor inductor22(L=L2sigma, i(start=0, fixed=true))
annotation (Placement(transformation(extent={{30,-40},{50,-20}})));
Modelica.Electrical.Analog.Basic.Resistor resistor22(R=R2)
annotation (Placement(transformation(extent={{60,-40},{80,-20}})));
Modelica.Electrical.Analog.Basic.Resistor load2(R=RL)
annotation (Placement(transformation(
origin={80,-50},
extent={{-10,-10},{10,10}},
rotation=270)));
Modelica.Electrical.Analog.Basic.Ground ground22
annotation (Placement(transformation(extent={{70,-90},{90,-70}})));
Modelica.Electrical.Analog.Basic.Transformer basicTransformer(
L1=L1,
L2=L2,
M=M) annotation (Placement(transformation(extent={{-10,40},{10,60}})));
Modelica.Electrical.Analog.Ideal.IdealTransformer idealTransformer(n=n,
Lm1=Lm1,
considerMagnetization=false)
annotation (Placement(transformation(extent={{-10,-50},{10,-30}})));
initial equation
basicTransformer.i1=0;
basicTransformer.i2=0;
equation
connect(sineVoltage1.n, ground11.p)
annotation (Line(points={{-80,30},{-80,20}}, color={0,0,255}));
connect(sineVoltage1.p, resistor11.p)
annotation (Line(points={{-80,50},{-80,60}}, color={0,0,255}));
connect(load1.n, ground12.p)
annotation (Line(points={{80,30},{80,20}}, color={0,0,255}));
connect(resistor12.n, load1.p)
annotation (Line(points={{80,60},{80,50}}, color={0,0,255}));
connect(sineVoltage2.n, ground21.p)
annotation (Line(points={{-80,-60},{-80,-70}}, color={0,0,255}));
connect(sineVoltage2.p, resistor21.p)
annotation (Line(points={{-80,-40},{-80,-30}}, color={0,0,255}));
connect(resistor21.n, inductor21.p)
annotation (Line(points={{-60,-30},{-50,-30}}, color={0,0,255}));
connect(inductor22.n, resistor22.p)
annotation (Line(points={{50,-30},{60,-30}}, color={0,0,255}));
connect(load2.n, ground22.p)
annotation (Line(points={{80,-60},{80,-70}}, color={0,0,255}));
connect(resistor22.n, load2.p)
annotation (Line(points={{80,-30},{80,-40}}, color={0,0,255}));
connect(ground11.p, basicTransformer.n1) annotation (Line(points={{-80,20},{
-10,20},{-10,40}}, color={0,0,255}));
connect(basicTransformer.n2, ground12.p) annotation (Line(points={{10,40},{10,
20},{80,20}}, color={0,0,255}));
connect(basicTransformer.p1, resistor11.n) annotation (Line(points={{-10,60},
{-10,60},{-60,60}}, color={0,0,255}));
connect(basicTransformer.p2, resistor12.p) annotation (Line(points={{10,60},{
10,60},{60,60}}, color={0,0,255}));
connect(ground21.p, idealTransformer.n1) annotation (Line(points={{-80,-70},{
-10,-70},{-10,-50}}, color={0,0,255}));
connect(ground22.p, idealTransformer.n2) annotation (Line(points={{80,-70},{
10,-70},{10,-50}}, color={0,0,255}));
connect(idealTransformer.p1, inductor21.n) annotation (Line(points={{-10,-30},
{-10,-30},{-30,-30}}, color={0,0,255}));
connect(idealTransformer.p2, inductor22.p) annotation (Line(points={{10,-30},
{10,-30},{30,-30}}, color={0,0,255}));
annotation (Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
-100},{100,100}})),
experiment(StopTime=50, Interval=0.001),
Documentation(revisions="<html>
<dl>
<dt><em>2009</em></dt>
<dd>by Anton Haumer<br> initially implemented</dd>
</dl>
</html>",
info="<html>
<p>This example is to demonstrate the behaviour of transformer models. The Basic.Transformer, which consists of mutual coupled inductors, is compared with the ideal transformer model. If the ideal model is used with considerMagnetization=true leakage inductances are taken into account, otherwise not.
The example is constructed in such a way that the ideal transformer circuit with considerMagnetization=true shows the same behaviour as the basic transformer.</p>
<p>Simulate until T=50 s with both considerMagnetization=false and considerMagnetization=true of the ideal transformer.
Plot in separate windows for comparison:
<br>basicTransformer.p1.v and idealTransformer.p1.v
<br>basicTransformer.p1.i and idealTransformer.p1.i
<br>basicTransformer.p2.v and idealTransformer.p2.v
basicTransformer.p2.i and idealTransformer.p2.i</p>
</html>"));
end CompareTransformers;