Admittance

model Admittance "Multiphase linear admittance"
    extends Interfaces.TwoPlug;

    parameter Modelica.SIunits.ComplexAdmittance Y_ref[m](re(start = fill(1, m)), im(start = fill(0, m))) "Complex admittances G_ref + j*B_ref";
    parameter Modelica.SIunits.Temperature T_ref[m] = fill(293.15, m) "Reference temperatures";
    parameter Modelica.SIunits.LinearTemperatureCoefficient alpha_ref[m] = zeros(m) "Temperature coefficient of resistance (R_actual = R_ref*(1 + alpha_ref*(heatPort.T - T_ref))";

    extends Modelica.Electrical.MultiPhase.Interfaces.ConditionalHeatPort(final mh = m, T = T_ref);

    parameter Boolean frequencyDependent = false "Consider frequency dependency, if true"
        annotation (
            Evaluate = true,
            HideResult = true,
            choices(checkBox = true));
    parameter Modelica.SIunits.Frequency f_ref = 1 "Reference frequency, if frequency dependency is considered"
        annotation (Dialog(enable = frequencyDependent));
    Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Admittance admittance[m](final Y_ref = Y_ref, final T_ref = T_ref, final alpha_ref = alpha_ref, final useHeatPort = fill(useHeatPort, m), final T = T, final frequencyDependent = fill(frequencyDependent, m), final f_ref = fill(f_ref, m)) annotation (Placement(transformation(extent = {
        {-10, -10}, 
        {10, 10}})));
equation
    connect(admittance.heatPort,heatPort) annotation (Line(
        points = {
            {0, -10}, 
            {0, -10}, 
            {0, -100}},
        color = {191, 0, 0}));
    connect(admittance.pin_n,plugToPins_n.pin_n) annotation (Line(
        points = {
            {10, 0}, 
            {39, 0}, 
            {68, 0}},
        color = {85, 170, 255}));
    connect(plugToPins_p.pin_p,admittance.pin_p) annotation (Line(
        points = {
            {-68, 0}, 
            {-53.5, 0}, 
            {-39, 0}, 
            {-10, 0}},
        color = {85, 170, 255}));

    annotation (
        Icon(graphics = {
            Text(
                extent = {
                    {150, -80}, 
                    {-150, -40}},
                textString = "m=%m"), 
            Line(
                points = {
                    {60, 0}, 
                    {90, 0}},
                color = {85, 170, 255}), 
            Line(
                points = {
                    {-90, 0}, 
                    {-60, 0}},
                color = {85, 170, 255}), 
            Rectangle(
                extent = {
                    {-70, 30}, 
                    {70, -30}},
                lineColor = {85, 170, 255},
                fillColor = {255, 255, 255},
                fillPattern = FillPattern.Solid), 
            Polygon(
                points = {
                    {-70, -30}, 
                    {70, 30}, 
                    {70, -30}, 
                    {-70, -30}},
                lineColor = {85, 170, 255},
                fillColor = {85, 170, 255},
                fillPattern = FillPattern.Solid), 
            Text(
                extent = {
                    {-150, 90}, 
                    {150, 50}},
                textString = "%name",
                lineColor = {0, 0, 255})}),
        Documentation(info = "<html>\n\n<p>The admittance model represents a <strong>parallel</strong> connection of a resistor and either a capacitor or inductor\nin each phase.<br>\n<img src=\"modelica://Modelica/Resources/Images/Electrical/QuasiStationary/SinglePhase/Basic/GB_admittance.png\"></p>\n\n<p>\nThe linear admittance connects the voltage <code><u>v</u></code> with the\ncurrent <code><u>i</u></code> by  <code><u>i</u> = <u>Y</u>*<u>v</u></code> in each phase, using <code>m</code>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Admittance\">singlephase admittances</a>.\nThe resistive\ncomponents are modeled temperature dependent, so the real parts <code>G_actual = real(<u>Y</u>)</code> are determined from\nthe actual operating temperatures and the reference input conductances <code>real(Y_ref)</code>.\n<a href=\"modelica://Modelica.Electrical.MultiPhase.Interfaces.ConditionalHeatPort\">Conditional heat ports</a> are considered.\nThe reactive components\n<code>B_actual = imag(<u>Y</u>)</code>\nare equal to <code>imag(Y_ref)</code> if <code>frequencyDependent = false</code>.\nFrequency dependency is considered by <code>frequencyDependent = true</code>, distinguishing two cases:\n</p>\n\n<dl>\n<dt>(a) <code>imag(Y_ref) &gt; 0</code>: capacitive case</dt>\n<dd>The actual susceptances <code>B_actual</code> are proportional to <code>f/f_ref</code></dd>\n<dt>(b) <code>imag(Y_ref) &lt; 0</code>: inductive case</dt>\n<dd>The actual susceptances <code>B_actual</code> are proportional to <code>f_ref/f</code></dd>\n</dl>\n\n<h4>See also</h4>\n<p>\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.SinglePhase.Basic.Admittance\">Admittance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Resistor\">Resistor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Conductor\">Conductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Capacitor\">Capacitor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.Impedance\">Impedance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableResistor\">Variable resistor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableConductor\">Variable conductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableCapacitor\">Variable capacitor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableInductor\">Variable inductor</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableImpedance\">Variable impedance</a>,\n<a href=\"modelica://Modelica.Electrical.QuasiStationary.MultiPhase.Basic.VariableAdmittance\">Variable admittance</a>\n</p>\n</html>"));
end Admittance;