model ElectroMagneticConverter "Electro-magnetic energy conversion"
constant Complex j = Complex(0, 1);
FluxTubes.Interfaces.PositiveMagneticPort port_p "Positive magnetic port"
annotation (Placement(
transformation(extent = {
{90, 90},
{110, 110}}),
iconTransformation(extent = {
{90, 90},
{110, 110}})));
FluxTubes.Interfaces.NegativeMagneticPort port_n "Negative magnetic port"
annotation (Placement(
transformation(extent = {
{110, -110},
{90, -90}}),
iconTransformation(extent = {
{110, -110},
{90, -90}})));
Modelica.Electrical.QuasiStationary.SinglePhase.Interfaces.PositivePin pin_p "Positive electric pin"
annotation (Placement(
transformation(extent = {
{-90, 90},
{-110, 110}}),
iconTransformation(extent = {
{-90, 90},
{-110, 110}})));
Modelica.Electrical.QuasiStationary.SinglePhase.Interfaces.NegativePin pin_n "Negative electric pin"
annotation (Placement(
transformation(extent = {
{-110, -110},
{-90, -90}}),
iconTransformation(extent = {
{-110, -110},
{-90, -90}})));
Modelica.SIunits.ComplexVoltage v "Voltage";
Modelica.SIunits.ComplexCurrent i(re(start = 0, stateSelect = StateSelect.prefer), im(start = 0, stateSelect = StateSelect.prefer)) "Current";
Modelica.SIunits.ComplexMagneticPotentialDifference V_m "Magnetic potential difference";
Modelica.SIunits.ComplexMagneticFlux Phi "Magnetic flux coupled into magnetic circuit";
Modelica.SIunits.AngularVelocity omega;
parameter Real N = 1 "Number of turns";
Modelica.SIunits.ComplexMagneticFlux Psi "Flux linkage for information only";
SI.Inductance L_stat "Static inductance abs(Psi/i) for information only";
protected
Real eps = 100 * Modelica.Constants.eps;
equation
Connections.branch(pin_p.reference, pin_n.reference);
Connections.branch(port_p.reference, pin_p.reference);
Connections.branch(port_p.reference, port_n.reference);
i = pin_p.i;
v = -j * omega * N * Phi;
v = pin_p.v - pin_n.v;
L_stat = noEvent(if eps < Modelica.ComplexMath.'abs'(i) then Modelica.ComplexMath.'abs'(Psi / i) else Modelica.ComplexMath.'abs'(Psi / eps));
Phi = port_p.Phi;
Psi = N * Phi;
V_m = N * i;
V_m = port_p.V_m - port_n.V_m;
omega = der(port_p.reference.gamma);
pin_p.reference.gamma = pin_n.reference.gamma;
port_p.reference.gamma = pin_p.reference.gamma;
port_p.reference.gamma = port_n.reference.gamma;
Complex(0) = pin_p.i + pin_n.i;
Complex(0) = port_p.Phi + port_n.Phi;
annotation (
defaultComponentName = "converter",
Diagram(coordinateSystem(
preserveAspectRatio = false,
extent = {
{-100, -100},
{100, 100}})),
Icon(
coordinateSystem(
preserveAspectRatio = false,
extent = {
{-100, -100},
{100, 100}}),
graphics = {
Line(
points = {
{-30, 100},
{-30, 60}},
color = {85, 170, 255}),
Line(
points = {
{-30, -60},
{-30, -100}},
color = {85, 170, 255}),
Line(
points = {
{-30, 100},
{-90, 100}},
color = {85, 170, 255}),
Line(
points = {
{-30, -100},
{-88, -100}},
color = {85, 170, 255}),
Line(
points = {
{0, 80},
{-100, 80}},
color = {85, 170, 255},
pattern = LinePattern.Dash),
Line(
points = {
{-100, 80},
{-100, -80}},
color = {85, 170, 255},
pattern = LinePattern.Dash),
Line(
points = {
{0, -80},
{-100, -80}},
color = {85, 170, 255},
pattern = LinePattern.Dash),
Line(
points = {
{100, 80},
{0, 80}},
color = {255, 170, 85},
pattern = LinePattern.Dash),
Line(
points = {
{100, -80},
{0, -80}},
color = {255, 170, 85},
pattern = LinePattern.Dash),
Line(
points = {
{100, 80},
{100, -80}},
color = {255, 170, 85},
pattern = LinePattern.Dash),
Ellipse(
extent = {
{-4, -34},
{64, 34}},
lineColor = {255, 170, 85}),
Line(
points = {
{30, -100},
{30, -34}},
color = {255, 170, 85}),
Line(
points = {
{18, 0},
{42, 0}},
color = {255, 170, 85}),
Line(
points = {
{42, 10},
{42, -12}},
color = {255, 170, 85}),
Line(
points = {
{30, 34},
{30, 100}},
color = {255, 170, 85}),
Line(
points = {
{30, 100},
{90, 100}},
color = {255, 170, 85}),
Line(
points = {
{30, -100},
{90, -100}},
color = {255, 170, 85}),
Text(
extent = {
{-150, 150},
{150, 110}},
textString = "%name",
pattern = LinePattern.None,
lineColor = {0, 0, 255}),
Line(
points = {
{18, 10},
{18, -12}},
color = {255, 170, 85}),
Line(
points = {
{-110, 30},
{-110, -30}},
color = {85, 170, 255}),
Polygon(
points = {
{-110, -30},
{-104, -10},
{-116, -10},
{-110, -30}},
lineColor = {85, 170, 255},
fillColor = {85, 170, 255},
fillPattern = FillPattern.Solid),
Line(
points = {
{110, 30},
{110, -30}},
color = {255, 170, 85}),
Polygon(
points = {
{110, -30},
{116, -10},
{104, -10},
{110, -30}},
lineColor = {255, 170, 85},
fillColor = {255, 170, 85},
fillPattern = FillPattern.Solid),
Line(
points = {
{-15, -7},
{-14, -1},
{-7, 7},
{7, 7},
{14, -1},
{15, -7}},
color = {85, 170, 255},
smooth = Smooth.Bezier,
origin = {-23, 45},
rotation = 270),
Line(
points = {
{-15, -7},
{-14, -1},
{-7, 7},
{7, 7},
{14, -1},
{15, -7}},
color = {85, 170, 255},
smooth = Smooth.Bezier,
origin = {-23, 15},
rotation = 270),
Line(
points = {
{-15, -7},
{-14, -1},
{-7, 7},
{7, 7},
{14, -1},
{15, -7}},
color = {85, 170, 255},
smooth = Smooth.Bezier,
origin = {-23, -15},
rotation = 270),
Line(
points = {
{-15, -7},
{-14, -1},
{-7, 7},
{7, 7},
{14, -1},
{15, -7}},
color = {85, 170, 255},
smooth = Smooth.Bezier,
origin = {-23, -45},
rotation = 270)}),
Documentation(info = "<html>\n<p>\nThe electro magnetic energy conversion is given by <strong>Ampere</strong>'s law and <strong>Faraday</strong>'s law respectively:\n</p>\n\n<dl>\n<dd>\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/converter.png\">\n</dd>\n</dl>\n\n<p>\nIn this equation\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/V_m.png\">\nis the magnetomotive force that is supplied to the connected magnetic circuit,\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/Phi.png\">\nis the magnetic flux through the associated branch of this magnetic circuit. The negative sign of the induced voltage\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/v.png\"> is due to <strong>Lenz</strong>'s law.\n</p>\n\n<p>\nThe static inductance is calculated from the flux linkage\n</p>\n<dl>\n<dd>\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/Psi-N-Phi.png\">\n</dd>\n</dl>\n<p>and the current\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/i.png\">:\n</p>\n<dl>\n<dd>\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/L_stat-Psi-i.png\">\n</dd>\n</dl>\n<p>\nThis quantity is calculated for information only.</p>\n\n<h5>Note</h5>\n\n<p><img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/L_stat.png\">\nis set to</p>\n<dl>\n<dd>\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/L_stat-Psi-eps.png\">\n</dd>\n</dl>\n<p>\nif\n<img src=\"modelica://Modelica/Resources/Images/Magnetic/QuasiStatic/FluxTubes/i-lt-eps.png\">.\n</p></html>"));
end ElectroMagneticConverter;