Delta

model Delta "Delta (polygon) connection"
    parameter Integer m(final min = 2) = 3 "Number of phases";
    Interfaces.PositivePlug plug_p(final m = m) annotation (Placement(transformation(extent = {
        {-110, -10}, 
        {-90, 10}})));
    Interfaces.NegativePlug plug_n(final m = m) annotation (Placement(transformation(extent = {
        {90, -10}, 
        {110, 10}})));
equation
    for j in 1:m loop
        if j < m then 
            plug_n.pin[j].v = plug_p.pin[j + 1].v;
            plug_n.pin[j].i + plug_p.pin[j + 1].i = 0;
        else 
            plug_n.pin[j].v = plug_p.pin[1].v;
            plug_n.pin[j].i + plug_p.pin[1].i = 0;
        end if;
    end for;

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = false,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-40, 68}, 
                        {-40, -70}, 
                        {79, 0}, 
                        {-40, 68}, 
                        {-40, 67}},
                    thickness = 0.5,
                    color = {0, 0, 255}), 
                Line(
                    points = {
                        {-90, 0}, 
                        {-40, 0}},
                    color = {0, 0, 255}), 
                Line(
                    points = {
                        {80, 0}, 
                        {90, 0}},
                    color = {0, 0, 255}), 
                Text(
                    extent = {
                        {-150, -110}, 
                        {150, -70}},
                    textString = "m=%m"), 
                Text(
                    extent = {
                        {-150, 70}, 
                        {150, 110}},
                    textString = "%name",
                    lineColor = {0, 0, 255})}),
        Documentation(info = "<html>\n<p>\nConnects in a cyclic way plug_n.pin[j] to plug_p.pin[j+1],\nthus establishing a so-called delta (or polygon) connection\nwhen used in parallel to another component.\n</p>\n\n<h4>See also</h4>\n<p>\n<a href=\"modelica://Modelica.Electrical.MultiPhase.Basic.Star\">Star</a>,\n<a href=\"modelica://Modelica.Electrical.MultiPhase.Basic.MultiStar\">MultiStar</a>,\n<a href=\"modelica://Modelica.Electrical.MultiPhase.Basic.MultiDelta\">MultiDelta</a>\n</p>\n</html>"));
end Delta;