MultiStar

model MultiStar "Star connection of multi phase systems consisting of multiple base systems"
    parameter Integer m(final min = 1) = 3 "Number of phases";
    final parameter Integer mSystems = Modelica.Electrical.MultiPhase.Functions.numberOfSymmetricBaseSystems(m) "Number of base systems";
    final parameter Integer mBasic = integer(m / mSystems) "Phase number of base systems";
    Modelica.Electrical.QuasiStationary.MultiPhase.Interfaces.PositivePlug plug_p(final m = m) annotation (Placement(transformation(extent = {
        {-110, -10}, 
        {-90, 10}})));
    Modelica.Electrical.QuasiStationary.MultiPhase.Interfaces.NegativePlug starpoints(final m = mSystems) annotation (Placement(transformation(extent = {
        {90, -10}, 
        {110, 10}})));
    Modelica.Electrical.QuasiStationary.MultiPhase.Basic.PlugToPins_p plugToPins_p(final m = m) annotation (Placement(transformation(extent = {
        {-80, -10}, 
        {-60, 10}})));
    Modelica.Electrical.QuasiStationary.MultiPhase.Basic.PlugToPins_n plugToPins_n(final m = mSystems) annotation (Placement(transformation(extent = {
        {80, -10}, 
        {60, 10}})));
equation
    for k in 1:mSystems loop
        for j in 1:mBasic loop
            connect(plugToPins_p.pin_p[(k - 1) * mBasic + j],plugToPins_n.pin_n[k]);
        end for;
    end for;
    connect(plug_p,plugToPins_p.plug_p) annotation (Line(
        points = {
            {-100, 0}, 
            {-72, 0}},
        color = {85, 170, 255}));
    connect(plugToPins_n.plug_n,starpoints) annotation (Line(
        points = {
            {72, 0}, 
            {100, 0}},
        color = {85, 170, 255}));

    annotation (
        Icon(graphics = {
            Line(
                points = {
                    {86, 4}, 
                    {6, 4}},
                color = {85, 170, 255},
                thickness = 0.5), 
            Line(
                points = {
                    {6, 4}, 
                    {-33, 72}},
                color = {85, 170, 255},
                thickness = 0.5), 
            Line(
                points = {
                    {6, 4}, 
                    {-32, -65}},
                color = {85, 170, 255},
                thickness = 0.5), 
            Line(
                points = {
                    {-90, 0}, 
                    {-40, 0}},
                color = {85, 170, 255}), 
            Line(
                points = {
                    {80, 0}, 
                    {90, 0}},
                color = {85, 170, 255}), 
            Line(
                points = {
                    {-6, -4}, 
                    {-45, 64}},
                color = {85, 170, 255},
                thickness = 0.5), 
            Line(
                points = {
                    {74, -4}, 
                    {-6, -4}},
                color = {85, 170, 255},
                thickness = 0.5), 
            Line(
                points = {
                    {-6, -4}, 
                    {-44, -73}},
                color = {85, 170, 255},
                thickness = 0.5), 
            Text(
                extent = {
                    {-150, 70}, 
                    {150, 110}},
                textString = "%name",
                lineColor = {0, 0, 255}), 
            Text(
                extent = {
                    {-150, -110}, 
                    {150, -70}},
                textString = "m=%m")}),
        Documentation(info = "<html>\n<p>\nStar (wye) connection of a multi phase circuit consisting of multiple base systems (see\n<a href=\"modelica://Modelica.Magnetic.FundamentalWave.UsersGuide.MultiPhase\">multi phase guidelines</a>). The potentials at the star points are all equal.\n</p>\n<h4>See also</h4>\n<p>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Star\">Star</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Delta\">Delta</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.MultiDelta\">MultiDelta</a>\n</p></html>"));
end MultiStar;